From 9cbaee3284faa548f2a7fdff7bd0c21471070c3f Mon Sep 17 00:00:00 2001 From: Richard Simpson Date: Wed, 4 Feb 2015 19:25:43 -0600 Subject: [PATCH 001/534] Updated Greensock Defintion to 1.15.1 --- greensock/greensock.d.ts | 252 ++++++++++++++++++++------------------- 1 file changed, 127 insertions(+), 125 deletions(-) diff --git a/greensock/greensock.d.ts b/greensock/greensock.d.ts index a9a46d113..a43c0d77f 100644 --- a/greensock/greensock.d.ts +++ b/greensock/greensock.d.ts @@ -1,167 +1,169 @@ -// Type definitions for GreenSock Animation Platform 1.1 +// Type definitions for GreenSock Animation Platform 1.15.1 // Project: http://www.greensock.com/get-started-js/ // Definitions by: Robert S // Definitions: https://github.com/borisyankov/DefinitelyTyped // JavaScript Docs http://api.greensock.com/js/ -// Version 1.1 (TypeScript 0.9) +// Version 1.15.1 (TypeScript 1.4) interface IDispatcher { addEventListener(type:string, callback:Function, scope?:Object, useParam?:boolean, priority?:number):void; removeEventListener(type:string, callback:Function):void; } +declare type Tween = TweenLite | TweenMax; +declare type Timeline = SimpleTimeline | TimelineLite | TimelineMax; + //com.greensock.core declare class Animation { - data:any; - static ticker:IDispatcher; - timeline:SimpleTimeline; - vars:Object; + static ticker: IDispatcher; + data: any; + timeline: SimpleTimeline; + vars: Object; - constructor(duration?:number, vars?:Object); + constructor(duration?: number, vars?: Object); - delay(value:number):any; - duration(value:number):any; - eventCallback(type:string, callback?:Function, params?:any[], scope?:any):any; - invalidate():any; - isActive():boolean; - kill(vars?:Object, target?:Object):any; - pause(atTime?:any, suppressEvents?:boolean):any; - paused(value?:boolean):any; - play(from?:any, suppressEvents?:boolean):any; - restart(includeDelay?:boolean, suppressEvents?:boolean):any; - resume(from?:any, suppressEvents?:boolean):any; - reverse(from?:any, suppressEvents?:boolean):any; - reversed(value?:boolean):any; - seek(time:any, suppressEvents?:boolean):any; - startTime(value:number):any; - time(value:number, suppressEvents?:boolean):any; - timeScale(value:number):any; - totalDuration(value:number):any; - totalTime(time:number, suppressEvents?:boolean):any; + delay(): number; + delay(value: number): Animation; + duration(): number; + duration(value: number): Animation; + eventCallback(type: string): Function; + eventCallback(type: string, callback: Function, params?: any[], scope?: any): Animation; + invalidate(): Animation; + isActive(): boolean; + kill(vars?: Object, target?: Object): Animation; + pause(atTime?: any, suppressEvents?: boolean): Animation; + paused(): boolean; + paused(value: boolean): Animation; + play(from?: any, suppressEvents?: boolean): Animation; + progress(): number; + progress(value: number, supressEvents?: boolean): Animation; + restart(includeDelay?: boolean, suppressEvents?: boolean): Animation; + resume(from?: any, suppressEvents?: boolean): Animation; + reverse(from?: any, suppressEvents?: boolean): Animation; + reversed(): boolean; + reversed(value: boolean): Animation; + seek(time: any, suppressEvents?: boolean): Animation; + startTime(): number; + startTime(value: number): Animation; + time(): number; + time(value: number, suppressEvents?: boolean): Animation; + timeScale(): number; + timeScale(value: number): Animation; + totalDuration(): number; + totalDuration(value: number): Animation; + totalProgress(): number; + totalProgress(value: number): Animation; + totalTime(): number; + totalTime(time: number, suppressEvents?: boolean): Animation; } declare class SimpleTimeline extends Animation { - autoRemoveChildren:boolean; - smoothChildTiming:boolean; + autoRemoveChildren: boolean; + smoothChildTiming: boolean; - constructor(vars?:Object); + constructor(vars?: Object); - add(value:any, position?:any, align?:string, stagger?:number):any; - insert(tween:any, time:any):any; - render(time:number, suppressEvents?:boolean, force?:boolean):void; + add(value: any, position?: any, align?: string, stagger?: number): SimpleTimeline; + render(time: number, suppressEvents?: boolean, force?: boolean): void; } //com.greensock declare class TweenLite extends Animation { - static defaultEase:Ease; - static defaultOverwrite:string; - static selector:any; - target:Object; - static ticker:IDispatcher; - timeline:SimpleTimeline; - vars:Object; + static defaultEase: Ease; + static defaultOverwrite: string; + static selector: any; + target: Object; - constructor(target:Object, duration:number, vars:Object); + constructor(target: Object, duration: number, vars: Object); - static delayedCall(delay:number, callback:Function, params?:any[], scope?:any, useFrames?:boolean):TweenLite; - static from(target:Object, duration:number, vars:Object):TweenLite; - static fromTo(target:Object, duration:number, fromVars:Object, toVars:Object):TweenLite; - static getTweensOf(target:Object):any[]; - invalidate():any; - static killDelayedCallsTo(func:Function):void; - static killTweensOf(target:Object, vars?:Object):void; - static set(target:Object, vars:Object):TweenLite; - static to(target:Object, duration:number, vars:Object):TweenLite; + static delayedCall(delay: number, callback: Function, params?: any[], scope?: any, useFrames?: boolean): TweenLite; + endTime(includeRepeats?: boolean): number; + static from(target: Object | Object[], duration: number, vars: Object): TweenLite; + static fromTo(target: Object | Object[], duration: number, fromVars: Object, toVars: Object): TweenLite; + static getTweensOf(target: Object, onlyActive: boolean): Tween[]; + static killDelayedCallsTo(func: Function): void; + static killTweensOf(target: Object, onlyActive?: boolean, vars?: Object): void; + static lagSmoothing(threshold: number, adjustedLag: number): void; + static set(target: Object, vars: Object): TweenLite; + static to(target: Object, duration: number, vars: Object): TweenLite; } declare class TweenMax extends TweenLite { - static ticker:IDispatcher; + constructor(target: Object, duration: number, vars: Object); - constructor(target:Object, duration:number, vars:Object); - - static delayedCall(delay:number, callback:Function, params?:any[], scope?:any, useFrames?:boolean):TweenMax; - static from(target:Object, duration:number, vars:Object):TweenMax; - static fromTo(target:Object, duration:number, fromVars:Object, toVars:Object):TweenMax; - static getAllTweens(includeTimelines?:boolean):any[]; - static getTweensOf(target:Object):any[]; - invalidate():any; - static isTweening(target:Object):boolean; - static killAll(complete?:boolean, tweens?:boolean, delayedCalls?:boolean, timelines?:boolean):void; - static killChildTweensOf(parent:any, complete?:boolean):void; - static killDelayedCallsTo(func:Function):void; - static killTweensOf(target:Object, vars?:Object):void; - static pauseAll(tweens?:boolean, delayedCalls?:boolean, timelines?:boolean):void; - progress(value:number):any; - repeat(value:number):any; - repeatDelay(value:number):any; - static resumeAll(tweens?:boolean, delayedCalls?:boolean, timelines?:boolean):void; - static set(target:Object, vars:Object):TweenMax; - static staggerFrom(targets:any, duration:number, vars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[]; - static staggerFromTo(targets:any, duration:number, fromVars:Object, toVars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[]; - static staggerTo(targets:any, duration:number, vars:Object, stagger:number, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any[]; - time(value:number, suppressEvents?:boolean):any; + static delayedCall(delay: number, callback: Function, params?: any[], scope?: Object, useFrames?: boolean): TweenMax; + static from(target: Object, duration: number, vars: Object): TweenMax; + static fromTo(target: Object, duration: number, fromVars: Object, toVars: Object): TweenMax; + static getAllTweens(includeTimelines?: boolean): Tween[]; + static getTweensOf(target: Object): Tween[]; + static isTweening(target: Object): boolean; + static killAll(complete?: boolean, tweens?: boolean, delayedCalls?: boolean, timelines?: boolean): void; + static killChildTweensOf(parent: any, complete?: boolean): void; + static killDelayedCallsTo(func: Function): void; + static killTweensOf(target: Object, vars?: Object): void; + static pauseAll(tweens?: boolean, delayedCalls?: boolean, timelines?: boolean): void; + repeat(): number; + repeat(value: number): TweenMax; + repeatDelay(): number; + repeatDelay(value: number): TweenMax; + static resumeAll(tweens?: boolean, delayedCalls?: boolean, timelines?: boolean): void; + static set(target: Object, vars: Object): TweenMax; + static staggerFrom(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; + static staggerFromTo(targets: any, duration: number, fromVars: Object, toVars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; + static staggerTo(targets: any, duration: number, vars: Object, stagger: number, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): any[]; static to(target:Object, duration:number, vars:Object):TweenMax; - totalDuration(value:number):any; - totalProgress(value:number):any; - updateTo(vars:Object, resetDuration?:boolean):any; - yoyo(value?:boolean):any; + updateTo(vars: Object, resetDuration?: boolean): TweenMax; + yoyo(): boolean; + yoyo(value?: boolean): TweenMax; } declare class TimelineLite extends SimpleTimeline { - constructor(vars?:Object); + constructor(vars?: Object); - add(value:any, position?:any, align?:string, stagger?:number):any; - addLabel(label:string, position:any):any; - addPause(position?:any, callback?:Function, params?:any[], scope?:any):any; - append(value:any, offsetOrLabel?:any):any; - appendMultiple(tweens:any[], offsetOrLabel?:any, align?:string, stagger?:number):any; - call(callback:Function, params?:any[], scope?:any, position?:any):any; - clear(labels?:boolean):any; - duration(value:number):any; - exportRoot(vars?:Object, omitDelayedCalls?:boolean):TimelineLite; - from(target:Object, duration:number, vars:Object, position?:any):any; - fromTo(target:Object, duration:number, fromVars:Object, toVars:Object, position?:any):any; - getChildren(nested?:boolean, tweens?:boolean, timelines?:boolean, ignoreBeforeTime?:number):any[]; - getLabelTime(label:string):number; - getTweensOf(target:Object, nested?:boolean):any[]; - insert(value:any, timeOrLabel?:any):any; - insertMultiple(tweens:any[], timeOrLabel?:any, align?:string, stagger?:number):any; - invalidate():any; - progress(value:number):any; - remove(value:any):any; - removeLabel(label:string):any; - set(target: Object, vars: Object, position?:any):any; - seek(position:any, suppressEvents?:boolean):any; - shiftChildren(amount:number, adjustLabels?:boolean, ignoreBeforeTime?:number):any; - staggerFrom(targets:any, duration:number, vars:Object, stagger?:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteScope?:any):any; - staggerFromTo(targets:any, duration:number, fromVars:Object, toVars:Object, stagger?:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any; - staggerTo(targets:any, duration:number, vars:Object, stagger:number, position?:any, onCompleteAll?:Function, onCompleteAllParams?:any[], onCompleteAllScope?:any):any; - stop():any; - to(target:Object, duration:number, vars:Object, position?:any):any; - usesFrames():Boolean; + add(value: any, position?: any, align?: string, stagger?: number): TimelineLite; + addLabel(label: string, position: any): TimelineLite; + addPause(position?: any, callback?: Function, params?: any[], scope?: any): TimelineLite; + call(callback: Function, params?: any[], scope?: any, position?: any): TimelineLite; + clear(labels?: boolean): TimelineLite; + endTime(includeRepeats?: boolean): number; + static exportRoot(vars?: Object, omitDelayedCalls?: boolean): TimelineLite; + from(target: Object, duration: number, vars: Object, position?: any): TimelineLite; + fromTo(target: Object, duration: number, fromVars: Object, toVars: Object, position?: any): TimelineLite; + getChildren(nested?: boolean, tweens?: boolean, timelines?: boolean, ignoreBeforeTime?: number): Tween | Timeline[]; + getLabelTime(label: string): number; + getTweensOf(target: Object, nested?: boolean): Tween[]; + recent(): Animation; + remove(value: any): TimelineLite; + removeLabel(label: string): any; + set(target: Object, vars: Object, position?: any): TimelineLite; + shiftChildren(amount: number, adjustLabels?: boolean, ignoreBeforeTime?: number): TimelineLite; + staggerFrom(targets: any, duration: number, vars: Object, stagger?: number, position?: any, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteScope?: any): TimelineLite; + staggerFromTo(targets: any, duration: number, fromVars: Object, toVars: Object, stagger?: number, position?: any, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): TimelineLite; + staggerTo(targets: any, duration: number, vars: Object, stagger: number, position?: any, onCompleteAll?: Function, onCompleteAllParams?: any[], onCompleteAllScope?: any): TimelineLite; + to(target: Object, duration: number, vars: Object, position?: any): TimelineLite; + usesFrames(): boolean; } declare class TimelineMax extends TimelineLite { - constructor(vars?:Object); + constructor(vars?: Object); - addCallback(callback:Function, position:any, params?:any[], scope?:any):TimelineMax; - currentLabel(value?:string):any; - getActive(nested?:boolean, tweens?:boolean, timelines?:boolean):any[]; - getLabelAfter(time:number):string; - getLabelBefore(time:number):string; - getLabelsArray():any[]; - invalidate():any; - progress(value:number):any; - removeCallback(callback:Function, timeOrLabel?:any):TimelineMax; - repeat(value?:number):any; - repeatDelay(value?:number):any; - time(value:number, suppressEvents?:boolean):any; - totalDuration(value:number):any; - totalProgress(value:number):any; - tweenFromTo(fromPosition:any, toPosition:any, vars?:Object):TweenLite; - tweenTo(position:any, vars?:Object):TweenLite; - yoyo(value?:boolean):any; + addCallback(callback: Function, position: any, params?: any[], scope?: any): TimelineMax; + currentLabel(): string; + currentLabel(value: string): TimelineMax; + getActive(nested?: boolean, tweens?: boolean, timelines?: boolean): Tween | Timeline[]; + getLabelAfter(time: number): string; + getLabelBefore(time: number): string; + getLabelsArray(): any[]; + removeCallback(callback: Function, timeOrLabel?: any): TimelineMax; + repeat(): number; + repeat(value: number): TimelineMax; + repeatDelay(): number; + repeatDelay(value: number): TimelineMax; + tweenFromTo(fromPosition: any, toPosition: any, vars?: Object): TweenLite; + tweenTo(position: any, vars?: Object): TweenLite; + yoyo(): boolean; + yoyo(value: boolean): TimelineMax; } //com.greensock.easing From 03735927ae8d11c9c5a3ce23f430fc6fc5d644c8 Mon Sep 17 00:00:00 2001 From: NN Date: Tue, 24 Feb 2015 18:02:04 +0200 Subject: [PATCH 002/534] Use DictionaryIterator for Dictionary functions Without DictionaryIterator the simplest code is impossible to write: var myDictionary : {[x:string]: string;} _.filter(myDictionary, (v, k, c) => { return k == "A"; }) --- lodash/lodash.d.ts | 56 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c43f27c5c..4211539d3 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2229,7 +2229,7 @@ declare module _ { **/ countBy( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -2314,7 +2314,7 @@ declare module _ { **/ every( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): boolean; /** @@ -2386,7 +2386,7 @@ declare module _ { **/ all( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): boolean; /** @@ -2473,7 +2473,7 @@ declare module _ { **/ filter( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T[]; /** @@ -2545,7 +2545,7 @@ declare module _ { **/ select( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T[]; /** @@ -2685,7 +2685,7 @@ declare module _ { **/ find( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T; /** @@ -2757,7 +2757,7 @@ declare module _ { **/ detect( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T; /** @@ -2829,7 +2829,7 @@ declare module _ { **/ findWhere( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T; /** @@ -2931,7 +2931,7 @@ declare module _ { **/ findLast( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T; /** @@ -3033,7 +3033,7 @@ declare module _ { **/ forEach( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -3068,7 +3068,7 @@ declare module _ { **/ each( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -3139,7 +3139,7 @@ declare module _ { **/ forEachRight( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -3166,7 +3166,7 @@ declare module _ { **/ eachRight( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): Dictionary; } @@ -3272,7 +3272,7 @@ declare module _ { **/ groupBy( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -3494,7 +3494,7 @@ declare module _ { **/ map( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): TResult[]; /** @@ -3534,7 +3534,7 @@ declare module _ { **/ collect( object: Dictionary, - callback: ObjectIterator, + callback: DictionaryIterator, thisArg?: any): TResult[]; /** @@ -3633,7 +3633,7 @@ declare module _ { **/ max( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): T; /** @@ -4266,7 +4266,7 @@ declare module _ { **/ reject( collection: Dictionary, - callback: ListIterator, + callback: DictionaryIterator, thisArg?: any): T[]; /** @@ -4463,7 +4463,7 @@ declare module _ { **/ some( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): boolean; /** @@ -4543,7 +4543,7 @@ declare module _ { **/ any( collection: Dictionary, - callback?: ListIterator, + callback?: DictionaryIterator, thisArg?: any): boolean; /** @@ -5486,7 +5486,7 @@ declare module _ { **/ forIn( object: Dictionary, - callback?: ObjectIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -5519,7 +5519,7 @@ declare module _ { **/ forInRight( object: Dictionary, - callback?: ObjectIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -5553,7 +5553,7 @@ declare module _ { **/ forOwn( object: Dictionary, - callback?: ObjectIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** @@ -5586,7 +5586,7 @@ declare module _ { **/ forOwnRight( object: Dictionary, - callback?: ObjectIterator, + callback?: DictionaryIterator, thisArg?: any): Dictionary; /** * @see _.forOwnRight @@ -6380,11 +6380,15 @@ declare module _ { } interface ListIterator { - (value: T, index: number, list: T[]): TResult; + (value: T, index: number, collection: T[]): TResult; + } + + interface DictionaryIterator { + (value: T, key: string, collection: Dictionary): TResult; } interface ObjectIterator { - (element: T, key: string, list: any): TResult; + (element: T, key: string, collection: any): TResult; } interface MemoVoidIterator { From 049e87b386bd01fc8f6197b7e21e2ba512d6f10e Mon Sep 17 00:00:00 2001 From: Jed Mao Date: Fri, 20 Mar 2015 21:43:15 -0500 Subject: [PATCH 003/534] Lodash union types, optional args --- lodash/lodash.d.ts | 83 ++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 50 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c43f27c5c..d61d61b9b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -263,12 +263,12 @@ declare module _ { * @param array Array to compact. * @return (Array) Returns a new array of filtered values. **/ - compact(array: Array): T[]; + compact(array?: Array): T[]; /** * @see _.compact **/ - compact(array: List): T[]; + compact(array?: List): T[]; } interface LoDashArrayWrapper { @@ -288,13 +288,13 @@ declare module _ { * @return Returns a new array of filtered values. **/ difference( - array: Array, + array?: Array, ...others: Array[]): T[]; /** * @see _.difference **/ difference( - array: List, + array?: List, ...others: List[]): T[]; } @@ -432,12 +432,12 @@ declare module _ { * @param array Retrieves the first element of this array. * @return Returns the first element of `array`. **/ - first(array: Array): T; + first(array?: Array): T; /** * @see _.first **/ - first(array: List): T; + first(array?: List): T; /** * @see _.first @@ -5663,7 +5663,7 @@ declare module _ { * @param value The value to check. * @return True if the value is an arguments object, else false. **/ - isArguments(value: any): boolean; + isArguments(value?: any): boolean; } //_.isArray @@ -5673,7 +5673,7 @@ declare module _ { * @param value The value to check. * @return True if the value is an array, else false. **/ - isArray(value: any): boolean; + isArray(value?: any): boolean; } //_.isBoolean @@ -5683,7 +5683,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a boolean value, else false. **/ - isBoolean(value: any): boolean; + isBoolean(value?: any): boolean; } //_.isDate @@ -5693,7 +5693,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a date, else false. **/ - isDate(value: any): boolean; + isDate(value?: any): boolean; } //_.isElement @@ -5703,7 +5703,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a DOM element, else false. **/ - isElement(value: any): boolean; + isElement(value?: any): boolean; } //_.isEmpty @@ -5714,22 +5714,7 @@ declare module _ { * @param value The value to inspect. * @return True if the value is empty, else false. **/ - isEmpty(value: any[]): boolean; - - /** - * @see _.isEmpty - **/ - isEmpty(value: Dictionary): boolean; - - /** - * @see _.isEmpty - **/ - isEmpty(value: string): boolean; - - /** - * @see _.isEmpty - **/ - isEmpty(value: any): boolean; + isEmpty(value?: any[]|Dictionary|string|any): boolean; } //_.isEqual @@ -5746,8 +5731,8 @@ declare module _ { * @return True if the values are equivalent, else false. **/ isEqual( - a: any, - b: any, + a?: any, + b?: any, callback?: (a: any, b: any) => boolean, thisArg?: any): boolean; } @@ -5762,7 +5747,7 @@ declare module _ { * @param value The value to check. * @return True if the value is finite, else false. **/ - isFinite(value: any): boolean; + isFinite(value?: any): boolean; } //_.isFunction @@ -5772,7 +5757,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a function, else false. **/ - isFunction(value: any): boolean; + isFunction(value?: any): boolean; } //_.isNaN @@ -5785,7 +5770,7 @@ declare module _ { * @param value The value to check. * @return True if the value is NaN, else false. **/ - isNaN(value: any): boolean; + isNaN(value?: any): boolean; } //_.isNull @@ -5795,7 +5780,7 @@ declare module _ { * @param value The value to check. * @return True if the value is null, else false. **/ - isNull(value: any): boolean; + isNull(value?: any): boolean; } //_.isNumber @@ -5807,7 +5792,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a number, else false. **/ - isNumber(value: any): boolean; + isNumber(value?: any): boolean; } //_.isObject @@ -5818,7 +5803,7 @@ declare module _ { * @param value The value to check. * @return True if the value is an object, else false. **/ - isObject(value: any): boolean; + isObject(value?: any): boolean; } //_.isPlainObject @@ -5828,7 +5813,7 @@ declare module _ { * @param value The value to check. * @return True if value is a plain object, else false. **/ - isPlainObject(value: any): boolean; + isPlainObject(value?: any): boolean; } //_.isRegExp @@ -5838,7 +5823,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a regular expression, else false. **/ - isRegExp(value: any): boolean; + isRegExp(value?: any): boolean; } //_.isString @@ -5848,7 +5833,7 @@ declare module _ { * @param value The value to check. * @return True if the value is a string, else false. **/ - isString(value: any): boolean; + isString(value?: any): boolean; } //_.isUndefined @@ -5858,7 +5843,7 @@ declare module _ { * @param value The value to check. * @return True if the value is undefined, else false. **/ - isUndefined(value: any): boolean; + isUndefined(value?: any): boolean; } //_.keys @@ -5868,7 +5853,7 @@ declare module _ { * @param object The object to inspect. * @return An array of property names. **/ - keys(object: any): string[]; + keys(object?: any): string[]; } interface LoDashObjectWrapper { @@ -6018,7 +6003,7 @@ declare module _ { * @param object The object to inspect. * @return Aew array of key-value pairs. **/ - pairs(object: any): any[][]; + pairs(object?: any): any[][]; } interface LoDashObjectWrapper { @@ -6130,7 +6115,7 @@ declare module _ { * @param object The object to inspect. * @return Returns an array of property values. **/ - values(object: any): any[]; + values(object?: any): any[]; } /********** @@ -6156,10 +6141,8 @@ declare module _ { trimLeft(str?: string, chars?: string): string; trimRight(str?: string, chars?: string): string; trunc(str?: string, len?: number): string; - trunc(str?: string, options?: { length?: number; omission?: string; separator?: string }): string; - trunc(str?: string, options?: { length?: number; omission?: string; separator?: RegExp }): string; - words(str?: string, pattern?: string): string[]; - words(str?: string, pattern?: RegExp): string[]; + trunc(str?: string, options?: { length?: number; omission?: string; separator?: string|RegExp }): string; + words(str?: string, pattern?: string|RegExp): string[]; } //_.parseInt @@ -6174,7 +6157,7 @@ declare module _ { * @param radix The radix used to interpret the value to parse. * @return The new integer value. **/ - parseInt(value: string, radix?: number): number; + parseInt(value?: string, radix?: number): number; } /************* @@ -6187,7 +6170,7 @@ declare module _ { * @param string The string to escape. * @return The escaped string. **/ - escape(str: string): string; + escape(str?: string): string; } //_.identity @@ -6197,7 +6180,7 @@ declare module _ { * @param value Any value. * @return value. **/ - identity(value: T): T; + identity(value?: T): T; } //_.mixin @@ -6206,7 +6189,7 @@ declare module _ { * Adds function properties of a source object to the lodash function and chainable wrapper. * @param object The object of function properties to add to lodash. **/ - mixin(object: Dictionary<(value: any) => any>): void; + mixin(object?: Dictionary<(value: any) => any>): void; } //_.noConflict From 7600257d34baa6305ee1da58245242926960d5a8 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Mon, 30 Mar 2015 14:55:16 -0400 Subject: [PATCH 004/534] Update d3.d.ts --- d3.cloud.layout/d3.cloud.layout.d.ts | 102 +- d3/d3-tests.ts | 575 +-- d3/d3.d.ts | 6729 +++++++++++++------------- d3/plugins/d3.superformula-tests.ts | 4 +- d3/plugins/d3.superformula.d.ts | 57 +- 5 files changed, 3665 insertions(+), 3802 deletions(-) diff --git a/d3.cloud.layout/d3.cloud.layout.d.ts b/d3.cloud.layout/d3.cloud.layout.d.ts index 5ac3aced8..1e41ecbc2 100644 --- a/d3.cloud.layout/d3.cloud.layout.d.ts +++ b/d3.cloud.layout/d3.cloud.layout.d.ts @@ -5,41 +5,77 @@ /// -declare module D3 { - export module Layout { - export interface IRotate { - (number:number) : CloudLayout; - (number:()=>number) : CloudLayout; +declare module d3 { + module layout { + export function cloud(): Cloud; + export function cloud(): Cloud; + + module cloud { + interface Word { + text?: string; + font?: string; + style?: string; + weight?: string | number; + rotate?: number; + size?: number; + padding?: number; + x?: number; + y?: number; + } } + interface Cloud { + start(): Cloud; + stop(): Cloud; + timeInterval(): number; + timeInterval(interval: number): Cloud; - export interface CloudLayout { - (layers: any[], index?: number): any[]; - values(accessor?: (d: any) => any): CloudLayout; - offset(offset: string): CloudLayout; - size: { - /** - * Gets the available layout size - */ - (): Array; - /** - * Sets the available layout size - */ - (size: Array): CloudLayout; - }; - words: (inputArray: Array) => CloudLayout; - rotate:IRotate; - padding: (number:number) => CloudLayout; - font: (string:string) => CloudLayout; - fontSize(fctn: (d: any) => number): CloudLayout; - on: (eventname: string, callee: (words: any[]) => void) => CloudLayout; - start: () => CloudLayout; + words(): T[]; + words(words: T[]): Cloud; + + size(): [number, number]; + size(size: [number, number]): Cloud; + + font(): (datum: T, index: number) => string; + font(font: string): Cloud; + font(font: (datum: T, index: number) => string): Cloud; + + fontStyle(): (datum: T, index: number) => string; + fontStyle(style: string): Cloud; + fontStyle(style: (datum: T, index: number) => string): Cloud; + + fontWeight(): (datum: T, index: number) => string | number; + fontWeight(weight: string | number): Cloud; + fontWeight(weight: (datum: T, index: number) => string | number): Cloud; + + rotate(): (datum: T, index: number) => number; + rotate(rotate: number): Cloud; + rotate(rotate: (datum: T, index: number) => number): Cloud; + + text(): (datum: T, index: number) => string; + text(text: string): Cloud; + text(text: (datum: T, index: number) => string): Cloud; + + spiral(): (size: number) => (t: number) => [number, number]; + spiral(name: string): Cloud; + spiral(spiral: (size: number) => (t: number) => [number, number]): Cloud; + + fontSize(): (datum: T, index: number) => number; + fontSize(size: number): Cloud; + fontSize(size: (datum: T, index: number) => number): Cloud; + + padding(): (datum: T, index: number) => number; + padding(padding: number): Cloud; + padding(padding: (datum: T, index: number) => number): Cloud; + + on(type: "word", listener: (word: T) => void): Cloud; + on(type: "end", listener: (tags: T[], bounds: { x: number; y: number }[]) => void): Cloud; + on(type: string, listener: (...args: any[]) => void): Cloud; + + on(type: "word"): (word: T) => void; + on(type: "end"): (tags: T[], bounds: { x: number; y: number }[]) => void; + on(type: string): (...args: any[]) => void; + } } - - - export interface Layout { - cloud(): CloudLayout; - } - } -} \ No newline at end of file +} diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index 51c51f608..70e4036dd 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -1,19 +1,23 @@ /// //Example from http://bl.ocks.org/3887235 +interface TestPieChartData { + population: number; + age: string; +} function testPieChart() { var width = 960, height = 500, radius = Math.min(width, height) / 2; - var color = d3.scale.ordinal() + var color = d3.scale.ordinal() .range(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]); - var arc = d3.svg.arc() + var arc = d3.svg.arc>() .outerRadius(radius - 10) .innerRadius(0); - var pie = d3.layout.pie() + var pie = d3.layout.pie() .sort(null) .value(function (d) { return d.population; }); @@ -23,12 +27,7 @@ function testPieChart() { .append("g") .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")"); - d3.csv("data.csv", function (error, data) { - - data.forEach(function (d) { - d.population = +d.population; - }); - + d3.csv("data.csv", d => ({ population: +d['population'], age: d['age'] }), function (error, data) { var g = svg.selectAll(".arc") .data(pie(data)) .enter().append("g") @@ -91,12 +90,12 @@ function groupedBarChart() { var x0 = d3.scale.ordinal() .rangeRoundBands([0, width], .1); - var x1 = d3.scale.ordinal(); + var x1 = d3.scale.ordinal(); var y = d3.scale.linear() .range([height, 0]); - var color = d3.scale.ordinal() + var color = d3.scale.ordinal() .range(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]); var xAxis = d3.svg.axis() @@ -114,7 +113,7 @@ function groupedBarChart() { .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - d3.csv("data.csv", function (error, data: Array) { + d3.csv("data.csv", function (error, data: Array) { var ageNames = d3.keys(data[0]).filter(function (key) { return key !== "State"; }); data.forEach(function (d) { @@ -146,7 +145,7 @@ function groupedBarChart() { .attr("class", "g") .attr("transform", function (d) { return "translate(" + x0(d.State) + ",0)"; }); - state.selectAll("rect") + state.selectAll("rect") .data(function (d) { return d.ages; }) .enter().append("rect") .attr("width", x1.rangeBand()) @@ -189,7 +188,7 @@ function stackedBarChart() { var y = d3.scale.linear() .rangeRound([height, 0]); - var color = d3.scale.ordinal() + var color = d3.scale.ordinal() .range(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]); var xAxis = d3.svg.axis() @@ -207,7 +206,7 @@ function stackedBarChart() { .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - d3.csv("data.csv", function (error, data) { + d3.csv("data.csv", function (error, data: any) { color.domain(d3.keys(data[0]).filter(function (key) { return key !== "State"; })); data.forEach(function (d) { @@ -219,7 +218,7 @@ function stackedBarChart() { data.sort(function (a, b) { return b.total - a.total; }); x.domain(data.map(function (d) { return d.State; })); - y.domain([0, d3.max(data, function (d) { return d.total; })]); + y.domain([0, d3.max(data, function (d: { total: number }) { return d.total; })]); svg.append("g") .attr("class", "x axis") @@ -240,15 +239,15 @@ function stackedBarChart() { .data(data) .enter().append("g") .attr("class", "g") - .attr("transform", function (d) { return "translate(" + x(d.State) + ",0)"; }); + .attr("transform", function (d: any) { return "translate(" + x(d.State) + ",0)"; }); state.selectAll("rect") - .data(function (d) { return d.ages; }) + .data(function (d: any) { return d.ages; }) .enter().append("rect") .attr("width", x.rangeBand()) - .attr("y", function (d) { return y(d.y1); }) - .attr("height", function (d) { return y(d.y0) - y(d.y1); }) - .style("fill", function (d) { return color(d.name); }); + .attr("y", function (d: any) { return y(d.y1); }) + .attr("height", function (d: any) { return y(d.y0) - y(d.y1); }) + .style("fill", function (d: any) { return color(d.name); }); var legend = svg.selectAll(".legend") .data(color.domain().reverse()) @@ -284,7 +283,7 @@ function normalizedBarChart() { var y = d3.scale.linear() .rangeRound([height, 0]); - var color = d3.scale.ordinal() + var color = d3.scale.ordinal() .range(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]); var xAxis = d3.svg.axis() @@ -328,21 +327,21 @@ function normalizedBarChart() { .data(data) .enter().append("g") .attr("class", "state") - .attr("transform", function (d) { return "translate(" + x(d.State) + ",0)"; }); + .attr("transform", function (d: any) { return "translate(" + x(d.State) + ",0)"; }); state.selectAll("rect") .data(function (d) { return d.ages; }) .enter().append("rect") .attr("width", x.rangeBand()) - .attr("y", function (d) { return y(d.y1); }) - .attr("height", function (d) { return y(d.y0) - y(d.y1); }) - .style("fill", function (d) { return color(d.name); }); + .attr("y", function (d: any) { return y(d.y1); }) + .attr("height", function (d: any) { return y(d.y0) - y(d.y1); }) + .style("fill", function (d: any) { return color(d.name); }); var legend = svg.select(".state:last-child").selectAll(".legend") - .data(function (d) { return d.ages; }) + .data(function (d: any) { return d.ages; }) .enter().append("g") .attr("class", "legend") - .attr("transform", function (d) { return "translate(" + x.rangeBand() / 2 + "," + y((d.y0 + d.y1) / 2) + ")"; }); + .attr("transform", function (d: any) { return "translate(" + x.rangeBand() / 2 + "," + y((d.y0 + d.y1) / 2) + ")"; }); legend.append("line") .attr("x2", 10); @@ -350,7 +349,7 @@ function normalizedBarChart() { legend.append("text") .attr("x", 13) .attr("dy", ".35em") - .text(function (d) { return d.name; }); + .text(function (d: any) { return d.name; }); }); } @@ -384,14 +383,14 @@ function sortablebarChart() { .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - d3.tsv("data.tsv", function (error, data) { + d3.tsv("data.tsv", function (error, data: any) { data.forEach(function (d) { d.frequency = +d.frequency; }); x.domain(data.map(function (d) { return d.letter; })); - y.domain([0, d3.max(data, function (d) { return d.frequency; })]); + y.domain([0, d3.max(data, function (d: any) { return d.frequency; })]); svg.append("g") .attr("class", "x axis") @@ -412,10 +411,10 @@ function sortablebarChart() { .data(data) .enter().append("rect") .attr("class", "bar") - .attr("x", function (d) { return x(d.letter); }) + .attr("x", function (d: any) { return x(d.letter); }) .attr("width", x.rangeBand()) - .attr("y", function (d) { return y(d.frequency); }) - .attr("height", function (d) { return height - y(d.frequency); }); + .attr("y", function (d: any) { return y(d.frequency); }) + .attr("height", function (d: any) { return height - y(d.frequency); }); d3.select("input").on("change", change); @@ -497,8 +496,8 @@ function callenderView() { d3.csv("dji.csv", function (error, csv) { var data = d3.nest() - .key(function (d) { return d.Date; }) - .rollup(function (d) { return (d[0].Close - d[0].Open) / d[0].Open; }) + .key(function (d: any) { return d.Date; }) + .rollup(function (d: any) { return (d[0].Close - d[0].Open) / d[0].Open; }) .map(csv); rect.filter(function (d) { return d in data; }) @@ -529,7 +528,7 @@ function lineChart() { var parseDate = d3.time.format("%d-%b-%y").parse; - var x = d3.time.scale() + var x = d3.time.scale() .range([0, width]); var y = d3.scale.linear() @@ -543,7 +542,7 @@ function lineChart() { .scale(y) .orient("left"); - var line = d3.svg.line() + var line = d3.svg.line<{ date: Date; close: number }>() .x(function (d) { return x(d.date); }) .y(function (d) { return y(d.close); }); @@ -559,8 +558,8 @@ function lineChart() { d.close = +d.close; }); - x.domain(d3.extent(data, function (d) { return d.date; })); - y.domain(d3.extent(data, function (d) { return d.close; })); + x.domain(d3.extent(data, function (d: any) { return d.date; })); + y.domain(d3.extent(data, function (d: any) { return d.close; })); svg.append("g") .attr("class", "x axis") @@ -606,7 +605,7 @@ function bivariateAreaChart() { .scale(y) .orient("left"); - var area = d3.svg.area() + var area = d3.svg.area<{ date: Date; low: number; high: number }>() .x(function (d) { return x(d.date); }) .y0(function (d) { return y(d.low); }) .y1(function (d) { return y(d.high); }); @@ -617,15 +616,15 @@ function bivariateAreaChart() { .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - d3.tsv("data.tsv", function (error, data) { + d3.tsv("data.tsv", function (error, data: any) { data.forEach(function (d) { d.date = parseDate(d.date); d.low = +d.low; d.high = +d.high; }); - x.domain(d3.extent(data, function (d) { return d.date; })); - y.domain([d3.min(data, function (d) { return d.low; }), d3.max(data, function (d) { return d.high; })]); + x.domain(d3.extent(data, function (d: any) { return d.date; })); + y.domain([d3.min(data, function (d: any) { return d.low; }), d3.max(data, function (d: any) { return d.high; })]); svg.append("path") .datum(data) @@ -673,8 +672,8 @@ function dragMultiples() { function dragmove(d) { d3.select(this) - .attr("cx", d.x = Math.max(radius, Math.min(width - radius, d3.event.x))) - .attr("cy", d.y = Math.max(radius, Math.min(height - radius, d3.event.y))); + .attr("cx", d.x = Math.max(radius, Math.min(width - radius, ( d3.event).x))) + .attr("cy", d.y = Math.max(radius, Math.min(height - radius, ( d3.event).y))); } } @@ -806,31 +805,31 @@ function populationPyramid() { .attr("dy", ".71em") .text(2000); - d3.csv("population.csv", function (error, data: Array) { + d3.csv("population.csv", function (error, rows: Array) { // Convert strings to numbers. - data.forEach(function (d) { + rows.forEach(function (d) { d.people = +d.people; d.year = +d.year; d.age = +d.age; } ); // Compute the extent of the data set in age and years. - var age1 = d3.max(data, function (d) { return d.age; } ), - year0 = d3.min(data, function (d) { return d.year; } ), - year1 = d3.max(data, function (d) { return d.year; } ), + var age1 = d3.max(rows, function (d) { return d.age; } ), + year0 = d3.min(rows, function (d) { return d.year; } ), + year1 = d3.max(rows, function (d) { return d.year; } ), year = year1; // Update the scale domains. x.domain([year1 - age1, year1]); - y.domain([0, d3.max(data, function (d) { return d.people; } )]); + y.domain([0, d3.max(rows, function (d) { return d.people; } )]); // Produce a map from year and birthyear to [male, female]. - data = d3.nest() - .key(function (d) { return d.year; } ) + var data = d3.nest() + .key(function (d) { return '' + d.year; } ) .key(function (d) { return '' + (d.year - d.age); } ) .rollup(function (v) { return v.map(function (d) { return d.people; } ); } ) - .map(data); + .map(rows); // Add an axis to show the population values. svg.append("g") @@ -849,7 +848,7 @@ function populationPyramid() { .attr("transform", function (birthyear) { return "translate(" + x(birthyear) + ",0)"; } ); birthyear.selectAll("rect") - .data(function (birthyear) { return data[year][birthyear] || [0, 0]; } ) + .data(function (birthyear): number[] { return data[year][birthyear] || [0, 0]; } ) .enter().append("rect") .attr("x", -barWidth / 2) .attr("width", barWidth) @@ -874,7 +873,7 @@ function populationPyramid() { // Allow the arrow keys to change the displayed year. window.focus(); d3.select(window).on("keydown", function () { - switch (d3.event.keyCode) { + switch (( d3.event).keyCode) { case 37: year = Math.max(year0, year - 10); break; case 39: year = Math.min(year1, year + 10); break; } @@ -890,7 +889,7 @@ function populationPyramid() { .attr("transform", "translate(" + (x(year1) - x(year)) + ",0)"); birthyear.selectAll("rect") - .data(function (birthyear) { return data[year][birthyear] || [0, 0]; } ) + .data(function (birthyear): number[] { return data[year][birthyear] || [0, 0]; } ) .transition() .duration(750) .attr("y", y) @@ -900,17 +899,31 @@ function populationPyramid() { } //Example from http://bl.ocks.org/MoritzStefaner/1377729 -function forcedBasedLabelPlacemant() { +module forcedBasedLabelPlacemant { + interface Node extends d3.layout.force.Node { + label: string; + } + + interface LabelAnchor extends d3.layout.force.Node { + node: Node; + } + + interface LabelAnchorLink extends d3.layout.force.Link { + source: Node; + target: Node; + weight: number; + } + var w = 960, h = 500; var labelDistance = 0; var vis = d3.select("body").append("svg:svg").attr("width", w).attr("height", h); - var nodes = []; - var labelAnchors = []; - var labelAnchorLinks = []; - var links = []; + var nodes: Node[] = []; + var labelAnchors: LabelAnchor[] = []; + var labelAnchorLinks: { source: number; target: number }[] = []; + var links: typeof labelAnchorLinks = []; for (var i = 0; i < 30; i++) { var nodeLabel = { @@ -941,14 +954,14 @@ function forcedBasedLabelPlacemant() { }); }; - var force = d3.layout.force().size([w, h]).nodes(nodes).links(links).gravity(1).linkDistance(50).charge(-3000).linkStrength(function (x) { + var force = d3.layout.force().size([w, h]).nodes(nodes).links(links).gravity(1).linkDistance(50).charge(-3000).linkStrength(function (x) { return x.weight * 10 } ); force.start(); - var force2 = d3.layout.force().nodes(labelAnchors).links(labelAnchorLinks).gravity(0).linkDistance(0).linkStrength(8).charge(-100).size([w, h]); + var force2 = d3.layout.force().nodes(labelAnchors).links(labelAnchorLinks).gravity(0).linkDistance(0).linkStrength(8).charge(-100).size([w, h]); force2.start(); var link = vis.selectAll("line.link").data(links).enter().append("svg:line").attr("class", "link").style("stroke", "#CCC"); @@ -1021,14 +1034,21 @@ function forcedBasedLabelPlacemant() { } //Example from http://bl.ocks.org/mbostock/1125997 -function forceCollapsable() { +module forceCollapsable { + interface Node extends d3.layout.force.Node { + id: string; + _children: Node[]; + children?: Node[]; + size: number; + } + var w = 1280, h = 800, node, link, root; - var force = d3.layout.force() + var force = d3.layout.force() .on("tick", tick) .charge(function (d) { return d._children ? -d.size / 100 : -30; } ) .linkDistance(function (d) { return d.target._children ? 80 : 30; } ) @@ -1048,7 +1068,7 @@ function forceCollapsable() { function update() { var nodes = flatten(root), - links = d3.layout.tree().links(nodes); + links = d3.layout.tree().links(nodes); // Restart the force layout. force @@ -1195,7 +1215,7 @@ function voronoiTesselation() { var width = 960, height = 500; - var vertices = >d3.range(100).map(function (d) { + var vertices = d3.range(100).map(function (d): [number, number] { return [Math.random() * width, Math.random() * height]; } ); @@ -1208,7 +1228,7 @@ function voronoiTesselation() { .attr("class", "PiYG") .on("mousemove", function () { vertices[0] = d3.mouse(this); redraw(); } ); - var path = svg.append("g").selectAll("path"); + var path = >svg.append("g").selectAll("path"); svg.selectAll("circle") .data(vertices.slice(1)) @@ -1234,50 +1254,50 @@ function forceDirectedVoronoi() { links = [], simulate = true, zoomToAdd = true, - color = d3.scale.quantize().domain([10000, 7250]).range(["#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]) + color = d3.scale.quantize().domain([10000, 7250]).range(["#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]) var numVertices = (w*h) / 3000; var vertices = d3.range(numVertices).map(function(i) { var angle = radius * (i+10); - return {x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)}; + return {x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)}; }); - var d3_geom_voronoi = d3.geom.voronoi() + var d3_geom_voronoi = d3.geom.voronoi<{ x: number; y: number }>() .x(function(d) { return d.x; }) .y(function(d) { return d.y; }) var prevEventScale = 1; var zoom = d3.behavior.zoom().on("zoom", function(d,i) { if (zoomToAdd){ - if (d3.event.scale > prevEventScale) { + if (( d3.event).scale > prevEventScale) { var angle = radius * vertices.length; - vertices.push({x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)}) - } else if (vertices.length > 2 && d3.event.scale != prevEventScale) { + vertices.push({x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)}) + } else if (vertices.length > 2 && ( d3.event).scale != prevEventScale) { vertices.pop(); } force.nodes(vertices).start() } else { - if (d3.event.scale > prevEventScale) { + if (( d3.event).scale > prevEventScale) { radius+= .01 } else { radius -= .01 } vertices.forEach(function(d, i) { var angle = radius * (i+10); - vertices[i] = {x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)}; + vertices[i] = {x: angle*Math.cos(angle)+(w/2), y: angle*Math.sin(angle)+(h/2)}; }); force.nodes(vertices).start() } - prevEventScale = d3.event.scale; + prevEventScale = ( d3.event).scale; }); d3.select(window) .on("keydown", function() { // shift - if(d3.event.keyCode == 16) { + if(( d3.event).keyCode == 16) { zoomToAdd = false } // s - if(d3.event.keyCode == 83) { + if(( d3.event).keyCode == 83) { simulate = !simulate if(simulate) { force.start() @@ -1303,9 +1323,9 @@ function forceDirectedVoronoi() { force.nodes(vertices).start(); - var circle = svg.selectAll("circle"); - var path = svg.selectAll("path"); - var link = svg.selectAll("line"); + var circle = > svg.selectAll("circle"); + var path = > svg.selectAll("path"); + var link = > svg.selectAll("line"); function update() { path = path.data(d3_geom_voronoi(vertices)); @@ -1313,7 +1333,7 @@ function forceDirectedVoronoi() { // drag node by dragging cell .call(d3.behavior.drag() .on("drag", function(d, i) { - vertices[i] = {x: vertices[i].x + d3.event.dx, y: vertices[i].y + d3.event.dy} + vertices[i] = {x: vertices[i].x + ( d3.event).dx, y: vertices[i].y + ( d3.event).dy} }) ) .style("fill", function(d, i) { return color(0) }) @@ -1347,7 +1367,7 @@ function delaunayTesselation() { var width = 960, height = 500; - var vertices = >d3.range(100).map(function (d) { + var vertices = d3.range(100).map(function (d): [number, number] { return [Math.random() * width, Math.random() * height]; } ); @@ -1357,7 +1377,7 @@ function delaunayTesselation() { .attr("class", "PiYG") .on("mousemove", function () { vertices[0] = d3.mouse(this); redraw(); } ); - var path = svg.append("g").selectAll("path"); + var path = >svg.append("g").selectAll("path"); svg.selectAll("circle") .data(vertices.slice(1)) @@ -1379,11 +1399,13 @@ function quadtree() { var width = 960, height = 500; - var data = d3.range(5000).map(function () { - return { x: Math.random() * width, y: Math.random() * width }; - } ); + var data = d3.range(5000).map(function(): [number, number] { + return [Math.random() * width, Math.random() * width]; + }); - var quadtree = d3.geom.quadtree(data, -1, -1, width + 1, height + 1); + var quadtree = d3.geom.quadtree() + .extent([[-1, -1], [width + 1, height + 1]]) + (data); var brush = d3.svg.brush() .x(d3.scale.identity().domain([0, width])) @@ -1405,11 +1427,11 @@ function quadtree() { .attr("height", function (d) { return d.height; } ); var point = svg.selectAll(".point") - .data(data) + .data(<{ scanned?: boolean; selected?: boolean; 0: number; 1: number }[]> data) .enter().append("circle") .attr("class", "point") - .attr("cx", function (d) { return d.x; } ) - .attr("cy", function (d) { return d.y; } ) + .attr("cx", function (d) { return d[0]; } ) + .attr("cy", function (d) { return d[1]; } ) .attr("r", 4); svg.append("g") @@ -1455,7 +1477,7 @@ function convexHull() { var randomX = d3.random.normal(width / 2, 60), randomY = d3.random.normal(height / 2, 60), - vertices = d3.range(100).map(function () { return [randomX(), randomY()]; } ); + vertices = d3.range(100).map(function (): [number, number] { return [randomX(), randomY()]; } ); var svg = d3.select("body").append("svg") .attr("width", width) @@ -1470,7 +1492,7 @@ function convexHull() { var hull = svg.append("path") .attr("class", "hull"); - var circle = svg.selectAll("circle"); + var circle = > svg.selectAll("circle"); redraw(); @@ -1483,19 +1505,25 @@ function convexHull() { } // example from http://bl.ocks.org/mbostock/1044242 -function hierarchicalEdgeBundling() { +module hierarchicalEdgeBundling { + interface Result extends d3.layout.cluster.Result { + parent: Result; + size: number; + key: string; + } + var diameter = 960, radius = diameter / 2, innerRadius = radius - 120; - var cluster = d3.layout.cluster() + var cluster = d3.layout.cluster() .size([360, innerRadius]) .sort(null) .value(function (d) { return d.size; } ); - var bundle = d3.layout.bundle(); + var bundle = d3.layout.bundle(); - var line = d3.svg.line.radial() + var line = d3.svg.line.radial() .interpolate("bundle") .tension(.85) .radius(function (d) { return d.y; } ) @@ -1604,7 +1632,7 @@ function roundedRectangles() { .attr("transform", function (d, i) { return "scale(" + (1 - d / 25) * 20 + ")"; } ) .style("fill", d3.scale.category20c()); - g.map(function (d) { + var g0 = g.datum(function (d) { return { center: [0, 0], angle: 0 }; } ); @@ -1614,7 +1642,7 @@ function roundedRectangles() { d3.timer(function () { count++; - g.attr("transform", function (d, i) { + g0.attr("transform", function (d, i) { d.center[0] += (mouse[0] - d.center[0]) / (i + 5); d.center[1] += (mouse[1] - d.center[1]) / (i + 5); d.angle += Math.sin((count + i) / 10) * 7; @@ -1643,10 +1671,10 @@ function streamGraph() { .domain([0, d3.max(layers0.concat(layers1), function (layer) { return d3.max(layer, function (d) { return d.y0 + d.y; }); })]) .range([height, 0]); - var color = d3.scale.linear() + var color = d3.scale.linear() .range(["#aad", "#556"]); - var area = d3.svg.area() + var area = d3.svg.area<{ x: number; y: number; y0: number }>() .x(function (d) { return x(d.x); }) .y0(function (d) { return y(d.y0); }) .y1(function (d) { return y(d.y0 + d.y); }); @@ -1694,14 +1722,20 @@ function streamGraph() { } // example from http://mbostock.github.io/d3/talk/20111116/force-collapsible.html -function forceCollapsable2() { +module forceCollapsable2 { + interface Node extends d3.layout.force.Node { + _children: Node[]; + size: number; + id: string; + } + var w = 1280, h = 800, node, link, root; - var force = d3.layout.force() + var force = d3.layout.force() .on("tick", tick) .charge(function (d) { return d._children ? -d.size / 100 : -30; } ) .linkDistance(function (d) { return d.target._children ? 80 : 30; } ) @@ -1721,7 +1755,7 @@ function forceCollapsable2() { function update() { var nodes = flatten(root), - links = d3.layout.tree().links(nodes); + links = d3.layout.tree().links(nodes); // Restart the force layout. force @@ -1828,7 +1862,7 @@ function chordDiagram() { innerRadius = Math.min(width, height) * .41, outerRadius = innerRadius * 1.1; - var fill = d3.scale.ordinal() + var fill = d3.scale.ordinal() .domain(d3.range(4)) .range(["#000000", "#FFDD89", "#957244", "#F26223"]); @@ -1843,7 +1877,7 @@ function chordDiagram() { .enter().append("path") .style("fill", function (d) { return fill(d.index); } ) .style("stroke", function (d) { return fill(d.index); } ) - .attr("d", d3.svg.arc().innerRadius(innerRadius).outerRadius(outerRadius)) + .attr("d", d3.svg.arc().innerRadius(innerRadius).outerRadius(outerRadius)) .on("mouseover", fade(.1)) .on("mouseout", fade(1)); @@ -1876,7 +1910,7 @@ function chordDiagram() { .selectAll("path") .data(chord.chords) .enter().append("path") - .attr("d", d3.svg.chord().radius(innerRadius)) + .attr("d", d3.svg.chord().radius(innerRadius)) .style("fill", function (d) { return fill(d.target.index); } ) .style("opacity", 1); @@ -1925,14 +1959,12 @@ function irisParallel() { .attr("transform", "translate(" + m[3] + "," + m[0] + ")"); d3.csv("iris.csv", function (flowers) { + var i: number; // Create a scale and brush for each trait. traits.forEach(function (d) { - // Coerce values to numbers. - flowers.forEach(function (p) { p[d] = +p[d]; } ); - - y[d] = d3.scale.linear() - .domain(d3.extent(flowers, function (p) { return p[d]; } )) + y[d] = d3.scale.linear() + .domain(d3.extent(flowers, function (p) { return +p[d]; } )) .range([h, 0]); y[d].brush = d3.svg.brush() @@ -1963,7 +1995,7 @@ function irisParallel() { .data(flowers) .enter().append("svg:path") .attr("d", path) - .attr("class", function (d) { return d.species; } ); + .attr("class", function (d) { return d['species']; } ); // Add a group element for each trait. var g = svg.selectAll(".trait") @@ -1971,8 +2003,8 @@ function irisParallel() { .enter().append("svg:g") .attr("class", "trait") .attr("transform", function (d) { return "translate(" + x(d) + ")"; } ) - .call(d3.behavior.drag() - .origin(function (d) { return { x: x(d) }; } ) + .call(d3.behavior.drag() + .origin(function (d) { return { x: x(d), y: undefined }; } ) .on("dragstart", dragstart) .on("drag", drag) .on("dragend", dragend)); @@ -1994,12 +2026,12 @@ function irisParallel() { .attr("x", -8) .attr("width", 16); - function dragstart(d, i?) { + function dragstart(d) { i = traits.indexOf(d); } - function drag(d, i?) { - x.range()[i] = d3.event.x; + function drag(d) { + x.range()[i] = ( d3.event).x; traits.sort(function (a, b) { return x(a) - x(b); } ); g.attr("transform", function (d) { return "translate(" + x(d) + ")"; } ); foreground.attr("d", path); @@ -2015,7 +2047,7 @@ function irisParallel() { // Returns the path for a given data point. function path(d) { - return line(traits.map(function (p) { return [x(p), y[p](d[p])]; } )); + return line(traits.map(function (p): [number, number] { return [x(p), y[p](d[p])]; } )); } // Handles a brush event, toggling the display of foreground lines. @@ -2098,7 +2130,7 @@ function healthAndWealth() { .text(1800); // Load the data. - d3.json("nations.json", function (nations) { + d3.json("nations.json", function (nations: any[]) { // A bisector since many nation's data is sparsely-defined. var bisect = d3.bisector(function (d) { return d[0]; } ); @@ -2219,7 +2251,7 @@ function healthAndWealth() { // Test for d3.functor function functorTest () { - var f = d3.functor(10); + var f: (n: number) => number = d3.functor(10); var g = d3.functor(function (v) { return v; }); return f(10) === g(10); @@ -2243,68 +2275,68 @@ function nestTest () { } ]; - var n1 = d3.nest() - .key(function (d) { return d.a; }) + var n1 = d3.nest<{a: number; b: number[] }>() + .key(function (d) { return String(d.a); }) .sortKeys(d3.descending) .rollup(function (vals) { - return d3.sum(vals); + return d3.sum(vals[0].b); }); n1.map(data); n1.entries(data); - var n2 = d3.nest() - .key(function (d) { return d.a; }) + var n2 = d3.nest<{ a: number; b: number[] }>() + .key(function (d) { return String(d.a); }) .sortValues(function (x1, x2) { return x1[0] < x1[1] ? -1 : (x1[0] > x1[0] ? 1 : 0); }); n2.map(data); n2.entries(data); // Tests adopted from d3's tests. - var keys = d3.nest() - .key(function(d) { return d.foo; }) + var keys = d3.nest<{ foo: number; }>() + .key(function(d) { return String(d.foo); }) .entries([{foo: 1}, {foo: 1}, {foo: 2}]) .map(function(d) { return d.key; }) .sort(d3.ascending); - var entries = d3.nest() - .key(function(d) { return d.foo; }) + var entries = d3.nest<{foo: number; bar?: number}>() + .key(function(d) { return String(d.foo); }) .entries([{foo: 1, bar: 0}, {foo: 2}, {foo: 1, bar: 1}]); - keys = d3.nest() - .key(function(d) { return d.foo; }).sortKeys(d3.descending) + keys = d3.nest<{foo: number}>() + .key(function(d) { return String(d.foo); }).sortKeys(d3.descending) .entries([{foo: 1}, {foo: 1}, {foo: 2}]) .map(function(d) { return d.key; }); - entries = d3.nest() - .key(function(d) { return d.foo; }) + entries = d3.nest<{ foo: number; bar?: number }>() + .key(function(d) { return String(d.foo); }) .sortValues(function(a, b) { return a.bar - b.bar; }) .entries([{foo: 1, bar: 2}, {foo: 1, bar: 0}, {foo: 1, bar: 1}, {foo: 2}]); - entries = d3.nest() - .key(function(d) { return d.foo; }) + entries = d3.nest<{ foo: number; bar?: number }>() + .key(function(d) { return String(d.foo); }) .rollup(function(values) { return d3.sum(values, function(d) { return d.bar; }); }) .entries([{foo: 1, bar: 2}, {foo: 1, bar: 0}, {foo: 1, bar: 1}, {foo: 2}]); - entries = d3.nest() - .key(function(d) { return d[0]; }).sortKeys(d3.ascending) - .key(function(d) { return d[1]; }).sortKeys(d3.ascending) + entries = d3.nest<[number, number]>() + .key(function(d) { return String(d[0]); }).sortKeys(d3.ascending) + .key(function(d) { return String(d[1]); }).sortKeys(d3.ascending) .entries([[0, 1], [0, 2], [1, 1], [1, 2], [0, 2]]); - entries = d3.nest() - .key(function(d) { return d[0]; }).sortKeys(d3.ascending) - .key(function(d) { return d[1]; }).sortKeys(d3.ascending) + entries = d3.nest<[number, number]>() + .key(function(d) { return String(d[0]); }).sortKeys(d3.ascending) + .key(function(d) { return String(d[1]); }).sortKeys(d3.ascending) .rollup(function(values) { return values.length; }) .entries([[0, 1], [0, 2], [1, 1], [1, 2], [0, 2]]); - entries = d3.nest() - .key(function(d) { return d[0]; }).sortKeys(d3.ascending) - .key(function(d) { return d[1]; }).sortKeys(d3.ascending) + entries = d3.nest<{ 0: number; 1: number; 2?: number }>() + .key(function(d) { return String(d[0]); }).sortKeys(d3.ascending) + .key(function(d) { return String(d[1]); }).sortKeys(d3.ascending) .sortValues(function(a, b) { return a[2] - b[2]; }) .entries([[0, 1], [0, 2, 1], [1, 1], [1, 2], [0, 2, 0]]); - var map = d3.nest() - .key(function(d) { return d[0]; }).sortKeys(d3.ascending) - .key(function(d) { return d[1]; }).sortKeys(d3.ascending) + var map = d3.nest<{ 0: number; 1: number; 2?: number }>() + .key(function(d) { return String(d[0]); }).sortKeys(d3.ascending) + .key(function(d) { return String(d[1]); }).sortKeys(d3.ascending) .sortValues(function(a, b) { return a[2] - b[2]; }) .map([[0, 1], [0, 2, 1], [1, 1], [1, 2], [0, 2, 0]]); } @@ -2344,7 +2376,7 @@ function brushTest() { var brush1 = d3.svg.brush() .x(xScale) .on('brush', function () { - var extent = brush1.extent(); + var extent = <[number, number]> brush1.extent(); xMin = Math.max(extent[0], 0); xMax = Math.min(extent[1], 1); brush1.extent([xMin, xMax]); @@ -2373,186 +2405,155 @@ function brushTest() { // Tests for area // Adopted from: https://github.com/mbostock/d3/blob/master/test/svg/area-test.js function svgAreaTest () { - var a = d3.svg.area(); + var a = d3.svg.area(), + f: () => number, + n: number; - a.x()([0, 1]); - a.x()([0, 1], 1); + a.x(f).x() === f; + a.x(n).x() === n; a.x(0); - a.x(function (d) { return d.x * 10; }); + a.x(function (d) { return d[0] * 10; }); a.x(function (d, i) { return i * 10; }); - a.x0()([0, 1]); - a.x0()([0, 1], 1); + a.x(f).x0() === f; + a.x(n).x0() === n; a.x0(0); - a.x0(function (d) { return d.x * 10; }); + a.x0(function (d) { return d[0] * 10; }); a.x0(function (d, i) { return i * 10; }); - a.x1()([0, 1]); - a.x1()([0, 1], 1); + a.x(f).x1() === f; + a.x(n).x1() === n; a.x1(0); - a.x1(function (d) { return d.x * 10; }); + a.x1(function (d) { return d[0] * 10; }); a.x1(function (d, i) { return i * 10; }); - a.y()([0, 1]); - a.y()([0, 1], 1); + a.y(f).y() === f; + a.y(n).y() === n; a.y(0); - a.y(function (d) { return d.x * 10; }); + a.y(function (d) { return d[0] * 10; }); a.y(function (d, i) { return i * 10; }); - a.y0()([0, 1]); - a.y0()([0, 1], 1); + a.y(f).y0() === f; + a.y(n).y0() === n; a.y0(0); - a.y0(function (d) { return d.x * 10; }); + a.y0(function (d) { return d[0] * 10; }); a.y0(function (d, i) { return i * 10; }); - a.y1()([0, 1]); - a.y1()([0, 1], 1); + a.y(f).y1() === f; + a.y(n).y1() === n; a.y1(0); - a.y1(function (d) { return d.x * 10; }); + a.y1(function (d) { return d[0] * 10; }); a.y1(function (d, i) { return i * 10; }); } // Tests for areaRadial // Adopted from: https://github.com/mbostock/d3/blob/master/test/svg/area-radial-test.js function svgAreaRadialTest () { - var a = d3.svg.area.radial(); + var a = d3.svg.area.radial(), + f: () => number, + n: number; - a.x()([0, 1]); - a.x()([0, 1], 1); - a.x(0); - a.x(function (d) { return d.x * 10; }); - a.x(function (d, i) { return i * 10; }); - - a.x0()([0, 1]); - a.x0()([0, 1], 1); - a.x0(0); - a.x0(function (d) { return d.x * 10; }); - a.x0(function (d, i) { return i * 10; }); - - a.x1()([0, 1]); - a.x1()([0, 1], 1); - a.x1(0); - a.x1(function (d) { return d.x * 10; }); - a.x1(function (d, i) { return i * 10; }); - - a.y()([0, 1]); - a.y()([0, 1], 1); - a.y(0); - a.y(function (d) { return d.x * 10; }); - a.y(function (d, i) { return i * 10; }); - - a.y0()([0, 1]); - a.y0()([0, 1], 1); - a.y0(0); - a.y0(function (d) { return d.x * 10; }); - a.y0(function (d, i) { return i * 10; }); - - a.y1()([0, 1]); - a.y1()([0, 1], 1); - a.y1(0); - a.y1(function (d) { return d.x * 10; }); - a.y1(function (d, i) { return i * 10; }); - - a.radius(function () { return 10; }); - a.radius(function (d) { return d.x * 10; }); + a.radius(f).radius() === f; + a.radius(n).radius() === n; + a.radius(0); + a.radius(function (d) { return d[0] * 10; }); a.radius(function (d, i) { return i * 10; }); - a.innerRadius(function () { return 10; }); - a.innerRadius(function (d) { return d.x * 10; }); + a.radius(f).innerRadius() === f; + a.radius(n).innerRadius() === n; + a.innerRadius(0); + a.innerRadius(function (d) { return d[0] * 10; }); a.innerRadius(function (d, i) { return i * 10; }); - a.outerRadius(function () { return 10; }); - a.outerRadius(function (d) { return d.x * 10; }); + a.radius(f).outerRadius() === f; + a.radius(n).outerRadius() === n; + a.outerRadius(0); + a.outerRadius(function (d) { return d[1] * 10; }); a.outerRadius(function (d, i) { return i * 10; }); - a.angle(function () { return 10; }); - a.angle(function (d) { return d.x * 10; }); + a.angle(f).angle() === f; + a.angle(n).angle() === n; + a.angle(0); + a.angle(function (d) { return d[0] * 10; }); a.angle(function (d, i) { return i * 10; }); - a.startAngle(function () { return 10; }); - a.startAngle(function (d) { return d.x * 10; }); + a.angle(f).startAngle() === f; + a.angle(n).startAngle() === n; + a.startAngle(0); + a.startAngle(function (d) { return d[0] * 10; }); a.startAngle(function (d, i) { return i * 10; }); - a.endAngle(function () { return 10; }); - a.endAngle(function (d) { return d.x * 10; }); + a.angle(f).endAngle() === f; + a.angle(n).endAngle() === n; + a.endAngle(0); + a.endAngle(function (d) { return d[1] * 10; }); a.endAngle(function (d, i) { return i * 10; }); } // Tests for d3.svg.line // Adopted from: https://github.com/mbostock/d3/blob/master/test/svg/line-test.js function svgLineTest () { - var l = d3.svg.line(); + var l = d3.svg.line(), + f: () => number, + n: number; - l.x()([0, 1]); - l.x()([0, 1], 0); + l.x(f).x() === f; + l.x(n).x() === n; l.x(0); - l.x(function (d) { return d.x; }); + l.x(function (d) { return d[0]; }); l.x(function (d, i) { return i; }); - l.y()([0, 1]); - l.y()([0, 1], 0); + l.y(f).y() === f; + l.y(n).y() === n; l.y(0); - l.y(function (d) { return d.y; }); + l.y(function (d) { return d[1]; }); l.y(function (d, i) { return i; }); } // Tests for d3.svg.line.radial // Adopted from: https://github.com/mbostock/d3/blob/master/test/svg/line-radial-test.js function svgLineRadialTest () { - var l = d3.svg.line.radial(); + var l = d3.svg.line.radial(), + f: () => number, + n: number; - l.x()([0, 1]); - l.x()([0, 1], 0); - l.x(0); - l.x(function (d) { return d.x; }); - l.x(function (d, i) { return i; }); - - l.y()([0, 1]); - l.y()([0, 1], 0); - l.y(0); - l.y(function (d) { return d.y; }); - l.y(function (d, i) { return i; }); - - l.radius()([0, 1]); - l.radius()([0, 1], 0); + l.radius(f).radius() === f; + l.radius(n).radius() === n; l.radius(0); - l.radius(function (d) { return d.x; }); + l.radius(function (d) { return d[0]; }); l.radius(function (d, i) { return i; }); - l.angle()([0, 1]); - l.angle()([0, 1], 0); + l.angle(f).angle() === f; + l.angle(n).angle() === n; l.angle(0); - l.angle(function (d) { return d.y; }); + l.angle(function (d) { return d[1]; }); l.angle(function (d, i) { return i; }); } // Tests for d3.svg.arc // Adopted from: https://github.com/mbostock/d3/blob/master/test/svg/arc-test.js function svgArcTest () { - var l = d3.svg.arc(); + var l = d3.svg.arc(), + f: () => number; - l.innerRadius()([0, 1]); - l.innerRadius()([0, 1], 0); + l.innerRadius(f).innerRadius() === f; l.innerRadius(0); - l.innerRadius(function (d) { return d.x; }); + l.innerRadius(function (d) { return d[0]; }); l.innerRadius(function (d, i) { return i; }); - l.outerRadius()([0, 1]); - l.outerRadius()([0, 1], 0); + l.outerRadius(f).outerRadius() === f; l.outerRadius(0); - l.outerRadius(function (d) { return d.x; }); + l.outerRadius(function (d) { return d[1]; }); l.outerRadius(function (d, i) { return i; }); - l.startAngle()([0, 1]); - l.startAngle()([0, 1], 0); + l.startAngle(f).startAngle() === f; l.startAngle(0); - l.startAngle(function (d) { return d.x; }); + l.startAngle(function (d) { return d[0]; }); l.startAngle(function (d, i) { return i; }); - l.endAngle()([0, 1]); - l.endAngle()([0, 1], 0); + l.endAngle(f).endAngle() === f; l.endAngle(0); - l.endAngle(function (d) { return d.x; }); + l.endAngle(function (d) { return d[1]; }); l.endAngle(function (d, i) { return i; }); } @@ -2561,28 +2562,28 @@ function svgArcTest () { function svgDiagonalTest () { var d = d3.svg.diagonal(); - d.projection()({ x: 0, y: 1}); d.projection()({ x: 0, y: 1}, 0); d.projection(function (d) { return [d.x, d.y]; }); d.projection(function (d, i) { return [i, i + 1]; }); - d.source()({x: 0, y: 1}); - d.source()({x: 0, y: 1}, 0); + d.source()({ source: {x: 0, y: 1}, target: null }, 0); d.source({x: 0, y: 1}); - d.source(function (d) { return {x: d.x, y: d.y}; }); - d.source(function (d, i) { return {x: d.x * i, y: d.y * i}; }); + d.source(function (d) { return {x: d.source.x, y: d.source.y}; }); + d.source(function (d, i) { return {x: d.source.x * i, y: d.source.y * i}; }); - d.target()({x: 0, y: 1}); - d.target()({x: 0, y: 1}, 0); + d.target()({ target: {x: 0, y: 1}, source: null }, 0); d.target({x: 0, y: 1}); - d.target(function (d) { return {x: d.x, y: d.y}; }); - d.target(function (d, i) { return {x: d.x * i, y: d.y * i}; }); + d.target(function (d) { return {x: d.target.x, y: d.target.y}; }); + d.target(function (d, i) { return {x: d.target.x * i, y: d.target.y * i}; }); } // Tests for d3.extent // Adopted from: https://github.com/mbostock/d3/blob/master/test/arrays/extent-test.js function extentTest() { + // usages of `o' suppressed as well as mixed-type comparisons + // see https://github.com/Microsoft/TypeScript/commit/c0db7ffe8f55b6ec335880482ca43b93b066689d var o = { valueOf: function () { return NaN; } }; + d3.extent([1]); d3.extent([5, 1, 2, 3, 4]); d3.extent([20, 3]); @@ -2591,15 +2592,15 @@ function extentTest() { d3.extent(["20", "3"]); d3.extent(["3", "20"]); d3.extent([NaN, 1, 2, 3, 4, 5]); - d3.extent([o, 1, 2, 3, 4, 5]); + // d3.extent([o, 1, 2, 3, 4, 5]); d3.extent([1, 2, 3, 4, 5, NaN]); - d3.extent([1, 2, 3, 4, 5, o]); + // d3.extent([1, 2, 3, 4, 5, o]); d3.extent([10, null, 3, undefined, 5, NaN]); d3.extent([-1, null, -3, undefined, -5, NaN]); - d3.extent([20, "3"]); - d3.extent(["20", 3]); - d3.extent([3, "20"]); - d3.extent(["3", 20]); + // d3.extent([20, "3"]); + // d3.extent(["20", 3]); + // d3.extent([3, "20"]); + // d3.extent(["3", 20]); d3.extent([1], (d) => { return d; }); d3.extent([5, 1, 2, 3, 4], (d) => { return d; }); @@ -2609,28 +2610,28 @@ function extentTest() { d3.extent(["20", "3"], (d) => { return d; }); d3.extent(["3", "20"], (d) => { return d; }); d3.extent([NaN, 1, 2, 3, 4, 5], (d) => { return d; }); - d3.extent([o, 1, 2, 3, 4, 5], (d) => { return d; }); + // d3.extent([o, 1, 2, 3, 4, 5], (d) => { return d; }); d3.extent([1, 2, 3, 4, 5, NaN], (d) => { return d; }); - d3.extent([1, 2, 3, 4, 5, o], (d) => { return d; }); + // d3.extent([1, 2, 3, 4, 5, o], (d) => { return d; }); d3.extent([10, null, 3, undefined, 5, NaN], (d) => { return d; }); d3.extent([-1, null, -3, undefined, -5, NaN], (d) => { return d; }); - d3.extent([20, "3"], (d) => { return d; }); - d3.extent(["20", 3], (d) => { return d; }); - d3.extent([3, "20"], (d) => { return d; }); - d3.extent(["3", 20], (d) => { return d; }); + // d3.extent([20, "3"], (d) => { return d; }); + // d3.extent(["20", 3], (d) => { return d; }); + // d3.extent([3, "20"], (d) => { return d; }); + // d3.extent(["3", 20], (d) => { return d; }); } // Tests for d3.time.format.multi // Adopted from http://bl.ocks.org/mbostock/4149176 function multiTest() { var customTimeFormat = d3.time.format.multi([ - [".%L", function(d) { return d.getMilliseconds(); }], - [":%S", function(d) { return d.getSeconds(); }], - ["%I:%M", function(d) { return d.getMinutes(); }], - ["%I %p", function(d) { return d.getHours(); }], - ["%a %d", function(d) { return d.getDay() && d.getDate() != 1; }], + [".%L", function(d) { return !!d.getMilliseconds(); }], + [":%S", function(d) { return !!d.getSeconds(); }], + ["%I:%M", function(d) { return !!d.getMinutes(); }], + ["%I %p", function(d) { return !!d.getHours(); }], + ["%a %d", function(d) { return !!d.getDay() && d.getDate() != 1; }], ["%b %d", function(d) { return d.getDate() != 1; }], - ["%B", function(d) { return d.getMonth(); }], + ["%B", function(d) { return !!d.getMonth(); }], ["%Y", function() { return true; }] ]); @@ -2656,4 +2657,4 @@ function multiTest() { .attr("class", "x axis") .attr("transform", "translate(0," + height + ")") .call(xAxis); -} \ No newline at end of file +} diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 57e817818..dddef751b 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -1,3451 +1,3278 @@ -// Type definitions for d3JS -// Project: http://d3js.org/ -// Definitions by: Boris Yankov -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module D3 { - export interface Selectors { - /** - * Select an element from the current document - */ - select: { - /** - * Returns the empty selection - */ - (): Selection; - /** - * Selects the first element that matches the specified selector string - * - * @param selector Selection String to match - */ - (selector: string): Selection; - /** - * Selects the specified node - * - * @param element Node element to select - */ - (element: EventTarget): Selection; - }; - - /** - * Select multiple elements from the current document - */ - selectAll: { - /** - * Selects all elements that match the specified selector - * - * @param selector Selection String to match - */ - (selector: string): Selection; - /** - * Selects the specified array of elements - * - * @param elements Array of node elements to select - */ - (elements: EventTarget[]): Selection; - }; - } - - export interface D3Event extends Event{ - dx: number; - dy: number; - clientX: number; - clientY: number; - translate: number[]; - scale: number; - sourceEvent: D3Event; - x: number; - y: number; - keyCode: number; - altKey: any; - type: string; - } - - export interface Base extends Selectors { - /** - * Create a behavior - */ - behavior: Behavior.Behavior; - /** - * Access the current user event for interaction - */ - event: D3Event; - - /** - * Compare two values for sorting. - * Returns -1 if a is less than b, or 1 if a is greater than b, or 0 - * - * @param a First value - * @param b Second value - */ - ascending(a: T, b: T): number; - /** - * Compare two values for sorting. - * Returns -1 if a is greater than b, or 1 if a is less than b, or 0 - * - * @param a First value - * @param b Second value - */ - descending(a: T, b: T): number; - /** - * Find the minimum value in an array - * - * @param arr Array to search - * @param map Accsessor function - */ - min(arr: T[], map: (v?: T, i?: number) => U): U; - /** - * Find the minimum value in an array - * - * @param arr Array to search - */ - min(arr: T[]): T; - /** - * Find the maximum value in an array - * - * @param arr Array to search - * @param map Accsessor function - */ - max(arr: T[], map: (v?: T, i?: number) => U): U; - /** - * Find the maximum value in an array - * - * @param arr Array to search - */ - max(arr: T[]): T; - /** - * Find the minimum and maximum value in an array - * - * @param arr Array to search - * @param map Accsessor function - */ - extent(arr: T[], map: (v: T) => U): U[]; - /** - * Find the minimum and maximum value in an array - * - * @param arr Array to search - */ - extent(arr: T[]): T[]; - /** - * Compute the sum of an array of numbers - * - * @param arr Array to search - * @param map Accsessor function - */ - sum(arr: T[], map: (v: T) => number): number; - /** - * Compute the sum of an array of numbers - * - * @param arr Array to search - */ - sum(arr: number[]): number; - /** - * Compute the arithmetic mean of an array of numbers - * - * @param arr Array to search - * @param map Accsessor function - */ - mean(arr: T[], map: (v: T) => number): number; - /** - * Compute the arithmetic mean of an array of numbers - * - * @param arr Array to search - */ - mean(arr: number[]): number; - /** - * Compute the median of an array of numbers (the 0.5-quantile). - * - * @param arr Array to search - * @param map Accsessor function - */ - median(arr: T[], map: (v: T) => number): number; - /** - * Compute the median of an array of numbers (the 0.5-quantile). - * - * @param arr Array to search - */ - median(arr: number[]): number; - /** - * Compute a quantile for a sorted array of numbers. - * - * @param arr Array to search - * @param p The quantile to return - */ - quantile: (arr: number[], p: number) => number; - /** - * Locate the insertion point for x in array to maintain sorted order - * - * @param arr Array to search - * @param x Value to search for insertion point - * @param low Minimum value of array subset - * @param hihg Maximum value of array subset - */ - bisect(arr: T[], x: T, low?: number, high?: number): number; - /** - * Locate the insertion point for x in array to maintain sorted order - * - * @param arr Array to search - * @param x Value to serch for insertion point - * @param low Minimum value of array subset - * @param high Maximum value of array subset - */ - bisectLeft(arr: T[], x: T, low?: number, high?: number): number; - /** - * Locate the insertion point for x in array to maintain sorted order - * - * @param arr Array to search - * @param x Value to serch for insertion point - * @param low Minimum value of array subset - * @param high Maximum value of array subset - */ - bisectRight(arr: T[], x: T, low?: number, high?: number): number; - /** - * Bisect using an accessor. - * - * @param accessor Accessor function - */ - bisector(accessor: (data: any, index: number) => any): any; - /** - * Randomize the order of an array. - * - * @param arr Array to randomize - */ - shuffle(arr: T[]): T[]; - /** - * Reorder an array of elements according to an array of indexes - * - * @param arr Array to reorder - * @param indexes Array containing the order the elements should be returned in - */ - permute(arr: any[], indexes: any[]): any[]; - /** - * Transpose a variable number of arrays. - * - * @param arrs Arrays to transpose - */ - zip(...arrs: any[]): any[]; - /** - * Parse the given 2D affine transform string, as defined by SVG's transform attribute. - * - * @param definition 2D affine transform string - */ - transform(definition: string): any; - /** - * Transpose an array of arrays. - * - * @param matrix Two dimensional array to transpose - */ - transpose(matrix: any[]): any[]; - /** - * Creates an array containing tuples of adjacent pairs - * - * @param arr An array containing entries to pair - * @returns any[][] An array of 2-element tuples for each pair - */ - pairs(arr: any[]): any[][]; - /** - * List the keys of an associative array. - * - * @param map Array of objects to get the key values from - */ - keys(map: any): string[]; - /** - * List the values of an associative array. - * - * @param map Array of objects to get the values from - */ - values(map: any): any[]; - /** - * List the key-value entries of an associative array. - * - * @param map Array of objects to get the key-value pairs from - */ - entries(map: any): any[]; - /** - * merge multiple arrays into one array - * - * @param map Arrays to merge - */ - merge(...map: any[]): any[]; - /** - * Generate a range of numeric values. - */ - range: { - /** - * Generate a range of numeric values from 0. - * - * @param stop Value to generate the range to - * @param step Step between each value - */ - (stop: number, step?: number): number[]; - /** - * Generate a range of numeric values. - * - * @param start Value to start - * @param stop Value to generate the range to - * @param step Step between each value - */ - (start: number, stop?: number, step?: number): number[]; - }; - /** - * Create new nest operator - */ - nest(): Nest; - /** - * Request a resource using XMLHttpRequest. - */ - xhr: { - /** - * Creates an asynchronous request for specified url - * - * @param url Url to request - * @param callback Function to invoke when resource is loaded or the request fails - */ - (url: string, callback?: (xhr: XMLHttpRequest) => void ): Xhr; - /** - * Creates an asynchronous request for specified url - * - * @param url Url to request - * @param mime MIME type to request - * @param callback Function to invoke when resource is loaded or the request fails - */ - (url: string, mime: string, callback?: (xhr: XMLHttpRequest) => void ): Xhr; - }; - /** - * Request a text file - */ - text: { - /** - * Request a text file - * - * @param url Url to request - * @param callback Function to invoke when resource is loaded or the request fails - */ - (url: string, callback?: (response: string) => void ): Xhr; - /** - * Request a text file - * - * @param url Url to request - * @param mime MIME type to request - * @param callback Function to invoke when resource is loaded or the request fails - */ - (url: string, mime: string, callback?: (response: string) => void ): Xhr; - }; - /** - * Request a JSON blob - * - * @param url Url to request - * @param callback Function to invoke when resource is loaded or the request fails - */ - json: (url: string, callback?: (error: any, data: any) => void ) => Xhr; - /** - * Request an HTML document fragment. - */ - xml: { - /** - * Request an HTML document fragment. - * - * @param url Url to request - * @param callback Function to invoke when resource is loaded or the request fails - */ - (url: string, callback?: (response: Document) => void ): Xhr; - /** - * Request an HTML document fragment. - * - * @param url Url to request - * @param mime MIME type to request - * @param callback Function to invoke when resource is loaded or the request fails - */ - (url: string, mime: string, callback?: (response: Document) => void ): Xhr; - }; - /** - * Request an XML document fragment. - * - * @param url Url to request - * @param callback Function to invoke when resource is loaded or the request fails - */ - html: (url: string, callback?: (response: DocumentFragment) => void ) => Xhr; - /** - * Request a comma-separated values (CSV) file. - */ - csv: Dsv; - /** - * Request a tab-separated values (TSV) file - */ - tsv: Dsv; - /** - * Time Functions - */ - time: Time.Time; - /** - * Scales - */ - scale: Scale.ScaleBase; - /* - * Interpolate two values - */ - interpolate: Transition.BaseInterpolate; - /* - * Interpolate two numbers - */ - interpolateNumber: Transition.BaseInterpolate; - /* - * Interpolate two integers - */ - interpolateRound: Transition.BaseInterpolate; - /* - * Interpolate two strings - */ - interpolateString: Transition.BaseInterpolate; - /* - * Interpolate two RGB colors - */ - interpolateRgb: Transition.BaseInterpolate; - /* - * Interpolate two HSL colors - */ - interpolateHsl: Transition.BaseInterpolate; - /* - * Interpolate two HCL colors - */ - interpolateHcl: Transition.BaseInterpolate; - /* - * Interpolate two L*a*b* colors - */ - interpolateLab: Transition.BaseInterpolate; - /* - * Interpolate two arrays of values - */ - interpolateArray: Transition.BaseInterpolate; - /* - * Interpolate two arbitary objects - */ - interpolateObject: Transition.BaseInterpolate; - /* - * Interpolate two 2D matrix transforms - */ - interpolateTransform: Transition.BaseInterpolate; - /* - * The array of built-in interpolator factories - */ - interpolators: Transition.InterpolateFactory[]; - /** - * Layouts - */ - layout: Layout.Layout; - /** - * Svg's - */ - svg: Svg.Svg; - /** - * Random number generators - */ - random: Random; - /** - * Create a function to format a number as a string - * - * @param specifier The format specifier to use - */ - format(specifier: string): (value: number) => string; - /** - * Returns the SI prefix for the specified value at the specified precision - */ - formatPrefix(value: number, precision?: number): MetricPrefix; - /** - * The version of the d3 library - */ - version: string; - /** - * Returns the root selection - */ - selection(): Selection; - ns: { - /** - * The map of registered namespace prefixes - */ - prefix: { - svg: string; - xhtml: string; - xlink: string; - xml: string; - xmlns: string; - }; - /** - * Qualifies the specified name - */ - qualify(name: string): { space: string; local: string; }; - }; - /** - * Returns a built-in easing function of the specified type - */ - ease: (type: string, ...arrs: any[]) => D3.Transition.Transition; - /** - * Constructs a new RGB color. - */ - rgb: { - /** - * Constructs a new RGB color with the specified r, g and b channel values - */ - (r: number, g: number, b: number): D3.Color.RGBColor; - /** - * Constructs a new RGB color by parsing the specified color string - */ - (color: string): D3.Color.RGBColor; - }; - /** - * Constructs a new HCL color. - */ - hcl: { - /** - * Constructs a new HCL color. - */ - (h: number, c: number, l: number): Color.HCLColor; - /** - * Constructs a new HCL color by parsing the specified color string - */ - (color: string): Color.HCLColor; - }; - /** - * Constructs a new HSL color. - */ - hsl: { - /** - * Constructs a new HSL color with the specified hue h, saturation s and lightness l - */ - (h: number, s: number, l: number): Color.HSLColor; - /** - * Constructs a new HSL color by parsing the specified color string - */ - (color: string): Color.HSLColor; - }; - /** - * Constructs a new RGB color. - */ - lab: { - /** - * Constructs a new LAB color. - */ - (l: number, a: number, b: number): Color.LABColor; - /** - * Constructs a new LAB color by parsing the specified color string - */ - (color: string): Color.LABColor; - }; - geo: Geo.Geo; - geom: Geom.Geom; - /** - * gets the mouse position relative to a specified container. - */ - mouse(container: any): number[]; - /** - * gets the touch positions relative to a specified container. - */ - touches(container: any): number[][]; - - /** - * If the specified value is a function, returns the specified value. - * Otherwise, returns a function that returns the specified value. - */ - functor(value: (p : R) => T): (p : R) => T; - functor(value: T): (p : any) => T; - - map: { - (): Map; - (object: {[key: string]: T; }): Map; - (map: Map): Map; - (array: T[]): Map; - (array: T[], keyFn: (object: T, index?: number) => string): Map; - }; - set: { - (): Set; - (array: T[]): Set; - }; - dispatch(...types: string[]): Dispatch; - rebind(target: any, source: any, ...names: any[]): any; - requote(str: string): string; - timer: { - (funct: () => boolean, delay?: number, mark?: number): void; - flush(): void; - } - transition(): Transition.Transition; - - round(x: number, n: number): number; - } - - export interface Dispatch { - [event: string]: any; - on: { - (type: string): any; - (type: string, listener: any): any; - } - } - - export interface MetricPrefix { - /** - * the scale function, for converting numbers to the appropriate prefixed scale. - */ - scale: (d: number) => number; - /** - * the prefix symbol - */ - symbol: string; - } - - export interface Xhr { - /** - * Get or set request header - */ - header: { - /** - * Get the value of specified request header - * - * @param name Name of header to get the value for - */ - (name: string): string; - /** - * Set the value of specified request header - * - * @param name Name of header to set the value for - * @param value Value to set the header to - */ - (name: string, value: string): Xhr; - }; - /** - * Get or set MIME Type - */ - mimeType: { - /** - * Get the current MIME Type - */ - (): string; - /** - * Set the MIME Type for the request - * - * @param type The MIME type for the request - */ - (type: string): Xhr; - }; - /* - * Get or Set the function used to map the response to the associated data value - */ - response: { - /** - * Get function used to map the response to the associated data value - */ - (): (xhr: XMLHttpRequest) => any; - /** - * Set function used to map the response to the associated data value - * - * @param value The function used to map the response to a data value - */ - (value: (xhr: XMLHttpRequest) => any): Xhr; - }; - /** - * Issue the request using the GET method - * - * @param callback Function to invoke on completion of request - */ - get(callback?: (xhr: XMLHttpRequest) => void ): Xhr; - /** - * Issue the request using the POST method - */ - post: { - /** - * Issue the request using the POST method - * - * @param callback Function to invoke on completion of request - */ - (callback?: (xhr: XMLHttpRequest) => void ): Xhr; - /** - * Issue the request using the POST method - * - * @param data Data to post back in the request - * @param callback Function to invoke on completion of request - */ - (data: any, callback?: (xhr: XMLHttpRequest) => void ): Xhr; - }; - /** - * Issues this request using the specified method - */ - send: { - /** - * Issues this request using the specified method - * - * @param method Method to use to make the request - * @param callback Function to invoke on completion of request - */ - (method: string, callback?: (xhr: XMLHttpRequest) => void ): Xhr; - /** - * Issues this request using the specified method - * - * @param method Method to use to make the request - * @param data Data to post back in the request - * @param callback Function to invoke on completion of request - */ - (method: string, data: any, callback?: (xhr: XMLHttpRequest) => void ): Xhr; - }; - /** - * Aborts this request, if it is currently in-flight - */ - abort(): Xhr; - /** - * Registers a listener to receive events - * - * @param type Enent name to attach the listener to - * @param listener Function to attach to event - */ - on: (type: string, listener: (data: any, index?: number) => any) => Xhr; - } - - export interface Dsv { - /** - * Request a delimited values file - * - * @param url Url to request - * @param callback Function to invoke when resource is loaded or the request fails - */ - (url: string, callback?: (error: any, response: any[]) => void ): Xhr; - /** - * Parse a delimited string into objects using the header row. - * - * @param string delimited formatted string to parse - * @param accessor to modify properties of each row - */ - parse(string: string, accessor?: (row: any, index?: number) => any): any[]; - /** - * Parse a delimited string into tuples, ignoring the header row. - * - * @param string delimited formatted string to parse - */ - parseRows(string: string, accessor: (row: any[], index: number) => any): any; - /** - * Format an array of tuples into a delimited string. - * - * @param rows Array to convert to a delimited string - */ - format(rows: any[]): string; - } - - export interface Selection extends Selectors, Array { - attr: { - (name: string): string; - (name: string, value: any): Selection; - (name: string, valueFunction: (data: any, index: number) => any): Selection; - (attrValueMap : Object): Selection; - }; - - classed: { - (name: string): boolean; - (name: string, value: any): Selection; - (name: string, valueFunction: (data: any, index: number) => any): Selection; - (classValueMap: Object): Selection; - }; - - style: { - (name: string): string; - (name: string, value: any, priority?: string): Selection; - (name: string, valueFunction: (data: any, index: number) => any, priority?: string): Selection; - (styleValueMap : Object): Selection; - }; - - property: { - (name: string): void; - (name: string, value: any): Selection; - (name: string, valueFunction: (data: any, index: number) => any): Selection; - (propertyValueMap : Object): Selection; - }; - - text: { - (): string; - (value: any): Selection; - (valueFunction: (data: any, index: number) => any): Selection; - }; - - html: { - (): string; - (value: any): Selection; - (valueFunction: (data: any, index: number) => any): Selection; - }; - - append: (name: string) => Selection; - insert: (name: string, before: string) => Selection; - remove: () => Selection; - empty: () => boolean; - - data: { - (values: (data: any, index?: number) => any[], key?: (data: any, index?: number) => any): UpdateSelection; - (values: any[], key?: (data: any, index?: number) => any): UpdateSelection; - (): any[]; - }; - - datum: { - /** - * Sets the element's bound data to the return value of the specified function evaluated - * for each selected element. - * Unlike the D3.Selection.data method, this method does not compute a join (and thus - * does not compute enter and exit selections). - * @param values The function to be evaluated for each selected element, being passed the - * previous datum d and the current index i, with the this context as the current DOM - * element. The function is then used to set each element's data. A null value will - * delete the bound data. This operator has no effect on the index. - */ - (values: (data: any, index: number) => any): UpdateSelection; - /** - * Sets the element's bound data to the specified value on all selected elements. - * Unlike the D3.Selection.data method, this method does not compute a join (and thus - * does not compute enter and exit selections). - * @param values The same data to be given to all elements. - */ - (values: any): UpdateSelection; - /** - * Returns the bound datum for the first non-null element in the selection. - * This is generally useful only if you know the selection contains exactly one element. - */ - (): any; - /** - * Returns the bound datum for the first non-null element in the selection. - * This is generally useful only if you know the selection contains exactly one element. - */ - (): T; - }; - - filter: { - (filter: (data: any, index: number) => boolean, thisArg?: any): UpdateSelection; - (filter: string): UpdateSelection; - }; - - call(callback: (selection: Selection, ...args: any[]) => void, ...args: any[]): Selection; - each(eachFunction: (data: any, index: number) => any): Selection; - on: { - (type: string): (data: any, index: number) => any; - (type: string, listener: (data: any, index: number) => any, capture?: boolean): Selection; - }; - - /** - * Returns the total number of elements in the current selection. - */ - size(): number; - - /** - * Starts a transition for the current selection. Transitions behave much like selections, - * except operators animate smoothly over time rather than applying instantaneously. - */ - transition(): Transition.Transition; - - /** - * Sorts the elements in the current selection according to the specified comparator - * function. - * - * @param comparator a comparison function, which will be passed two data elements a and b - * to compare, and should return either a negative, positive, or zero value to indicate - * their relative order. - */ - sort(comparator?: (a: T, b: T) => number): Selection; - - /** - * Re-inserts elements into the document such that the document order matches the selection - * order. This is equivalent to calling sort() if the data is already sorted, but much - * faster. - */ - order: () => Selection; - - /** - * Returns the first non-null element in the current selection. If the selection is empty, - * returns null. - */ - node: () => T; - } - - export interface EnterSelection { - append: (name: string) => Selection; - insert: (name: string, before?: string) => Selection; - select: (selector: string) => Selection; - empty: () => boolean; - node: () => Element; - call: (callback: (selection: EnterSelection) => void) => EnterSelection; - size: () => number; - } - - export interface UpdateSelection extends Selection { - enter: () => EnterSelection; - update: () => Selection; - exit: () => Selection; - } - - export interface NestKeyValue { - key: string; - values: any; - } - - export interface Nest { - key(keyFunction: (data: any, index: number) => string): Nest; - sortKeys(comparator: (d1: any, d2: any) => number): Nest; - sortValues(comparator: (d1: any, d2: any) => number): Nest; - rollup(rollupFunction: (data: any, index: number) => any): Nest; - map(values: any[], mapType?: any): any; - entries(values: any[]): NestKeyValue[]; - } - - export interface MapKeyValue { - key: string; - value: T; - } - - export interface Map { - has(key: string): boolean; - get(key: string): T; - set(key: string, value: T): T; - remove(key: string): boolean; - keys(): string[]; - values(): T[]; - entries(): MapKeyValue[]; - forEach(func: (key: string, value: T) => void ): void; - empty(): boolean; - size(): number; - } - - export interface Set { - has(value: T): boolean; - add(value: T): T; - remove(value: T): boolean; - values(): string[]; - forEach(func: (value: string) => void ): void; - empty(): boolean; - size(): number; - } - - export interface Random { - /** - * Returns a function for generating random numbers with a normal distribution - * - * @param mean The expected value of the generated pseudorandom numbers - * @param deviation The given standard deviation - */ - normal(mean?: number, deviation?: number): () => number; - /** - * Returns a function for generating random numbers with a log-normal distribution - * - * @param mean The expected value of the generated pseudorandom numbers - * @param deviation The given standard deviation - */ - logNormal(mean?: number, deviation?: number): () => number; - /** - * Returns a function for generating random numbers with an Irwin-Hall distribution - * - * @param count The number of independent variables - */ - irwinHall(count: number): () => number; - } - - // Transitions - export module Transition { - export interface Transition { - duration: { - (duration: number): Transition; - (duration: (data: any, index: number) => any): Transition; - }; - delay: { - (delay: number): Transition; - (delay: (data: any, index: number) => any): Transition; - }; - attr: { - (name: string): string; - (name: string, value: any): Transition; - (name: string, valueFunction: (data: any, index: number) => any): Transition; - (attrValueMap : any): Transition; - }; - style: { - (name: string): string; - (name: string, value: any, priority?: string): Transition; - (name: string, valueFunction: (data: any, index: number) => any, priority?: string): Transition; - }; - call(callback: (transition: Transition, ...args: any[]) => void, ...args: any[]): Transition; - /** - * Select an element from the current document - */ - select: { - /** - * Selects the first element that matches the specified selector string - * - * @param selector Selection String to match - */ - (selector: string): Transition; - /** - * Selects the specified node - * - * @param element Node element to select - */ - (element: EventTarget): Transition; - }; - - /** - * Select multiple elements from the current document - */ - selectAll: { - /** - * Selects all elements that match the specified selector - * - * @param selector Selection String to match - */ - (selector: string): Transition; - /** - * Selects the specified array of elements - * - * @param elements Array of node elements to select - */ - (elements: EventTarget[]): Transition; - } - each: { - /** - * Immediately invokes the specified function for each element in the current - * transition, passing in the current datum and index, with the this context - * of the current DOM element. Similar to D3.Selection.each. - * - * @param eachFunction The function to be invoked for each element in the - * current transition, passing in the current datum and index, with the this - * context of the current DOM element. - */ - (eachFunction: (data: any, index: number) => any): Transition; - /** - * Adds a listener for transition events, supporting "start", "end" and - * "interrupt" events. The listener will be invoked for each individual - * element in the transition. - * - * @param type Type of transition event. Supported values are "start", "end" - * and "interrupt". - * @param listener The listener to be invoked for each individual element in - * the transition. - */ - (type: string, listener: (data: any, index: number) => any): Transition; - } - transition: () => Transition; - ease: (value: string, ...arrs: any[]) => Transition; - attrTween(name: string, tween: (d: any, i: number, a: any) => BaseInterpolate): Transition; - styleTween(name: string, tween: (d: any, i: number, a: any) => BaseInterpolate, priority?: string): Transition; - text: { - (text: string): Transition; - (text: (d: any, i: number) => string): Transition; - } - tween(name: string, factory: InterpolateFactory): Transition; - filter: { - (selector: string): Transition; - (selector: (data: any, index: number) => boolean): Transition; - }; - remove(): Transition; - } - - export interface InterpolateFactory { - (a?: any, b?: any): BaseInterpolate; - } - - export interface BaseInterpolate { - (a: any, b?: any): any; - } - - export interface Interpolate { - (t: any): any; - } - } - - //Time - export module Time { - export interface Time { - second: Interval; - minute: Interval; - hour: Interval; - day: Interval; - week: Interval; - sunday: Interval; - monday: Interval; - tuesday: Interval; - wednesday: Interval; - thursday: Interval; - friday: Interval; - saturday: Interval; - month: Interval; - year: Interval; - - seconds: Range; - minutes: Range; - hours: Range; - days: Range; - weeks: Range; - months: Range; - years: Range; - - sundays: Range; - mondays: Range; - tuesdays: Range; - wednesdays: Range; - thursdays: Range; - fridays: Range; - saturdays: Range; - format: { - /** - * Constructs a new local time formatter using the given specifier. - */ - (specifier: string): TimeFormat; - /** - * Returns a new multi-resolution time format given the specified array of predicated formats. - */ - multi: (formats: any[][]) => TimeFormat; - - utc: { - /** - * Constructs a new local time formatter using the given specifier. - */ - (specifier: string): TimeFormat; - /** - * Returns a new multi-resolution UTC time format given the specified array of predicated formats. - */ - multi: (formats: any[][]) => TimeFormat; - }; - - /** - * The full ISO 8601 UTC time format: "%Y-%m-%dT%H:%M:%S.%LZ". - */ - iso: TimeFormat; - }; - - scale: { - /** - * Constructs a new time scale with the default domain and range; - * the ticks and tick format are configured for local time. - */ - (): Scale.TimeScale; - /** - * Constructs a new time scale with the default domain and range; - * the ticks and tick format are configured for UTC time. - */ - utc(): Scale.TimeScale; - }; - } - - export interface Range { - (start: Date, end: Date, step?: number): Date[]; - } - - export interface Interval { - (date: Date): Date; - floor: (date: Date) => Date; - round: (date: Date) => Date; - ceil: (date: Date) => Date; - range: Range; - offset: (date: Date, step: number) => Date; - utc?: Interval; - } - - export interface TimeFormat { - (date: Date): string; - parse: (string: string) => Date; - } - } - - // Layout - export module Layout { - export interface Layout { - /** - * Creates a new Stack layout - */ - stack(): StackLayout; - /** - * Creates a new pie layout - */ - pie(): PieLayout; - /** - * Creates a new force layout - */ - force(): ForceLayout; - /** - * Creates a new tree layout - */ - tree(): TreeLayout; - bundle(): BundleLayout; - chord(): ChordLayout; - cluster(): ClusterLayout; - hierarchy(): HierarchyLayout; - histogram(): HistogramLayout; - pack(): PackLayout; - partition(): PartitionLayout; - treemap(): TreeMapLayout; - } - - export interface StackLayout { - (layers: T[], index?: number): T[]; - values(accessor?: (d: any) => any): StackLayout; - offset(offset: string): StackLayout; - x(accessor: (d: any, i: number) => any): StackLayout; - y(accessor: (d: any, i: number) => any): StackLayout; - out(setter: (d: any, y0: number, y: number) => void): StackLayout; - } - - export interface TreeLayout { - /** - * Gets or sets the sort order of sibling nodes for the layout using the specified comparator function - */ - sort: { - /** - * Gets the sort order function of sibling nodes for the layout - */ - (): (d1: any, d2: any) => number; - /** - * Sets the sort order of sibling nodes for the layout using the specified comparator function - */ - (comparator: (d1: any, d2: any) => number): TreeLayout; - }; - /** - * Gets or sets the specified children accessor function - */ - children: { - /** - * Gets the children accessor function - */ - (): (d: any) => any; - /** - * Sets the specified children accessor function - */ - (children: (d: any) => any): TreeLayout; - }; - /** - * Runs the tree layout - */ - nodes(root: GraphNode): GraphNode[]; - /** - * Given the specified array of nodes, such as those returned by nodes, returns an array of objects representing the links from parent to child for each node - */ - links(nodes: GraphNode[]): GraphLink[]; - /** - * If separation is specified, uses the specified function to compute separation between neighboring nodes. If separation is not specified, returns the current separation function - */ - separation: { - /** - * Gets the current separation function - */ - (): (a: GraphNode, b: GraphNode) => number; - /** - * Sets the specified function to compute separation between neighboring nodes - */ - (separation: (a: GraphNode, b: GraphNode) => number): TreeLayout; - }; - /** - * Gets or sets the available layout size - */ - size: { - /** - * Gets the available layout size - */ - (): number[]; - /** - * Sets the available layout size - */ - (size: number[]): TreeLayout; - }; - /** - * Gets or sets the available node size - */ - nodeSize: { - /** - * Gets the available node size - */ - (): number[]; - /** - * Sets the available node size - */ - (size: number[]): TreeLayout; - }; - } - - export interface PieLayout { - (values: any[], index?: number): ArcDescriptor[]; - value: { - (): (d: any, index: number) => number; - (accessor: (d: any, index: number) => number): PieLayout; - }; - sort: { - (): (d1: any, d2: any) => number; - (comparator: (d1: any, d2: any) => number): PieLayout; - }; - startAngle: { - (): number; - (angle: number): PieLayout; - (angle: () => number): PieLayout; - (angle: (d : any) => number): PieLayout; - (angle: (d : any, i: number) => number): PieLayout; - }; - endAngle: { - (): number; - (angle: number): PieLayout; - (angle: () => number): PieLayout; - (angle: (d : any) => number): PieLayout - (angle: (d : any, i: number) => number): PieLayout; - }; - } - - export interface ArcDescriptor { - value: any; - data: any; - startAngle: number; - endAngle: number; - index: number; - } - - export interface GraphNode { - id?: number; - index?: number; - name?: string; - px?: number; - py?: number; - size?: number; - weight?: number; - x?: number; - y?: number; - subindex?: number; - startAngle?: number; - endAngle?: number; - value?: number; - fixed?: boolean; - children?: GraphNode[]; - _children?: GraphNode[]; - parent?: GraphNode; - depth?: number; - } - - export interface GraphLink { - source: GraphNode; - target: GraphNode; - } - - export interface GraphNodeForce { - index?: number; - x?: number; - y?: number; - px?: number; - py?: number; - fixed?: boolean; - weight?: number; - } - - export interface GraphLinkForce { - source: GraphNodeForce; - target: GraphNodeForce; - } - - export interface ForceLayout { - (): ForceLayout; - size: { - (): number[]; - (mysize: number[]): ForceLayout; - }; - linkDistance: { - (): number; - (number:number): ForceLayout; - (accessor: (d: any, index: number) => number): ForceLayout; - }; - linkStrength: - { - (): number; - (number:number): ForceLayout; - (accessor: (d: any, index: number) => number): ForceLayout; - }; - friction: - { - (): number; - (number:number): ForceLayout; - (accessor: (d: any, index: number) => number): ForceLayout; - }; - alpha: { - (): number; - (number:number): ForceLayout; - (accessor: (d: any, index: number) => number): ForceLayout; - }; - charge: { - (): number; - (number:number): ForceLayout; - (accessor: (d: any, index: number) => number): ForceLayout; - }; - - theta: { - (): number; - (number:number): ForceLayout; - (accessor: (d: any, index: number) => number): ForceLayout; - }; - - gravity: { - (): number; - (number:number): ForceLayout; - (accessor: (d: any, index: number) => number): ForceLayout; - }; - - links: { - (): GraphLinkForce[]; - (arLinks: GraphLinkForce[]): ForceLayout; - - }; - nodes: - { - (): GraphNodeForce[]; - (arNodes: GraphNodeForce[]): ForceLayout; - - }; - start(): ForceLayout; - resume(): ForceLayout; - stop(): ForceLayout; - tick(): ForceLayout; - on(type: string, listener: () => void ): ForceLayout; - drag(): ForceLayout; - } - - export interface BundleLayout{ - (links: GraphLink[]): GraphNode[][]; - } - - export interface ChordLayout { - matrix: { - (): number[][]; - (matrix: number[][]): ChordLayout; - } - padding: { - (): number; - (padding: number): ChordLayout; - } - sortGroups: { - (): (a: number, b: number) => number; - (comparator: (a: number, b: number) => number): ChordLayout; - } - sortSubgroups: { - (): (a: number, b: number) => number; - (comparator: (a: number, b: number) => number): ChordLayout; - } - sortChords: { - (): (a: number, b: number) => number; - (comparator: (a: number, b: number) => number): ChordLayout; - } - chords(): GraphLink[]; - groups(): ArcDescriptor[]; - } - - export interface ClusterLayout{ - sort: { - (): (a: GraphNode, b: GraphNode) => number; - (comparator: (a: GraphNode, b: GraphNode) => number): ClusterLayout; - } - children: { - (): (d: any, i?: number) => GraphNode[]; - (children: (d: any, i?: number) => GraphNode[]): ClusterLayout; - } - nodes(root: GraphNode): GraphNode[]; - links(nodes: GraphNode[]): GraphLink[]; - separation: { - (): (a: GraphNode, b: GraphNode) => number; - (separation: (a: GraphNode, b: GraphNode) => number): ClusterLayout; - } - size: { - (): number[]; - (size: number[]): ClusterLayout; - } - value: { - (): (node: GraphNode) => number; - (value: (node: GraphNode) => number): ClusterLayout; - } - } - - export interface HierarchyLayout { - sort: { - (): (a: GraphNode, b: GraphNode) => number; - (comparator: (a: GraphNode, b: GraphNode) => number): HierarchyLayout; - } - children: { - (): (d: any, i?: number) => GraphNode[]; - (children: (d: any, i?: number) => GraphNode[]): HierarchyLayout; - } - nodes(root: GraphNode): GraphNode[]; - links(nodes: GraphNode[]): GraphLink[]; - value: { - (): (node: GraphNode) => number; - (value: (node: GraphNode) => number): HierarchyLayout; - } - reValue(root: GraphNode): HierarchyLayout; - } - - export interface Bin extends Array { - x: number; - dx: number; - y: number; - } - - export interface HistogramLayout { - (values: any[], index?: number): Bin[]; - value: { - (): (value: any) => any; - (accessor: (value: any) => any): HistogramLayout - } - range: { - (): (value: any, index: number) => number[]; - (range: (value: any, index: number) => number[]): HistogramLayout; - (range: number[]): HistogramLayout; - } - bins: { - (): (range: any[], index: number) => number[]; - (bins: (range: any[], index: number) => number[]): HistogramLayout; - (bins: number): HistogramLayout; - (bins: number[]): HistogramLayout; - } - frequency: { - (): boolean; - (frequency: boolean): HistogramLayout; - } - } - - export interface PackLayout { - sort: { - (): (a: GraphNode, b: GraphNode) => number; - (comparator: (a: GraphNode, b: GraphNode) => number): PackLayout; - } - children: { - (): (d: any, i?: number) => GraphNode[]; - (children: (d: any, i?: number) => GraphNode[]): PackLayout; - } - nodes(root: GraphNode): GraphNode[]; - links(nodes: GraphNode[]): GraphLink[]; - value: { - (): (node: GraphNode) => number; - (value: (node: GraphNode) => number): PackLayout; - } - size: { - (): number[]; - (size: number[]): PackLayout; - } - padding: { - (): number; - (padding: number): PackLayout; - } - } - - export interface PartitionLayout { - sort: { - (): (a: GraphNode, b: GraphNode) => number; - (comparator: (a: GraphNode, b: GraphNode) => number): PackLayout; - } - children: { - (): (d: any, i?: number) => GraphNode[]; - (children: (d: any, i?: number) => GraphNode[]): PackLayout; - } - nodes(root: GraphNode): GraphNode[]; - links(nodes: GraphNode[]): GraphLink[]; - value: { - (): (node: GraphNode) => number; - (value: (node: GraphNode) => number): PackLayout; - } - size: { - (): number[]; - (size: number[]): PackLayout; - } - } - - export interface TreeMapLayout { - sort: { - (): (a: GraphNode, b: GraphNode) => number; - (comparator: (a: GraphNode, b: GraphNode) => number): TreeMapLayout; - } - children: { - (): (d: any, i?: number) => GraphNode[]; - (children: (d: any, i?: number) => GraphNode[]): TreeMapLayout; - } - nodes(root: GraphNode): GraphNode[]; - links(nodes: GraphNode[]): GraphLink[]; - value: { - (): (node: GraphNode) => number; - (value: (node: GraphNode) => number): TreeMapLayout; - } - size: { - (): number[]; - (size: number[]): TreeMapLayout; - } - padding: { - (): number; - (padding: number): TreeMapLayout; - } - round: { - (): boolean; - (round: boolean): TreeMapLayout; - } - sticky: { - (): boolean; - (sticky: boolean): TreeMapLayout; - } - mode: { - (): string; - (mode: string): TreeMapLayout; - } - } - } - - // Color - export module Color { - export interface Color { - /** - * increase lightness by some exponential factor (gamma) - */ - brighter(k?: number): Color; - /** - * decrease lightness by some exponential factor (gamma) - */ - darker(k?: number): Color; - /** - * convert the color to a string. - */ - toString(): string; - } - - export interface RGBColor extends Color{ - /** - * the red color channel. - */ - r: number; - /** - * the green color channel. - */ - g: number; - /** - * the blue color channel. - */ - b: number; - /** - * convert from RGB to HSL. - */ - hsl(): HSLColor; - } - - export interface HSLColor extends Color{ - /** - * hue - */ - h: number; - /** - * saturation - */ - s: number; - /** - * lightness - */ - l: number; - /** - * convert from HSL to RGB. - */ - rgb(): RGBColor; - } - - export interface LABColor extends Color{ - /** - * lightness - */ - l: number; - /** - * a-dimension - */ - a: number; - /** - * b-dimension - */ - b: number; - /** - * convert from LAB to RGB. - */ - rgb(): RGBColor; - } - - export interface HCLColor extends Color{ - /** - * hue - */ - h: number; - /** - * chroma - */ - c: number; - /** - * luminance - */ - l: number; - /** - * convert from HCL to RGB. - */ - rgb(): RGBColor; - } - } - - // SVG - export module Svg { - export interface Svg { - /** - * Create a new symbol generator - */ - symbol(): Symbol; - /** - * Create a new axis generator - */ - axis(): Axis; - /** - * Create a new arc generator - */ - arc(): Arc; - /** - * Create a new line generator - */ - line: { - (): Line; - radial(): LineRadial; - } - /** - * Create a new area generator - */ - area: { - (): Area; - radial(): AreaRadial; - } - /** - * Create a new brush generator - */ - brush(): Brush; - /** - * Create a new chord generator - */ - chord(): Chord; - /** - * Create a new diagonal generator - */ - diagonal: { - (): Diagonal; - radial(): Diagonal; - } - /** - * The array of supported symbol types. - */ - symbolTypes: string[]; - } - - export interface Symbol { - type: (symbolType: string | ((datum: any, index: number) => string)) => Symbol; - size: (size: number | ((datum: any, index: number) => number)) => Symbol; - (datum:any, index:number): string; - } - - export interface Brush { - /** - * Draws or redraws this brush into the specified selection of elements - */ - (selection: Selection): void; - /** - * Gets or sets the x-scale associated with the brush - */ - x: { - /** - * Gets the x-scale associated with the brush - */ - (): D3.Scale.Scale; - /** - * Sets the x-scale associated with the brush - * - * @param accessor The new Scale - */ - (scale: D3.Scale.Scale): Brush; - }; - /** - * Gets or sets the x-scale associated with the brush - */ - y: { - /** - * Gets the x-scale associated with the brush - */ - (): D3.Scale.Scale; - /** - * Sets the x-scale associated with the brush - * - * @param accessor The new Scale - */ - (scale: D3.Scale.Scale): Brush; - }; - /** - * Gets or sets the current brush extent - */ - extent: { - /** - * Gets the current brush extent - */ - (): any[]; - /** - * Sets the current brush extent - */ - (values: any[]): Brush; - }; - /** - * Clears the extent, making the brush extent empty. - */ - clear(): Brush; - /** - * Returns true if and only if the brush extent is empty - */ - empty(): boolean; - /** - * Gets or sets the listener for the specified event type - */ - on: { - /** - * Gets the listener for the specified event type - */ - (type: string): (data: any, index: number) => any; - /** - * Sets the listener for the specified event type - */ - (type: string, listener: (data: any, index: number) => any, capture?: boolean): Brush; - }; - } - - export interface Axis { - (selection: Selection): void; - (transition: Transition.Transition): void; - - scale: { - (): any; - (scale: any): Axis; - }; - - orient: { - (): string; - (orientation: string): Axis; - }; - - ticks: { - (): any[]; - (...arguments: any[]): Axis; - }; - - tickPadding: { - (): number; - (padding: number): Axis; - }; - - tickValues: { - (): any[]; - (values: any[]): Axis; - }; - tickSubdivide(count: number): Axis; - tickSize: { - (): number; - (inner: number, outer?: number): Axis; - } - innerTickSize: { - (): number; - (value: number): Axis; - } - outerTickSize: { - (): number; - (value: number): Axis; - } - tickFormat(formatter: (value: any, index?: number) => string): Axis; - nice(count?: number): Axis; - } - - export interface Arc { - /** - * Returns the path data string - * - * @param data Array of data elements - * @param index Optional index - */ - (data: any, index?: number): string; - innerRadius: { - (): (data: any, index?: number) => number; - (radius: number): Arc; - (radius: () => number): Arc; - (radius: (data: any) => number): Arc; - (radius: (data: any, index: number) => number): Arc; - }; - outerRadius: { - (): (data: any, index?: number) => number; - (radius: number): Arc; - (radius: () => number): Arc; - (radius: (data: any) => number): Arc; - (radius: (data: any, index: number) => number): Arc; - }; - startAngle: { - (): (data: any, index?: number) => number; - (angle: number): Arc; - (angle: () => number): Arc; - (angle: (data: any) => number): Arc; - (angle: (data: any, index: number) => number): Arc; - }; - endAngle: { - (): (data: any, index?: number) => number; - (angle: number): Arc; - (angle: () => number): Arc; - (angle: (data: any) => number): Arc; - (angle: (data: any, index: number) => number): Arc; - }; - centroid(data: any, index?: number): number[]; - } - - export interface Line { - /** - * Returns the path data string - * - * @param data Array of data elements - * @param index Optional index - */ - (data: any[], index?: number): string; - /** - * Get or set the x-coordinate accessor. - */ - x: { - /** - * Get the x-coordinate accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the x-coordinate accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): Line; - (accessor: (data: any, index: number) => number): Line; - /** - * Set the x-coordinate to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): Line; - }; - /** - * Get or set the y-coordinate accessor. - */ - y: { - /** - * Get the y-coordinate accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the y-coordinate accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): Line; - (accessor: (data: any, index: number) => number): Line; - /** - * Set the y-coordinate to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): Line; - }; - /** - * Get or set the interpolation mode. - */ - interpolate: { - /** - * Get the interpolation accessor. - */ - (): string; - /** - * Set the interpolation accessor. - * - * @param interpolate The interpolation mode - */ - (interpolate: string): Line; - }; - /** - * Get or set the cardinal spline tension. - */ - tension: { - /** - * Get the cardinal spline accessor. - */ - (): number; - /** - * Set the cardinal spline accessor. - * - * @param tension The Cardinal spline interpolation tension - */ - (tension: number): Line; - }; - /** - * Control whether the line is defined at a given point. - */ - defined: { - /** - * Get the accessor function that controls where the line is defined. - */ - (): (data: any, index?: number) => boolean; - /** - * Set the accessor function that controls where the area is defined. - * - * @param defined The new accessor function - */ - (defined: (data: any, index?: number) => boolean): Line; - }; - } - - export interface LineRadial { - /** - * Returns the path data string - * - * @param data Array of data elements - * @param index Optional index - */ - (data: any[], index?: number): string; - /** - * Get or set the x-coordinate accessor. - */ - x: { - /** - * Get the x-coordinate accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the x-coordinate accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): LineRadial; - (accessor: (data: any, index: number) => number): LineRadial; - - /** - * Set the x-coordinate to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): LineRadial; - }; - /** - * Get or set the y-coordinate accessor. - */ - y: { - /** - * Get the y-coordinate accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the y-coordinate accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): LineRadial; - (accessor: (data: any, index: number) => number): LineRadial; - /** - * Set the y-coordinate to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): LineRadial; - }; - /** - * Get or set the interpolation mode. - */ - interpolate: { - /** - * Get the interpolation accessor. - */ - (): string; - /** - * Set the interpolation accessor. - * - * @param interpolate The interpolation mode - */ - (interpolate: string): LineRadial; - }; - /** - * Get or set the cardinal spline tension. - */ - tension: { - /** - * Get the cardinal spline accessor. - */ - (): number; - /** - * Set the cardinal spline accessor. - * - * @param tension The Cardinal spline interpolation tension - */ - (tension: number): LineRadial; - }; - /** - * Control whether the line is defined at a given point. - */ - defined: { - /** - * Get the accessor function that controls where the line is defined. - */ - (): (data: any) => any; - /** - * Set the accessor function that controls where the area is defined. - * - * @param defined The new accessor function - */ - (defined: (data: any) => any): LineRadial; - }; - radius: { - (): (d: any, i?: number) => number; - (radius: number): LineRadial; - (radius: (d: any) => number): LineRadial; - (radius: (d: any, i: number) => number): LineRadial; - } - angle: { - (): (d: any, i?: any) => number; - (angle: number): LineRadial; - (angle: (d: any) => number): LineRadial; - (angle: (d: any, i: any) => number): LineRadial; - } - } - - export interface Area { - /** - * Generate a piecewise linear area, as in an area chart. - */ - (data: any[], index?: number): string; - /** - * Get or set the x-coordinate accessor. - */ - x: { - /** - * Get the x-coordinate accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the x-coordinate accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): Area; - (accessor: (data: any, index: number) => number): Area; - /** - * Set the x-coordinate to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): Area; - }; - /** - * Get or set the x0-coordinate (baseline) accessor. - */ - x0: { - /** - * Get the x0-coordinate (baseline) accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the x0-coordinate (baseline) accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): Area; - (accessor: (data: any, index: number) => number): Area; - /** - * Set the x0-coordinate (baseline) to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): Area; - }; - /** - * Get or set the x1-coordinate (topline) accessor. - */ - x1: { - /** - * Get the x1-coordinate (topline) accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the x1-coordinate (topline) accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): Area; - (accessor: (data: any, index: number) => number): Area; - /** - * Set the x1-coordinate (topline) to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): Area; - }; - /** - * Get or set the y-coordinate accessor. - */ - y: { - /** - * Get the y-coordinate accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the y-coordinate accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): Area; - (accessor: (data: any, index: number) => number): Area; - /** - * Set the y-coordinate to a constant. - * - * @param cnst The constant value - */ - (cnst: number): Area; - }; - /** - * Get or set the y0-coordinate (baseline) accessor. - */ - y0: { - /** - * Get the y0-coordinate (baseline) accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the y0-coordinate (baseline) accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): Area; - (accessor: (data: any, index: number) => number): Area; - /** - * Set the y0-coordinate (baseline) to a constant. - * - * @param cnst The constant value - */ - (cnst: number): Area; - }; - /** - * Get or set the y1-coordinate (topline) accessor. - */ - y1: { - /** - * Get the y1-coordinate (topline) accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the y1-coordinate (topline) accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): Area; - (accessor: (data: any, index: number) => number): Area; - /** - * Set the y1-coordinate (baseline) to a constant. - * - * @param cnst The constant value - */ - (cnst: number): Area; - }; - /** - * Get or set the interpolation mode. - */ - interpolate: { - /** - * Get the interpolation accessor. - */ - (): string; - /** - * Set the interpolation accessor. - * - * @param interpolate The interpolation mode - */ - (interpolate: string): Area; - }; - /** - * Get or set the cardinal spline tension. - */ - tension: { - /** - * Get the cardinal spline accessor. - */ - (): number; - /** - * Set the cardinal spline accessor. - * - * @param tension The Cardinal spline interpolation tension - */ - (tension: number): Area; - }; - /** - * Control whether the area is defined at a given point. - */ - defined: { - /** - * Get the accessor function that controls where the area is defined. - */ - (): (data: any, index?: number) => any; - /** - * Set the accessor function that controls where the area is defined. - * - * @param defined The new accessor function - */ - (defined: (data: any, index?: number) => any): Area; - }; - } - - export interface AreaRadial { - /** - * Generate a piecewise linear area, as in an area chart. - */ - (data: any[], index?: number): string; - /** - * Get or set the x-coordinate accessor. - */ - x: { - /** - * Get the x-coordinate accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the x-coordinate accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): AreaRadial; - (accessor: (data: any, index: number) => number): AreaRadial; - /** - * Set the x-coordinate to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): AreaRadial; - }; - /** - * Get or set the x0-coordinate (baseline) accessor. - */ - x0: { - /** - * Get the x0-coordinate (baseline) accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the x0-coordinate (baseline) accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): AreaRadial; - (accessor: (data: any, index: number) => number): AreaRadial; - /** - * Set the x0-coordinate to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): AreaRadial; - }; - /** - * Get or set the x1-coordinate (topline) accessor. - */ - x1: { - /** - * Get the x1-coordinate (topline) accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the x1-coordinate (topline) accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): AreaRadial; - (accessor: (data: any, index: number) => number): AreaRadial; - /** - * Set the x1-coordinate to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): AreaRadial; - }; - /** - * Get or set the y-coordinate accessor. - */ - y: { - /** - * Get the y-coordinate accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the y-coordinate accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): AreaRadial; - (accessor: (data: any, index: number) => number): AreaRadial; - /** - * Set the y-coordinate to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): AreaRadial; - }; - /** - * Get or set the y0-coordinate (baseline) accessor. - */ - y0: { - /** - * Get the y0-coordinate (baseline) accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the y0-coordinate (baseline) accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): AreaRadial; - (accessor: (data: any, index: number) => number): AreaRadial; - /** - * Set the y0-coordinate to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): AreaRadial; - }; - /** - * Get or set the y1-coordinate (topline) accessor. - */ - y1: { - /** - * Get the y1-coordinate (topline) accessor. - */ - (): (data: any, index ?: number) => number; - /** - * Set the y1-coordinate (topline) accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: any) => number): AreaRadial; - (accessor: (data: any, index: number) => number): AreaRadial; - /** - * Set the y1-coordinate to a constant. - * - * @param cnst The new constant value. - */ - (cnst: number): AreaRadial; - }; - /** - * Get or set the interpolation mode. - */ - interpolate: { - /** - * Get the interpolation accessor. - */ - (): string; - /** - * Set the interpolation accessor. - * - * @param interpolate The interpolation mode - */ - (interpolate: string): AreaRadial; - }; - /** - * Get or set the cardinal spline tension. - */ - tension: { - /** - * Get the cardinal spline accessor. - */ - (): number; - /** - * Set the cardinal spline accessor. - * - * @param tension The Cardinal spline interpolation tension - */ - (tension: number): AreaRadial; - }; - /** - * Control whether the area is defined at a given point. - */ - defined: { - /** - * Get the accessor function that controls where the area is defined. - */ - (): (data: any) => any; - /** - * Set the accessor function that controls where the area is defined. - * - * @param defined The new accessor function - */ - (defined: (data: any) => any): AreaRadial; - }; - radius: { - (): number; - (radius: number): AreaRadial; - (radius: () => number): AreaRadial; - (radius: (data: any) => number): AreaRadial; - (radius: (data: any, index: number) => number): AreaRadial; - }; - innerRadius: { - (): number; - (radius: number): AreaRadial; - (radius: () => number): AreaRadial; - (radius: (data: any) => number): AreaRadial; - (radius: (data: any, index: number) => number): AreaRadial; - }; - outerRadius: { - (): number; - (radius: number): AreaRadial; - (radius: () => number): AreaRadial; - (radius: (data: any) => number): AreaRadial; - (radius: (data: any, index: number) => number): AreaRadial; - }; - angle: { - (): number; - (angle: number): AreaRadial; - (angle: () => number): AreaRadial; - (angle: (data: any) => number): AreaRadial; - (angle: (data: any, index: number) => number): AreaRadial; - }; - startAngle: { - (): number; - (angle: number): AreaRadial; - (angle: () => number): AreaRadial; - (angle: (data: any) => number): AreaRadial; - (angle: (data: any, index: number) => number): AreaRadial; - }; - endAngle: { - (): number; - (angle: number): AreaRadial; - (angle: () => number): AreaRadial; - (angle: (data: any) => number): AreaRadial; - (angle: (data: any, index: number) => number): AreaRadial; - }; - } - - export interface Chord { - (datum: any, index?: number): string; - radius: { - (): number; - (radius: number): Chord; - (radius: () => number): Chord; - }; - startAngle: { - (): number; - (angle: number): Chord; - (angle: () => number): Chord; - }; - endAngle: { - (): number; - (angle: number): Chord; - (angle: () => number): Chord; - }; - source: { - (): any; - (angle: any): Chord; - (angle: (d: any, i?: number) => any): Chord; - }; - target: { - (): any; - (angle: any): Chord; - (angle: (d: any, i?: number) => any): Chord; - }; - } - - export interface Diagonal { - (datum: any, index?: number): string; - projection: { - (): (datum: any, index?: number) => number[]; - (proj: (datum: any) => number[]): Diagonal; - (proj: (datum: any, index: number) => number[]): Diagonal; - }; - source: { - (): (datum: any, index?: number) => any; - (src: (datum: any) => any): Diagonal; - (src: (datum: any, index: number) => any): Diagonal; - (src: any): Diagonal; - }; - target: { - (): (datum: any, index?: number) => any; - (target: (d: any) => any): Diagonal; - (target: (d: any, i: number) => any): Diagonal; - (target: any): Diagonal; - }; - } - } - - // Scales - export module Scale { - export interface ScaleBase { - /** - * Construct a linear quantitative scale. - */ - linear(): LinearScale; - /* - * Construct an ordinal scale. - */ - ordinal(): OrdinalScale; - /** - * Construct a linear quantitative scale with a discrete output range. - */ - quantize(): QuantizeScale; - /* - * Construct an ordinal scale with ten categorical colors. - */ - category10(): OrdinalScale; - /* - * Construct an ordinal scale with twenty categorical colors - */ - category20(): OrdinalScale; - /* - * Construct an ordinal scale with twenty categorical colors - */ - category20b(): OrdinalScale; - /* - * Construct an ordinal scale with twenty categorical colors - */ - category20c(): OrdinalScale; - /* - * Construct a linear identity scale. - */ - identity(): IdentityScale; - /* - * Construct a quantitative scale with an logarithmic transform. - */ - log(): LogScale; - /* - * Construct a quantitative scale with an exponential transform. - */ - pow(): PowScale; - /* - * Construct a quantitative scale mapping to quantiles. - */ - quantile(): QuantileScale; - /* - * Construct a quantitative scale with a square root transform. - */ - sqrt(): SqrtScale; - /* - * Construct a threshold scale with a discrete output range. - */ - threshold(): ThresholdScale; - } - - export interface GenericScale { - (value: any): any; - domain: { - (values: any[]): S; - (): any[]; - }; - range: { - (values: any[]): S; - (): any[]; - }; - invertExtent?(y: any): any[]; - copy(): S; - } - - export interface Scale extends GenericScale { } - - export interface GenericQuantitativeScale extends GenericScale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: number): number; - /** - * Get the domain value corresponding to a given range value. - * - * @param value Range Value - */ - invert(value: number): number; - /** - * Set the scale's output range, and enable rounding. - * - * @param value The output range. - */ - rangeRound: (values: any[]) => S; - /** - * get or set the scale's output interpolator. - */ - interpolate: { - (): D3.Transition.Interpolate; - (factory: D3.Transition.Interpolate): S; - }; - /** - * enable or disable clamping of the output range. - * - * @param clamp Enable or disable - */ - clamp: { - (): boolean; - (clamp: boolean): S; - } - /** - * extend the scale domain to nice round numbers. - * - * @param count Optional number of ticks to exactly fit the domain - */ - nice(count?: number): S; - /** - * get representative values from the input domain. - * - * @param count Aproximate representative values to return. - */ - ticks(count: number): any[]; - /** - * get a formatter for displaying tick values - * - * @param count Aproximate representative values to return - */ - tickFormat(count: number, format?: string): (n: number) => string; - } - - export interface QuantitativeScale extends GenericQuantitativeScale { } - - export interface LinearScale extends GenericQuantitativeScale { } - - export interface IdentityScale extends GenericScale { - /** - * Get the range value corresponding to a given domain value. - * - * @param value Domain Value - */ - (value: number): number; - /** - * Get the domain value corresponding to a given range value. - * - * @param value Range Value - */ - invert(value: number): number; - /** - * get representative values from the input domain. - * - * @param count Aproximate representative values to return. - */ - ticks(count: number): any[]; - /** - * get a formatter for displaying tick values - * - * @param count Aproximate representative values to return - */ - tickFormat(count: number): (n: number) => string; - } - - export interface SqrtScale extends GenericQuantitativeScale { } - - export interface PowScale extends GenericQuantitativeScale { } - - export interface LogScale extends GenericQuantitativeScale { } - - export interface OrdinalScale extends GenericScale { - rangePoints(interval: any[], padding?: number): OrdinalScale; - rangeBands(interval: any[], padding?: number, outerPadding?: number): OrdinalScale; - rangeRoundBands(interval: any[], padding?: number, outerPadding?: number): OrdinalScale; - rangeBand(): number; - rangeExtent(): any[]; - } - - export interface QuantizeScale extends GenericScale { } - - export interface ThresholdScale extends GenericScale { } - - export interface QuantileScale extends GenericScale { - quantiles(): any[]; - } - - export interface TimeScale extends GenericScale { - (value: Date): number; - invert(value: number): Date; - rangeRound: (values: any[]) => TimeScale; - interpolate: { - (): D3.Transition.Interpolate; - (factory: D3.Transition.InterpolateFactory): TimeScale; - }; - clamp(clamp: boolean): TimeScale; - ticks: { - (count: number): any[]; - (range: D3.Time.Range, count: number): any[]; - }; - tickFormat(count: number): (n: number) => string; - nice(count?: number): TimeScale; - } - } - - // Behaviour - export module Behavior { - export interface Behavior{ - /** - * Constructs a new drag behaviour - */ - drag(): Drag; - /** - * Constructs a new zoom behaviour - */ - zoom(): Zoom; - } - - export interface Zoom { - /** - * Applies the zoom behavior to the specified selection, - * registering the necessary event listeners to support - * panning and zooming. - */ - (selection: Selection): void; - - /** - * Registers a listener to receive events - * - * @param type Enent name to attach the listener to - * @param listener Function to attach to event - */ - on: (type: string, listener: (data: any, index?: number) => any) => Zoom; - - /** - * Gets or set the current zoom scale - */ - scale: { - /** - * Get the current current zoom scale - */ - (): number; - /** - * Set the current current zoom scale - * - * @param origin Zoom scale - */ - (scale: number): Zoom; - }; - - /** - * Gets or set the current zoom translation vector - */ - translate: { - /** - * Get the current zoom translation vector - */ - (): number[]; - /** - * Set the current zoom translation vector - * - * @param translate Tranlation vector - */ - (translate: number[]): Zoom; - }; - - /** - * Gets or set the allowed scale range - */ - scaleExtent: { - /** - * Get the current allowed zoom range - */ - (): number[]; - /** - * Set the allowable zoom range - * - * @param extent Allowed zoom range - */ - (extent: number[]): Zoom; - }; - - /** - * Gets or set the X-Scale that should be adjusted when zooming - */ - x: { - /** - * Get the X-Scale - */ - (): D3.Scale.Scale; - /** - * Set the X-Scale to be adjusted - * - * @param x The X Scale - */ - (x: D3.Scale.Scale): Zoom; - - }; - - /** - * Gets or set the Y-Scale that should be adjusted when zooming - */ - y: { - /** - * Get the Y-Scale - */ - (): D3.Scale.Scale; - /** - * Set the Y-Scale to be adjusted - * - * @param y The Y Scale - */ - (y: D3.Scale.Scale): Zoom; - }; - } - - export interface Drag { - /** - * Execute drag method - */ - (): any; - - /** - * Registers a listener to receive events - * - * @param type Enent name to attach the listener to - * @param listener Function to attach to event - */ - on: (type: string, listener: (data: any, index?: number) => any) => Drag; - - /** - * Gets or set the current origin accessor function - */ - origin: { - /** - * Get the current origin accessor function - */ - (): any; - /** - * Set the origin accessor function - * - * @param origin Accessor function - */ - (origin?: any): Drag; - }; - } - } - - // Geography - export module Geo { - export interface Geo { - /** - * create a new geographic path generator - */ - path(): Path; - /** - * create a circle generator. - */ - circle(): Circle; - /** - * compute the spherical area of a given feature. - */ - area(feature: any): number; - /** - * compute the latitude-longitude bounding box for a given feature. - */ - bounds(feature: any): number[][]; - /** - * compute the spherical centroid of a given feature. - */ - centroid(feature: any): number[]; - /** - * compute the great-arc distance between two points. - */ - distance(a: number[], b: number[]): number; - /** - * interpolate between two points along a great arc. - */ - interpolate(a: number[], b: number[]): (t: number) => number[]; - /** - * compute the length of a line string or the circumference of a polygon. - */ - length(feature: any): number; - /** - * create a standard projection from a raw projection. - */ - projection(raw: RawProjection): Projection; - /** - * create a standard projection from a mutable raw projection. - */ - projectionMutator(rawFactory: RawProjection): ProjectionMutator; - /** - * the Albers equal-area conic projection. - */ - albers(): Projection; - /** - * a composite Albers projection for the United States. - */ - albersUsa(): Projection; - /** - * the azimuthal equal-area projection. - */ - azimuthalEqualArea: { - (): Projection; - raw: RawProjection; - } - /** - * the azimuthal equidistant projection. - */ - azimuthalEquidistant: { - (): Projection; - raw: RawProjection; - } - /** - * the conic conformal projection. - */ - conicConformal: { - (): Projection; - raw(phi1:number, phi2:number): RawProjection; - } - /** - * the conic equidistant projection. - */ - conicEquidistant: { - (): Projection; - raw(phi1:number, phi2:number): RawProjection; - } - /** - * the conic equal-area (a.k.a. Albers) projection. - */ - conicEqualArea: { - (): Projection; - raw(phi1:number, phi2:number): RawProjection; - } - /** - * the equirectangular (plate carreé) projection. - */ - equirectangular: { - (): Projection; - raw: RawProjection; - } - /** - * the gnomonic projection. - */ - gnomonic: { - (): Projection; - raw: RawProjection; - } - /** - * the spherical Mercator projection. - */ - mercator: { - (): Projection; - raw: RawProjection; - } - /** - * the azimuthal orthographic projection. - */ - orthographic: { - (): Projection; - raw: RawProjection; - } - /** - * the azimuthal stereographic projection. - */ - stereographic: { - (): Projection; - raw: RawProjection; - } - /** - * the transverse Mercator projection. - */ - transverseMercator: { - (): Projection; - raw: RawProjection; - } - /** - * convert a GeoJSON object to a geometry stream. - */ - stream(object: GeoJSON, listener: Stream): void; - /** - * - */ - graticule(): Graticule; - /** - * - */ - greatArc(): GreatArc; - /** - * - */ - rotation(rotation: number[]): Rotation; - } - - export interface Path { - /** - * Returns the path data string for the given feature - */ - (feature: any, index?: any): string; - /** - * get or set the geographic projection. - */ - projection: { - /** - * get the geographic projection. - */ - (): Projection; - /** - * set the geographic projection. - */ - (projection: Projection): Path; - } - /** - * get or set the render context. - */ - context: { - /** - * return an SVG path string invoked on the given feature. - */ - (): string; - /** - * sets the render context and returns the path generator - */ - (context: Context): Path; - } - /** - * Computes the projected area - */ - area(feature: any): any; - /** - * Computes the projected centroid - */ - centroid(feature: any): any; - /** - * Computes the projected bounding box - */ - bounds(feature: any): any; - /** - * get or set the radius to display point features. - */ - pointRadius: { - /** - * returns the current radius - */ - (): number; - /** - * sets the radius used to display Point and MultiPoint features to the specified number - */ - (radius: number): Path; - /** - * sets the radius used to display Point and MultiPoint features to the specified number - */ - (radius: (feature: any, index: number) => number): Path; - } - } - - export interface Context { - beginPath(): any; - moveTo(x: number, y: number): any; - lineTo(x: number, y: number): any; - arc(x: number, y: number, radius: number, startAngle: number, endAngle: number): any; - closePath(): any; - } - - export interface Circle { - (...args: any[]): GeoJSON; - origin: { - (): number[]; - (origin: number[]): Circle; - (origin: (...args: any[]) => number[]): Circle; - } - angle: { - (): number; - (angle: number): Circle; - } - precision: { - (): number; - (precision: number): Circle; - } - } - - export interface Graticule{ - (): GeoJSON; - lines(): GeoJSON[]; - outline(): GeoJSON; - extent: { - (): number[][]; - (extent: number[][]): Graticule; - } - minorExtent: { - (): number[][]; - (extent: number[][]): Graticule; - } - majorExtent: { - (): number[][]; - (extent: number[][]): Graticule; - } - step: { - (): number[][]; - (extent: number[][]): Graticule; - } - minorStep: { - (): number[][]; - (extent: number[][]): Graticule; - } - majorStep: { - (): number[][]; - (extent: number[][]): Graticule; - } - precision: { - (): number; - (precision: number): Graticule; - } - } - - export interface GreatArc { - (): GeoJSON; - distance(): number; - source: { - (): any; - (source: any): GreatArc; - } - target: { - (): any; - (target: any): GreatArc; - } - precision: { - (): number; - (precision: number): GreatArc; - } - } - - export interface GeoJSON { - coordinates: number[][]; - type: string; - } - - export interface RawProjection { - (lambda: number, phi: number): number[]; - invert?(x: number, y: number): number[]; - } - - export interface Projection { - (coordinates: number[]): number[]; - invert?(point: number[]): number[]; - rotate: { - (): number[]; - (rotation: number[]): Projection; - }; - center: { - (): number[]; - (location: number[]): Projection; - }; - parallels: { - (): number[]; - (location: number[]): Projection; - }; - translate: { - (): number[]; - (point: number[]): Projection; - }; - scale: { - (): number; - (scale: number): Projection; - }; - clipAngle: { - (): number; - (angle: number): Projection; - }; - clipExtent: { - (): number[][]; - (extent: number[][]): Projection; - }; - precision: { - (): number; - (precision: number): Projection; - }; - stream(listener?: Stream): Stream; - } - - export interface Stream { - point(x: number, y: number, z?: number): void; - lineStart(): void; - lineEnd(): void; - polygonStart(): void; - polygonEnd(): void; - sphere(): void; - } - - export interface Rotation extends Array { - (location: number[]): Rotation; - invert(location: number[]): Rotation; - } - - export interface ProjectionMutator { - (lambda: number, phi: number): Projection; - } - } - - // Geometry - export module Geom { - export interface Geom { - voronoi(): Voronoi; - /** - * compute the Voronoi diagram for the specified points. - */ - voronoi(vertices: Vertice[]): Polygon[]; - /** - * compute the Delaunay triangulation for the specified points. - */ - delaunay(vertices?: Vertice[]): Polygon[]; - /** - * constructs a quadtree for an array of points. - */ - quadtree(): QuadtreeFactory; - /** - * Constructs a new quadtree for the specified array of points. - */ - quadtree(points: Point[], x1: number, y1: number, x2: number, y2: number): Quadtree; - /** - * Constructs a new quadtree for the specified array of points. - */ - quadtree(points: Point[], width: number, height: number): Quadtree; - /** - * Returns the input array of vertices with additional methods attached - */ - polygon(vertices:Vertice[]): Polygon; - /** - * creates a new hull layout with the default settings. - */ - hull(): Hull; - - hull(vertices:Vertice[]): Vertice[]; - } - - export interface Vertice extends Array { - /** - * Returns the angle of the vertice - */ - angle?: number; - } - - export interface Polygon extends Array { - /** - * Returns the signed area of this polygon - */ - area(): number; - /** - * Returns a two-element array representing the centroid of this polygon. - */ - centroid(): number[]; - /** - * Clips the subject polygon against this polygon - */ - clip(subject: Polygon): Polygon; - } - - export interface QuadtreeFactory { - /** - * Constructs a new quadtree for the specified array of points. - */ - (): Quadtree; - /** - * Constructs a new quadtree for the specified array of points. - */ - (points: Point[], x1: number, y1: number, x2: number, y2: number): Quadtree; - /** - * Constructs a new quadtree for the specified array of points. - */ - (points: Point[], width: number, height: number): Quadtree; - - x: { - (): (d: any) => any; - (accesor: (d: any) => any): QuadtreeFactory; - - } - y: { - (): (d: any) => any; - (accesor: (d: any) => any): QuadtreeFactory; - - } - size(): number[]; - size(size: number[]): QuadtreeFactory; - extent(): number[][]; - extent(points: number[][]): QuadtreeFactory; - } - - export interface Quadtree { - /** - * Adds a new point to the quadtree. - */ - add(point: Point): void; - visit(callback: any): void; - } - - export interface Point { - x: number; - y: number; - } - - export interface Voronoi { - /** - * Compute the Voronoi diagram for the specified data. - */ - (data: T[]): Polygon[]; - /** - * Compute the graph links for the Voronoi diagram for the specified data. - */ - links(data: T[]): Layout.GraphLink[]; - /** - * Compute the triangles for the Voronoi diagram for the specified data. - */ - triangles(data: T[]): number[][]; - x: { - /** - * Get the x-coordinate accessor. - */ - (): (data: T, index ?: number) => number; - - /** - * Set the x-coordinate accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: T, index: number) => number): Voronoi; - - /** - * Set the x-coordinate to a constant. - * - * @param constant The new constant value. - */ - (constant: number): Voronoi; - } - y: { - /** - * Get the y-coordinate accessor. - */ - (): (data: T, index ?: number) => number; - - /** - * Set the y-coordinate accessor. - * - * @param accessor The new accessor function - */ - (accessor: (data: T, index: number) => number): Voronoi; - - /** - * Set the y-coordinate to a constant. - * - * @param constant The new constant value. - */ - (constant: number): Voronoi; - } - clipExtent: { - /** - * Get the clip extent. - */ - (): number[][]; - /** - * Set the clip extent. - * - * @param extent The new clip extent. - */ - (extent: number[][]): Voronoi; - } - size: { - /** - * Get the size. - */ - (): number[]; - /** - * Set the size, equivalent to a clip extent starting from (0,0). - * - * @param size The new size. - */ - (size: number[]): Voronoi; - } - } - - export interface Hull { - (vertices: Vertice[]): Vertice[]; - x: { - (): (d: any) => any; - (accesor: (d: any) => any): any; - } - y: { - (): (d: any) => any; - (accesor: (d: any) => any): any; - } - } - } -} - -declare var d3: D3.Base; - -declare module "d3" { - export = d3; -} +// Type definitions for d3JS +// Project: http://d3js.org/ +// Definitions by: Boris Yankov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module d3 { + /** + * The current version of D3.js. + */ + export var version: string; + + /** + * Find the first element that matches the given selector string. + */ + export function select(selector: string): Selection; + + /** + * Create a selection from the given node reference. + */ + export function select(node: EventTarget): Selection; + + /** + * Find all elements that match the given selector string. + */ + export function selectAll(selector: string): Selection; + + /** + * Create a selection from the given list of nodes. + */ + export function selectAll(nodes: EventTarget[]): Selection; + + /** + * Returns the root selection (as if by d3.select(document.documentElement)). This function may be used for 'instanceof' tests, and extending its prototype will add properties to all selections. + */ + export function selection(): Selection; + + module selection { + export var prototype: Selection; + + /** + * Selections are grouped into arrays of nodes, with the parent tracked in the 'parentNode' property. + */ + interface Group extends Array { + parentNode: EventTarget; + } + + interface Update { + /** + * Retrieve a grouped selection. + */ + [index: number]: Group; + + /** + * The number of groups in this selection. + */ + length: number; + + /** + * Retrieve the value of the given attribute for the first node in the selection. + * + * @param name The attribute name to query. May be prefixed (see d3.ns.prefix). + */ + attr(name: string): string; + + /** + * For all nodes, set the attribute to the specified constant value. Use null to remove. + * + * @param name The attribute name, optionally prefixed. + * @param value The attribute value to use. Note that this is coerced to a string automatically. + */ + attr(name: string, value: Primitive): Update; + + /** + * Derive an attribute value for each node in the selection based on bound data. + * + * @param name The attribute name, optionally prefixed. + * @param value The function of the datum (the bound data item) and index (the position in the subgrouping) which computes the attribute value. If the function returns null, the attribute is removed. + */ + attr(name: string, value: (datum: Datum, index: number) => Primitive): Update; + + /** + * Set multiple properties at once using an Object. D3 iterates over all enumerable properties and either sets or computes the attribute's value based on the corresponding entry in the Object. + * + * @param obj A key-value mapping corresponding to attributes and values. If the value is a simple string or number, it is taken as a constant. Otherwise, it is a function that derives the attribute value. + */ + attr(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }): Update; + + /** + * Returns true if the first node in this selection has the given class list. If multiple classes are specified (i.e., "foo bar"), then returns true only if all classes match. + * + * @param name The class list to query. + */ + classed(name: string): boolean; + + /** + * Adds (or removes) the given class list. + * + * @param name The class list to toggle. Spaces separate class names: "foo bar" is a list of two classes. + * @param value If true, add the classes. If false, remove them. + */ + classed(name: string, value: boolean): Update; + + /** + * Determine if the given class list should be toggled for each node in the selection. + * + * @param name The class list. Spaces separate multiple class names. + * @param value The function to run for each node. Should return true to add the class to the node, or false to remove it. + */ + classed(name: string, value: (datum: Datum, index: number) => boolean): Update; + + /** + * Set or derive classes for multiple class lists at once. + * + * @param obj An Object mapping class lists to values that are either plain booleans or functions that return booleans. + */ + classed(obj: { [key: string]: boolean | ((datum: Datum, index: number) => boolean) }): Update; + + /** + * Retrieve the computed style value for the first node in the selection. + * @param name The CSS property name to query + */ + style(name: string): string; + + /** + * Set a style property for all nodes in the selection. + * @param name the CSS property name + * @param value the property value + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(name: string, value: Primitive, priority?: string): Update; + + /** + * Derive a property value for each node in the selection. + * @param name the CSS property name + * @param value the function to derive the value + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(name: string, value: (datum: Datum, index: number) => Primitive, priority?: string): Update; + + /** + * Set a large number of CSS properties from an object. + * + * @param obj an Object whose keys correspond to CSS property names and values are either constants or functions that derive property values + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }, priority?: string): Update; + + /** + * Retrieve an arbitrary node property such as the 'checked' property of checkboxes, or the 'value' of text boxes. + * + * @param name the node's property to retrieve + */ + property(name: string): any; + + /** + * For each node, set the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. + * + * @param name the property name + * @param value the property value + */ + property(name: string, value: any): Update; + + /** + * For each node, derive the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. + * + * @param name the property name + * @param value the function used to derive the property's value + */ + property(name: string, value: (datum: Datum, index: number) => any): Update; + + /** + * Set multiple node properties. Caveats apply: take care not to mutate special properties like __proto__. + * + * @param obj an Object whose keys correspond to node properties and values are either constants or functions that will compute a value. + */ + property(obj: { [key: string]: any | ((datum: Datum, index: number) => any) }): Update; + + /** + * Retrieve the textContent of the first node in the selection. + */ + text(): string; + + /** + * Set the textContent of each node in the selection. + * @param value the text to use for all nodes + */ + text(value: Primitive): Update; + + /** + * Compute the textContent of each node in the selection. + * @param value the function which will compute the text + */ + text(value: (datum: Datum, index: number) => Primitive): Update; + + /** + * Retrieve the HTML content of the first node in the selection. Uses 'innerHTML' internally and will not work with SVG or other elements without a polyfill. + */ + html(): string; + + /** + * Set the HTML content of every node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. + * @param value the HTML content to use. + */ + html(value: string): Selection; + + /** + * Compute the HTML content for each node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. + * @param value the function to compute HTML content + */ + html(value: (datum: Datum, index: number) => string): Selection; + + /** + * Appends a new child to each node in the selection. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. + * + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + */ + append(name: string): Selection; + + /** + * Appends a new child to each node in the selection by computing a new node. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. + * + * @param name the function to compute a new element + */ + append(name: (datum: Datum, index: number) => EventTarget): Update; + + /** + * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + * @param before the selector to determine position (e.g., ":first-child") + */ + insert(name: string, before: string): Update; + + /** + * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + * @param before a function to determine the node to use as the next sibling + */ + insert(name: string, before: (datum: Datum, index: number) => EventTarget): Update; + + /** + * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the function to compute a new child + * @param before the selector to determine position (e.g., ":first-child") + */ + insert(name: (datum: Datum, index: number) => EventTarget, before: string): Update; + + /** + * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the function to compute a new child + * @param before a function to determine the node to use as the next sibling + */ + insert(name: (datum: Datum, index: number) => EventTarget, before: (datum: Datum, index: number) => EventTarget): Update; + + /** + * Removes the elements from the DOM. They are in a detached state and may be re-added (though there is currently no dedicated API for doing so). + */ + remove(): Update; + + /** + * Retrieves the data bound to the first group in this selection. + */ + data(): Datum[]; + + /** + * Binds data to this selection. + * @param data the array of data to bind to this selection + * @param key the optional function to determine the unique key for each piece of data. When unspecified, uses the index of the element. + */ + data(data: NewDatum[], key?: (datum: NewDatum, index: number) => string): Update; + + /** + * Derives data to bind to this selection. + * @param data the function to derive data. Must return an array. + * @param key the optional function to determine the unique key for each data item. When unspecified, uses the index of the element. + */ + data(data: (datum: Datum, index: number) => NewDatum[], key?: (datum: NewDatum, index: number) => string): Update; + + /** + * Filters the selection, returning only those nodes that match the given CSS selector. + * @param selector the CSS selector + */ + filter(selector: string): Update; + + /** + * Filters the selection, returning only those nodes for which the given function returned true. + * @param selector the filter function + */ + filter(selector: (datum: Datum, index: number) => boolean): Update; + + /** + * Return the data item bound to the first element in the selection. + */ + datum(): Datum; + + /** + * Set the data item for each node in the selection. + * @param value the constant element to use for each node + */ + datum(value: NewDatum): Update; + + /** + * Derive the data item for each node in the selection. Useful for situations such as the HTML5 'dataset' attribute. + * @param value the function to compute data for each node + */ + datum(value: (datum: Datum, index: number) => NewDatum): Update; + + /** + * Reorders nodes in the selection based on the given comparator. Nodes are re-inserted into the document once sorted. + * @param comparator the comparison function, which defaults to d3.ascending + */ + sort(comparator?: (a: Datum, b: Datum) => number): Update; + + /** + * Reorders nodes in the document to match the selection order. More efficient than calling sort() if the selection is already ordered. + */ + order(): Update; + + /** + * Returns the listener (if any) for the given event. + * @param type the type of event to load the listener for. May have a namespace (e.g., ".foo") at the end. + */ + on(type: string): (datum: Datum, index: number) => any; + + /** + * Adds a listener for the specified event. If one was already registered, it is removed before the new listener is added. The return value of the listener function is ignored. + * @param type the of event to listen to. May have a namespace (e.g., ".foo") at the end. + * @param listener an event listener function, or null to unregister + * @param capture sets the DOM useCapture flag + */ + on(type: string, listener: (datum: Datum, index: number) => any, capture?: boolean): Update; + + /** + * Begins a new transition. Interrupts any active transitions of the same name. + * @param name the transition name (defaults to "") + */ + transition(name?: string): Transition; + + /** + * Interrupts the active transition of the provided name. Does not cancel scheduled transitions. + * @param name the transition name (defaults to "") + */ + interrupt(name?: string): Update; + + /** + * Creates a subselection by finding the first descendent matching the selector string. Bound data is inherited. + * @param selector the CSS selector to match against + */ + select(selector: string): Update; + + /** + * Creates a subselection by using a function to find descendent elements. Bound data is inherited. + * @param selector the function to find matching descendants + */ + select(selector: (datum: Datum, index: number) => EventTarget): Update; + + /** + * Creates a subselection by finding all descendents that match the given selector. Bound data is not inherited. + * @param selector the CSS selector to match against + */ + selectAll(selector: string): Update; + + /** + * Creates a subselection by using a function to find descendent elements. Bound data is not inherited. + * @param selector the function to find matching descendents + */ + selectAll(selector: (datum: Datum, index: number) => Array | NodeList): Update; + + /** + * Invoke the given function for each element in the selection. The return value of the function is ignored. + * @param func the function to invoke + */ + each(func: (datum: Datum, index: number) => any): Update; + + /** + * Call a function on the selection. sel.call(foo) is equivalent to foo(sel). + * @param func the function to call on the selection + * @param args any optional args + */ + call(func: (sel: Update, ...args: any[]) => any, ...args: any[]): Update; + + /** + * Returns true if the current selection is empty. + */ + empty(): boolean; + + /** + * Returns the first non-null element in the selection, or null otherwise. + */ + node(): EventTarget; + + /** + * Returns the total number of elements in the selection. + */ + size(): number; + + /** + * Returns the placeholder nodes for each data element for which no corresponding DOM element was found. + */ + enter(): Enter; + + /** + * Returns a selection for those DOM nodes for which no new data element was found. + */ + exit(): Selection; + } + + interface Enter { + append(name: string): Selection; + append(name: (datum: Datum, index: number) => EventTarget): Selection; + + insert(name: string, before?: string): Selection; + insert(name: string, before: (datum: Datum, index: number) => EventTarget): Selection; + insert(name: (datum: Datum, index: number) => EventTarget, before?: string): Selection; + insert(name: (datum: Datum, index: number) => EventTarget, before: (datum: Datum, index: number) => EventTarget): Selection; + + select(name: (datum: Datum, index: number) => EventTarget): Selection; + call(func: (selection: Enter, ...args: any[]) => any, ...args: any[]): Enter; + } + } + + /** + * Administrivia: JavaScript primitive types, or "things that toString() predictably". + */ + export type Primitive = number | string | boolean; + + /** + * Administrivia: anything with a valueOf(): number method is comparable, so we allow it in numeric operations + */ + interface Numeric { + valueOf(): number; + } + + /** + * A grouped array of nodes. + * @param Datum the data bound to this selection. + */ + interface Selection { + /** + * Retrieve a grouped selection. + */ + [index: number]: selection.Group; + + /** + * The number of groups in this selection. + */ + length: number; + + /** + * Retrieve the value of the given attribute for the first node in the selection. + * + * @param name The attribute name to query. May be prefixed (see d3.ns.prefix). + */ + attr(name: string): string; + + /** + * For all nodes, set the attribute to the specified constant value. Use null to remove. + * + * @param name The attribute name, optionally prefixed. + * @param value The attribute value to use. Note that this is coerced to a string automatically. + */ + attr(name: string, value: Primitive): Selection; + + /** + * Derive an attribute value for each node in the selection based on bound data. + * + * @param name The attribute name, optionally prefixed. + * @param value The function of the datum (the bound data item) and index (the position in the subgrouping) which computes the attribute value. If the function returns null, the attribute is removed. + */ + attr(name: string, value: (datum: Datum, index: number) => Primitive): Selection; + + /** + * Set multiple properties at once using an Object. D3 iterates over all enumerable properties and either sets or computes the attribute's value based on the corresponding entry in the Object. + * + * @param obj A key-value mapping corresponding to attributes and values. If the value is a simple string or number, it is taken as a constant. Otherwise, it is a function that derives the attribute value. + */ + attr(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }): Selection; + + /** + * Returns true if the first node in this selection has the given class list. If multiple classes are specified (i.e., "foo bar"), then returns true only if all classes match. + * + * @param name The class list to query. + */ + classed(name: string): boolean; + + /** + * Adds (or removes) the given class list. + * + * @param name The class list to toggle. Spaces separate class names: "foo bar" is a list of two classes. + * @param value If true, add the classes. If false, remove them. + */ + classed(name: string, value: boolean): Selection; + + /** + * Determine if the given class list should be toggled for each node in the selection. + * + * @param name The class list. Spaces separate multiple class names. + * @param value The function to run for each node. Should return true to add the class to the node, or false to remove it. + */ + classed(name: string, value: (datum: Datum, index: number) => boolean): Selection; + + /** + * Set or derive classes for multiple class lists at once. + * + * @param obj An Object mapping class lists to values that are either plain booleans or functions that return booleans. + */ + classed(obj: { [key: string]: boolean | ((datum: Datum, index: number) => boolean) }): Selection; + + /** + * Retrieve the computed style value for the first node in the selection. + * @param name The CSS property name to query + */ + style(name: string): string; + + /** + * Set a style property for all nodes in the selection. + * @param name the CSS property name + * @param value the property value + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(name: string, value: Primitive, priority?: string): Selection; + + /** + * Derive a property value for each node in the selection. + * @param name the CSS property name + * @param value the function to derive the value + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(name: string, value: (datum: Datum, index: number) => Primitive, priority?: string): Selection; + + /** + * Set a large number of CSS properties from an object. + * + * @param obj an Object whose keys correspond to CSS property names and values are either constants or functions that derive property values + * @param priority if specified, either null or the string "important" (no exclamation mark) + */ + style(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }, priority?: string): Selection; + + /** + * Retrieve an arbitrary node property such as the 'checked' property of checkboxes, or the 'value' of text boxes. + * + * @param name the node's property to retrieve + */ + property(name: string): any; + + /** + * For each node, set the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. + * + * @param name the property name + * @param value the property value + */ + property(name: string, value: any): Selection; + + /** + * For each node, derive the property value. Internally, this sets the node property directly (e.g., node[name] = value), so take care not to mutate special properties like __proto__. + * + * @param name the property name + * @param value the function used to derive the property's value + */ + property(name: string, value: (datum: Datum, index: number) => any): Selection; + + /** + * Set multiple node properties. Caveats apply: take care not to mutate special properties like __proto__. + * + * @param obj an Object whose keys correspond to node properties and values are either constants or functions that will compute a value. + */ + property(obj: { [key: string]: any | ((datum: Datum, index: number) => any) }): Selection; + + /** + * Retrieve the textContent of the first node in the selection. + */ + text(): string; + + /** + * Set the textContent of each node in the selection. + * @param value the text to use for all nodes + */ + text(value: Primitive): Selection; + + /** + * Compute the textContent of each node in the selection. + * @param value the function which will compute the text + */ + text(value: (datum: Datum, index: number) => Primitive): Selection; + + /** + * Retrieve the HTML content of the first node in the selection. Uses 'innerHTML' internally and will not work with SVG or other elements without a polyfill. + */ + html(): string; + + /** + * Set the HTML content of every node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. + * @param value the HTML content to use. + */ + html(value: string): Selection; + + /** + * Compute the HTML content for each node in the selection. Uses 'innerHTML' internally and thus will not work with SVG or other elements without a polyfill. + * @param value the function to compute HTML content + */ + html(value: (datum: Datum, index: number) => string): Selection; + + /** + * Appends a new child to each node in the selection. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. + * + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + */ + append(name: string): Selection; + + /** + * Appends a new child to each node in the selection by computing a new node. This child will inherit the parent's data (if available). Returns a fresh selection consisting of the newly-appended children. + * + * @param name the function to compute a new element + */ + append(name: (datum: Datum, index: number) => EventTarget): Selection; + + /** + * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + * @param before the selector to determine position (e.g., ":first-child") + */ + insert(name: string, before: string): Selection; + + /** + * Inserts a new child to each node in the selection. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the element name to append. May be prefixed (see d3.ns.prefix). + * @param before a function to determine the node to use as the next sibling + */ + insert(name: string, before: (datum: Datum, index: number) => EventTarget): Selection; + + /** + * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the function to compute a new child + * @param before the selector to determine position (e.g., ":first-child") + */ + insert(name: (datum: Datum, index: number) => EventTarget, before: string): Selection; + + /** + * Inserts a new child to the end of each node in the selection by computing a new node. This child will inherit its parent's data (if available). Returns a fresh selection consisting of the newly-inserted children. + * @param name the function to compute a new child + * @param before a function to determine the node to use as the next sibling + */ + insert(name: (datum: Datum, index: number) => EventTarget, before: (datum: Datum, index: number) => EventTarget): Selection; + + /** + * Removes the elements from the DOM. They are in a detached state and may be re-added (though there is currently no dedicated API for doing so). + */ + remove(): Selection; + + /** + * Retrieves the data bound to the first group in this selection. + */ + data(): Datum[]; + + /** + * Binds data to this selection. + * @param data the array of data to bind to this selection + * @param key the optional function to determine the unique key for each piece of data. When unspecified, uses the index of the element. + */ + data(data: NewDatum[], key?: (datum: NewDatum, index: number) => string): selection.Update; + + /** + * Derives data to bind to this selection. + * @param data the function to derive data. Must return an array. + * @param key the optional function to determine the unique key for each data item. When unspecified, uses the index of the element. + */ + data(data: (datum: Datum, index: number) => NewDatum[], key?: (datum: NewDatum, index: number) => string): selection.Update; + + /** + * Filters the selection, returning only those nodes that match the given CSS selector. + * @param selector the CSS selector + */ + filter(selector: string): Selection; + + /** + * Filters the selection, returning only those nodes for which the given function returned true. + * @param selector the filter function + */ + filter(selector: (datum: Datum, index: number) => boolean): Selection; + + /** + * Return the data item bound to the first element in the selection. + */ + datum(): Datum; + + /** + * Derive the data item for each node in the selection. Useful for situations such as the HTML5 'dataset' attribute. + * @param value the function to compute data for each node + */ + datum(value: (datum: Datum, index: number) => NewDatum): Selection; + + /** + * Set the data item for each node in the selection. + * @param value the constant element to use for each node + */ + datum(value: NewDatum): Selection; + + /** + * Reorders nodes in the selection based on the given comparator. Nodes are re-inserted into the document once sorted. + * @param comparator the comparison function, which defaults to d3.ascending + */ + sort(comparator?: (a: Datum, b: Datum) => number): Selection; + + /** + * Reorders nodes in the document to match the selection order. More efficient than calling sort() if the selection is already ordered. + */ + order(): Selection; + + /** + * Returns the listener (if any) for the given event. + * @param type the type of event to load the listener for. May have a namespace (e.g., ".foo") at the end. + */ + on(type: string): (datum: Datum, index: number) => any; + + /** + * Adds a listener for the specified event. If one was already registered, it is removed before the new listener is added. The return value of the listener function is ignored. + * @param type the of event to listen to. May have a namespace (e.g., ".foo") at the end. + * @param listener an event listener function, or null to unregister + * @param capture sets the DOM useCapture flag + */ + on(type: string, listener: (datum: Datum, index: number) => any, capture?: boolean): Selection; + + /** + * Begins a new transition. Interrupts any active transitions of the same name. + * @param name the transition name (defaults to "") + */ + transition(name?: string): Transition; + + /** + * Interrupts the active transition of the provided name. Does not cancel scheduled transitions. + * @param name the transition name (defaults to "") + */ + interrupt(name?: string): Selection; + + /** + * Creates a subselection by finding the first descendent matching the selector string. Bound data is inherited. + * @param selector the CSS selector to match against + */ + select(selector: string): Selection; + + /** + * Creates a subselection by using a function to find descendent elements. Bound data is inherited. + * @param selector the function to find matching descendants + */ + select(selector: (datum: Datum, index: number) => EventTarget): Selection; + + /** + * Creates a subselection by finding all descendents that match the given selector. Bound data is not inherited. + * @param selector the CSS selector to match against + */ + selectAll(selector: string): Selection; + + /** + * Creates a subselection by finding all descendants that match the given selector. Bound data is not inherited. + * + * Use this overload when data-binding a subselection (that is, sel.selectAll('.foo').data(d => ...)). The type will carry over. + */ + selectAll(selector: string): Selection; + + /** + * Creates a subselection by using a function to find descendent elements. Bound data is not inherited. + * @param selector the function to find matching descendents + */ + selectAll(selector: (datum: Datum, index: number) => Array | NodeList): Selection; + + /** + * Creates a subselection by using a function to find descendent elements. Bound data is not inherited. + * + * Use this overload when data-binding a subselection (that is, sel.selectAll('.foo').data(d => ...)). The type will carry over. + * @param selector the function to find matching descendents + */ + selectAll(selector: (datum: Datum, index: number) => Array | NodeList): Selection; + + /** + * Invoke the given function for each element in the selection. The return value of the function is ignored. + * @param func the function to invoke + */ + each(func: (datum: Datum, index: number) => any): Selection; + + /** + * Call a function on the selection. sel.call(foo) is equivalent to foo(sel). + * @param func the function to call on the selection + * @param args any optional args + */ + call(func: (sel: Selection, ...args: any[]) => any, ...args: any[]): Selection; + + /** + * Returns true if the current selection is empty. + */ + empty(): boolean; + + /** + * Returns the first non-null element in the selection, or null otherwise. + */ + node(): EventTarget; + + /** + * Returns the total number of elements in the selection. + */ + size(): number; + } + + export function transition(): Transition; + module transition { + export var prototype: Transition; + } + + interface Transition { + delay(): number; + delay(delay: number): Transition; + delay(delay: (datum: Datum, index: number) => number): Transition; + + duration(): number; + duration(duration: number): Transition; + duration(duration: (datum: Datum, index: number) => number): Transition; + + ease(): (t: number) => number; + ease(value: string, ...args: any[]): Transition; + ease(value: (t: number) => number): Transition; + + attr(name: string, value: Primitive): Transition; + attr(name: string, value: (datum: Datum, index: number) => Primitive): Transition; + attr(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }): Transition; + + attrTween(name: string, tween: (datum: Datum, index: number, attr: string) => Primitive): Transition; + + style(name: string, value: Primitive, priority?: string): Transition; + style(name: string, value: (datum: Datum, index: number) => Primitive, priority?: string): Transition; + style(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }, priority?: string): Transition; + + styleTween(name: string, tween: (datum: Datum, index: number, attr: string) => Primitive, priority?: string): Transition; + + text(value: Primitive): Transition; + text(value: (datum: Datum, index: number) => Primitive): Transition; + + tween(name: string, factory: () => (t: number) => any): Transition; + + remove(): Transition; + + select(selector: string): Transition; + select(selector: (d: Datum, i: number) => EventTarget): Transition; + + selectAll(selector: string): Transition; + selectAll(selector: (d: Datum, i: number) => EventTarget[]): Transition; + + filter(selector: string): Transition; + filter(selector: (d: Datum, i: number) => boolean): Transition; + + each(type: string, listener: (d: Datum, i: number) => any): Transition; + each(listener: (d: Datum, i: number) => any): Transition; + + call(func: (transition: Transition, ...args: any[]) => any, ...args: any[]): Transition; + + empty(): boolean; + node(): EventTarget; + size(): number; + } + + export function ease(type: 'linear'): (t: number) => number; + export function ease(type: 'linear-in'): (t: number) => number; + export function ease(type: 'linear-out'): (t: number) => number; + export function ease(type: 'linear-in-out'): (t: number) => number; + export function ease(type: 'linear-out-in'): (t: number) => number; + + export function ease(type: 'poly', k: number): (t: number) => number; + export function ease(type: 'poly-in', k: number): (t: number) => number; + export function ease(type: 'poly-out', k: number): (t: number) => number; + export function ease(type: 'poly-in-out', k: number): (t: number) => number; + export function ease(type: 'poly-out-in', k: number): (t: number) => number; + + export function ease(type: 'quad'): (t: number) => number; + export function ease(type: 'quad-in'): (t: number) => number; + export function ease(type: 'quad-out'): (t: number) => number; + export function ease(type: 'quad-in-out'): (t: number) => number; + export function ease(type: 'quad-out-in'): (t: number) => number; + + export function ease(type: 'cubic'): (t: number) => number; + export function ease(type: 'cubic-in'): (t: number) => number; + export function ease(type: 'cubic-out'): (t: number) => number; + export function ease(type: 'cubic-in-out'): (t: number) => number; + export function ease(type: 'cubic-out-in'): (t: number) => number; + + export function ease(type: 'sin'): (t: number) => number; + export function ease(type: 'sin-in'): (t: number) => number; + export function ease(type: 'sin-out'): (t: number) => number; + export function ease(type: 'sin-in-out'): (t: number) => number; + export function ease(type: 'sin-out-in'): (t: number) => number; + + export function ease(type: 'circle'): (t: number) => number; + export function ease(type: 'circle-in'): (t: number) => number; + export function ease(type: 'circle-out'): (t: number) => number; + export function ease(type: 'circle-in-out'): (t: number) => number; + export function ease(type: 'circle-out-in'): (t: number) => number; + + export function ease(type: 'elastic', a?: number, b?: number): (t: number) => number; + export function ease(type: 'elastic-in', a?: number, b?: number): (t: number) => number; + export function ease(type: 'elastic-out', a?: number, b?: number): (t: number) => number; + export function ease(type: 'elastic-in-out', a?: number, b?: number): (t: number) => number; + export function ease(type: 'elastic-out-in', a?: number, b?: number): (t: number) => number; + + export function ease(type: 'back', s: number): (t: number) => number; + export function ease(type: 'back-in', s: number): (t: number) => number; + export function ease(type: 'back-out', s: number): (t: number) => number; + export function ease(type: 'back-in-out', s: number): (t: number) => number; + export function ease(type: 'back-out-in', s: number): (t: number) => number; + + export function ease(type: 'bounce'): (t: number) => number; + export function ease(type: 'bounce-in'): (t: number) => number; + export function ease(type: 'bounce-out'): (t: number) => number; + export function ease(type: 'bounce-in-out'): (t: number) => number; + export function ease(type: 'bounce-out-in'): (t: number) => number; + + export function ease(type: string, ...args: any[]): (t: number) => number; + + export function timer(func: () => any, delay?: number, time?: number): void; + + module timer { + export function flush(): void; + } + + /** + * The current event's value. Use this variable in a handler registered with selection.on. + */ + export var event: Event; + + /** + * Returns the x and y coordinates of the mouse relative to the provided container element, using d3.event for the mouse's position on the page. + * @param container the container element (e.g. an SVG element) + */ + export function mouse(container: EventTarget): [number, number]; + + /** + * Given a container element and a touch identifier, determine the x and y coordinates of the touch. + * @param container the container element (e.g., an SVG element) + * @param identifier the given touch identifier + */ + export function touch(container: EventTarget, identifer: number): [number, number]; + + /** + * Given a container element, a list of touches, and a touch identifier, determine the x and y coordinates of the touch. + * @param container the container element (e.g., an SVG element) + * @param identifier the given touch identifier + */ + export function touch(container: EventTarget, touches: TouchList, identifer: number): [number, number]; + + /** + * Given a container element and an optional list of touches, return the position of every touch relative to the container. + * @param container the container element + * @param touches an optional list of touches (defaults to d3.event.touches) + */ + export function touches(container: EventTarget, touches?: TouchList): Array<[number, number]>; + + // NB. this is limited to primitive values due to D3's use of the <, >, and >= operators. Results get weird for object instances. + /** + * Compares two primitive values for sorting (in ascending order). + */ + export function ascending(a: Primitive, b: Primitive): number; + + /** + * Compares two primitive values for sorting (in ascending order). + */ + export function descending(a: Primitive, b: Primitive): number; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: number[]): number; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: string[]): string; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: T[]): T; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: T[], accessor: (datum: T, index: number) => number): number; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: T[], accessor: (datum: T, index: number) => string): string; + + /** + * Return the minimum value in the array using natural order. + */ + export function min(array: T[], accessor: (datum: T, index: number) => U): U; + + /** + * Return the maximum value in the array of numbers using natural order. + */ + export function max(array: number[]): number; + + /** + * Return the maximum value in the array of strings using natural order. + */ + export function max(array: string[]): string; + + /** + * Return the maximum value in the array of numbers using natural order. + */ + export function max(array: T[]): T; + + /** + * Return the maximum value in the array using natural order and a projection function to map values to numbers. + */ + export function max(array: T[], accessor: (datum: T, index: number) => number): number; + + /** + * Return the maximum value in the array using natural order and a projection function to map values to strings. + */ + export function max(array: T[], accessor: (datum: T, index: number) => string): string; + + /** + * Return the maximum value in the array using natural order and a projection function to map values to easily-sorted values. + */ + export function max(array: T[], accessor: (datum: T, index: number) => U): U; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: number[]): [number, number]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: string[]): [string, string]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: T[]): [T, T]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: Array): [T | Primitive, T | Primitive]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: T[], accessor: (datum: T, index: number) => number): [number, number]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: T[], accessor: (datum: T, index: number) => string): [string, string]; + + /** + * Return the min and max simultaneously. + */ + export function extent(array: U[], accessor: (datum: T, index: number) => U): [U | Primitive, U | Primitive]; + + /** + * Compute the sum of an array of numbers. + */ + export function sum(array: number[]): number; + + /** + * Compute the sum of an array, using the given accessor to convert values to numbers. + */ + export function sum(array: T[], accessor: (datum: T, index: number) => number): number; + + export function mean(array: number[]): number; + export function mean(array: T[], accessor: (datum: T, index: number) => number): number; + + export function quantile(array: number[], p: number): number; + + export function variance(array: number[]): number; + export function variance(array: T[], accessor: (datum: T, index: number) => number): number; + + export function deviation(array: number[]): number; + export function deviation(array: T[], accessor: (datum: T, index: number) => number): number; + + export function bisectLeft(array: number[], x: number, lo?: number, hi?: number): number; + export function bisectLeft(array: string[], x: string, lo?: number, hi?: number): number; + + export var bisect: typeof bisectRight; + + export function bisectRight(array: T[], x: T, lo?: number, hi?: number): number; + + export function bisector(accessor: (x: T) => U): { + left: (array: T[], x: T, lo?: number, hi?: number) => number; + right: (array: T[], x: T, lo?: number, hi?: number) => number; + } + + export function bisector(comparator: (a: T, b: U) => number): { + left: (array: T[], x: U, lo?: number, hi?: number) => number; + right: (array: T[], x: U, lo?: number, hi?: number) => number; + } + + export function shuffle(array: T[], lo?: number, hi?: number): T[]; + + /** + * Returns the enumerable property names of the specified object. + * @param object a JavaScript object + */ + export function keys(object: Object): string[]; + + /** + * Returns an array containing the property values of the specified object. + */ + export function values(object: { [key: string]: T }): T[]; + /** + * Returns an array containing the property values of the specified object. + */ + export function values(object: { [key: number]: T }): T[]; + /** + * Returns an array containing the property values of the specified object. + */ + export function values(object: Object): any[]; + + /** + * Returns an array of key-value pairs containing the property values of the specified object. + */ + export function entries(object: { [key: string]: T }): { key: string; value: T }[]; + + /** + * Returns an array of key-value pairs containing the property values of the specified object. + */ + export function entries(object: { [key: number]: T }): { key: string; value: T }[]; + + /** + * Returns an array of key-value pairs containing the property values of the specified object. + */ + export function entries(object: Object): { key: string; value: any }[]; + + /** + * A shim for ES6 maps. The implementation uses a JavaScript object internally, and thus keys are limited to strings. + */ + interface Map { + /** + * Does the map contain the given key? + */ + has(key: string): boolean; + + /** + * Retrieve the value for the given key. Returns undefined if there is no value stored. + */ + get(key: string): T; + + /** + * Set the value for the given key. Returns the new value. + */ + set(key: string, value: T): T; + + /** + * Remove the value for the given key. Returns true if there was a value and false otherwise. + */ + remove(key: string): boolean; + + /** + * Returns an array of all keys in arbitrary order. + */ + keys(): string[]; + + /** + * Returns an array of all values in arbitrary order. + */ + values(): T[]; + + /** + * Returns an array of key-value objects in arbitrary order. + */ + entries(): { key: string; value: T }[]; + + /** + * Calls the function for each key and value pair in the map. The 'this' context is the map itself. + */ + forEach(func: (key: string, value: T) => any): void; + + /** + * Is this map empty? + */ + empty(): boolean; + + /** + * Returns the number of elements stored in the map. + */ + size(): number; + } + + /** + * Constructs an initially empty map. + */ + export function map(): Map; + + /** + * Construct a new map by copying keys and values from the given one. + */ + export function map(object: Map): Map; + + /** + * Construct a new map by copying enumerable properties and values from the given object. + */ + export function map(object: { [key: string]: T }): Map; + + /** + * Construct a new map by copying enumerable properties and values from the given object. + */ + export function map(object: { [key: number]: T }): Map; + + /** + * Construct a new map by copying elements from the array. The key function is used to identify each object. + */ + export function map(array: T[], key: (datum: T, index: number) => string): Map; + + /** + * Construct a new map by copying enumerable properties and values from the given object. + */ + export function map(object: Object): Map; + + /** + * A shim for ES6 sets. Is only able to store strings. + */ + interface Set { + /** + * Is the given string stored in this set? + */ + has(value: string): boolean; + + /** + * Add the string to this set. Returns the value. + */ + add(value: string): string; + + /** + * Remove the given value from the set. Returns true if it was stored, and false otherwise. + */ + remove(value: string): boolean; + + /** + * Returns an array of the strings stored in this set. + */ + values(): string[]; + + /** + * Calls a given function for each value in the set. The return value of the function is ignored. The this context of the function is the set itself. + */ + forEach(func: (value: string) => any): void; + + /** + * Is this set empty? + */ + empty(): boolean; + + /** + * Returns the number of values stored in this set. + */ + size(): number; + } + + /** + * Creates an initially-empty set. + */ + export function set(): Set; + + /** + * Initializes a set from the given array of strings. + */ + export function set(array: string[]): Set; + + /** + * Merges the specified arrays into a single array. + */ + export function merge(arrays: T[][]): T[]; + + /** + * Generates a 0-based numeric sequence. The output range does not include 'stop'. + */ + export function range(stop: number): number[]; + + /** + * Generates a numeric sequence starting from the given start and stop values. 'step' defaults to 1. The output range does not include 'stop'. + */ + export function range(start: number, stop: number, step?: number): number[]; + + /** + * Given the specified array, return an array corresponding to the list of indices in 'keys'. + */ + export function permute(array: { [key: number]: T }, keys: number[]): T[]; + + /** + * Given the specified object, return an array corresponding to the list of property names in 'keys'. + */ + export function permute(object: { [key: string]: T }, keys: string[]): T[]; + + // TODO construct n-tuples from n input arrays + export function zip(...arrays: T[][]): T[][]; + + export function transpose(matrix: T[][]): T[][]; + + /** + * For each adjacent pair of elements in the specified array, returns a new array of tuples of elements i and i - 1. + * Returns the empty array if the input array has fewer than two elements. + */ + export function pairs(array: T[]): Array<[T, T]>; + + interface Nest { + key(func: (datum: T) => string): Nest; + sortKeys(comparator: (a: string, b: string) => number): Nest; + sortValues(comparator: (a: T, b: T) => number): Nest; + rollup(func: (values: T[]) => U): Nest; + map(array: T[]): { [key: string]: any }; + map(array: T[], mapType: typeof d3.map): Map; + entries(array: T[]): { key: string; values: any }[]; + } + + export function nest(): Nest; + + export module random { + export function normal(mean?: number, deviation?: number): () => number; + export function logNormal(mean?: number, deviation?: number): () => number; + export function bates(count: number): () => number; + export function irwinHall(count: number): () => number; + } + + interface Transform { + rotate: number; + translate: [number, number]; + skew: number; + scale: [number, number]; + toString(): string; + } + + export function transform(transform: string): Transform; + + export function format(specifier: string): (n: number) => string; + + interface FormatPrefix { + symbol: string; + scale(n: number): number; + } + + export function formatPrefix(value: number, precision?: number): FormatPrefix; + + export function round(x: number, n?: number): number; + + export function requote(string: string): string; + + export var rgb: { + new (r: number, g: number, b: number): Rgb; + new (color: string): Rgb; + + (r: number, g: number, b: number): Rgb; + (color: string): Rgb; + }; + + interface Rgb extends Color { + r: number; + g: number; + b: number; + + brighter(k?: number): Rgb; + darker(k?: number): Rgb; + + hsl(): Hsl; + + toString(): string; + } + + export var hsl: { + new (h: number, s: number, l: number): Hsl; + new (color: string): Hsl; + + (h: number, s: number, l: number): Hsl; + (color: string): Hsl; + }; + + interface Hsl extends Color { + h: number; + s: number; + l: number; + + brighter(k?: number): Hsl; + darker(k?: number): Hsl; + + rgb(): Rgb; + + toString(): string; + } + + export var hcl: { + new (h: number, c: number, l: number): Hcl; + new (color: string): Hcl; + + (h: number, c: number, l: number): Hcl; + (color: string): Hcl; + }; + + interface Hcl extends Color { + h: number; + c: number; + l: number; + + brighter(k?: number): Hcl; + darker(k?: number): Hcl; + } + + export var lab: { + new (l: number, a: number, b: number): Lab; + new (color: string): Lab; + + (l: number, a: number, b: number): Lab; + (color: string): Lab; + } + + interface Lab extends Color { + l: number; + a: number; + b: number; + + brighter(k?: number): Lab; + darker(k?: number): Lab; + + rgb(): Rgb; + toString(): string; + } + + export var color: { + (): Color; + new (): Color; + }; + + interface Color { + rgb(): Rgb; + } + + export module ns { + interface Qualified { + space: string; + local: string; + } + + export var prefix: { [key: string]: string }; + export function qualify(name: string): Qualified | string; + } + + export function functor(value: T): T; + export function functor(value: T): () => T; + + export function rebind(target: {}, source: {}, ...names: string[]): any; + + export function dispatch(...names: string[]): Dispatch; + + interface Dispatch { + on(type: string): (...args: any[]) => void; + on(type: string, listener: (...args: any[]) => any): Dispatch; + [event: string]: (...args: any[]) => void; + } + + export module scale { + export function identity(): Identity; + + interface Identity { + (n: number): number; + invert(n: number): number; + + domain(): number[]; + domain(numbers: number[]): Identity; + + range(): number[]; + range(numbers: number[]): Identity; + + ticks(count?: number): number[]; + + tickFormat(count?: number, format?: string): (n: number) => string; + + copy(): Identity; + } + + export function linear(): Linear; + export function linear(): Linear; + export function linear(): Linear; + + interface Linear { + (x: number): Output; + invert(y: number): number; + + domain(): number[]; + domain(numbers: number[]): Linear; + + range(): Range[]; + range(values: Range[]): Linear; + + rangeRound(values: number[]): Linear; + + interpolate(): (a: Range, b: Range) => (t: number) => Output; + interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Linear; + + clamp(): boolean; + clamp(clamp: boolean): Linear; + + ticks(count?: number): number[]; + + tickFormat(count?: number, format?: string): (n: number) => string; + + copy(): Linear; + } + + export function sqrt(): Pow; + export function sqrt(): Pow; + export function pow(): Pow; + export function pow(): Pow; + + interface Pow { + (x: number): Output; + + invert(y: number): number; + + domain(): number[]; + domain(numbers: number[]): Pow; + + range(): Range[]; + range(values: Range[]): Pow; + + rangeRound(values: number[]): Pow; + + exponent(): number; + exponent(k: number): Pow; + + interpolate(): (a: Range, b: Range) => (t: number) => Output; + interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Pow; + + clamp(): boolean; + clamp(clamp: boolean): Pow; + + nice(m?: number): Pow; + + ticks(count?: number): number[]; + + tickFormat(count?: number, format?: string): (n: number) => string; + + copy(): Pow; + } + + export function log(): Log; + export function log(): Log; + + interface Log { + (x: number): Output; + + invert(y: number): number; + + domain(): number[]; + domain(numbers: number[]): Log; + + range(): Range[]; + range(values: Range[]): Log; + + rangeRound(values: number[]): Log; + + base(): number; + base(base: number): Log; + + interpolate(): (a: Range, b: Range) => (t: number) => Output; + interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Log; + + clamp(): boolean; + clamp(clamp: boolean): Log; + + nice(): Log; + + ticks(): number[]; + + tickFormat(count?: number, format?: string): (t: number) => string; + + copy(): Log; + } + + export function quantize(): Quantize; + + interface Quantize { + (x: number): T; + + invertExtent(y: T): [number, number]; + + domain(): number[]; + domain(numbers: number[]): Quantize; + + range(): T[]; + range(values: T[]): Quantize; + + copy(): Quantize; + } + + export function quantile(): Quantile; + + interface Quantile { + (x: number): T; + + invertExtent(y: T): [number, number]; + + domain(): number[]; + domain(numbers: number[]): Quantile; + + range(): T[]; + range(values: T[]): Quantile; + + quantiles(): number[]; + + copy(): Quantile; + } + + export function threshold(): Threshold; + export function threshold(): Threshold; + + interface Threshold { + (x: number): Range; + + invertExtent(y: Range): [Domain, Domain]; + + domain(): Domain[]; + domain(domain: Domain[]): Threshold; + + range(): Range[]; + range(values: Range[]): Threshold; + + copy(): Threshold; + } + + export function ordinal(): Ordinal; + export function category10(): Ordinal; + export function category20(): Ordinal; + export function category20b(): Ordinal; + export function category20c(): Ordinal; + + interface Ordinal { + (x: Primitive): T; + + domain(): string[]; + domain(values: Primitive[]): Ordinal; + + range(): T[]; + range(values: T[]): Ordinal; + + rangePoints(interval: [number, number], padding?: number): Ordinal; + rangeRoundPoints(interval: [number, number], padding?: number): Ordinal; + + rangeBands(interval: [number, number], padding?: number, outerPadding?: number): Ordinal; + rangeRoundBands(interval: [number, number], padding?: number, outerPadding?: number): Ordinal; + + rangeBand(): number; + rangeExtent(): [number, number]; + + copy(): Ordinal; + } + } + + export function interpolate(a: number, b: number): (t: number) => number; + export function interpolate(a: string, b: string): (t: number) => string; + export function interpolate(a: string | Color, b: Color): (t: number) => string; + export function interpolate(a: Array, b: Color[]): (t: number) => string; + export function interpolate(a: Range[], b: Output[]): (t: number) => Output[]; + export function interpolate(a: Range[], b: Range[]): (t: number) => Output[]; + export function interpolate(a: { [key: string]: string | Color }, b: { [key: string]: Color }): (t: number) => { [key: string]: string }; + export function interpolate(a: { [key: string]: Range }, b: { [key: string]: Output }): (t: number) => { [key: string]: Output }; + export function interpolate(a: { [key: string]: Range }, b: { [key: string]: Range }): (t: number) => { [key: string]: Output }; + + export function interpolateNumber(a: number, b: number): (t: number) => number; + + export function interpolateRound(a: number, b: number): (t: number) => number; + + export function interpolateString(a: string, b: string): (t: number) => string; + + export function interpolateRgb(a: string | Color, b: string | Color): (t: number) => string; + + export function interpolateHsl(a: string | Color, b: string | Color): (t: number) => string; + + export function interpolateLab(a: string | Color, b: string | Color): (t: number) => string; + + export function interpolateHcl(a: string | Color, b: string | Color): (t: number) => string; + + export function interpolateArray(a: Array, b: Color[]): (t: number) => string[]; + export function interpolateArray(a: Range[], b: Range[]): (t: number) => Output[]; + export function interpolateArray(a: Range[], b: Output[]): (t: number) => Output[]; + + export function interpolateObject(a: { [key: string]: string | Color }, b: { [key: string]: Color }): (t: number) => { [key: string]: string }; + export function interpolateObject(a: { [key: string]: Range }, b: { [key: string]: Output }): (t: number) => { [key: string]: Output }; + export function interpolateObject(a: { [key: string]: Range }, b: { [key: string]: Range }): (t: number) => { [key: string]: Output }; + + export function interpolateTransform(a: string | Transform, b: string | Transform): (t: number) => string; + + export function interpolateZoom(a: [number, number, number], b: [number, number, number]): { + (t: number): [number, number, number]; + duration: number; + }; + + export var interpolators: Array<(a: any, b: any) => (t: number) => any>; + + export module time { + export var second: Interval; + export var minute: Interval; + export var hour: Interval; + export var day: Interval; + export var week: Interval; + export var sunday: Interval; + export var monday: Interval; + export var tuesday: Interval; + export var wednesday: Interval; + export var thursday: Interval; + export var friday: Interval; + export var saturday: Interval; + export var month: Interval; + export var year: Interval; + + interface Interval { + (d: Date): Date; + + floor(d: Date): Date; + + round(d: Date): Date; + + ceil(d: Date): Date; + + range(start: Date, stop: Date, step?: number): Date[]; + + offset(date: Date, step: Date): Date; + + utc: { + (d: Date): Date; + + floor(d: Date): Date; + + round(d: Date): Date; + + ceil(d: Date): Date; + + range(start: Date, stop: Date, step?: number): Date[]; + + offset(date: Date, step: Date): Date; + } + } + + export function seconds(start: Date, stop: Date, step?: number): Date[]; + export function minutes(start: Date, stop: Date, step?: number): Date[]; + export function hours(start: Date, stop: Date, step?: number): Date[]; + export function days(start: Date, stop: Date, step?: number): Date[]; + export function weeks(start: Date, stop: Date, step?: number): Date[]; + export function sundays(start: Date, stop: Date, step?: number): Date[]; + export function mondays(start: Date, stop: Date, step?: number): Date[]; + export function tuesdays(start: Date, stop: Date, step?: number): Date[]; + export function wednesdays(start: Date, stop: Date, step?: number): Date[]; + export function thursdays(start: Date, stop: Date, step?: number): Date[]; + export function fridays(start: Date, stop: Date, step?: number): Date[]; + export function saturdays(start: Date, stop: Date, step?: number): Date[]; + export function months(start: Date, stop: Date, step?: number): Date[]; + export function years(start: Date, stop: Date, step?: number): Date[]; + + export function dayOfYear(d: Date): number; + export function weekOfYear(d: Date): number; + export function sundayOfYear(d: Date): number; + export function mondayOfYear(d: Date): number; + export function tuesdayOfYear(d: Date): number; + export function wednesdayOfYear(d: Date): number; + export function fridayOfYear(d: Date): number; + export function saturdayOfYear(d: Date): number; + + export function format(specifier: string): Format; + + export module format { + export function multi(formats: Array<[string, (d: Date) => boolean]>): Format; + export function utc(specifier: string): Format; + export var iso: Format; + } + + interface Format { + (d: Date): string; + parse(input: string): Date; + } + + export function scale(): Scale; + export function scale(): Scale; + export function scale(): Scale; + + export module scale { + export function utc(): Scale; + export function utc(): Scale; + export function utc(): Scale; + } + + + interface Scale { + (x: Date): Output; + + invert(y: number): Date; + + domain(): Date[]; + domain(dates: number[]): Scale; + domain(dates: Date[]): Scale; + + nice(): Scale; + nice(interval: Interval, step?: number): Scale; + + range(): Range[]; + range(values: Range[]): Scale; + + rangeRound(values: number[]): Scale; + + interpolate(): (a: Range, b: Range) => (t: number) => Output; + interpolate(factory: (a: Range, b: Range) => (t: number) => Output): Scale; + + clamp(): boolean; + clamp(clamp: boolean): Scale; + + ticks(): Date[]; + ticks(interval: Interval, step?: number): Date[]; + ticks(count: number): Date[]; + + tickFormat(count: number): (d: Date) => string; + + copy(): Scale; + } + } + + export module behavior { + export function drag(): Drag; + + interface Drag { + (selection: Selection): void; + + on(type: string): (d: Datum, i: number) => any; + on(type: string, listener: (d: Datum, i: number) => any): Drag; + + origin(): (d: Datum, i: number) => { x: number; y: number }; + origin(accessor: (d: Datum, i: number) => { x: number; y: number }): Drag; + } + + export function zoom(): Zoom; + + module zoom { + interface Scale { + domain(): number[]; + domain(values: number[]): Scale; + + invert(y: number): number; + + range(values: number[]): Scale; + range(): number[]; + } + } + + interface Zoom { + (selection: Selection): void; + + translate(): [number, number]; + translate(translate: [number, number]): Zoom; + + scale(): number; + scale(scale: number): Zoom; + + scaleExtent(): [number, number]; + scaleExtent(extent: [number, number]): Zoom; + + center(): [number, number]; + center(center: [number, number]): Zoom; + + size(): [number, number]; + size(size: [number, number]): Zoom; + + x(): zoom.Scale; + x(x: zoom.Scale): Zoom; + + y(): zoom.Scale; + y(y: zoom.Scale): Zoom; + + on(type: string): (d: Datum, i: number) => any; + on(type: string, listener: (d: Datum, i: number) => any): Zoom; + + event(selection: Selection): void; + event(transition: Transition): void; + } + } + + export module geo { + export function path(): Path; + + interface Path { + (feature: any, index?: number): string; + + area(feature: any): number; + + centroid(feature: any): [number, number]; + + bounds(feature: any): [[number, number], [number, number]]; + + projection(): Transform | ((coordinates: [number, number]) => [number, number]); + projection(stream: Transform): Path; + projection(projection: (coordinates: [number, number]) => [number, number]): Path; + + pointRadius(): number | ((datum: any, index: number) => number); + pointRadius(radius: number): Path; + pointRadius(radius: (datum: any, index: number) => number): Path; + + context(): CanvasRenderingContext2D; + context(context: CanvasRenderingContext2D): Path; + } + + export function graticule(): Graticule; + + interface Graticule { + (): any; + + lines(): any[]; + + outline(): any; + + extent(): [[number, number], [number, number]]; + extent(extent: [[number, number], [number, number]]): Graticule; + + majorExtent(): [[number, number], [number, number]]; + majorExtent(extent: [[number, number], [number, number]]): Graticule; + + minorExtent(): [[number, number], [number, number]]; + minorExtent(extent: [[number, number], [number, number]]): Graticule; + + step(): [number, number]; + step(step: [number, number]): Graticule; + + majorStep(): [number, number]; + majorStep(step: [number, number]): Graticule; + + minorStep(): [number, number]; + minorStep(step: [number, number]): Graticule; + + precision(): number; + precision(precision: number): Graticule; + } + + export function circle(): Circle; + + interface Circle { + (...args: any[]): any; + + origin(): [number, number] | ((...args: any[]) => [number, number]); + origin(origin: [number, number]): Circle; + origin(origin: (...args: any[]) => [number, number]): Circle; + + angle(): number; + angle(angle: number): Circle; + + precision(): number; + precision(precision: number): Circle; + } + + export function area(feature: any): number; + export function centroid(feature: any): [number, number]; + export function bounds(feature: any): [[number, number], [number, number]]; + export function distance(a: [number, number], b: [number, number]): number; + export function length(feature: any): number; + export function interpolate(a: [number, number], b: [number, number]): (t: number) => [number, number]; + + export function rotation(rotate: [number, number] | [number, number, number]): Rotation; + + interface Rotation { + (location: [number, number]): [number, number]; + invert(location: [number, number]): [number, number]; + } + + export function stream(object: any, listener: Listener): void; + + interface Listener { + point(x: number, y: number, z: number): void; + lineStart(): void; + lineEnd(): void; + polygonStart(): void; + polygonEnd(): void; + sphere(): void; + } + + export function transform(methods: TransformMethods): Transform; + + interface TransformMethods { + point?(x: number, y: number, z: number): void; + lineStart?(): void; + lineEnd?(): void; + polygonStart?(): void; + polygonEnd?(): void; + sphere?(): void; + } + + interface Transform { + stream(stream: Listener): Listener; + } + + export function clipExtent(): ClipExtent; + + interface ClipExtent extends Transform { + extent(): [[number, number], [number, number]]; + extent(extent: [[number, number], [number, number]]): ClipExtent; + } + + export function projection(raw: RawInvertibleProjection): InvertibleProjection; + export function projection(raw: RawProjection): Projection; + + export function projectionMutator(factory: (...args: any[]) => RawInvertibleProjection): (...args: any[]) => InvertibleProjection; + export function projectionMutator(factory: (...args: any[]) => RawProjection): (...args: any[]) => Projection; + + export function albers(): ConicProjection; + export function albersUsa(): ConicProjection; + export function azimuthalEqualArea(): InvertibleProjection; + module azimuthalEqualArea { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function azimuthalEquidistant(): InvertibleProjection; + module azimuthalEquidistant { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function conicConformal(): ConicProjection; + module conicConformal { + export function raw(phi0: number, phi1: number): RawInvertibleProjection; + } + + export function conicEqualArea(): ConicProjection; + module conicEqualArea { + export function raw(phi0: number, phi1: number): RawInvertibleProjection; + } + + export function conicEquidistant(): ConicProjection; + module conicEquidistant { + export function raw(phi0: number, phi1: number): RawInvertibleProjection; + } + + export function equirectangular(): InvertibleProjection; + module equirectangular { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function gnomonic(): InvertibleProjection; + module gnomonic { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function mercator(): InvertibleProjection; + module mercator { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function orthographic(): InvertibleProjection; + module orthographic { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function stereographic(): InvertibleProjection; + module stereographic { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + export function transverseMercator(): InvertibleProjection; + module transverseMercator { + export function raw(lambda: number, phi: number): [number, number]; + module raw { + export function invert(x: number, y: number): [number, number]; + } + } + + interface Projection { + (location: [number, number]): [number, number]; + + rotate(): [number, number, number]; + rotate(rotation: [number, number, number]): Projection; + + center(): [number, number]; + center(location: [number, number]): Projection; + + translate(): [number, number]; + translate(point: [number, number]): Projection; + + scale(): number; + scale(scale: number): Projection; + + clipAngle(): number; + clipAngle(angle: number): Projection; + + clipExtent(): [[number, number], [number, number]]; + clipExtent(extent: [[number, number], [number, number]]): Projection; + + precision(): number; + precision(precision: number): Projection; + + stream(listener: Listener): Listener; + } + + interface InvertibleProjection extends Projection { + invert(point: [number, number]): [number, number]; + } + + interface ConicProjection extends InvertibleProjection { + parallels(): [number, number]; + parallels(parallels: [number, number]): ConicProjection; + + rotate(): [number, number, number]; + rotate(rotation: [number, number, number]): ConicProjection; + + center(): [number, number]; + center(location: [number, number]): ConicProjection; + + translate(): [number, number]; + translate(point: [number, number]): ConicProjection; + + scale(): number; + scale(scale: number): ConicProjection; + + clipAngle(): number; + clipAngle(angle: number): ConicProjection; + + clipExtent(): [[number, number], [number, number]]; + clipExtent(extent: [[number, number], [number, number]]): ConicProjection; + + precision(): number; + precision(precision: number): ConicProjection; + } + + interface RawProjection { + (lambda: number, phi: number): [number, number]; + } + + interface RawInvertibleProjection extends RawProjection { + invert(x: number, y: number): [number, number]; + } + } + + module svg { + export function line(): Line<[number, number]>; + export function line(): Line; + + interface Line { + (data: T[]): string; + + x(): number | ((d: T, i: number) => number); + x(x: number): Line; + x(x: (d: T, i: number) => number): Line; + + y(): number | ((d: T, i: number) => number); + y(x: number): Line; + y(y: (d: T, i: number) => number): Line; + + interpolate(): string | ((points: Array<[number, number]>) => string); + interpolate(interpolate: "linear"): Line; + interpolate(interpolate: "linear-closed"): Line; + interpolate(interpolate: "step"): Line; + interpolate(interpolate: "step-before"): Line; + interpolate(interpolate: "step-after"): Line; + interpolate(interpolate: "basis"): Line; + interpolate(interpolate: "basis-open"): Line; + interpolate(interpolate: "basis-closed"): Line; + interpolate(interpolate: "bundle"): Line; + interpolate(interpolate: "cardinal"): Line; + interpolate(interpolate: "cardinal-open"): Line; + interpolate(interpolate: "cardinal-closed"): Line; + interpolate(interpolate: "monotone"): Line; + interpolate(interpolate: string): Line; + interpolate(interpolate: (points: Array<[number, number]>) => string): Line; + + tension(): number; + tension(tension: number): Line; + + defined(): (d: T, i: number) => boolean; + defined(defined: (d: T, i: number) => boolean): Line; + } + + module line { + export function radial(): Radial<[number, number]>; + export function radial(): Radial; + + interface Radial { + (data: T[]): string; + + radius(): number | ((d: T, i: number) => number); + radius(radius: number): Radial; + radius(radius: (d: T, i: number) => number): Radial; + + angle(): number | ((d: T, i: number) => number); + angle(angle: number): Radial; + angle(angle: (d: T, i: number) => number): Radial; + + interpolate(): string | ((points: Array<[number, number]>) => string); + interpolate(interpolate: "linear"): Radial; + interpolate(interpolate: "linear-closed"): Radial; + interpolate(interpolate: "step"): Radial; + interpolate(interpolate: "step-before"): Radial; + interpolate(interpolate: "step-after"): Radial; + interpolate(interpolate: "basis"): Radial; + interpolate(interpolate: "basis-open"): Radial; + interpolate(interpolate: "basis-closed"): Radial; + interpolate(interpolate: "bundle"): Radial; + interpolate(interpolate: "cardinal"): Radial; + interpolate(interpolate: "cardinal-open"): Radial; + interpolate(interpolate: "cardinal-closed"): Radial; + interpolate(interpolate: "monotone"): Radial; + interpolate(interpolate: string): Radial; + interpolate(interpolate: (points: Array<[number, number]>) => string): Radial; + + tension(): number; + tension(tension: number): Radial; + + defined(): (d: T, i: number) => boolean; + defined(defined: (d: T, i: number) => boolean): Radial; + } + } + + export function area(): Area<[number, number]>; + export function area(): Area; + + interface Area { + (data: T[]): string; + + x(): number | ((d: T, i: number) => number); + x(x: number): Area; + x(x: (d: T, i: number) => number): Area; + + x0(): number | ((d: T, i: number) => number); + x0(x0: number): Area; + x0(x0: (d: T, i: number) => number): Area; + + x1(): number | ((d: T, i: number) => number); + x1(x1: number): Area; + x1(x1: (d: T, i: number) => number): Area; + + y(): number | ((d: T, i: number) => number); + y(y: number): Area; + y(y: (d: T, i: number) => number): Area; + + y0(): number | ((d: T, i: number) => number); + y0(y0: number): Area; + y0(y0: (d: T, i: number) => number): Area; + + y1(): number | ((d: T, i: number) => number); + y1(y1: number): Area; + y1(y1: (d: T, i: number) => number): Area; + + interpolate(): string | ((points: Array<[number, number]>) => string); + interpolate(interpolate: "linear"): Area; + interpolate(interpolate: "step"): Area; + interpolate(interpolate: "step-before"): Area; + interpolate(interpolate: "step-after"): Area; + interpolate(interpolate: "basis"): Area; + interpolate(interpolate: "basis-open"): Area; + interpolate(interpolate: "cardinal"): Area; + interpolate(interpolate: "cardinal-open"): Area; + interpolate(interpolate: "monotone"): Area; + interpolate(interpolate: string): Area; + + tension(): number; + tension(tension: number): Area; + + defined(): (d: T, i: number) => boolean; + defined(): (d: T, i: number) => boolean; + } + + module area { + export function radial(): Radial<[number, number]>; + export function radial(): Radial; + + interface Radial { + (data: T[]): string; + + radius(): number | ((d: T, i: number) => number); + radius(radius: number): Radial; + radius(radius: (d: T, i: number) => number): Radial; + + innerRadius(): number | ((d: T, i: number) => number); + innerRadius(innerRadius: number): Radial; + innerRadius(innerRadius: (d: T, i: number) => number): Radial; + + outerRadius(): number | ((d: T, i: number) => number); + outerRadius(outerRadius: number): Radial; + outerRadius(outerRadius: (d: T, i: number) => number): Radial; + + angle(): number | ((d: T, i: number) => number); + angle(angle: number): Radial; + angle(angle: (d: T, i: number) => number): Radial; + + startAngle(): number | ((d: T, i: number) => number); + startAngle(startAngle: number): Radial; + startAngle(startAngle: (d: T, i: number) => number): Radial; + + endAngle(): number | ((d: T, i: number) => number); + endAngle(endAngle: number): Radial; + endAngle(endAngle: (d: T, i: number) => number): Radial; + + interpolate(): string | ((points: Array<[number, number]>) => string); + interpolate(interpolate: "linear"): Radial; + interpolate(interpolate: "step"): Radial; + interpolate(interpolate: "step-before"): Radial; + interpolate(interpolate: "step-after"): Radial; + interpolate(interpolate: "basis"): Radial; + interpolate(interpolate: "basis-open"): Radial; + interpolate(interpolate: "cardinal"): Radial; + interpolate(interpolate: "cardinal-open"): Radial; + interpolate(interpolate: "monotone"): Radial; + interpolate(interpolate: string): Radial; + interpolate(interpolate: (points: Array<[number, number]>) => string): Radial; + + tension(): number; + tension(tension: number): Radial; + + defined(): (d: T, i: number) => boolean; + defined(): (d: T, i: number) => boolean; + } + } + + export function arc(): Arc; + export function arc(): Arc; + + module arc { + interface Arc { + innerRadius: number; + outerRadius: number; + startAngle: number; + endAngle: number; + padAngle: number + } + } + + interface Arc { + (d: T, i: number): string; + + innerRadius(): (d: T, i: number) => number; + innerRadius(radius: number): Arc; + innerRadius(radius: (d: T, i: number) => number): Arc; + + outerRadius(): (d: T, i: number) => number; + outerRadius(radius: number): Arc; + outerRadius(radius: (d: T, i: number) => number): Arc; + + cornerRadius(): (d: T, i: number) => number; + cornerRadius(radius: number): Arc; + cornerRadius(radius: (d: T, i: number) => number): Arc; + + padRadius(): string | ((d: T, i: number) => number); + padRadius(radius: "auto"): Arc; + padRadius(radius: string): Arc; + padRadius(radius: (d: T, i: number) => number): Arc; + + startAngle(): (d: T, i: number) => number; + startAngle(angle: number): Arc; + startAngle(angle: (d: T, i: number) => number): Arc; + + endAngle(): (d: T, i: number) => number; + endAngle(angle: number): Arc; + endAngle(angle: (d: T, i: number) => number): Arc; + + padAngle(): (d: T, i: number) => number; + padAngle(angle: number): Arc; + padAngle(angle: (d: T, i: number) => number): Arc; + + centroid(d: T, i?: number): [number, number]; + } + + export function symbol(): Symbol<{}>; + export function symbol(): Symbol; + + interface Symbol { + (d: T, i: number): string; + + type(): (d: T, i: number) => string; + type(type: string): Symbol; + type(type: (d: T, i: number) => string): Symbol; + + size(): (d: T, i: string) => number; + size(size: number): Symbol; + size(size: (d: T, i: number) => number): Symbol; + } + + export var symbolTypes: string[]; + + export function chord(): Chord, chord.Node>; + export function chord(): Chord, Node>; + export function chord(): Chord; + + module chord { + interface Link { + source: Node; + target: Node; + } + + interface Node { + radius: number; + startAngle: number; + endAngle: number + } + } + + interface Chord { + (d: Link, i: number): string; + + source(): (d: Link, i: number) => Node; + source(source: Node): Chord; + source(source: (d: Link, i: number) => Node): Chord; + + target(): (d: Link, i: number) => Node; + target(target: Node): Chord; + target(target: (d: Link, i: number) => Node): Chord; + + radius(): (d: Node, i: number) => number; + radius(radius: number): Chord; + radius(radius: (d: Node, i: number) => number): Chord; + + startAngle(): (d: Node, i: number) => number; + startAngle(angle: number): Chord; + startAngle(angle: (d: Node, i: number) => number): Chord; + + endAngle(): (d: Node, i: number) => number; + endAngle(angle: number): Chord; + endAngle(angle: (d: Node, i: number) => number): Chord; + } + + export function diagonal(): Diagonal, diagonal.Node>; + export function diagonal(): Diagonal, Node>; + export function diagonal(): Diagonal; + + module diagonal { + interface Link { + source: Node; + target: Node; + } + + interface Node { + x: number; + y: number; + } + } + + interface Diagonal { + (d: Link, i: number): string; + + source(): (d: Link, i: number) => Node; + source(source: Node): Diagonal; + source(source: (d: Link, i: number) => Node): Diagonal; + + target(): (d: Link, i: number) => Node; + target(target: Node): Diagonal; + target(target: (d: Link, i: number) => Node): Diagonal; + + projection(): (d: Node, i: number) => [number, number]; + projection(projection: (d: Node, i: number) => [number, number]): Diagonal; + } + + module diagonal { + export function radial(): Radial, Node>; + export function radial(): Radial, Node>; + export function radial(): Radial; + + interface Radial { + (d: Link, i: number): string; + + source(): (d: Link, i: number) => Node; + source(source: Node): Radial; + source(source: (d: Link, i: number) => Node): Radial; + + target(): (d: Link, i: number) => Node; + target(target: Node): Radial; + target(target: (d: Link, i: number) => Node): Radial; + + projection(): (d: Node, i: number) => [number, number]; + projection(projection: (d: Node, i: number) => [number, number]): Radial; + } + } + + export function axis(): Axis; + + interface Axis { + (selection: Selection): void; + (selection: Transition): void; + + scale(): any; + scale(scale: any): Axis; + + orient(): string; + orient(orientation: string): Axis; + + ticks(): any[]; + ticks(...args: any[]): Axis; + + tickValues(): any[]; + tickValues(values: any[]): Axis; + + tickSize(): number; + tickSize(size: number): Axis; + tickSize(inner: number, outer: number): Axis; + + innerTickSize(): number; + innerTickSize(size: number): Axis; + + outerTickSize(): number; + outerTickSize(size: number): Axis; + + tickPadding(): number; + tickPadding(padding: number): Axis; + + tickFormat(): (t: any) => string; + tickFormat(format: (t: any) => string): Axis; + } + + export function brush(): Brush; + export function brush(): Brush; + + module brush { + interface Scale { + domain(): number[]; + domain(domain: number[]): Scale; + + range(): number[]; + range(range: number[]): Scale; + + invert?(y: number): number; + } + } + + interface Brush { + (selection: Selection): void; + (selection: Transition): void; + + event(selection: Selection): void; + event(selection: Transition): void; + + x(): brush.Scale; + x(x: brush.Scale): Brush; + + y(): brush.Scale; + y(y: brush.Scale): Brush; + + extent(): [number, number] | [[number, number], [number, number]]; + extent(extent: [number, number] | [[number, number], [number, number]]): Brush; + + clamp(): boolean | [boolean, boolean]; + clamp(clamp: boolean | [boolean, boolean]): Brush; + + clear(): void; + + empty(): boolean; + + on(type: 'brushstart'): (datum: T, index: number) => void; + on(type: 'brush'): (datum: T, index: number) => void; + on(type: 'brushend'): (datum: T, index: number) => void; + on(type: string): (datum: T, index: number) => void; + + on(type: 'brushstart', listener: (datum: T, index: number) => void): Brush; + on(type: 'brush', listener: (datum: T, index: number) => void): Brush; + on(type: 'brushend', listener: (datum: T, index: number) => void): Brush; + on(type: string, listener: (datum: T, index: number) => void): Brush; + } + } + + export function xhr(url: string, mimeType?: string, callback?: (err: any, data: any) => void): Xhr; + export function xhr(url: string, callback: (err: any, data: any) => void): Xhr; + + interface Xhr { + header(name: string): string; + header(name: string, value: string): Xhr; + + mimeType(): string; + mimeType(type: string): Xhr; + + responseType(): string; + responseType(type: string): Xhr; + + response(): (request: XMLHttpRequest) => any; + response(value: (request: XMLHttpRequest) => any): Xhr; + + get(callback?: (err: any, data: any) => void): Xhr; + + post(data?: any, callback?: (err: any, data: any) => void): Xhr; + post(callback: (err: any, data: any) => void): Xhr; + + send(method: string, data?: any, callback?: (err: any, data: any) => void): Xhr; + send(method: string, callback: (err: any, data: any) => void): Xhr; + + abort(): Xhr; + + on(type: "beforesend"): (request: XMLHttpRequest) => void; + on(type: "progress"): (request: XMLHttpRequest) => void; + on(type: "load"): (response: any) => void; + on(type: "error"): (err: any) => void; + on(type: string): (...args: any[]) => void; + + on(type: "beforesend", listener: (request: XMLHttpRequest) => void): Xhr; + on(type: "progress", listener: (request: XMLHttpRequest) => void): Xhr; + on(type: "load", listener: (response: any) => void): Xhr; + on(type: "error", listener: (err: any) => void): Xhr; + on(type: string, listener: (...args: any[]) => void): Xhr; + } + + export function text(url: string, mimeType?: string, callback?: (err: any, data: string) => void): Xhr; + export function text(url: string, callback: (err: any, data: string) => void): Xhr; + + export function json(url: string, callback?: (err: any, data: any) => void): Xhr; + + export function xml(url: string, mimeType?: string, callback?: (err: any, data: any) => void): Xhr; + export function xml(url: string, callback: (err: any, data: any) => void): Xhr; + + export function html(url: string, callback?: (err: any, data: DocumentFragment) => void): Xhr; + + export var csv: Dsv; + export var tsv: Dsv; + export function dsv(delimiter: string, mimeType: string): Dsv; + + interface Dsv { + (url: string, callback: (rows: { [key: string]: string }[]) => void): DsvXhr<{ [key: string]: string }>; + (url: string, callback: (error: any, rows: { [key: string]: string }[]) => void): DsvXhr<{ [key: string]: string }>; + (url: string): DsvXhr<{ [key: string]: string }>; + (url: string, accessor: (row: { [key: string]: string }) => T, callback: (rows: T[]) => void): DsvXhr; + (url: string, accessor: (row: { [key: string]: string }) => T, callback: (error: any, rows: T[]) => void): DsvXhr; + (url: string, accessor: (row: { [key: string]: string }) => T): DsvXhr; + + parse(string: string): { [key: string]: string }[]; + parse(string: string, accessor: (row: { [key: string]: string }, index: number) => T): T[]; + + parseRows(string: string): string[][]; + parseRows(string: string, accessor: (row: string[], index: number) => T): T[]; + + format(rows: Object[]): string; + + formatRows(rows: string[][]): string; + } + + interface DsvXhr extends Xhr { + row(): (row: { [key: string]: string }) => T; + row(accessor: (row: { [key: string]: string }) => U): DsvXhr; + + header(name: string): string; + header(name: string, value: string): DsvXhr; + + mimeType(): string; + mimeType(type: string): DsvXhr; + + responseType(): string; + responseType(type: string): DsvXhr; + + response(): (request: XMLHttpRequest) => any; + response(value: (request: XMLHttpRequest) => any): DsvXhr; + + get(callback?: (err: any, data: T) => void): DsvXhr; + post(data?: any, callback?: (err: any, data: T) => void): DsvXhr; + post(callback: (err: any, data: T) => void): DsvXhr; + + send(method: string, data?: any, callback?: (err: any, data: T) => void): DsvXhr; + send(method: string, callback: (err: any, data: T) => void): DsvXhr; + + abort(): DsvXhr; + + on(type: "beforesend"): (request: XMLHttpRequest) => void; + on(type: "progress"): (request: XMLHttpRequest) => void; + on(type: "load"): (response: T) => void; + on(type: "error"): (err: any) => void; + on(type: string): (...args: any[]) => void; + + on(type: "beforesend", listener: (request: XMLHttpRequest) => void): DsvXhr; + on(type: "progress", listener: (request: XMLHttpRequest) => void): DsvXhr; + on(type: "load", listener: (response: T) => void): DsvXhr; + on(type: "error", listener: (err: any) => void): DsvXhr; + on(type: string, listener: (...args: any[]) => void): DsvXhr; + } + + export function locale(definition: LocaleDefinition): Locale; + + interface LocaleDefinition { + decimal: string; + thousands: string; + grouping: number[]; + currency: [string, string]; + dateTime: string; + date: string; + time: string; + periods: [string, string]; + days: [string, string, string, string, string, string, string]; + shortDays: [string, string, string, string, string, string, string]; + months: [string, string, string, string, string, string, string, string, string, string, string, string]; + shortMonths: [string, string, string, string, string, string, string, string, string, string, string, string]; + } + + interface Locale { + numberFormat(specifier: string): (n: number) => string; + timeFormat: { + (specifier: string): time.Format; + utc(specifier: string): time.Format; + } + } + + module layout { + export function bundle(): Bundle; + export function bundle(): Bundle + + module bundle { + interface Node { + parent: Node; + } + + interface Link { + source: T; + target: T; + } + } + + interface Bundle { + (links: bundle.Link[]): T[][]; + } + + export function chord(): Chord; + + module chord { + interface Link { + source: Node; + target: Node; + } + + interface Node { + index: number; + subindex: number; + startAngle: number; + endAngle: number; + value: number; + } + + interface Group { + index: number; + startAngle: number; + endAngle: number; + value: number; + } + } + + interface Chord { + matrix(): number[][]; + matrix(matrix: number[][]): Chord; + + padding(): number; + padding(padding: number): Chord; + + sortGroups(): (a: number, b: number) => number; + sortGroups(comparator: (a: number, b: number) => number): Chord; + + sortSubgroups(): (a: number, b: number) => number; + sortSubgroups(comparator: (a: number, b: number) => number): Chord; + + sortChords(): (a: number, b: number) => number; + sortChords(comparator: (a: number, b: number) => number): Chord; + + chords(): chord.Link[]; + groups(): chord.Group[]; + } + + export function cluster(): Cluster; + export function cluster(): Cluster; + + module cluster { + interface Result { + parent?: Result; + children?: Result[]; + depth?: number; + x?: number; + y?: number; + } + + interface Link { + source: T; + target: T; + } + } + + interface Cluster { + (root: T): T[]; + + nodes(root: T): T[]; + + links(nodes: T[]): cluster.Link; + + children(): (node: T) => T[]; + children(accessor: (node: T) => T[]): Cluster; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Cluster; + + separation(): (a: T, b: T) => number; + separation(separation: (a: T, b: T) => number): Cluster; + + size(): [number, number]; + size(size: [number, number]): Cluster; + + nodeSize(): [number, number]; + nodeSize(nodeSize: [number, number]): Cluster; + + value(): (a: T) => number; + value(value: (a: T) => number): Cluster; + } + + export function force(): Force, force.Node>; + export function force(): Force, Node>; + export function force, Node extends force.Node>(): Force; + + module force { + interface Link { + source: T; + target: T; + } + + interface Node { + index?: number; + x?: number; + y?: number; + px?: number; + py?: number; + fixed?: boolean; + weight?: number; + } + + interface Event { + type: string; + alpha: number; + } + } + + interface Force, Node extends force.Node> { + size(): [number, number]; + size(size: [number, number]): Force; + + linkDistance(): number | ((link: Link, index: number) => number); + linkDistance(distance: number): Force; + linkDistance(distance: (link: Link, index: number) => number): Force; + + linkStrength(): number | ((link: Link, index: number) => number); + linkStrength(strength: number): Force; + linkStrength(strength: (link: Link, index: number) => number): Force; + + friction(): number; + friction(friction: number): Force; + + charge(): number | ((node: Node, index: number) => number); + charge(charge: number): Force; + charge(charge: (node: Node, index: number) => number): Force; + + chargeDistance(): number; + chargeDistance(distance: number): Force; + + theta(): number; + theta(theta: number): Force; + + gravity(): number; + gravity(gravity: number): Force; + + nodes(): Node[]; + nodes(nodes: Node[]): Force; + + links(): Link[]; + links(links: { source: number; target: number }[]): Force; + links(links: Link[]): Force; + + start(): Force; + + alpha(): number; + alpha(value: number): Force; + + resume(): Force; + + stop(): Force; + + on(type: string): (event: force.Event) => void; + on(type: string, listener: (event: force.Event) => void): Force; + + drag(): behavior.Drag; + drag(selection: Selection): void; + } + + export function hierarchy(): Hierarchy; + export function hierarchy(): Hierarchy; + + module hierarchy { + interface Result { + parent?: Result; + children?: Result[]; + value?: number; + depth?: number; + } + } + + interface Hierarchy { + (root: T): T[]; + + children(): (node: T) => T[]; + children(accessor: (node: T) => T[]): Hierarchy; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Hierarchy; + + value(): (node: T) => number; + value(accessor: (node: T) => number): Hierarchy; + + revalue(root: T): T[]; + } + + export function histogram(): Histogram; + export function histogram(): Histogram; + + module histogram { + interface Bin extends Array { + x: number; + dx: number; + y: number; + } + } + + interface Histogram { + (values: T[], index?: number): histogram.Bin[]; + + value(): (datum: T, index: number) => number; + value(value: (datum: T, index: number) => number): Histogram; + + range(): (values: T[], index: number) => [number, number]; + range(range: (values: T[], index: number) => [number, number]): Histogram; + + bins(): (range: [number, number], values: T[], index: number) => number[]; + bins(count: number): Histogram; + bins(thresholds: number[]): Histogram; + bins(func: (range: [number, number], values: T[], index: number) => number[]): Histogram; + + frequency(): boolean; + frequency(frequency: boolean): Histogram; + } + + export function pack(): Pack; + export function pack(): Pack; + + module pack { + interface Node { + parent?: Node; + children?: Node[]; + value?: number; + depth?: number; + x?: number; + y?: number; + r?: number; + } + + interface Link { + source: Node; + target: Node; + } + } + + interface Pack { + (root: T): T[]; + + nodes(root: T): T[]; + + links(nodes: T[]): pack.Link[]; + + children(): (node: T, depth: number) => T[]; + children(children: (node: T, depth: number) => T[]): Pack; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Pack; + + value(): (node: T) => number; + value(value: (node: T) => number): Pack; + + size(): [number, number]; + size(size: [number, number]): Pack; + + radius(): number | ((node: T) => number); + radius(radius: number): Pack; + radius(radius: (node: T) => number): Pack; + + padding(): number; + padding(padding: number): Pack; + } + + export function pie(): Pie; + export function pie(): Pie; + + module pie { + interface Arc { + value: number; + startAngle: number; + endAngle: number; + padAngle: number; + data: T; + } + } + + interface Pie { + (data: T[], index?: number): pie.Arc[]; + + value(): (datum: T, index: number) => number; + value(accessor: (datum: T, index: number) => number): Pie; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Pie; + + startAngle(): number | ((data: T[], index: number) => number); + startAngle(angle: number): Pie; + startAngle(angle: (data: T[], index: number) => number): Pie; + + endAngle(): number | ((data: T[], index: number) => number); + endAngle(angle: number): Pie; + endAngle(angle: (data: T[], index: number) => number): Pie; + + padAngle(): number | ((data: T[], index: number) => number); + padAngle(angle: number): Pie; + padAngle(angle: (data: T[], index: number) => number): Pie; + } + + export function stack(): Stack; + export function stack(): Stack; + export function stack(): Stack; + module stack { + interface Value { + x: number; + y: number; + y0?: number; + } + } + + interface Stack { + (layers: Series[], index?: number): Series[]; + + values(): (layer: Series, index: number) => Value[]; + values(accessor: (layer: Series, index: number) => Value[]): Stack; + + offset(): (data: Array<[number, number]>) => number[]; + offset(offset: "silhouette"): Stack; + offset(offset: "wiggle"): Stack; + offset(offset: "expand"): Stack; + offset(offset: "zero"): Stack; + offset(offset: string): Stack; + offset(offset: (data: Array<[number, number]>) => number[]): Stack; + + order(): (data: Array<[number, number]>) => number[]; + order(order: "inside-out"): Stack; + order(order: "reverse"): Stack; + order(order: "default"): Stack; + order(order: string): Stack; + order(order: (data: Array<[number, number]>) => number[]): Stack; + + x(): (value: Value, index: number) => number; + x(accessor: (value: Value, index: number) => number): Stack; + + y(): (value: Value, index: number) => number; + y(accesor: (value: Value, index: number) => number): Stack; + + out(): (value: Value, y0: number, y: number) => void; + out(setter: (value: Value, y0: number, y: number) => void): Stack; + } + + export function tree(): Tree; + export function tree(): Tree; + + module tree { + interface Link { + source: T; + target: T; + } + + interface Node { + parent?: Node; + children?: Node[]; + depth?: number; + x?: number; + y?: number; + } + } + + interface Tree { + (root: T, index?: number): T[]; + + nodes(root: T, index?: number): T[]; + + links(nodes: T[]): tree.Link[]; + + children(): (datum: T, index: number) => T[]; + children(children: (datum: T, index: number) => T[]): Tree; + + separation(): (a: T, b: T) => number; + separation(separation: (a: T, b: T) => number): Tree; + + size(): [number, number]; + size(size: [number, number]): Tree; + + nodeSize(): [number, number]; + nodeSize(size: [number, number]): Tree; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Tree; + + value(): (datum: T, index: number) => number; + value(value: (datum: T, index: number) => number): Tree; + } + + export function treemap(): Treemap; + export function treemap(): Treemap; + + module treemap { + interface Node { + parent?: Node; + children?: Node[]; + value?: number; + depth?: number; + x?: number; + y?: number; + dx?: number; + dy?: number; + } + + interface Link { + source: T; + target: T; + } + + type Padding = number | [number, number, number, number]; + } + + interface Treemap { + (root: T, index?: number): T[]; + + nodes(root: T, index?: number): T[]; + + links(nodes: T[]): treemap.Link[]; + + children(): (node: T, depth: number) => T[]; + children(children: (node: T, depth: number) => T[]): Treemap; + + sort(): (a: T, b: T) => number; + sort(comparator: (a: T, b: T) => number): Treemap; + + value(): (node: T, index: number) => number; + value(value: (node: T, index: number) => number): Treemap; + + size(): [number, number]; + size(size: [number, number]): Treemap; + + padding(): (node: T, depth: number) => treemap.Padding; + padding(padding: treemap.Padding): Treemap; + padding(padding: (node: T, depth: number) => treemap.Padding): Treemap; + + round(): boolean; + round(round: boolean): Treemap; + + sticky(): boolean; + sticky(sticky: boolean): boolean; + + mode(): string; + mode(mode: "squarify"): Treemap; + mode(mode: "slice"): Treemap; + mode(mode: "dice"): Treemap; + mode(mode: "slice-dice"): Treemap; + mode(mode: string): Treemap; + + ratio(): number; + ratio(ratio: number): Treemap; + } + } + + module geom { + export function voronoi(): Voronoi<[number, number]>; + export function voronoi(): Voronoi; + + module voronoi { + interface Link { + source: T; + target: T; + } + } + + interface Voronoi { + (data: T[]): Array<[number, number]>; + + x(): (vertex: T) => number; + x(x: (vertex: T) => number): Voronoi; + + y(): (vertex: T) => number; + y(y: (vertex: T) => number): Voronoi; + + clipExtent(): [[number, number], [number, number]]; + clipExtent(extent: [[number, number], [number, number]]): Voronoi; + + links(data: T[]): voronoi.Link[]; + + triangles(data: T[]): Array<[T, T, T]>; + } + + /** + * @deprecated use d3.geom.voronoi().triangles() instead + */ + export function delaunay(vertices: Array<[number, number]>): Array<[[number, number], [number, number], [number, number]]>; + + export function quadtree(): Quadtree<[number, number]>; + export function quadtree(): Quadtree; + + module quadtree { + interface Node { + nodes: [Node, Node, Node, Node]; + leaf: boolean; + point: T; + x: number; + y: number; + } + + interface Quadtree extends Node { + add(point: T): void; + visit(callback: (node: Node, x1: number, y1: number, x2: number, y2: number) => boolean | void): void; + find(point: [number, number]): T; + } + } + + interface Quadtree { + (points: T[]): quadtree.Quadtree; + + x(): (datum: T, index: number) => number; + x(x: number): Quadtree; + x(x: (datum: T, index: number) => number): Quadtree; + + y(): (datum: T, index: number) => number; + y(y: number): Quadtree; + y(y: (datum: T, index: number) => number): Quadtree; + + extent(): [[number, number], [number, number]]; + extent(extent: [[number, number], [number, number]]): Quadtree; + } + + export function hull(vertices: Array<[number, number]>): Array<[number, number]>; + export function hull(): Hull<[number, number]>; + export function hull(): Hull; + + interface Hull { + (vertices: T[]): Array<[number, number]>; + + x(): (datum: T) => number; + x(x: (datum: T) => number): Hull; + + y(): (datum: T) => number; + y(y: (datum: T) => number): Hull; + } + + export function polygon(vertices: Array<[number, number]>): Polygon; + + interface Polygon { + area(): number; + + centroid(): [number, number]; + + clip(subject: Array<[number, number]>): Array<[number, number]>; + } + } +} + +// we need this to exist +interface TouchList { } + +declare module 'd3' { + export = d3; +} diff --git a/d3/plugins/d3.superformula-tests.ts b/d3/plugins/d3.superformula-tests.ts index 3e7dd4d58..432ea214c 100644 --- a/d3/plugins/d3.superformula-tests.ts +++ b/d3/plugins/d3.superformula-tests.ts @@ -12,7 +12,7 @@ function superformula() { .attr("width", 960) .attr("height", 500); - var small = d3.superformula() + var small = d3.superformula() .type(function (d) { return d; } ) .size(size); @@ -37,4 +37,4 @@ function superformula() { .attr("class", "big") .attr("transform", "translate(450,250)") .attr("d", big); -} \ No newline at end of file +} diff --git a/d3/plugins/d3.superformula.d.ts b/d3/plugins/d3.superformula.d.ts index 6f5c59b07..d9252a45d 100644 --- a/d3/plugins/d3.superformula.d.ts +++ b/d3/plugins/d3.superformula.d.ts @@ -1,38 +1,37 @@ /// +declare module d3 { + export function superformula(): Superformula; -declare module D3 { - interface SuperformulaPath - { - superformulaPath(params: number[], n: number, diameter: number): Superformula; + module superformula { + interface Type { + m: number; + n1: number; + n2: number; + n3: number; + a: number; + b: number; + } } + interface Superformula { + (datum: T, index: number): string; - interface SuperformulaType - { - (any: any): any;//hans - m: number; - n1: number; - n2: number; - n3: number; - a: number; - b: number; + type(): (datum: T, index: number) => string; + type(type: string): Superformula; + type(type: (datum: T, index: number) => string): Superformula; + + size(): (datum: T, index: number) => number; + size(size: number): Superformula; + size(size: (datum: T, index: number) => number): Superformula; + + segments(): (datum: T, index: number) => number; + segments(segments: number): Superformula; + segments(segments: (datum: T, index: number) => number): Superformula; + + param(name: string): number; + param(name: string, value: number): Superformula; } - interface Superformula - { - (): any; - type(any: any): any; - param(name: string, value: number): Superformula; - size(x: number): Superformula; - segments(x: number): Superformula; - } - - - interface Base extends Selectors - { - superformula: Superformula; - superformulaPath: SuperformulaPath; - superformulaTypes: SuperformulaType[]; - } + export var superformulaTypes: string[]; } From 39debc285e0827afc57b78c4f3d4fe1a345287f8 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Mon, 30 Mar 2015 15:26:22 -0400 Subject: [PATCH 005/534] Fix tests and broken references --- d3/d3-tests.ts | 12 ++++++------ dagre-d3/dagre-d3.d.ts | 2 +- dcjs/dc-1.6.0.d.ts | 8 ++++---- dcjs/dc.d.ts | 44 +++++++++++++++++++++--------------------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index 70e4036dd..4750c2309 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -48,33 +48,33 @@ function testPieChart() { function testMapConstructor() { //No arg constructor - var emptyMap: D3.Map = d3.map(); + var emptyMap: d3.Map = d3.map(); //Object constructor var object:{[key: string]: number } = {a: 1, b: 2, c: 3}; - var objectMap: D3.Map = d3.map(object); + var objectMap: d3.Map = d3.map(object); //Array constructor var numberArray: number[] = [1, 2, 3] - var numberArrayMap: D3.Map = d3.map(numberArray); + var numberArrayMap: d3.Map = d3.map(numberArray); //Array with keyFn constructor var objectArray: {key: string}[] = [{key: "v1"}, {key: "v2"}, {key: "v3"}]; var indexes: number[] = []; //keyFn with index - var objectArrayMap1: D3.Map<{key: string}> + var objectArrayMap1: d3.Map<{key: string}> = d3.map<{key: string}>(objectArray, (o: {key: string}, index: number) => { indexes.push(index); return o.key; }); //keyFn without index - var objectArrayMap2: D3.Map<{key: string}> + var objectArrayMap2: d3.Map<{key: string}> = d3.map<{key: string}>(objectArray, (o: {key: string}) => { return o.key; }); //Map constructor - var duplicateMap: D3.Map = d3.map(numberArrayMap); + var duplicateMap: d3.Map = d3.map(numberArrayMap); } //Example from http://bl.ocks.org/3887051 diff --git a/dagre-d3/dagre-d3.d.ts b/dagre-d3/dagre-d3.d.ts index d088d1d82..d654fa0b4 100644 --- a/dagre-d3/dagre-d3.d.ts +++ b/dagre-d3/dagre-d3.d.ts @@ -24,7 +24,7 @@ declare module Dagre { interface Render { new (): Render; - (selection: D3.Selection, g: Dagre.Graph): void; + (selection: d3.Selection, g: Dagre.Graph): void; } } diff --git a/dcjs/dc-1.6.0.d.ts b/dcjs/dc-1.6.0.d.ts index 2b06c34dd..2feed9a8c 100644 --- a/dcjs/dc-1.6.0.d.ts +++ b/dcjs/dc-1.6.0.d.ts @@ -47,8 +47,8 @@ export interface ILegendwidget { legend: (l:ILegendwidget) => T; chartID: () => number; options: (o:Object)=>void ; - select: (selector: D3.Selection) => D3.Selection; - selectAll: (selector: D3.Selection) => D3.Selection; + select: (selector: d3.Selection) => d3.Selection; + selectAll: (selector: d3.Selection) => d3.Selection; } export interface IEvents { @@ -85,8 +85,8 @@ export interface ILegendwidget { x: IGetSet; y: IGetSet; elasticY: IGetSet; - xAxis: IGetSet; - yAxis: IGetSet; + xAxis: IGetSet; + yAxis: IGetSet; yAxisPadding: IGetSet; xAxisPadding: IGetSet; renderHorizontalGridLines: IGetSet; diff --git a/dcjs/dc.d.ts b/dcjs/dc.d.ts index 5a83b5c7c..5382c9b76 100644 --- a/dcjs/dc.d.ts +++ b/dcjs/dc.d.ts @@ -86,7 +86,7 @@ declare module DC { clamp(n: number, min: number, max: number): number; uniqueId(): number; nameToId(name: string): string; - appendOrSelect(parent: D3.Selection, selector: string, tag: any): D3.Selection; + appendOrSelect(parent: d3.Selection, selector: string, tag: any): d3.Selection; safeNumber(n: any): number; } @@ -112,11 +112,11 @@ declare module DC { group: IGetSet; ordering: IGetSet, T>; filterAll(): void; - select(selector: D3.Selection|string): D3.Selection; - selectAll(selector: D3.Selection|string): D3.Selection; - anchor(anchor: BaseMixin|D3.Selection|string, chartGroup?: string): D3.Selection; + select(selector: d3.Selection|string): d3.Selection; + selectAll(selector: d3.Selection|string): d3.Selection; + anchor(anchor: BaseMixin|d3.Selection|string, chartGroup?: string): d3.Selection; anchorName(): string; - svg: IGetSet; + svg: IGetSet, d3.Selection>; resetSvg(): void; filterPrinter: IGetSet<(filters: Array) => string, T>; turnOnControls(): void; @@ -160,7 +160,7 @@ declare module DC { } export interface ColorMixin { - colors: IGetSet|Array, T>; + colors: IGetSet | { (n: number): string; domain(colors: any[]): any }, T>; ordinalColors(r: Array): void; linearColors(r: Array): void; colorAccessor: IGetSet, T>; @@ -174,12 +174,12 @@ declare module DC { rangeChart: IGetSet, T>; zoomScale: IGetSet, T>; zoomOutRestrict: IGetSet; - g: IGetSet; + g: IGetSet, T>; mouseZoomable: IGetSet; - chartBodyG(): D3.Selection; - x: IGetSet, T>; + chartBodyG(): d3.Selection; + x: IGetSet<(n: any) => any, T>; xUnits: IGetSet; - xAxis: IGetSet; + xAxis: IGetSet; elasticX: IGetSet; xAxisPadding: IGetSet; xUnitCount(): number; @@ -187,8 +187,8 @@ declare module DC { isOrdinal(): boolean; xAxisLabel: IBiGetSet; yAxisLabel: IBiGetSet; - y: IGetSet, T>; - yAxis: IGetSet; + y: IGetSet<(n: any) => any, T>; + yAxis: IGetSet; elasticY: IGetSet; renderHorizontalGridLines: IGetSet; renderVerticalGridLines: IGetSet; @@ -209,7 +209,7 @@ declare module DC { hideStack(name: string): void; showStack(name: string): void; // title(stackName: string, titleFn: Accessor); - stackLayout: IGetSet; + stackLayout: IGetSet, T>; } export interface CapMixin { @@ -219,7 +219,7 @@ declare module DC { } export interface BubbleMixin extends ColorMixin { - r: IGetSet, T>; + r: IGetSet<(n: any) => any, T>; radiusValueAccessor: IGetSet, T>; minRadiusWithLabel: IGetSet; maxBubbleRelativeSize: IGetSet; @@ -295,8 +295,8 @@ declare module DC { children(): Array>; shareColors: IGetSet; shareTitle: IGetSet; - rightY: IGetSet, CompositeChart>; - rightYAxis: IGetSet; + rightY: IGetSet<(n: any) => any, CompositeChart>; + rightYAxis: IGetSet; } export interface SeriesChart extends CompositeChart { @@ -314,9 +314,9 @@ declare module DC { export interface GeoChoroplethChart extends ColorMixin, BaseMixin { overlayGeoJson(json: any, name: string, keyAccessor: Accessor): void; - projection: IGetSet; + projection: IGetSet; geoJsons(): Array; - geoPath(): D3.Geo.Path; + geoPath(): d3.geo.Path; removeGeoJson(name: string): void; } @@ -325,9 +325,9 @@ declare module DC { } export interface RowChart extends CapMixin, MarginMixin, ColorMixin, BaseMixin { - x: IGetSet, RowChart>; + x: IGetSet<(n: any) => any, RowChart>; renderTitleLabel: IGetSet; - xAxis: IGetSet; + xAxis: IGetSet; fixedBarHeight: IGetSet; gap: IGetSet; elasticX: IGetSet; @@ -338,7 +338,7 @@ declare module DC { export interface ScatterPlot extends CoordinateGridMixin { existenceAccessor: IGetSet, ScatterPlot>; - symbol: IGetSet; + symbol: IGetSet, ScatterPlot>; symbolSize: IGetSet; highlightedSize: IGetSet; hiddenSize: IGetSet; @@ -392,7 +392,7 @@ declare module DC { renderAll(group?: string): void; redrawAll(group?: string): void; disableTransitions: boolean; - transition(selections: D3.Selection, duration: number, callback: (s: D3.Selection) => void): void; + transition(selections: d3.Selection, duration: number, callback: (s: d3.Selection) => void): void; units: Units; events: Events; From 6f60566a5e6cedc17778624d1a231be4f0745031 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Mon, 30 Mar 2015 15:28:48 -0400 Subject: [PATCH 006/534] add self to contributor header --- d3/d3.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index dddef751b..e5b9c86c6 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -1,6 +1,6 @@ // Type definitions for d3JS // Project: http://d3js.org/ -// Definitions by: Boris Yankov +// Definitions by: Alex Ford , Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module d3 { From 16d084b052cbbae8826835c2ab5fe1109bc1f9dd Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Tue, 31 Mar 2015 10:51:43 -0400 Subject: [PATCH 007/534] Add more default types for D3 scales --- d3/d3.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index e5b9c86c6..9aa91a874 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -1502,8 +1502,11 @@ declare module d3 { copy(): Linear; } + export function sqrt(): Pow; export function sqrt(): Pow; export function sqrt(): Pow; + + export function pow(): Pow; export function pow(): Pow; export function pow(): Pow; @@ -1538,6 +1541,7 @@ declare module d3 { copy(): Pow; } + export function log(): Log; export function log(): Log; export function log(): Log; From b9546998e3f65e39b944164846396d13cd195986 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Tue, 31 Mar 2015 10:51:58 -0400 Subject: [PATCH 008/534] noImplicitAny compliance --- d3/d3-tests.ts | 193 +++++++++++++++++++++++++------------------------ 1 file changed, 100 insertions(+), 93 deletions(-) diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index 4750c2309..2bae83e43 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -113,11 +113,11 @@ function groupedBarChart() { .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - d3.csv("data.csv", function (error, data: Array) { + d3.csv("data.csv", function (error: any, data: Array) { var ageNames = d3.keys(data[0]).filter(function (key) { return key !== "State"; }); data.forEach(function (d) { - d.ages = ageNames.map(function (name) { return { name: name, value: +d[name] }; }); + d.ages = ageNames.map(function (name) { return { name: name, value: +( d)[name] }; }); }); x0.domain(data.map(function (d) { return d.State; })); @@ -206,18 +206,18 @@ function stackedBarChart() { .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - d3.csv("data.csv", function (error, data: any) { + d3.csv("data.csv", function (error: any, data: any) { color.domain(d3.keys(data[0]).filter(function (key) { return key !== "State"; })); - data.forEach(function (d) { + data.forEach(function (d: any) { var y0 = 0; d.ages = color.domain().map(function (name) { return { name: name, y0: y0, y1: y0 += +d[name] }; }); d.total = d.ages[d.ages.length - 1].y1; }); - data.sort(function (a, b) { return b.total - a.total; }); + data.sort(function (a: any, b: any) { return b.total - a.total; }); - x.domain(data.map(function (d) { return d.State; })); + x.domain(data.map(function (d: any) { return d.State; })); y.domain([0, d3.max(data, function (d: { total: number }) { return d.total; })]); svg.append("g") @@ -304,15 +304,15 @@ function normalizedBarChart() { d3.csv("data.csv", function (error, data) { color.domain(d3.keys(data[0]).filter(function (key) { return key !== "State"; })); - data.forEach(function (d) { + data.forEach(function (d: any) { var y0 = 0; d.ages = color.domain().map(function (name) { return { name: name, y0: y0, y1: y0 += +d[name] }; }); - d.ages.forEach(function (d) { d.y0 /= y0; d.y1 /= y0; }); + d.ages.forEach(function (d: any) { d.y0 /= y0; d.y1 /= y0; }); }); - data.sort(function (a, b) { return b.ages[0].y1 - a.ages[0].y1; }); + data.sort(function (a: any, b: any) { return b.ages[0].y1 - a.ages[0].y1; }); - x.domain(data.map(function (d) { return d.State; })); + x.domain(data.map(function (d: any) { return d.State; })); svg.append("g") .attr("class", "x axis") @@ -383,13 +383,13 @@ function sortablebarChart() { .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - d3.tsv("data.tsv", function (error, data: any) { + d3.tsv("data.tsv", function (error: any, data: any) { - data.forEach(function (d) { + data.forEach(function (d: any) { d.frequency = +d.frequency; }); - x.domain(data.map(function (d) { return d.letter; })); + x.domain(data.map(function (d: any) { return d.letter; })); y.domain([0, d3.max(data, function (d: any) { return d.frequency; })]); svg.append("g") @@ -426,17 +426,17 @@ function sortablebarChart() { clearTimeout(sortTimeout); var x0 = x.domain(data.sort(this.checked - ? function (a, b) { return b.frequency - a.frequency; } - : function (a, b) { return d3.ascending(a.letter, b.letter); }) - .map(function (d) { return d.letter; })) + ? function (a: any, b: any) { return b.frequency - a.frequency; } + : function (a: any, b: any) { return d3.ascending(a.letter, b.letter); }) + .map(function (d: any) { return d.letter; })) .copy(); var transition = svg.transition().duration(750), - delay = function (d, i) { return i * 50; }; + delay = function (d: any, i: number) { return i * 50; }; transition.selectAll(".bar") .delay(delay) - .attr("x", function (d) { return x0(d.letter); }); + .attr("x", function (d: any) { return x0(d.letter); }); transition.select(".x.axis") .call(xAxis) @@ -506,7 +506,7 @@ function callenderView() { .text(function (d) { return d + ": " + percent(data[d]); }); }); - function monthPath(t0) { + function monthPath(t0: Date) { var t1 = new Date(t0.getFullYear(), t0.getMonth() + 1, 0), d0 = +day(t0), w0 = +week(t0), d1 = +day(t1), w1 = +week(t1); @@ -552,8 +552,8 @@ function lineChart() { .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - d3.tsv("data.tsv", function (error, data) { - data.forEach(function (d) { + d3.tsv("data.tsv", function (error: any, data: any) { + data.forEach(function (d: any) { d.date = parseDate(d.date); d.close = +d.close; }); @@ -616,8 +616,8 @@ function bivariateAreaChart() { .append("g") .attr("transform", "translate(" + margin.left + "," + margin.top + ")"); - d3.tsv("data.tsv", function (error, data: any) { - data.forEach(function (d) { + d3.tsv("data.tsv", function (error: any, data: any) { + data.forEach(function (d: any) { d.date = parseDate(d.date); d.low = +d.low; d.high = +d.high; @@ -670,7 +670,7 @@ function dragMultiples() { .attr("cy", function (d) { return d.y; }) .call(drag); - function dragmove(d) { + function dragmove(d: { x: number; y: number }) { d3.select(this) .attr("cx", d.x = Math.max(radius, Math.min(width - radius, ( d3.event).x))) .attr("cy", d.y = Math.max(radius, Math.min(height - radius, ( d3.event).y))); @@ -753,7 +753,7 @@ function chainedTransitions() { .attr("cy", y) .each(slide(20, w - 20)); - function slide(x0, x1) { + function slide(x0: number, x1: number) { t += 50; return function() { d3.select(this).transition() @@ -805,7 +805,7 @@ function populationPyramid() { .attr("dy", ".71em") .text(2000); - d3.csv("population.csv", function (error, rows: Array) { + d3.csv("population.csv", function (error: any, rows: Array) { // Convert strings to numbers. rows.forEach(function (d) { @@ -980,7 +980,7 @@ module forcedBasedLabelPlacemant { } ).style("fill", "#555").style("font-family", "Arial").style("font-size", 12); var updateLink = function () { - this.attr("x1", function (d) { + (> this).attr("x1", function (d) { return d.source.x; } ).attr("y1", function (d) { return d.source.y; @@ -993,7 +993,7 @@ module forcedBasedLabelPlacemant { } var updateNode = function () { - this.attr("transform", function (d) { + (> this).attr("transform", function (d) { return "translate(" + d.x + "," + d.y + ")"; } ); @@ -1044,9 +1044,9 @@ module forceCollapsable { var w = 1280, h = 800, - node, - link, - root; + node: d3.selection.Update, + link: d3.selection.Update>, + root: any; var force = d3.layout.force() .on("tick", tick) @@ -1124,12 +1124,12 @@ module forceCollapsable { } // Color leaf nodes orange, and packages white or blue. - function color(d) { + function color(d: Node) { return d._children ? "#3182bd" : d.children ? "#c6dbef" : "#fd8d3c"; } // Toggle children on click. - function click(d) { + function click(d: Node) { if (d.children) { d._children = d.children; d.children = null; @@ -1141,12 +1141,12 @@ module forceCollapsable { } // Returns a list of all nodes under the root. - function flatten(root) { - var nodes = [], i = 0; + function flatten(root: Node) { + var nodes: Node[] = [], i = 0; - function recurse(node) { + function recurse(node: Node) { if (node.children) node.size = node.children.reduce(function (p, v) { return p + recurse(v); } , 0); - if (!node.id) node.id = ++i; + if (!node.id) node.id = String(++i); nodes.push(node); return node.size; } @@ -1202,7 +1202,7 @@ function azimuthalEquidistant() { .attr("d", path); svg.insert("path", ".graticule") - .datum(topojson.mesh(world, world.objects.countries, function (a, b) { return a !== b; } )) + .datum(topojson.mesh(world, world.objects.countries, function (a: any, b: any) { return a !== b; } )) .attr("class", "boundary") .attr("d", path); } ); @@ -1251,7 +1251,6 @@ function forceDirectedVoronoi() { var w = window.innerWidth > 960 ? 960 : (window.innerWidth || 960), h = window.innerHeight > 500 ? 500 : (window.innerHeight || 500), radius = 5.25, - links = [], simulate = true, zoomToAdd = true, color = d3.scale.quantize().domain([10000, 7250]).range(["#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]) @@ -1441,7 +1440,7 @@ function quadtree() { brushed(); function brushed() { - var extent = brush.extent(); + var extent = <[[number, number], [number, number]]> brush.extent(); point.each(function (d) { d.scanned = d.selected = false; } ); search(quadtree, extent[0][0], extent[0][1], extent[1][0], extent[1][1]); point.classed("scanned", function (d) { return d.scanned; } ); @@ -1449,8 +1448,8 @@ function quadtree() { } // Collapse the quadtree into an array of rectangles. - function nodes(quadtree) { - var nodes = []; + function nodes(quadtree: d3.geom.quadtree.Quadtree<[number, number]>) { + var nodes: Array<{x: number; y: number; width: number; height: number}> = []; quadtree.visit(function (node, x1, y1, x2, y2) { nodes.push({ x: x1, y: y1, width: x2 - x1, height: y2 - y1 }); } ); @@ -1458,12 +1457,12 @@ function quadtree() { } // Find the nodes within the specified rectangle. - function search(quadtree, x0, y0, x3, y3) { + function search(quadtree: d3.geom.quadtree.Quadtree<{ scanned?: boolean; selected?: boolean; 0: number; 1: number }>, x0: number, y0: number, x3: number, y3: number) { quadtree.visit(function (node, x1, y1, x2, y2) { var p = node.point; if (p) { p.scanned = true; - p.selected = (p.x >= x0) && (p.x < x3) && (p.y >= y0) && (p.y < y3); + p.selected = (p[0] >= x0) && (p[0] < x3) && (p[1] >= y0) && (p[1] < y3); } return x1 >= x3 || y1 >= y3 || x2 < x0 || y2 < y0; } ); @@ -1563,11 +1562,11 @@ module hierarchicalEdgeBundling { var packages = { // Lazily construct the package hierarchy from class names. - root: function (classes) { - var map = {}; + root: function (classes: any[]) { + var map: {[key: string]: Result} = {}; - function find(name, data?) { - var node = map[name], i; + function find(name: string, data?: any) { + var node: Result = map[name], i: number; if (!node) { node = map[name] = data || { name: name, children: [] }; if (name.length) { @@ -1587,9 +1586,9 @@ module hierarchicalEdgeBundling { } , // Return a list of imports for the given array of nodes. - imports: function (nodes) { - var map = {}, - imports = []; + imports: function (nodes: any[]) { + var map: {[key: string]: Result} = {}, + imports: d3.layout.cluster.Link[] = []; // Compute a map from name to node. nodes.forEach(function (d) { @@ -1598,7 +1597,7 @@ module hierarchicalEdgeBundling { // For each import, construct a link from the source to target node. nodes.forEach(function (d) { - if (d.imports) d.imports.forEach(function (i) { + if (d.imports) d.imports.forEach(function (i: string) { imports.push({ source: map[d.name], target: map[i] }); } ); } ); @@ -1702,9 +1701,9 @@ function streamGraph() { } // Inspired by Lee Byron's test data generator. - function bumpLayer(n): Array<{x: number; y: number;y0?:number;}> { + function bumpLayer(n: number): Array<{x: number; y: number;y0?:number;}> { - function bump(a) { + function bump(a: number[]) { var x = 1 / (.1 + Math.random()), y = 2 * Math.random() - .5, z = 10 / (.1 + Math.random()); @@ -1714,7 +1713,7 @@ function streamGraph() { } } - var a = [], i; + var a: number[] = [], i: number; for (i = 0; i < n; ++i) a[i] = 0; for (i = 0; i < 5; ++i) bump(a); return a.map(function (d, i) { return { x: i, y: Math.max(0, d) }; } ); @@ -1724,6 +1723,7 @@ function streamGraph() { // example from http://mbostock.github.io/d3/talk/20111116/force-collapsible.html module forceCollapsable2 { interface Node extends d3.layout.force.Node { + children: Node[]; _children: Node[]; size: number; id: string; @@ -1731,9 +1731,9 @@ module forceCollapsable2 { var w = 1280, h = 800, - node, - link, - root; + node: d3.selection.Update, + link: d3.selection.Update>, + root: Node; var force = d3.layout.force() .on("tick", tick) @@ -1811,12 +1811,12 @@ module forceCollapsable2 { } // Color leaf nodes orange, and packages white or blue. - function color(d) { + function color(d: Node) { return d._children ? "#3182bd" : d.children ? "#c6dbef" : "#fd8d3c"; } // Toggle children on click. - function click(d) { + function click(d: Node) { if (d.children) { d._children = d.children; d.children = null; @@ -1828,12 +1828,12 @@ module forceCollapsable2 { } // Returns a list of all nodes under the root. - function flatten(root) { - var nodes = [], i = 0; + function flatten(root: Node) { + var nodes: Node[] = [], i = 0; - function recurse(node) { + function recurse(node: Node) { if (node.children) node.size = node.children.reduce(function (p, v) { return p + recurse(v); } , 0); - if (!node.id) node.id = ++i; + if (!node.id) node.id = String(++i); nodes.push(node); return node.size; } @@ -1915,7 +1915,7 @@ function chordDiagram() { .style("opacity", 1); // Returns an array of tick angles and labels, given a group. - function groupTicks(d) { + function groupTicks(d: d3.layout.chord.Node) { var k = (d.endAngle - d.startAngle) / d.value; return d3.range(0, d.value, 1000).map(function (v, i) { return { @@ -1926,8 +1926,8 @@ function chordDiagram() { } // Returns an event handler for fading a given chord group. - function fade(opacity) { - return function (g, i) { + function fade(opacity: number) { + return function (g: {}, i: number) { svg.selectAll(".chord path") .filter(function (d) { return d.source.index != i && d.target.index != i; } ) .transition() @@ -1946,11 +1946,11 @@ function irisParallel() { h = 800 - m[0] - m[2]; var x = d3.scale.ordinal().domain(traits).rangePoints([0, w]), - y = {}; + y: {[key: string]: any} = {}; var line = d3.svg.line(), axis = d3.svg.axis().orient("left"), - foreground; + foreground: d3.Selection<{ [key: string]: string}>; var svg = d3.select("body").append("svg:svg") .attr("width", w + m[1] + m[3]) @@ -2004,7 +2004,7 @@ function irisParallel() { .attr("class", "trait") .attr("transform", function (d) { return "translate(" + x(d) + ")"; } ) .call(d3.behavior.drag() - .origin(function (d) { return { x: x(d), y: undefined }; } ) + .origin(function (d) { return { x: x(d), y: NaN }; } ) .on("dragstart", dragstart) .on("drag", drag) .on("dragend", dragend)); @@ -2026,18 +2026,18 @@ function irisParallel() { .attr("x", -8) .attr("width", 16); - function dragstart(d) { + function dragstart(d: string) { i = traits.indexOf(d); } - function drag(d) { + function drag(d: string) { x.range()[i] = ( d3.event).x; traits.sort(function (a, b) { return x(a) - x(b); } ); g.attr("transform", function (d) { return "translate(" + x(d) + ")"; } ); foreground.attr("d", path); } - function dragend(d) { + function dragend(d: string) { x.domain(traits).rangePoints([0, w]); var t = d3.transition().duration(500); t.selectAll(".trait").attr("transform", function (d) { return "translate(" + x(d) + ")"; } ); @@ -2046,7 +2046,7 @@ function irisParallel() { } ); // Returns the path for a given data point. - function path(d) { + function path(d: any): string { return line(traits.map(function (p): [number, number] { return [x(p), y[p](d[p])]; } )); } @@ -2065,11 +2065,11 @@ function irisParallel() { //example from function healthAndWealth() { // Various accessors that specify the four dimensions of data to visualize. - function x(d) { return d.income; } - function y(d) { return d.lifeExpectancy; } - function radius(d) { return d.population; } - function color(d) { return d.region; } - function key(d) { return d.name; } + function x(d: any) { return d.income; } + function y(d: any) { return d.lifeExpectancy; } + function radius(d: any) { return d.population; } + function color(d: any) { return d.region; } + function key(d: any) { return d.name; } // Chart dimensions. var margin = { top: 19.5, right: 19.5, bottom: 19.5, left: 39.5 }, @@ -2133,7 +2133,7 @@ function healthAndWealth() { d3.json("nations.json", function (nations: any[]) { // A bisector since many nation's data is sparsely-defined. - var bisect = d3.bisector(function (d) { return d[0]; } ); + var bisect = d3.bisector(function (d: any) { return d[0]; } ); // Add a dot per nation. Initialize the data at 1800, and set the colors. var dot = svg.append("g") @@ -2169,14 +2169,14 @@ function healthAndWealth() { .each("end", enableInteraction); // Positions the dots based on data. - function position(dot) { + function position(dot: d3.Selection) { dot.attr("cx", function (d) { return xScale(x(d)); } ) .attr("cy", function (d) { return yScale(y(d)); } ) .attr("r", function (d) { return radiusScale(radius(d)); } ); } // Defines a sort order so that the smallest dots are drawn on top. - function order(a, b) { + function order(a: any, b: any) { return radius(b) - radius(a); } @@ -2213,17 +2213,17 @@ function healthAndWealth() { // For the interpolated data, the dots and label are redrawn. function tweenYear() { var year = d3.interpolateNumber(1800, 2009); - return function (t) { displayYear(year(t)); }; + return function (t: number) { displayYear(year(t)); }; } // Updates the display to show the specified year. - function displayYear(year) { + function displayYear(year: number) { dot.data(interpolateData(year), key).call(position).sort(order); label.text(Math.round(year)); } // Interpolates the dataset for the given (fractional) year. - function interpolateData(year) { + function interpolateData(year: number) { return nations.map(function (d) { return { name: d.name, @@ -2236,7 +2236,7 @@ function healthAndWealth() { } // Finds (and possibly interpolates) the value for the specified year. - function interpolateValues(values, year) { + function interpolateValues(values: any[], year: number) { var i = bisect.left(values, year, 0, values.length - 1), a = values[i]; if (i > 0) { @@ -2252,7 +2252,7 @@ function healthAndWealth() { // Test for d3.functor function functorTest () { var f: (n: number) => number = d3.functor(10); - var g = d3.functor(function (v) { return v; }); + var g = d3.functor(function (v: number) { return v; }); return f(10) === g(10); } @@ -2287,7 +2287,7 @@ function nestTest () { var n2 = d3.nest<{ a: number; b: number[] }>() .key(function (d) { return String(d.a); }) .sortValues(function (x1, x2) { - return x1[0] < x1[1] ? -1 : (x1[0] > x1[0] ? 1 : 0); }); + return x1.b[0] < x1.b[1] ? -1 : (x1.b[0] > x1.b[0] ? 1 : 0); }); n2.map(data); n2.entries(data); @@ -2387,7 +2387,7 @@ function brushTest() { .x(xScale) .y(yScale) .on('brush', function () { - var extent = brush2.extent(); + var extent = <[[number, number], [number, number]]> brush2.extent(); var xExtent = extent[0], yExtent = extent[1]; @@ -2538,25 +2538,32 @@ function svgArcTest () { l.innerRadius(f).innerRadius() === f; l.innerRadius(0); - l.innerRadius(function (d) { return d[0]; }); + l.innerRadius(function (d) { return d.innerRadius; }); l.innerRadius(function (d, i) { return i; }); l.outerRadius(f).outerRadius() === f; l.outerRadius(0); - l.outerRadius(function (d) { return d[1]; }); + l.outerRadius(function (d) { return d.outerRadius; }); l.outerRadius(function (d, i) { return i; }); l.startAngle(f).startAngle() === f; l.startAngle(0); - l.startAngle(function (d) { return d[0]; }); + l.startAngle(function (d) { return d.innerRadius; }); l.startAngle(function (d, i) { return i; }); l.endAngle(f).endAngle() === f; l.endAngle(0); - l.endAngle(function (d) { return d[1]; }); + l.endAngle(function (d) { return d.outerRadius; }); l.endAngle(function (d, i) { return i; }); } +function svgArcTest2 () { + var l = d3.svg.arc<[number, number]>(); + + l.innerRadius(d => d[0]); + l.outerRadius(d => d[1]); +} + // Tests for d3.svg.diagonal // Adopted from: https://github.com/mbostock/d3/blob/master/test/svg/diagonal-test.js function svgDiagonalTest () { From 663240f96936f0aa16f9e175241e3890f3c461dc Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Tue, 31 Mar 2015 11:03:02 -0400 Subject: [PATCH 009/534] ordinal scales use any string-coercible type --- d3/d3-tests.ts | 6 +++--- d3/d3.d.ts | 39 ++++++++++++++++++++++----------------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index 2bae83e43..5db3528f5 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -738,7 +738,7 @@ function panAndZoom() { function chainedTransitions() { var w = 960, h = 500, - y = d3.scale.ordinal().domain(d3.range(50)).rangePoints([20, h - 20]), + y = d3.scale.ordinal().domain(d3.range(50)).rangePoints([20, h - 20]), t = Date.now(); var svg = d3.select("body").append("svg:svg") @@ -1629,7 +1629,7 @@ function roundedRectangles() { .attr("width", 25) .attr("height", 25) .attr("transform", function (d, i) { return "scale(" + (1 - d / 25) * 20 + ")"; } ) - .style("fill", d3.scale.category20c()); + .style("fill", d3.scale.category20c()); var g0 = g.datum(function (d) { return { center: [0, 0], angle: 0 }; @@ -1862,7 +1862,7 @@ function chordDiagram() { innerRadius = Math.min(width, height) * .41, outerRadius = innerRadius * 1.1; - var fill = d3.scale.ordinal() + var fill = d3.scale.ordinal() .domain(d3.range(4)) .range(["#000000", "#FFDD89", "#957244", "#F26223"]); diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 9aa91a874..18a27790b 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -1627,31 +1627,36 @@ declare module d3 { copy(): Threshold; } - export function ordinal(): Ordinal; - export function category10(): Ordinal; - export function category20(): Ordinal; - export function category20b(): Ordinal; - export function category20c(): Ordinal; + export function ordinal(): Ordinal; + export function ordinal(): Ordinal; + export function category10(): Ordinal; + export function category10(): Ordinal; + export function category20(): Ordinal; + export function category20(): Ordinal; + export function category20b(): Ordinal; + export function category20b(): Ordinal; + export function category20c(): Ordinal; + export function category20c(): Ordinal; + + interface Ordinal { + (x: Domain): Range; - interface Ordinal { - (x: Primitive): T; + domain(): Domain[]; + domain(values: Domain[]): Ordinal; - domain(): string[]; - domain(values: Primitive[]): Ordinal; + range(): Range[]; + range(values: Range[]): Ordinal; - range(): T[]; - range(values: T[]): Ordinal; + rangePoints(interval: [number, number], padding?: number): Ordinal; + rangeRoundPoints(interval: [number, number], padding?: number): Ordinal; - rangePoints(interval: [number, number], padding?: number): Ordinal; - rangeRoundPoints(interval: [number, number], padding?: number): Ordinal; - - rangeBands(interval: [number, number], padding?: number, outerPadding?: number): Ordinal; - rangeRoundBands(interval: [number, number], padding?: number, outerPadding?: number): Ordinal; + rangeBands(interval: [number, number], padding?: number, outerPadding?: number): Ordinal; + rangeRoundBands(interval: [number, number], padding?: number, outerPadding?: number): Ordinal; rangeBand(): number; rangeExtent(): [number, number]; - copy(): Ordinal; + copy(): Ordinal; } } From c390cc036fa7b9336ba8be9784c0e18c459dacc3 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Tue, 31 Mar 2015 11:06:14 -0400 Subject: [PATCH 010/534] Correct failing build. --- d3.cloud.layout/d3.cloud.layout-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d3.cloud.layout/d3.cloud.layout-tests.ts b/d3.cloud.layout/d3.cloud.layout-tests.ts index c22d76b36..9d5ed7b71 100644 --- a/d3.cloud.layout/d3.cloud.layout-tests.ts +++ b/d3.cloud.layout/d3.cloud.layout-tests.ts @@ -10,7 +10,7 @@ } - var fill = d3.scale.category20(); + var fill = d3.scale.category20(); d3.layout.cloud().size([300, 300]) .words([ "Hello", "world", "normally", "you", "want", "more", "words", @@ -40,4 +40,4 @@ return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")"; }) .text(function(d:ICompTextSize) { return d.text; }); - } \ No newline at end of file + } From 5532887980800ceef4d93f7a6b43188662d709f9 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Tue, 31 Mar 2015 19:44:31 -0400 Subject: [PATCH 011/534] require scale-like behavior of dc.js scales --- dcjs/dc.d.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/dcjs/dc.d.ts b/dcjs/dc.d.ts index 5382c9b76..62739e16a 100644 --- a/dcjs/dc.d.ts +++ b/dcjs/dc.d.ts @@ -20,6 +20,16 @@ declare module DC { (t: T, r?: R): V; } + export interface Scale { + (x: any): T; + + domain(values: any[]): Scale; + domain(): any[]; + + range(values: T[]): Scale; + range(): T[]; + } + export interface Accessor { (datum: T, index?: number): V; } @@ -160,9 +170,9 @@ declare module DC { } export interface ColorMixin { - colors: IGetSet | { (n: number): string; domain(colors: any[]): any }, T>; + colors: IGetSet | Scale, T>; ordinalColors(r: Array): void; - linearColors(r: Array): void; + linearColors(r: Array): void; colorAccessor: IGetSet, T>; colorDomain: IGetSet, T>; calculateColorDomain(): void; @@ -187,7 +197,7 @@ declare module DC { isOrdinal(): boolean; xAxisLabel: IBiGetSet; yAxisLabel: IBiGetSet; - y: IGetSet<(n: any) => any, T>; + y: IGetSet, T>; yAxis: IGetSet; elasticY: IGetSet; renderHorizontalGridLines: IGetSet; @@ -219,7 +229,7 @@ declare module DC { } export interface BubbleMixin extends ColorMixin { - r: IGetSet<(n: any) => any, T>; + r: IGetSet, T>; radiusValueAccessor: IGetSet, T>; minRadiusWithLabel: IGetSet; maxBubbleRelativeSize: IGetSet; @@ -325,7 +335,7 @@ declare module DC { } export interface RowChart extends CapMixin, MarginMixin, ColorMixin, BaseMixin { - x: IGetSet<(n: any) => any, RowChart>; + x: IGetSet, RowChart>; renderTitleLabel: IGetSet; xAxis: IGetSet; fixedBarHeight: IGetSet; From 23515939b9df8c4525dad8ac3d063810700ec9cf Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Fri, 3 Apr 2015 15:36:58 -0400 Subject: [PATCH 012/534] remove refs to non-existent "D3" --- d3/d3-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index 15be39839..5db3528f5 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -475,7 +475,7 @@ function callenderView() { .style("text-anchor", "middle") .text(function (d) { return d; }); - var rect: D3.UpdateSelection = svg.selectAll(".day") + var rect = svg.selectAll(".day") .data(function (d) { return d3.time.days(new Date(d, 0, 1), new Date(d + 1, 0, 1)); }) .enter().append("rect") .attr("class", "day") @@ -973,7 +973,7 @@ module forcedBasedLabelPlacemant { var anchorLink = vis.selectAll("line.anchorLink").data(labelAnchorLinks)//.enter().append("svg:line").attr("class", "anchorLink").style("stroke", "#999"); - var anchorNode: D3.Selection = vis.selectAll("g.anchorNode").data(force2.nodes()).enter().append("svg:g").attr("class", "anchorNode"); + var anchorNode = vis.selectAll("g.anchorNode").data(force2.nodes()).enter().append("svg:g").attr("class", "anchorNode"); anchorNode.append("svg:circle").attr("r", 0).style("fill", "#FFF"); anchorNode.append("svg:text").text(function (d, i) { return i % 2 == 0 ? "" : d.node.label From d47d0b7b5ea8e90c8fbb41ba14b1f63b1cfdb56d Mon Sep 17 00:00:00 2001 From: Anatoly Bakirov Date: Tue, 7 Apr 2015 15:56:38 -0700 Subject: [PATCH 013/534] Make Promise generic --- dojo/dojo.d.ts | 56 +++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/dojo/dojo.d.ts b/dojo/dojo.d.ts index 63cda16dd..bda5c3494 100644 --- a/dojo/dojo.d.ts +++ b/dojo/dojo.d.ts @@ -927,7 +927,7 @@ declare module dojo { * * */ - class __Promise extends dojo.promise.Promise { + class __Promise implements dojo.promise.Promise { constructor(); /** * A promise resolving to an object representing @@ -988,7 +988,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error. * @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update. */ - then(callback?: Function, errback?: Function, progback?: Function): dojo.promise.Promise; + then(callback?: Function, errback?: Function, progback?: Function): dojo.promise.Promise; /** * */ @@ -996,11 +996,11 @@ declare module dojo { /** * */ - trace(): dojo.promise.Promise; + trace(): dojo.promise.Promise; /** * */ - traceRejected(): dojo.promise.Promise; + traceRejected(): dojo.promise.Promise; } /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/request/default.html @@ -1590,7 +1590,7 @@ declare module dojo { * @param listener * @param dontFix */ - once(target: any, type: any, listener: any, dontFix: any): any; + once(target: any, type: any, listener: any, dontFix?: any): any; /** * * @param target @@ -1783,7 +1783,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected. * @param progback OptionalCallback to be invoked when the promise emits a progress update. */ - interface when{(valueOrPromise: any, callback?: Function, errback?: Function, progback?: Function): void} + interface when { (value: T|dojo.promise.Promise, callback: dojo.promise.Callback, errback?: any, progback?: any): U|dojo.promise.Promise } /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/DeferredList.html * @@ -1822,7 +1822,7 @@ declare module dojo { /** * */ - "promise": dojo.promise.Promise; + "promise": dojo.promise.Promise; /** * Inform the deferred it may cancel its asynchronous operation. * Inform the deferred it may cancel its asynchronous operation. @@ -1863,7 +1863,7 @@ declare module dojo { * @param update The progress update. Passed to progbacks. * @param strict OptionalIf strict, will throw an error if the deferred has alreadybeen fulfilled and consequently no progress can be emitted. */ - progress(update: any, strict: boolean): dojo.promise.Promise; + progress(update: any, strict: boolean): dojo.promise.Promise; /** * Reject the deferred. * Reject the deferred, putting it in an error state. @@ -1879,7 +1879,7 @@ declare module dojo { * @param value The result of the deferred. Passed to callbacks. * @param strict OptionalIf strict, will throw an error if the deferred has alreadybeen fulfilled and consequently cannot be resolved. */ - resolve(value: any, strict?: boolean): dojo.promise.Promise; + resolve(value: any, strict?: boolean): dojo.promise.Promise; /** * Add new callbacks to the deferred. * Add new callbacks to the deferred. Callbacks can be added @@ -1889,7 +1889,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error. * @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update. */ - then(callback: Function, errback: Function, progback: Function): dojo.promise.Promise; + then(callback: Function, errback: Function, progback: Function): dojo.promise.Promise; /** * */ @@ -9119,7 +9119,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected. * @param progback OptionalCallback to be invoked when the promise emits a progress update. */ - when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise; + when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise; /** * signal fired by impending window destruction. You may use * dojo.addOnWIndowUnload() or dojo.connect() to this method to perform @@ -16050,7 +16050,7 @@ declare module dojo { * * @param objectOrArray OptionalThe promise will be fulfilled with a list of results if invoked with anarray, or an object of results when passed an object (using the samekeys). If passed neither an object or array it is resolved with anundefined value. */ - interface all{(objectOrArray?: Object): void} + interface all{(value: Promise[]): Promise} /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/all.html * @@ -16063,7 +16063,7 @@ declare module dojo { * * @param objectOrArray OptionalThe promise will be fulfilled with a list of results if invoked with anarray, or an object of results when passed an object (using the samekeys). If passed neither an object or array it is resolved with anundefined value. */ - interface all{(objectOrArray?: any[]): void} + interface all{(value: Object): Promise} /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/first.html * @@ -16107,6 +16107,11 @@ declare module dojo { * @param Deferred */ interface instrumentation{(Deferred: any): void} + + interface Callback { + (arg: T): U|Promise; + } + /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/Promise.html * @@ -16115,15 +16120,14 @@ declare module dojo { * instances of this class. * */ - class Promise { - constructor(); + interface Promise { /** * Add a callback to be invoked when the promise is resolved * or rejected. * * @param callbackOrErrback OptionalA function that is used both as a callback and errback. */ - always(callbackOrErrback: Function): any; + always(callbackOrErrback: Callback): Promise; /** * Inform the deferred it may cancel its asynchronous operation. * Inform the deferred it may cancel its asynchronous operation. @@ -16160,7 +16164,7 @@ declare module dojo { * * @param errback OptionalCallback to be invoked when the promise is rejected. */ - otherwise(errback: Function): any; + otherwise(errback: Callback): Promise; /** * Add new callbacks to the promise. * Add new callbacks to the deferred. Callbacks can be added @@ -16170,7 +16174,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected.Receives the rejection error. * @param progback OptionalCallback to be invoked when the promise emits a progressupdate. Receives the progress update. */ - then(callback: Function, errback?: Function, progback?: Function): dojo.promise.Promise; + then(callback: Callback, errback?: Callback, progback?: Callback): Promise; /** * */ @@ -16184,7 +16188,7 @@ declare module dojo { * to handle traces. * */ - trace(): dojo.promise.Promise; + trace(): Promise; /** * Trace rejection of the promise. * Tracing allows you to transparently log progress, @@ -16194,7 +16198,7 @@ declare module dojo { * to handle traces. * */ - traceRejected(): dojo.promise.Promise; + traceRejected(): Promise; } /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/promise/tracer.html @@ -17467,7 +17471,7 @@ declare module dojo { * * @param results The result set as an array, or a promise for an array. */ - interface QueryResults{(results: dojo.promise.Promise): void} + interface QueryResults{(results: dojo.promise.Promise): void} /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/store/util/SimpleQueryEngine.html * @@ -20456,7 +20460,7 @@ declare module dojo { * @param value the number to be formatted * @param options OptionalAn object with the following properties:pattern (String, optional): override formatting patternwith this string. Default value is based on locale. Overriding this property will defeatlocalization. Literal characters in patterns are not supported.type (String, optional): choose a format type based on the locale from the following:decimal, scientific (not yet supported), percent, currency. decimal by default.places (Number, optional): fixed number of decimal places to show. This overrides anyinformation in the provided pattern.round (Number, optional): 5 rounds to nearest .5; 0 rounds to nearest whole (default). -1means do not round.locale (String, optional): override the locale used to determine formatting rulesfractional (Boolean, optional): If false, show no decimal places, overriding places and pattern settings. */ - format(value: number, options: Object): any; + format(value: number, options?: Object): any; /** * Convert a properly formatted string to a primitive Number, using * locale-specific settings. @@ -20782,7 +20786,7 @@ declare module dojo { * @param root OptionalA default starting root node from which to start the parsing. Can beomitted, defaulting to the entire document. If omitted, the optionsobject can be passed in this place. If the options object has arootNode member, that is used. * @param options a kwArgs options object, see parse() for details */ - scan(root: HTMLElement, options: Object): dojo.promise.Promise; + scan(root: HTMLElement, options: Object): dojo.promise.Promise; } /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/regexp.html @@ -24419,7 +24423,7 @@ declare module dojo { * @param errback OptionalCallback to be invoked when the promise is rejected. * @param progback OptionalCallback to be invoked when the promise emits a progress update. */ - when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise; + when(valueOrPromise: any, callback: Function, errback: Function, progback: Function): dojo.promise.Promise; /** * signal fired by impending window destruction. You may use * dojo.addOnWIndowUnload() or dojo.connect() to this method to perform @@ -28268,8 +28272,8 @@ declare module "dojo/promise/tracer" { export=exp; } declare module "dojo/promise/Promise" { - var exp: typeof dojo.promise.Promise - export=exp; + interface Promise extends dojo.promise.Promise { } + export = Promise; } declare module "dojo/rpc/JsonpService" { var exp: typeof dojo.rpc.JsonpService From eff54af628a053f78dc63d6d79da6862a8a71439 Mon Sep 17 00:00:00 2001 From: peferron Date: Mon, 13 Apr 2015 21:02:00 -0700 Subject: [PATCH 014/534] lodash: update _.zipObject and _.object - Update the jsdoc and parameter names. - Add the 'two-dimensional array' invocation type. - Add chaining. - In the test file, replace `{ [key: string]: any }` by `Dictionary` for consistency with the rest of the code. --- lodash/lodash-tests.ts | 10 +++++++-- lodash/lodash.d.ts | 46 +++++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 46c11ebf6..4c19db806 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -255,8 +255,14 @@ result = _.last(foodsType, { 'type': 'vegetable' }); result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); -result = <{ [key: string]: any }>_.zipObject(['moe', 'larry'], [30, 40]); -result = <{ [key: string]: any }>_.object(['moe', 'larry'], [30, 40]); +result = <_.Dictionary>_.zipObject(['moe', 'larry'], [30, 40]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_(['moe', 'larry']).zipObject([30, 40]); +result = <_.Dictionary>_.object(['moe', 'larry'], [30, 40]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_(['moe', 'larry']).object([30, 40]); +result = <_.Dictionary>_.zipObject([['moe', 30], ['larry', 40]]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_([['moe', 30], ['larry', 40]]).zipObject(); +result = <_.Dictionary>_.object([['moe', 30], ['larry', 40]]); +result = <_.LoDashObjectWrapper<_.Dictionary>>_([['moe', 30], ['larry', 40]]).object(); result = _.pull([1, 2, 3, 1, 2, 3], 2, 3); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 55d35707f..55d099f18 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2042,25 +2042,47 @@ declare module _ { //_.zipObject interface LoDashStatic { /** - * Creates an object composed from arrays of keys and values. Provide either a single - * two dimensional array, i.e. [[key1, value1], [key2, value2]] or two arrays, one of - * keys and one of corresponding values. - * @param keys The array of keys. - * @param values The array of values. - * @return An object composed of the given keys and corresponding values. + * The inverse of _.pairs; this method returns an object composed from arrays of property + * names and values. Provide either a single two dimensional array, e.g. [[key1, value1], + * [key2, value2]] or two arrays, one of property names and one of corresponding values. + * @param props The property names. + * @param values The property values. + * @return Returns the new object. **/ zipObject( - keys: List, - values: List): TResult; + props: List, + values?: List): TResult; /** - * @see _.object + * @see _.zipObject + **/ + zipObject(props: List>): Dictionary; + + /** + * @see _.zipObject **/ object( - keys: List, - values: List): TResult; - } + props: List, + values?: List): TResult; + /** + * @see _.zipObject + **/ + object(props: List>): Dictionary; + } + + interface LoDashArrayWrapper { + /** + * @see _.zipObject + **/ + zipObject(values?: List): _.LoDashObjectWrapper>; + + /** + * @see _.zipObject + **/ + object(values?: List): _.LoDashObjectWrapper>; + } + /* ************* * Collections * ************* */ From b76b01450a5f3d90b92298b1204da474e8568133 Mon Sep 17 00:00:00 2001 From: Eric Byers Date: Wed, 15 Apr 2015 16:52:31 -0500 Subject: [PATCH 015/534] Split external and internal modules apart, add additional RequestValidation functions, extend Express Request to include RequestValidation. --- express-validator/express-validator.d.ts | 325 ++++++++++++----------- 1 file changed, 171 insertions(+), 154 deletions(-) diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index 5a5df2fa0..6ec5ece9e 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -5,169 +5,186 @@ /// +// Add RequestValidation Interface on to Express's Request Interface. +declare module Express { + interface Request extends ExpressValidator.RequestValidation {} +} +// External express-validator module. declare module "express-validator" { import express = require('express'); - module ExpressValidator { - - export interface ValidationError { - msg: string; - param: string; - } - - export interface RequestValidation { - check(field:string, message:string): Validator; - assert(field:string, message:string): Validator; - sanitize(field:string): Sanitizer; - onValidationError(func:(msg:string) => void): void; - validationErrors() : any; - } - - export interface Validator { - /** - * Alias for regex() - */ - is(): Validator; - /** - * Alias for notRegex() - */ - not(): Validator; - isEmail(): Validator; - /** - * Accepts http, https, ftp - */ - isUrl(): Validator; - /** - * Combines isIPv4 and isIPv6 - */ - isIP(): Validator; - isIPv4(): Validator; - isIPv6(): Validator; - isAlpha(): Validator; - isAlphanumeric(): Validator; - isNumeric(): Validator; - isHexadecimal(): Validator; - /** - * Accepts valid hexcolors with or without # prefix - */ - isHexColor(): Validator; - /** - * isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't - */ - isInt(): Validator; - isLowercase(): Validator; - isUppercase(): Validator; - isDecimal(): Validator; - /** - * Alias for isDecimal - */ - isFloat(): Validator; - /** - * Check if length is 0 - */ - notNull(): Validator; - isNull(): Validator; - /** - * Not just whitespace (input.trim().length !== 0) - */ - notEmpty(): Validator; - equals(equals:any): Validator; - contains(str:string): Validator; - notContains(str:string): Validator; - /** - * Usage: regex(/[a-z]/i) or regex('[a-z]','i') - */ - regex(pattern:string, modifiers:string): Validator; - notRegex(pattern:string, modifiers:string): Validator; - /** - * max is optional - */ - len(min:number, max?:number): Validator; - /** - * Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier - */ - isUUID(version:number): Validator; - /** - * Alias for isUUID(3) - */ - isUUIDv3(): Validator; - /** - * Alias for isUUID(4) - */ - isUUIDv4(): Validator; - /** - * Alias for isUUID(5) - */ - isUUIDv5(): Validator; - /** - * Uses Date.parse() - regex is probably a better choice - */ - isDate(): Validator; - /** - * Argument is optional and defaults to today. Comparison is non-inclusive - */ - isAfter(date:Date): Validator; - /** - * Argument is optional and defaults to today. Comparison is non-inclusive - */ - isBefore(date:Date): Validator; - isIn(options:string): Validator; - isIn(options:string[]): Validator; - notIn(options:string): Validator; - notIn(options:string[]): Validator; - max(val:string): Validator; - min(val:string): Validator; - /** - * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats - */ - isCreditCard(): Validator; - } - - interface Sanitizer { - /** - * Trim optional `chars`, default is to trim whitespace (\r\n\t ) - */ - trim(...chars:string[]): Sanitizer; - ltrim(...chars:string[]): Sanitizer; - rtrim(...chars:string[]): Sanitizer; - ifNull(replace:any): Sanitizer; - toFloat(): Sanitizer; - toInt(): Sanitizer; - /** - * True unless str = '0', 'false', or str.length == 0 - */ - toBoolean(): Sanitizer; - /** - * False unless str = '1' or 'true' - */ - toBooleanStrict(): Sanitizer; - /** - * Decode HTML entities - */ - entityDecode(): Sanitizer; - entityEncode(): Sanitizer; - /** - * Escape &, <, >, and " - */ - escape(): Sanitizer; - /** - * Remove common XSS attack vectors from user-supplied HTML - */ - xss(): Sanitizer; - /** - * Remove common XSS attack vectors from images - */ - xss(fromImages:boolean): Sanitizer; - } - } - /** * * @middlewareOptions see: https://github.com/ctavan/express-validator#middleware-options */ function ExpressValidator(middlewareOptions?:any):express.RequestHandler; - export = ExpressValidator; } + +// Internal Module. +declare module ExpressValidator { + + export interface ValidationError { + msg: string; + param: string; + } + + export interface RequestValidation { + checkBody(field:string, message:string): Validator; + checkParams(field:string, message:string): Validator; + checkQuery(field:string, message:string): Validator; + checkHeader(field:string, message:string): Validator; + checkFiles(field:string, message:string): Validator; + + filter(field:string): Sanitizer; + sanitize(field:string): Sanitizer; + + check(field:string, message:string): Validator; + validate(field:string, message: string): Validator; + + assert(field:string, message:string): Validator; + + onValidationError(func:(msg:string) => void): void; + validationErrors(): any; + } + + export interface Validator { + /** + * Alias for regex() + */ + is(): Validator; + /** + * Alias for notRegex() + */ + not(): Validator; + isEmail(): Validator; + /** + * Accepts http, https, ftp + */ + isUrl(): Validator; + /** + * Combines isIPv4 and isIPv6 + */ + isIP(): Validator; + isIPv4(): Validator; + isIPv6(): Validator; + isAlpha(): Validator; + isAlphanumeric(): Validator; + isNumeric(): Validator; + isHexadecimal(): Validator; + /** + * Accepts valid hexcolors with or without # prefix + */ + isHexColor(): Validator; + /** + * isNumeric accepts zero padded numbers, e.g. '001', isInt doesn't + */ + isInt(): Validator; + isLowercase(): Validator; + isUppercase(): Validator; + isDecimal(): Validator; + /** + * Alias for isDecimal + */ + isFloat(): Validator; + /** + * Check if length is 0 + */ + notNull(): Validator; + isNull(): Validator; + /** + * Not just whitespace (input.trim().length !== 0) + */ + notEmpty(): Validator; + equals(equals:any): Validator; + contains(str:string): Validator; + notContains(str:string): Validator; + /** + * Usage: regex(/[a-z]/i) or regex('[a-z]','i') + */ + regex(pattern:string, modifiers:string): Validator; + notRegex(pattern:string, modifiers:string): Validator; + /** + * max is optional + */ + len(min:number, max?:number): Validator; + /** + * Version can be 3, 4 or 5 or empty, see http://en.wikipedia.org/wiki/Universally_unique_identifier + */ + isUUID(version:number): Validator; + /** + * Alias for isUUID(3) + */ + isUUIDv3(): Validator; + /** + * Alias for isUUID(4) + */ + isUUIDv4(): Validator; + /** + * Alias for isUUID(5) + */ + isUUIDv5(): Validator; + /** + * Uses Date.parse() - regex is probably a better choice + */ + isDate(): Validator; + /** + * Argument is optional and defaults to today. Comparison is non-inclusive + */ + isAfter(date:Date): Validator; + /** + * Argument is optional and defaults to today. Comparison is non-inclusive + */ + isBefore(date:Date): Validator; + isIn(options:string): Validator; + isIn(options:string[]): Validator; + notIn(options:string): Validator; + notIn(options:string[]): Validator; + max(val:string): Validator; + min(val:string): Validator; + /** + * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats + */ + isCreditCard(): Validator; + } + + interface Sanitizer { + /** + * Trim optional `chars`, default is to trim whitespace (\r\n\t ) + */ + trim(...chars:string[]): Sanitizer; + ltrim(...chars:string[]): Sanitizer; + rtrim(...chars:string[]): Sanitizer; + ifNull(replace:any): Sanitizer; + toFloat(): Sanitizer; + toInt(): Sanitizer; + /** + * True unless str = '0', 'false', or str.length == 0 + */ + toBoolean(): Sanitizer; + /** + * False unless str = '1' or 'true' + */ + toBooleanStrict(): Sanitizer; + /** + * Decode HTML entities + */ + entityDecode(): Sanitizer; + entityEncode(): Sanitizer; + /** + * Escape &, <, >, and " + */ + escape(): Sanitizer; + /** + * Remove common XSS attack vectors from user-supplied HTML + */ + xss(): Sanitizer; + /** + * Remove common XSS attack vectors from images + */ + xss(fromImages:boolean): Sanitizer; + } + +} \ No newline at end of file From 93f4df8e1a421ce209c54ab39bc4eddd925c3094 Mon Sep 17 00:00:00 2001 From: Eric Byers Date: Wed, 15 Apr 2015 17:13:29 -0500 Subject: [PATCH 016/534] Fix validationErrors parameters to have optional mapErrors parameters --- express-validator/express-validator.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index 6ec5ece9e..4f3686c48 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -47,7 +47,7 @@ declare module ExpressValidator { assert(field:string, message:string): Validator; onValidationError(func:(msg:string) => void): void; - validationErrors(): any; + validationErrors(mapErrors?: boolean): any; } export interface Validator { From ca99daff707027bfed47f30a6603911778529e99 Mon Sep 17 00:00:00 2001 From: Eric Byers Date: Wed, 15 Apr 2015 17:16:24 -0500 Subject: [PATCH 017/534] Return valid array type for validationErrors --- express-validator/express-validator.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index 4f3686c48..c265a4f8b 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -47,7 +47,7 @@ declare module ExpressValidator { assert(field:string, message:string): Validator; onValidationError(func:(msg:string) => void): void; - validationErrors(mapErrors?: boolean): any; + validationErrors(mapErrors?: boolean): Array; } export interface Validator { From 72fece2722cca1b9c9fe3a6c811c2717149b535a Mon Sep 17 00:00:00 2001 From: Eric Byers Date: Thu, 16 Apr 2015 11:06:23 -0500 Subject: [PATCH 018/534] Adding basic express-validator-tests --- express-validator/express-validator-tests.ts | 35 ++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 express-validator/express-validator-tests.ts diff --git a/express-validator/express-validator-tests.ts b/express-validator/express-validator-tests.ts new file mode 100644 index 000000000..4cfe35c62 --- /dev/null +++ b/express-validator/express-validator-tests.ts @@ -0,0 +1,35 @@ +/// + +// @todo Most of the sanitize/validator methods are not tested here. + +import express = require('express'); +import expressValidator = require('express-validator'); + +var app = express(); + +// Add the middleware to make sure it includes. +app.use(expressValidator({ + errorFormatter: function(param: string, msg: string, value: string): {} { + return {}; + } +})); + +var router: express.Router = express.Router(); + +// Add a sample route so we can use the request. +router.get('/test/:testParam', function(req: express.Request, res: express.Response): void { + + // Various different request tests. + // The fluid calls are just random, making sure to cover a portion of the Validator. + req.checkParams('testParam', 'Invalid testParam').notEmpty().isInt(); + req.checkBody('testBody', 'Invalid testBody').isNumeric(); + req.checkFiles('testFiles', 'Invalid testFiles').isUrl(); + req.checkQuery('testQuery', 'Invalid testQuery').isDate(); + req.checkHeader('testHeader', 'Invalid testHeader').isLowercase().isUppercase(); + + var test = req.filter('postparam').toBoolean(); + var test2 = req.sanitize('postparam').toInt(); + + var errors = req.validationErrors(); + var mappedErrors = req.validationErrors(true); +}); \ No newline at end of file From d484d07be66b5eb84addadc19dcba058ae2dfa5a Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Sun, 19 Apr 2015 14:40:48 -0500 Subject: [PATCH 019/534] Move jquery.pickadate definitions to module and support Pickadate v3.5.5 --- jquery.pickadate/jquery.pickadate-tests.ts | 451 ++++++++++++++--- jquery.pickadate/jquery.pickadate.d.ts | 532 +++++++++++---------- 2 files changed, 677 insertions(+), 306 deletions(-) diff --git a/jquery.pickadate/jquery.pickadate-tests.ts b/jquery.pickadate/jquery.pickadate-tests.ts index fde52f3e3..15ebcbc3a 100644 --- a/jquery.pickadate/jquery.pickadate-tests.ts +++ b/jquery.pickadate/jquery.pickadate-tests.ts @@ -1,20 +1,30 @@ /// -/* -* Date picker tests -* From http://amsul.ca/pickadate.js/date.htm -*/ +// Date picker tests from http://amsul.ca/pickadate.js/date/ $('.datepicker').pickadate(); +// Change the month and weekday labels $('.datepicker').pickadate({ weekdaysShort: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], showMonthsShort: true }); +// Change button text or hide a button completely $('.datepicker').pickadate({ today: '', - clear: 'Clear selection' + clear: 'Clear selection', + close: 'Cancel' +}); + +// Change the title attributes of several elements within the picker +$('.datepicker').pickadate({ + labelMonthNext: 'Go to the next month', + labelMonthPrev: 'Go to the previous month', + labelMonthSelect: 'Pick a month from the dropdown', + labelYearSelect: 'Pick a year from the dropdown', + selectMonths: true, + selectYears: true }); // Extend the default picker options for all instances. @@ -35,6 +45,7 @@ $('.datepicker').pickadate({ formatSubmit: 'yyyy/mm/dd' }); +// Display a human-friendly format and use an alternate one to submit to the server $('.datepicker').pickadate({ // Escape any "rule" characters with an exclamation mark (!). format: 'You selecte!d: dddd, dd mmm, yyyy', @@ -43,30 +54,51 @@ $('.datepicker').pickadate({ hiddenSuffix: '__suffix' }); +// Send the hidden value only +$('.datepicker').pickadate({ + formatSubmit: 'yyyy/mm/dd', + hiddenName: true +}); + +// Editable input +$('.datepicker').pickadate({ + editable: true +}); + +// Display select menus to pick the month and year $('.datepicker').pickadate({ selectYears: true, selectMonths: true }); +// Specify the number of years to show in the dropdown using an +// even integer - half before and half after the year in focus: $('.datepicker').pickadate({ // `true` defaults to 10. selectYears: 4 }); +// The first day of the week can be set to either Sunday or Monday. +// Anything truth-y sets it as Monday and anything false-y as Sunday. $('.datepicker').pickadate({ firstDay: 1 }); +// Date Limits + +// Using JavaScript dates $('.datepicker').pickadate({ min: new Date(2013, 3, 20), max: new Date(2013, 7, 14) }); +// Using arrays formatted as [YEAR,MONTH,DATE] $('.datepicker').pickadate({ min: [2013, 3, 20], max: [2013, 7, 14] }); +// Using integers or a boolean $('.datepicker').pickadate({ // An integer (positive/negative) sets it relative to today. min: -15, @@ -74,21 +106,9 @@ $('.datepicker').pickadate({ max: true }); -$('.datepicker').pickadate({ - disable: [ - [2013, 3, 3], - [2013, 3, 12], - [2013, 3, 20], - [2013, 3, 29] - ] -}); - -$('.datepicker').pickadate({ - disable: [ - 1, 4, 7 - ] -}); +// Disable dates +// Using JavaScript dates $('.datepicker').pickadate({ disable: [ new Date(2013, 3, 13), @@ -96,6 +116,30 @@ $('.datepicker').pickadate({ ] }); +// Using arrays formatted as [YEAR,MONTH,DATE] +$('.datepicker').pickadate({ + disable: [ + [2015, 3, 3], + [2015, 3, 12], + [2015, 3, 20] + ] +}); + +// Using integers as days of the week (1 to 7) +$('.datepicker').pickadate({ + disable: [ + 1, 4, 7 + ] +}); + +// Using objects as a range of dates +$('.datepicker').pickadate({ + disable: [ + { from: [2016, 2, 14], to: [2016, 2, 27] } + ] +}); + +// Enable only a specific or arbitrary set of dates by setting true as the first item in the collection $('.datepicker').pickadate({ disable: [ true, @@ -103,14 +147,40 @@ $('.datepicker').pickadate({ [2013, 3, 3], [2013, 3, 12], [2013, 3, 20], - [2013, 3, 29] + new Date(2015, 3, 13), + new Date(2015, 3, 29) ] }); +// Enable dates that fall within a range of disabled dates by adding +// the inverted parameter to the item within the collection $('.datepicker').pickadate({ - container: '#root-outlet' + disable: [ + 5, + [2015, 10, 21, 'inverted'], + { from: [2016, 3, 15], to: [2016, 3, 25] }, + [2016, 3, 20, 'inverted'], + { from: [2016, 3, 17], to: [2016, 3, 18], inverted: true } + ] }); +// Specify where to insert the root element by passing any valid CSS selector to the container option +$('.datepicker').pickadate({ + container: '#root-picker-outlet' +}); + +// Specify where to insert the hidden element by passing any valid CSS selector to the containerHidden option +$('.datepicker').pickadate({ + containerHidden: '#hidden-input-outlet' +}); + +// Close on a user action +$('.datepicker').pickadate({ + closeOnSelect: false, + closeOnClear: false +}); + +// Fire off events as the user interacts with the picker $('.datepicker').pickadate({ onStart: function () { console.log('Hello there :)') @@ -127,22 +197,31 @@ $('.datepicker').pickadate({ onStop: function () { console.log('See ya.') }, - onSet: function (event) { - console.log('Just set stuff:', event) + onSet: function (context) { + console.log('Just set stuff:', context) } }); -/* -* Time picker tests -* From http://amsul.ca/pickadate.js/time.htm -*/ +// Time picker tests from http://amsul.ca/pickadate.js/time/ $('.timepicker').pickatime(); +// Extend the default picker options for all instances. +$.extend($.fn.pickatime.defaults, { + clear: 'Effacer' +}) + +// Or, pass the months and weekdays as an array for each invocation. +$('.timepicker').pickatime({ + clear: 'Effacer' +}) + +// Change the text or hide the button completely by passing a false-y value $('.timepicker').pickatime({ clear: '' }); +// Display a human-friendly label and input format and use an alternate one to submit $('.timepicker').pickatime({ // Escape any "rule" characters with an exclamation mark (!). format: 'T!ime selected: h:i a', @@ -152,23 +231,47 @@ $('.timepicker').pickatime({ hiddenSuffix: '__suffix' }); +// The formatLabel option is unique. It can contain HTML and it can also +// be a function if you want to create the label during run-time: $('.timepicker').pickatime({ - formatLabel: function (time: TimePickerItemObject) { + formatLabel: function (time) { var hours = (time.pick - this.get('now').pick) / 60, label = hours < 0 ? ' !hours to now' : hours > 0 ? ' !hours from now' : 'now' - return 'h:i a ' + (hours ? Math.abs(hours).toString() : '') + label + '' + return 'h:i a ' + (hours ? Math.abs(hours) : '') + label + '' } }); -$('.datepicker').pickadate({ +// Send the hidden value only +$('.timepicker').pickatime({ + formatSubmit: 'HH:i', + hiddenName: true +}); + +// Editable input +$('.timepicker').pickatime({ + editable: true +}); + +// Choose the minutes interval between each time in the list +$('.timepicker').pickatime({ interval: 150 }); +// Time Limits + +// Using JavaScript dates +$('.timepicker').pickatime({ + min: new Date(2015, 3, 20, 7), + max: new Date(2015, 7, 14, 18, 30) +}); + +// Using arrays formatted as [HOUR,MINUTE] $('.timepicker').pickatime({ min: [7, 30], max: [14, 0] }); +// Using integers or a boolean $('.timepicker').pickatime({ // An integer (positive/negative) sets it as intervals relative from now. min: -5, @@ -176,6 +279,17 @@ $('.timepicker').pickatime({ max: true }); +// Disable Times + +// Using JavaScript dates +$('.timepicker').pickatime({ + disable: [ + new Date(2016, 3, 20, 4, 30), + new Date(2016, 3, 20, 9) + ] +}); + +// Using arrays formatted as [HOUR,MINUTE] $('.timepicker').pickatime({ disable: [ [0, 30], @@ -185,12 +299,21 @@ $('.timepicker').pickatime({ ] }); +// Using integers as hours (0 to 23) $('.timepicker').pickatime({ disable: [ 3, 5, 7 ] }); +// Using objects as a range of times +$('.timepicker').pickatime({ + disable: [ + { from: [2, 0], to: [5, 30] } + ] +}); + +// Enable only a specific or arbitrary set of times by setting true as the first item in the collection $('.timepicker').pickatime({ disable: [ true, @@ -202,10 +325,35 @@ $('.timepicker').pickatime({ ] }); +// Enable times that fall within a range of disabled times by adding +// the inverted parameter to the item within the collection $('.timepicker').pickatime({ - container: '#root-outlet' + disable: [ + 1, + [1, 30, 'inverted'], + { from: [4, 30], to: [10, 30] }, + [6, 30, 'inverted'], + { from: [8, 0], to: [9, 0], inverted: true } + ] }); +// Specify where to insert the root element by passing any valid CSS selector to the container option +$('.timepicker').pickatime({ + container: '#root-picker-outlet' +}); + +// Specify where to insert the hidden element by passing any valid CSS selector to the containerHidden option +$('.timepicker').pickatime({ + containerHidden: '#hidden-input-outlet' +}); + +// Close on a user action +$('.timepicker').pickatime({ + closeOnSelect: false, + closeOnClear: false +}); + +// Fire off events as the user interacts with the picker $('.timepicker').pickatime({ onStart: function () { console.log('Hello there :)') @@ -222,15 +370,12 @@ $('.timepicker').pickatime({ onStop: function () { console.log('See ya.') }, - onSet: function (event) { - console.log('Just set stuff:', event) + onSet: function (context) { + console.log('Just set stuff:', context) } }); -/* -* API tests -* From http://amsul.ca/pickadate.js/api.htm -*/ +// API tests from http://amsul.ca/pickadate.js/api/ var $input = $('.datepicker').pickadate(); @@ -243,17 +388,18 @@ picker.open(); picker.close(); picker.close(true); -picker.open(false) +picker.open(false); $(document).on('click', function () { - picker.close() + picker.close(); }); picker.start(); picker.stop(); picker.render(); +picker.render(true); picker.clear(); -picker.get() // Short for `picker.get('value')` +picker.get(); // Short for `picker.get('value')` picker.get('select'); picker.get('select', 'yyyy/mm/dd'); @@ -262,6 +408,7 @@ picker.get('highlight'); picker.get('highlight', 'yyyy/mm/dd'); picker.get('view'); +picker.get('view', 'yyyy/mm/dd'); picker.get('min'); picker.get('min', 'yyyy/mm/dd'); @@ -271,63 +418,105 @@ picker.get('max', 'yyyy/mm/dd'); picker.get('open'); picker.get('start'); picker.get('id'); +picker.get('enable'); picker.get('disable'); picker.set('clear'); -// reset disabled dates -picker.set('disable', undefined); +// Set select for a date item object // Using arrays formatted as [YEAR,MONTH,DATE]. picker.set('select', [2013, 3, 20]); // Using JavaScript Date objects. -picker.set('select', new Date(2013,03,20)); +picker.set('select', new Date(2013, 3, 20)); // Using positive integers as UNIX timestamps. picker.set('select', 1365961912346); +// Using a string along with the parsing format (defaults to `format` option). +picker.set('select', '2016-04-20', { format: 'yyyy-mm-dd' }); + +// Set select for a time item object + // Using arrays formatted as [HOUR,MINUTE]. picker.set('select', [3, 0]); +// Using JavaScript Date objects. +picker.set('select', new Date(2015, 3, 20, 10, 30)); + // Using positive integers as minutes. picker.set('select', 540); +// Using a string along with the parsing format (defaults to `format` option). +picker.set('select', '04-30', { format: 'hh-i' }); + +// Set highlight for a date item object + // Using arrays formatted as [YEAR,MONTH,DATE]. picker.set('highlight', [2013, 3, 20]); // Using JavaScript Date objects. -picker.set('highlight', new Date(2013,7,14)); +picker.set('highlight', new Date(2015, 3, 30)); // Using positive integers as UNIX timestamps. picker.set('highlight', 1365961912346); +// Using a string along with the parsing format (defaults to `format` option). +picker.set('highlight', '2016-04-20', { format: 'yyyy-mm-dd' }); + +// Set highlight for a time item object + // Using arrays formatted as [HOUR,MINUTE]. picker.set('highlight', [15, 30]); +// Using JavaScript Date objects. +picker.set('highlight', new Date(2015, 3, 20, 10, 30)); + // Using positive integers as minutes. picker.set('highlight', 1080); +// Using a string along with the parsing format (defaults to `format` option). +picker.set('highlight', '04-30', { format: 'hh-i' }); + +// Set view for a date item object + // Using arrays formatted as [YEAR,MONTH,DATE]. picker.set('view', [2000, 3, 20]); // Using JavaScript Date objects. -picker.set('view', new Date(1988,7,14)); +picker.set('view', new Date(1988, 7, 14)); // Using positive integers as UNIX timestamps. picker.set('view', 1587355200000); +// Using a string along with the parsing format (defaults to `format` option). +picker.set('view', '2016-04-20', { format: 'yyyy-mm-dd' }); + +// Set view for a time item object + // Using arrays formatted as [HOUR,MINUTE]. picker.set('view', [15, 30]); +// Using JavaScript Date objects. +picker.set('view', new Date(2015, 3, 20, 10, 30)); + // Using positive integers as minutes. picker.set('view', 1080); +// Using a string along with the parsing format (defaults to `format` option). +picker.set('view', '04-30', { format: 'hh-i' }); + +// Limit the min date + // Using arrays formatted as [YEAR,MONTH,DATE]. picker.set('min', [2013, 3, 20]); // Using JavaScript Date objects. -picker.set('min', new Date(2013,7,14)); +picker.set('min', new Date(2015, 7, 14)); + +// Using formatted strings. +picker.set('min', '8 January, 2016'); // Using integers as days relative to today. picker.set('min', -4); @@ -338,9 +527,17 @@ picker.set('min', true); // Using `false` to remove. picker.set('min', false); +// Limit the min time + // Using arrays formatted as [HOUR,MINUTE]. picker.set('min', [15, 30]); +// Using JavaScript Date objects. +picker.set('min', new Date(2015, 3, 20, 10, 30)); + +// Using formatted strings. +picker.set('min', '4:30 PM'); + // Using integers as intervals relative from now. picker.set('min', -4); @@ -350,11 +547,16 @@ picker.set('min', true); // Using `false` to remove. picker.set('min', false); +// Limit the max date + // Using arrays formatted as [YEAR,MONTH,DATE]. picker.set('max', [2013, 3, 20]); // Using JavaScript Date objects. -picker.set('max', new Date(2013,7,14)); +picker.set('max', new Date(2015, 7, 14)); + +// Using formatted strings. +picker.set('max', '20 April, 2016'); // Using integers as days relative to today. picker.set('max', 4); @@ -365,9 +567,17 @@ picker.set('max', true); // Using `false` to remove. picker.set('max', false); +// Limit the max time + // Using arrays formatted as [HOUR,MINUTE]. picker.set('max', [15, 30]); +// Using JavaScript Date objects. +picker.set('max', new Date(2015, 3, 20, 10, 30)); + +// Using formatted strings. +picker.set('max', '11:30 AM'); + // Using integers as intervals relative from now. picker.set('max', 4); @@ -377,16 +587,131 @@ picker.set('max', true); // Using `false` to remove. picker.set('max', false); -picker.on('open', function () { - console.log('Opened.. and here I am!'); -}); +// Disable/enable specific dates +picker.set('disable', [ + // Using a collection of arrays formatted as [YEAR,MONTH,DATE] + [2016, 9, 3], [2016, 9, 9], [2016, 9, 20], + + // Using JavaScript Date objects + new Date(2015, 9, 13), new Date(2015, 9, 24) +]); + +picker.set('enable', [ + [2016, 9, 9], + [2016, 9, 13], + new Date(2015, 9, 20) +]); + +// Disable/enable ranges of dates +picker.set('disable', [ + 1, 4, 7, // Using integers as the days of the week (1 to 7) + + // Using a range object with a "from" and "to" property + { from: [2016, 2, 14], to: [2016, 2, 27] } +]); + +picker.set('enable', [ + 4, + { from: [2016, 2, 24], to: [2016, 2, 27] } +]); + +// "Flip" the enabled and disabled dates: +picker.set('disable', 'flip'); +picker.set('enable', 'flip'); + +// Disable all the dates +picker.set('disable', true); +picker.set('enable', false); + +// Enable all the dates +picker.set('enable', true); +picker.set('disable', false); + +// Disable/enable specific times +picker.set('disable', [ + // Using a collection of arrays formatted as [HOUR,MINUTES] + [2, 30], [4, 30], [9, 0], + + // Using JavaScript Date objects + new Date(2015, 9, 13, 6), new Date(2015, 9, 13, 12, 30) +]); + +picker.set('enable', [ + [4, 30], [6, 0], + new Date(2015, 9, 13, 9) +]); + +// Disable/enable ranges of times +picker.set('disable', [ + 1, 4, 7, // Using integers as hours of the day (from 0 to 23) + + // Using a range object with a “from†and “to†property + { from: [10, 30], to: [18, 0] } +]); + +picker.set('enable', [ + 4, + { from: [14, 0], to: [16, 30] } +]); + +// "Flip" the enabled and disabled times: +picker.set('disable', 'flip'); +picker.set('enable', 'flip'); + +// Disable all the times +picker.set('disable', true); +picker.set('enable', true); + +// Enable all the times +picker.set('enable', true); +picker.set('disable', false); + +// Enable an element within a disabled range + +picker.set('disable', [ + // Disable all Mondays, except November 15th, 2015. + 1, [2015, 10, 15, 'inverted'], + + // Disable all dates from March 2nd, 2016 to March 28th, 2016 + // except for March 10th and all between March 14th and March 23rd. + { from: [2016, 2, 2], to: [2016, 2, 28] }, + [2016, 2, 10, 'inverted'], + { from: [2016, 2, 14], to: [2016, 2, 23], inverted: true } +]); + +picker.set('disable', [ + // Disable all times from 1:00 AM to 1:59 AM, except 1:30 AM. + 1, [1, 30, 'inverted'], + + // Disable all times from 3:00 AM to 6:00 PM except + // for 4:30 AM and all between 7:30 AM and 11:30 AM. + { from: [3, 0], to: [18, 0] }, + [4, 30, 'inverted'], + { from: [7, 30], to: [11, 30], inverted: true } +]); + +// For the time picker only, you can change the interval between each time display +// using integers representing the interval length in minutes. +picker.set('interval', 15); +picker.set('interval', 20); +picker.set('interval', 120); + picker.on({ open: function () { - console.log('Opened.. and here I am!'); + console.log('Opened up!') }, close: function () { - console.log('Closed.. and here I am!'); + console.log('Closed now') + }, + render: function () { + console.log('Just rendered anew') + }, + stop: function () { + console.log('See ya') + }, + set: function (thingSet) { + console.log('Set stuff:', thingSet) } }); @@ -406,15 +731,27 @@ $('.datepicker').pickadate({ onStop: function () { console.log('See ya') }, - onSet: function (event) { - console.log('Set stuff:', event) + onSet: function (thingSet) { + console.log('Set stuff:', thingSet) } }); picker.on('open', function () { - console.log('Didn\'t open.. yet here I am!'); -}) + console.log('Even when I’m opened, I’m not logged..'); +}); +picker.off('open'); + +// Trigger an event’s callbacks that have been queued up +picker.on('open', function () { + console.log('This logs without opening!'); +}); picker.trigger('open'); +// Optionally, you can also pass some data to the method being triggered +picker.on('open', function (data) { + console.log('This logs without opening with this data:', data); +}); +picker.trigger('open', { some: 'value' }); + picker.$node; -picker.$root; \ No newline at end of file +picker.$root; diff --git a/jquery.pickadate/jquery.pickadate.d.ts b/jquery.pickadate/jquery.pickadate.d.ts index 62b20bb22..2c30eb046 100644 --- a/jquery.pickadate/jquery.pickadate.d.ts +++ b/jquery.pickadate/jquery.pickadate.d.ts @@ -1,69 +1,19 @@ -// Type definitions for pickadate.js 3.3.0 +// Type definitions for pickadate.js 3.5.5 // Project: https://github.com/amsul/pickadate.js // Definitions by: Theodore Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -/** Options shared between date and time pickers */ -interface pickerOptions { - /** Set clear button text */ - clear?: string; // default 'Clear' - - /** Specify where to insert the picker's root element by passing any valid CSS selector to this option */ - container?: any; - - // Events - onStart?: (event: any) => void; - onRender?: (event: any) => void; - onOpen?: (event: any) => void; - onClose?: (event: any) => void; - onSet?: (event: any) => void; - onStop?: (event: any) => void; -} - -interface pickadateOptions extends pickerOptions { - // Strings and translations - monthsFull?: string[]; // default 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' - monthsShort?: string[]; // default 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' - weekdaysFull?: string[]; // default 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' - weekdaysShort?: string[]; // default 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' - showMonthsShort?: boolean; - showWeekdaysFull?: boolean; - - // Buttons - today?: string; // default 'Today' - - // Formats - format?: string; // default 'd mmmm, yyyy' - formatSubmit?: string; // e.g. 'yyyy/mm/dd' - hiddenPrefix?: string; // default undefined - hiddenSuffix?: string; // default '_submit' - hiddenName?: boolean; // default undefined - - // Dropdown selectors - selectYears?: any; // Specify the number of years selectable using an even integer - half before and half after the year in focus: - selectMonths?: boolean; - - // First day of the week - firstDay?: any; // The first day of the week can be set to either Sunday or Monday. Anything truth-y sets it as Monday and anything false-y as Sunday - - // Date limits - min?: any; // date object, array formatted as [YEAR,MONTH,DATE], or dates relative to today using integers or a boolean (`true` sets it to today. `false` removes any limits). - max?: any; - - // Disable dates - disable?: any[]; // Date objects, arrays formatted as [YEAR,MONTH,DATE], or integers representing days of the week (from 1 to 7). Switch to whitelist by setting first item in collection to `true`. - - // Classes - klass?: { - +declare module Pickadate { + /** KlassOptions shared between date and time pickers */ + interface KlassOptions { // The element states input?: string; // default 'picker__input' active?: string; // default 'picker__input--active' // The root picker and states - picker?: string; // default 'picker' + picker?: string; // default 'picker' or 'picker picker--time' opened?: string; // default 'picker--opened' focused?: string; // default 'picker--focused' @@ -75,6 +25,17 @@ interface pickadateOptions extends pickerOptions { wrap?: string; // default 'picker__wrap' box?: string; // default 'picker__box' + // Day/Time states + disabled?: string; // default 'picker__day--disabled' or 'picker__list-item--disabled' + selected?: string // default 'picker__day--selected' or 'picker__list-item--selected' + highlighted?: string // default 'picker__day--highlighted' or 'picker__list-item--highlighted' + now?: string; // default 'picker__day--today' or 'picker__list-item--now' + + // Clear button + buttonClear?: string; // default 'picker__button--clear' + } + + interface DateKlassOptions extends KlassOptions { // The picker header header?: string; // default 'picker__header' @@ -99,221 +60,294 @@ interface pickadateOptions extends pickerOptions { // Day states day?: string; // default 'picker__day' - disabled?: string; // default 'picker__day--disabled' - selected?: string // default 'picker__day--selected' - highlighted?: string // default 'picker__day--highlighted' - now?: string; // default 'picker__day--today' infocus?: string; // default 'picker__day--infocus' outfocus?: string; // default 'picker__day--outfocus' // The picker footer footer?: string; // default 'picker__footer' - // Today & clear buttons - buttonClear?: string; // default 'picker__button--clear' + // Today & close buttons + buttonClose?: string; // default 'picker__button--close' buttonToday?: string; // default 'picker__button--today' } -} -interface pickatimeOptions extends pickerOptions { - - // Formats - format?: string; // default 'h:i A' - formatLabel?: any; - formatSubmit?: string; - hiddenPrefix?: string; // default undefined - hiddenSuffix?: string; // default '_submit' - - // Time intervals - interval?: number; // interval in minutes. default 30. - - // Time limits - min?: any; // array formatted as [HOUR,MINUTE], or as times relative to now using integers or a boolean (`true` sets it to now, `false` removes any limits). - max?: any; - - // Disable times - disable?: any[]; // arrays formatted as [HOUR,MINUTE] or integers representing hours (from 0 to 23). Switch to whitelist by setting true as the first item in the collection. - - // Classes - klass?: { - - // The element states - input?: string; // default 'picker__input' - active?: string; // default 'picker__input--active' - - // The root picker and states - picker?: string; // default 'picker picker--time' - opened?: string; // default 'picker--opened' - focused?: string; // default 'picker--focused' - - // The picker holder - holder?: string; // default 'picker__holder' - - // The picker frame, wrapper, and box - frame?: string; // default 'picker__frame' - wrap?: string; // default 'picker__wrap' - box?: string; // default 'picker__box' + interface TimeKlassOptions extends KlassOptions { + // The root picker + picker?: string; // default 'picker picker--time' // List of times list?: string; // default 'picker__list' listItem?: string; // default 'picker__list-item' // Time states - disabled?: string; // default 'picker__list-item--disabled' - selected?: string; // default 'picker__list-item--selected' - highlighted?: string; // default 'picker__list-item--highlighted' viewset?: string; // default 'picker__list-item--viewset' - now?: string; // default 'picker__list-item--now' - - // Clear button - buttonClear?: string; // default 'picker__button--clear' } + + /** Options shared between date and time pickers */ + interface Options { + /** Set clear button text */ + clear?: string; // default 'Clear' + + /** + * The human-friendly display format. + * Escape any "rule" characters with an exclamation mark (!). + */ + format?: string; // default 'd mmmm, yyyy' + + /** An alternate format to submit to the server. */ + formatSubmit?: string; // default undefined + hiddenPrefix?: string; // default undefined + hiddenSuffix?: string; // default '_submit' + + /** + * A majority of the time, the value that needs to be sent to the server is just the hidden value + * and not the visible one. To make this happen, use the hiddenName option. + * This essentially nullifies the hiddenPrefix and hiddenSuffix, strips the name attribute from the source input, and then sets it as the name of the hidden input: + */ + hiddenName?: boolean; // default undefined + + /** + * By default, typing into the input is disabled by giving it a readOnly attribute. + * Setting the editable option to true allows the input field to be edited directly. + */ + editable?: boolean; + + /** Specify where to insert the picker's root element by passing any valid CSS selector to this option */ + container?: string; // default undefined + + /** The hidden input container */ + containerHidden?: string; // default undefined + + // Close on a user action + closeOnSelect?: boolean; // default true + closeOnClear?: boolean; // default true + + // Events + onStart?: (event: any) => void; + onRender?: (event: any) => void; + onOpen?: (event: any) => void; + onClose?: (event: any) => void; + onSet?: (event: any) => void; + onStop?: (event: any) => void; + } + + export interface DateOptions extends Options { + // Strings and translations + monthsFull?: string[]; // default 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' + monthsShort?: string[]; // default 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' + weekdaysFull?: string[]; // default 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' + weekdaysShort?: string[]; // default 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' + showMonthsShort?: boolean; + showWeekdaysFull?: boolean; + + // Buttons + today?: string; // default 'Today' + close?: string; // default 'Close' + + // Accessibility labels + labelMonthNext?: string; // default 'Next month' + labelMonthPrev?: string; // default 'Previous month' + labelMonthSelect?: string; // default 'Select a month' + labelYearSelect?: string; //default 'Select a year' + + /** + * True enables the dropdown selector and false replaces it with text. + * You can also specify the number of years to show in the dropdown using an even integer + * - half before and half after the year in focus. If true the value will default to 10. + */ + selectYears?: boolean|number; + + /** True enables the dropdown selector and false replaces it with text */ + selectMonths?: boolean; + + /** + * The first day of the week can be set to either Sunday or Monday. + * True or 1 sets it as Monday and false or 0 as Sunday. + */ + firstDay?: boolean|number; + + // Date limits + min?: any; // date object, array formatted as [YEAR,MONTH,DATE], or dates relative to today using integers or a boolean (`true` sets it to today. `false` removes any limits). + max?: any; + + // Disable dates + disable?: any[]; // Date objects, arrays formatted as [YEAR,MONTH,DATE], or integers representing days of the week (from 1 to 7). Switch to whitelist by setting first item in collection to `true`. + + // Classes + klass?: DateKlassOptions; + } + + export interface TimeOptions extends Options { + /** + * The formatLabel option is unique. It can contain HTML and it can + * also be a function if you want to create the label during run-time. + */ + formatLabel?: string|((time: TimeItem) => string); + + /** + * Choose the interval in minutes between each time in the list. + * Default is 30. + */ + interval?: number; + + // Time limits + min?: any; // array formatted as [HOUR,MINUTE], or as times relative to now using integers or a boolean (`true` sets it to now, `false` removes any limits). + max?: any; + + // Disable times + disable?: any[]; // arrays formatted as [HOUR,MINUTE] or integers representing hours (from 0 to 23). Switch to whitelist by setting true as the first item in the collection. + + // Classes + klass?: TimeKlassOptions; + } + + interface Item { + /** The "pick" value used for comparisons. */ + pick: number; + } + + export interface DateItem extends Item { + /** The full year. */ + year: number; + + /** The month with zero-as-index. */ + month: number; + + /** The date of the month. */ + date: number; + + /** The day of the week with zero-as-index. */ + day: number; + + /** The underlying JavaScript Date object. */ + obj: Date; + } + + export interface TimeItem extends Item { + /** Hour of the day from 0 to 23. */ + hour: number; + + /** The minutes of the hour from 0 to 59 (based on the interval). */ + mins: number; + } + + export interface CallbackObject { + open?: () => void; + close?: () => void; + render?: () => void; + start?: () => void; + stop?: () => void; + set?: (thingset) => void; + } + + export interface SetObject { + clear?: any; + select?: any; + highlight?: any; + view?: any; + min?: any; + max?: any; + disable?: any; + enable?: any; + } + + export interface TimeSetObject extends SetObject { + interval?: number; + } + + interface Picker { + /** The picker's relative input element wrapped as a jQuery object. */ + $node: JQuery; + + /** The picker's relative root holder element wrapped as a jQuery object. */ + $root: JQuery; + + open(withoutFocus?: boolean): TPickerObject; + close(withFocus?: boolean): TPickerObject; + + /** Rebuild the picker. */ + start(): TPickerObject; + + /** Destroy the picker. */ + stop(): TPickerObject; + + /** + * Refresh the picker box after adding something to the holder. + * By default, only the "face" of the picker (i.e. the box element) + * has it’s contents re-rendered. To render the entire picker from + * the root up, pass true as the first argument. + */ + render(entirePicker?: boolean): TPickerObject; + + /** Clear the value in the picker's input element. */ + clear(): TPickerObject; + + /** Short for picker.get('value') */ + get(): string; + + /** Get the properties, objects, and states that make up the current state of the picker. */ + get(thing: string): any; + + /** Returns the string value of the picker's input element. */ + get(thing: 'value'): string; + + /** Returns the item object that is visually selected. */ + get(thing: 'select'): TItemObject; + + /** Returns the item object that is visually highlighted. */ + get(thing: 'highlight'): TItemObject; + + /** Returns the item object that sets the current view. */ + get(thing: 'view'): TItemObject; + + /** Returns the item object that limits the picker's lower range. */ + get(thing: 'min'): TItemObject; + + /** Returns the item object that limits the picker's upper range. */ + get(thing: 'max'): TItemObject; + + /** Returns a boolean value of whether the picker is open or not. */ + get(thing: 'open'): boolean; + + /** Returns a boolean value of whether the picker has started or not. */ + get(thing: 'start'): boolean; + + /** Returns a unique 9-digit integer that is the ID of the picker. */ + get(thing: 'id'): number; + + /** Returns an array of items that determine which item objects to disable on the picker. */ + get(thing: 'disable'): any[]; + + /** Returns a formatted string for the item object specified by `thing` */ + get(thing: string, format: string): string; + + /** Set the properties, objects, and states to change the state of the picker. */ + set(thing: string, value?: any, options?: any): TPickerObject; + set(things: TOptions, options?: any): TPickerObject; + + /** Bind callbacks to get fired off when the relative picker method is called. */ + on(methodName: string, callback: (data?: any) => void): TPickerObject; + + /** Bind multiple callbacks at once to get fired off when the relative picker method is called. */ + on(callbackObject: CallbackObject): TPickerObject; + + /** Unbind callbacks that are bound using the on method. */ + off(...methodName: string[]): TPickerObject; + + /** Trigger callbacks that have been queued up using the the on method. */ + trigger(event: string, data?: any): TPickerObject; + } + + interface DatePicker extends Picker { } + interface TimePicker extends Picker { } } -interface PickerItemObject { - /** The "pick" value used for comparisons. */ - pick: number; -} - -interface DatePickerItemObject extends PickerItemObject { - /** The full year. */ - year: number; - - /** The month with zero-as-index. */ - month: number; - - /** The date of the month. */ - date: number; - - /** The day of the week with zero-as-index. */ - day: number; - - /** The underlying JavaScript Date object. */ - obj: Date; -} - -interface TimePickerItemObject extends PickerItemObject { - /** Hour of the day from 0 to 23. */ - hour: number; - - /** The minutes of the hour from 0 to 59 (based on the interval). */ - mins: number; -} - -interface CallbackObject { - open?: () => void; - close?: () => void; - render?: () => void; - start?: () => void; - stop?: () => void; - set?: () => void; -} - -interface SetThings { - clear?; - select?: any; - highlight?: any; - view?: any; - min?: any; - max?: any; - disable?: any; - enable?: any; -} - -interface TimePickerSetThings extends SetThings { - interval?: any; -} - -interface PickerObject { - /** The picker's relative input element wrapped as a jQuery object. */ - $node: JQuery; - - /** The picker's relative root holder element wrapped as a jQuery object. */ - $root: JQuery; - - open(withoutFocus?: boolean): TPickerObject; - close(withFocus?: boolean): TPickerObject; - - /** Rebuild the picker. */ - start(): TPickerObject; - - /** Destroy the picker. */ - stop(): TPickerObject; - - /** - * Refresh the picker box after adding something to the holder. - * By default, only the "face" of the picker (i.e. the box element) - * has it’s contents re-rendered. To render the entire picker from - * the root up, pass true as the first argument. - */ - render(entirePicker?: boolean): TPickerObject; - - /** Clear the value in the picker's input element. */ - clear(): TPickerObject; - - /** Short for picker.get('value') */ - get(): string; - - /** Get the properties, objects, and states that make up the current state of the picker. */ - get(thing: string): any; - - /** Returns the string value of the picker's input element. */ - get(thing: 'value'): string; - - /** Returns the item object that is visually selected. */ - get(thing: 'select'): TItemObject; - - /** Returns the item object that is visually highlighted. */ - get(thing: 'highlight'): TItemObject; - - /** Returns the item object that sets the current view. */ - get(thing: 'view'): TItemObject; - - /** Returns the item object that limits the picker's lower range. */ - get(thing: 'min'): TItemObject; - - /** Returns the item object that limits the picker's upper range. */ - get(thing: 'max'): TItemObject; - - /** Returns a boolean value of whether the picker is open or not. */ - get(thing: 'open'): boolean; - - /** Returns a boolean value of whether the picker has started or not. */ - get(thing: 'start'): boolean; - - /** Returns a unique 9-digit integer that is the ID of the picker. */ - get(thing: 'id'): number; - - /** Returns an array of items that determine which item objects to disable on the picker. */ - get(thing: 'disable'): any[]; - - /** Returns a formatted string for the item object specified by `thing` */ - get(thing: string, format: string): string; - - /** Set the properties, objects, and states to change the state of the picker. */ - set(thing: string, value?: any, options?: any): TPickerObject; - set(things: TOptions, options?: any): TPickerObject; - - /** Bind callbacks to get fired off when the relative picker method is called. */ - on(methodName, callback: () => void): TPickerObject; - - /** Bind multiple callbacks at once to get fired off when the relative picker method is called. */ - on(callbackObject: CallbackObject): TPickerObject; - - /** Trigger callbacks that have been queued up using the the on method. */ - trigger(event: string): TPickerObject; -} - -interface DatePickerObject extends PickerObject { } -interface TimePickerObject extends PickerObject { } - interface JQuery { - pickadate(methodName: "picker"): DatePickerObject; + pickadate(methodName: "picker"): Pickadate.DatePicker; pickadate(methodName: string): any; - pickadate(options?: pickadateOptions): JQuery; + pickadate(options?: Pickadate.DateOptions): JQuery; - pickatime(methodName: "picker"): TimePickerObject; + pickatime(methodName: "picker"): Pickadate.TimePicker; pickatime(methodName: string): any; - pickatime(options?: pickatimeOptions): JQuery; + pickatime(options?: Pickadate.TimeOptions): JQuery; } - From 35243e64dff30581c3f577173fc92cd5ebaa7bc9 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Sun, 19 Apr 2015 16:56:28 -0500 Subject: [PATCH 020/534] Add definitions and tests for muted callbacks --- jquery.pickadate/jquery.pickadate-tests.ts | 20 ++++++++++++++++++++ jquery.pickadate/jquery.pickadate.d.ts | 12 ++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/jquery.pickadate/jquery.pickadate-tests.ts b/jquery.pickadate/jquery.pickadate-tests.ts index 15ebcbc3a..3bd3f0721 100644 --- a/jquery.pickadate/jquery.pickadate-tests.ts +++ b/jquery.pickadate/jquery.pickadate-tests.ts @@ -421,6 +421,26 @@ picker.get('id'); picker.get('enable'); picker.get('disable'); +// Set multiple at once +picker.set({ + select: new Date(2015, 3, 20), + highlight: [2015, 3, 20], + min: -4 +}); + +// Muted callbacks + +// One at a time +picker.set('disable', 'flip', { muted: true }) + +// Multiple at once +picker.set({ + select: [1988, 7, 14], + view: new Date(1988, 7, 14), + max: 4 +}, { muted: true }); + +// Clear the value in the picker’s input element. picker.set('clear'); // Set select for a date item object diff --git a/jquery.pickadate/jquery.pickadate.d.ts b/jquery.pickadate/jquery.pickadate.d.ts index 2c30eb046..4d5e52949 100644 --- a/jquery.pickadate/jquery.pickadate.d.ts +++ b/jquery.pickadate/jquery.pickadate.d.ts @@ -255,6 +255,14 @@ declare module Pickadate { interval?: number; } + interface SetOptions { + /** + * By default, any callbacks bound with the on method will be fired when its relevant thing is set. + * To silently set a thing, pass an options object with the muted parameter set to true. + */ + muted: boolean; + } + interface Picker { /** The picker's relative input element wrapped as a jQuery object. */ $node: JQuery; @@ -322,8 +330,8 @@ declare module Pickadate { get(thing: string, format: string): string; /** Set the properties, objects, and states to change the state of the picker. */ - set(thing: string, value?: any, options?: any): TPickerObject; - set(things: TOptions, options?: any): TPickerObject; + set(thing: string, value?: any, options?: SetOptions): TPickerObject; + set(things: TOptions, options?: SetOptions): TPickerObject; /** Bind callbacks to get fired off when the relative picker method is called. */ on(methodName: string, callback: (data?: any) => void): TPickerObject; From e507992e6352c488e7b5e4c438e17259abd4c5d7 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Sun, 19 Apr 2015 17:29:04 -0500 Subject: [PATCH 021/534] Remove duplicate, less complete pickadate definitions Fixes #3078 --- pickadate/pickadate-tests.ts | 279 --------------------- pickadate/pickadate.d.ts | 474 ----------------------------------- 2 files changed, 753 deletions(-) delete mode 100644 pickadate/pickadate-tests.ts delete mode 100644 pickadate/pickadate.d.ts diff --git a/pickadate/pickadate-tests.ts b/pickadate/pickadate-tests.ts deleted file mode 100644 index 4700310b8..000000000 --- a/pickadate/pickadate-tests.ts +++ /dev/null @@ -1,279 +0,0 @@ -/// -/// - -function testApiMethods(api: Pickadate.Api) { - api.clear(); - api.close(); - api.close(true); - api.get('value'); - api.get('value', 'yyyy-mm-dd'); - api.off('open'); - api.off('open', 'close', 'render'); - api.on('set', (context: {[key: string]: any}) => { }); - api.on('get', () => { }); - api.open(); - api.open(true); - api.render(); - api.render(true); - api.set('value', '2014-09-23'); - api.set({ - value: '2014-09-23', - max: new Date(2014, 12, 1) - }); - api.start(); - api.stop(); - api.trigger('open'); - - api.start().open().close().stop(); - - var pickerInputElement = api.$node; - pickerInputElement.show(); - - var pickerRootElement = api.$root; - pickerRootElement.show(); -} - -function testDateApiMethods(api: Pickadate.DateApi) { - api.get('select'); - api.get('select', 'yyyy/mm/dd'); - api.get('highlight'); - api.get('highlight', 'yyyy/mm/dd'); - api.get('view'); - api.get('view', 'yyyy/mm/dd'); - api.get('min'); - api.get('min', 'yyyy/mm/dd'); - api.get('max'); - api.get('max', 'yyyy/mm/dd'); -} - -function testTimeApiMethods(api: Pickadate.TimeApi) { - api.get('select'); - api.get('select', 'hh:i'); - api.get('highlight'); - api.get('highlight', 'hh:i'); - api.get('view'); - api.get('view', 'hh:i'); - api.get('min'); - api.get('min', 'hh:i'); - api.get('max'); - api.get('max', 'hh:i'); -} - -// ==================================================================================================================== - -var datePickerInput = $("input.date"); - -datePickerInput.pickadate(); - -datePickerInput.pickadate({ - monthsFull: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], - monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], - weekdaysFull: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], - weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], - showMonthsShort: true, - showWeekdaysFull: true, - - today: 'Today', - clear: 'Clear', - close: 'Close', - - labelMonthNext: 'Next month', - labelMonthPrev: 'Previous month', - labelMonthSelect: 'Select a month', - labelYearSelect: 'Select a year', - - // Formats - format: 'd mmmm, yyyy', - formatSubmit: 'yyyy-mm-dd', - hiddenPrefix: 'foo', - hiddenSuffix: '_submit', - hiddenName: 'bar', - - // Editable input - editable: true, - - // Dropdown selectors - selectYears: true, - selectMonths: 10, - - // First day of the week - firstDay: 0, - - // Date limits - min: new Date(2013, 3, 20), - max: [2013, 7, 14], - - // Disable dates - disable: [ new Date(2013, 3, 21) ], - - // Root container - container: '.root-container', - - // Events - onStart: () => { }, - onRender: () => { }, - onOpen: () => { }, - onClose: () => { }, - onSet: (context: {[key: string]: any}) => { }, - onStop: () => { } -}); - -datePickerInput.pickadate({ - klass: { - // The element states - input: 'picker__input', - active: 'picker__input--active', - - // The root picker and states * - picker: 'picker', - opened: 'picker--opened', - focused: 'picker--focused', - - // The picker holder - holder: 'picker__holder', - - // The picker frame, wrapper, and box - frame: 'picker__frame', - wrap: 'picker__wrap', - box: 'picker__box', - - // The picker header - header: 'picker__header', - - // Month navigation - navPrev: 'picker__nav--prev', - navNext: 'picker__nav--next', - navDisabled: 'picker__nav--disabled', - - // Month & year labels - month: 'picker__month', - year: 'picker__year', - - // Month & year dropdowns - selectMonth: 'picker__select--month', - selectYear: 'picker__select--year', - - // Table of dates - table: 'picker__table', - - // Weekday labels - weekdays: 'picker__weekday', - - // Day states - day: 'picker__day', - disabled: 'picker__day--disabled', - selected: 'picker__day--selected', - highlighted: 'picker__day--highlighted', - now: 'picker__day--today', - infocus: 'picker__day--infocus', - outfocus: 'picker__day--outfocus', - - // The picker footer - footer: 'picker__footer', - - // Today, clear, & close buttons - buttonClear: 'picker__button--clear', - buttonClose: 'picker__button--close', - buttonToday: 'picker__button--today' - } -}); - -var datePickerApi = datePickerInput.pickadate('picker'); - -datePickerInput.pickadate('open'); -datePickerInput.pickadate('get', 'value'); -datePickerInput.pickadate('$node').show(); -datePickerInput.pickadate('$root').show(); -datePickerInput.pickadate('_hidden').show(); - -testApiMethods(datePickerApi); -testDateApiMethods(datePickerApi); - -// ==================================================================================================================== - -var timePickerInput = $("input.time"); - -timePickerInput.pickatime(); - -timePickerInput.pickatime({ - // Translations and clear button - clear: 'Clear', - - // Formats - format: 'h:i A', - formatLabel: 'h:i a', - formatSubmit: 'HH:i', - hiddenPrefix: 'prefix__', - hiddenSuffix: '__suffix', - - // Editable input - editable: true, - - // Time intervals - interval: 30, - - // Time limits - min: new Date(2013, 3, 20, 7), - max: [7, 14], - - // Disable times - disable: [ new Date(2013, 3, 21, 7) ], - - // Root container - container: '.root-container', - - // Events - onStart: () => { }, - onRender: () => { }, - onOpen: () => { }, - onClose: () => { }, - onSet: (context: {[key: string]: any}) => { }, - onStop: () => { } -}); - -timePickerInput.pickatime({ - klass: { - // The element states - input: 'picker__input', - active: 'picker__input--active', - - // The root picker and states * - picker: 'picker picker--time', - opened: 'picker--opened', - focused: 'picker--focused', - - // The picker holder - holder: 'picker__holder', - - // The picker frame, wrapper, and box - frame: 'picker__frame', - wrap: 'picker__wrap', - box: 'picker__box', - - // List of times - list: 'picker__list', - listItem: 'picker__list-item', - - // Time states - disabled: 'picker__list-item--disabled', - selected: 'picker__list-item--selected', - highlighted: 'picker__list-item--highlighted', - viewset: 'picker__list-item--viewset', - now: 'picker__list-item--now', - - // Clear button - buttonClear: 'picker__button--clear' - } -}); - -var timePickerApi = timePickerInput.pickatime('picker'); - -timePickerInput.pickatime('open'); -timePickerInput.pickatime('get', 'value'); -timePickerInput.pickatime('$node').show(); -timePickerInput.pickatime('$root').show(); -timePickerInput.pickatime('_hidden').show(); - -testApiMethods(timePickerApi); -testTimeApiMethods(timePickerApi); - diff --git a/pickadate/pickadate.d.ts b/pickadate/pickadate.d.ts deleted file mode 100644 index 1f96085f7..000000000 --- a/pickadate/pickadate.d.ts +++ /dev/null @@ -1,474 +0,0 @@ -// Type definitions for pickadate.js 3.5.4 -// Project: https://github.com/amsul/pickadate.js -// Definitions by: Adi Dahiya -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare module Pickadate { - - export interface Api { - /** - * Clear the value in the picker's input element. - */ - clear(): Pickadate.Api; - - /** - * Close the picker. - * - * @param keepFocus whether to retain focus on the input element (default: false) - */ - close(keepFocus?: boolean): Pickadate.Api; - - /** - * Get the properties, objects, and states of the picker. - * - * @param field one of [ "value", "select", "highlight", "view", "min", "max", "open", "start", "id", "disable", "enable" ] - * @param format string formatter (available for certain fields) - */ - get(field: string, format?: string): any; - - /** - * Returns the string value of the picker’s input element. - */ - get(field: "value"): string; - - /** - * Returns a boolean value of whether the picker is open or not. - */ - get(field: "open"): boolean; - - /** - * Returns a boolean value of whether the picker has started or not. - */ - get(field: "start"): boolean; - - /** - * Returns a unique string that is the ID of the picker and it’s element. If the element has no ID, it is set to something random. - */ - get(field: "id"): string; - - /** - * "enable" and "disable" work together to determine which item objects to disable on the picker. - * - * "enable" returns 1 to represent a base enabled state, meaning that specific dates or times are disabled and all others are enabled; - * or -1 to indicate a base disabled state, meaning that specific dates or times are enabled and all others are disabled. - */ - get(field: "enable"): number; - - /** - * If "enable" is 1, returns the collection of dates or times to disable. If "enable" is -1, returns the collection of dates or - * times to *not* disable. - */ - get(field: "disable"): any; - - /** - * Unbind callbacks that are bound using the `on` method. - * @param methodName one of [ "open, "close", "render", "start", "stop", "set" ] - */ - off(methodName: string, ...moreMethodNames: string[]): Pickadate.Api; - - /** - * Attach an event handler for the picker. Only "set" events callbacks receive a "context" object. - * - * @param methodName event to attach handler to, one of [ "open", "close", "render", "start", "stop", or "set" ] - * @param callback event handler - */ - on(methodName: string, callback: (context?: any) => void): Pickadate.Api; - - /** - * Open the picker. - * - * @param keepFocus whether to focus the input element (default: true) - */ - open(keepFocus?: boolean): Pickadate.Api; - - /** - * Refresh the picker after adding something to the holder. - * By default, only the "face" of the picker (i.e. the box element), has its contents re-rendered. - * - * @param fromRoot whether to render the entire picker from the root up (default: false) - */ - render(fromRoot?: boolean): Pickadate.Api; - - /** - * Set the properties, objects, and states of the picker. - * - * @param field one of [ "clear", "select", "highlight", "view", "min", "max", "disable", "enable", "interval" ] - * @param value the thing you want to set - */ - set(field: string, value: any, options?: {[key: string]: any}): Pickadate.Api; - /** - * Batch set picker options after initialization. - */ - set(values: {[field: string]: any}, options?: {[key: string]: any}): Pickadate.Api; - - /** - * Rebuild the picker. - */ - start(): Pickadate.Api; - - /** - * Destroy the picker. - */ - stop(): Pickadate.Api; - - /** - * Trigger a picker event. - * @param eventName the event to trigger - */ - trigger(eventName: string): Pickadate.Api; - - /** - * The picker's relative element. - */ - $node: JQuery; - - /** - * The picker's relative root holder element. - */ - $root: JQuery; - - /** - * The picker's relative hidden element, which is undefined if there's no formatSubmit option. - * This is meant to be mostly for internal use. - */ - _hidden: JQuery; - } - - export interface DateApi extends Api { - get(field: string, format?: string): any; - - /** - * Returns the item object or formatted string of the date that is visually selected. - * Defaults to null when there’s no value. - */ - get(field: "select"): DateItem; - get(field: "select", format: string): string; - - /** - * Returns the item object or formatted string of the date that is visually highlighted. - * Defaults to "today" when there’s no value. - */ - get(field: "highlight"): DateItem; - get(field: "highlight", format: string): string; - - /** - * Returns the item object or formatted string of the date that determines the current view. - * Defaults to the first day of the current month when there’s no value. - */ - get(field: "view"): DateItem; - get(field: "view", format: string): string; - - /** - * Returns the item object or formatted string of the date that determines the lower limit. - * Defaults to a -Infinity item object when it is not explicitly set in the options or through the picker’s API. - */ - get(field: "min"): DateItem; - get(field: "min", format: string): string; - - /** - * Returns the item object or formatted string of the date that determines the upper limit. - * Defaults to an Infinity item object when it is not explicitly set in the options or through the picker’s API. - */ - get(field: "max"): DateItem; - get(field: "max", format: string): string; - } - - export interface DateItem { - // The full year. - year: number; - - // The month with zero-as-index. - month: number; - - // The date of the month. - date: number; - - // The day of the week with zero-as-index. - day: number; - - // The underlying JavaScript Date object. - obj: Date; - - // The "pick" value used for comparisons. - pick: number; - } - - export interface DateOptions { - // String and translations - monthsFull?: string[]; - monthsShort?: string[]; - weekdaysFull?: string[]; - weekdaysShort?: string[] - showMonthsShort?: boolean; - showWeekdaysFull?: boolean; - - // Button labels (if falsy, the corresponding button is disabled) - today?: string; - clear?: string; - close?: string; - - // Accessibility labels - labelMonthNext?: string; - labelMonthPrev?: string; - labelMonthSelect?: string; - labelYearSelect?: string; - - // Formats - format?: string; - formatSubmit?: string; - hiddenPrefix?: string; - hiddenSuffix?: string; - hiddenName?: string; - - // Editable input - editable?: boolean; - - // Number of months to show in the month selection dropdown OR a boolean - selectMonths?: any; - // Number of years to show in the month selection dropdown OR a boolean - selectYears?: any; - - // First day of the week - firstDay?: number - - // Disable dates (elements can be Dates, [YEAR, MONTH, DATE] arrays, or integers of the week) - disable?: any[]; - - // Root container selector (string) or element (JQuery) - container?: any; - - // Events - onStart?: () => void; - onRender?: () => void; - onOpen?: () => void; - onClose?: () => void; - onSet?: (context: {[key: string]: any}) => void; - onStop?: () => void; - - // Classes - klass?: DateKlassOptions; - } - - export interface DateKlassOptions { - // The element states - input?: string; - active?: string; - - // The root picker and states - picker?: string; - opened?: string; - focused?: string; - - // The picker holder - holder?: string; - - // The picker frame, wrapper, and box - frame?: string; - wrap?: string; - box?: string; - - // The picker header - header?: string; - - // Month navigation - navPrev?: string; - navNext?: string; - navDisabled?: string; - - // Month & year labels - month?: string; - year?: string; - - // Month & year dropdowns - selectMonth?: string; - selectYear?: string; - - // Table of dates - table?: string; - - // Weekday labels - weekdays?: string; - - // Day states - day?: string; - disabled?: string; - selected?: string; - highlighted?: string; - now?: string; - infocus?: string; - outfocus?: string; - - // The picker footer - footer?: string; - - // Today, clear, & close buttons - buttonClear?: string; - buttonClose?: string; - buttonToday?: string - } - - export interface TimeApi extends Api { - get(field: string, format?: string): any; - - /** - * Returns the item object or formatted string of the date that is visually selected. - * Defaults to null when there’s no value. - */ - get(field: "select"): TimeItem; - get(field: "select", format: string): string; - - /** - * Returns the item object or formatted string of the date that is visually highlighted. - * Defaults to "now" when there’s no value. - */ - get(field: "highlight"): TimeItem; - get(field: "highlight", format: string): string; - - /** - * Returns the item object or formatted string of the date that determines the current view. - * Defaults to "now" when there’s no value. - */ - get(field: "view"): TimeItem; - get(field: "view", format: string): string; - - /** - * Returns the item object or formatted string of the date that determines the lower limit. - * Defaults to a -Infinity item object when it is not explicitly set in the options or through the picker’s API. - */ - get(field: "min"): TimeItem; - get(field: "min", format: string): string; - - /** - * Returns the item object or formatted string of the date that determines the upper limit. - * Defaults to an Infinity item object when it is not explicitly set in the options or through the picker’s API. - */ - get(field: "max"): TimeItem; - get(field: "max", format: string): string; - } - - export interface TimeItem { - // Hour of the day from 0 to 23. - hour: number; - - // The minutes of the hour from 0 to 59 (based on the interval). - mins: number; - - // The "pick" value used for comparisons. - pick: number; - } - - export interface TimeOptions { - // Translations and clear button - clear?: string; - - // Formats - format?: string; - formatLabel?: string; - formatSubmit?: string; - hiddenPrefix?: string; - hiddenSuffix?: string; - - // Editable input - editable?: boolean; - - // Time intervals - interval?: number; - - // Time limits (can be Dates, arrays formatted as [HOUR, MINUTE], integers, or booleans) - min?: any; - max?: any; - - // Disable dates (elements can be Dates, [YEAR, MONTH, DATE] arrays, or integers of the week) - disable?: any[]; - - // Root container selector (string) or element (JQuery) - container?: any; - - // Events - onStart?: () => void; - onRender?: () => void; - onOpen?: () => void; - onClose?: () => void; - onSet?: (context: {[key: string]: any}) => void; - onStop?: () => void; - - // Classes - klass?: TimeKlassOptions; - } - - export interface TimeKlassOptions { - // The element states - input?: string; - active?: string; - - // The root picker and states - picker?: string; - opened?: string; - focused?: string; - - // The picker holder - holder?: string; - - // The picker frame, wrapper, and box - frame?: string; - wrap?: string; - box?: string; - - // List of times - list?: string; - listItem?: string; - - // Time states - disabled?: string; - selected?: string; - highlighted?: string; - viewset?: string; - now?: string; - - // Clear button - buttonClear?: string; - } -} - -interface JQuery { - /** - * Access the API object after initialization. - */ - pickadate(keyword: "picker"): Pickadate.DateApi; - pickadate(objectName: "$node"): JQuery; - pickadate(objectName: "$root"): JQuery; - pickadate(objectName: "_hidden"): JQuery; - - /** - * Invoke API methods after picker initialization. - * @param methodName - * @param arguments any arguments to pass to the method - */ - pickadate(methodName: string, ...arguments: any[]): any; - - /** - * Initialize a date picker. - * @returns the original JQuery selection - */ - pickadate(options?: Pickadate.DateOptions): JQuery; - - - pickatime(keyword: "picker"): Pickadate.TimeApi; - pickatime(objectName: "$node"): JQuery; - pickatime(objectName: "$root"): JQuery; - pickatime(objectName: "_hidden"): JQuery; - - /** - * Invoke API methods after picker initialization. - * @param methodName - * @param arguments any arguments to pass to the method - */ - pickatime(methodName: string, ...arguments: any[]): any; - - /** - * Initialize a time picker. - * @returns the original JQuery selection - */ - pickatime(options?: Pickadate.TimeOptions): JQuery; -} - From 502b8d8c58d747862bd24dbb030e4fac3cf0f7b2 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Sun, 19 Apr 2015 17:41:42 -0500 Subject: [PATCH 022/534] Consistent comment indentation --- jquery.pickadate/jquery.pickadate.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jquery.pickadate/jquery.pickadate.d.ts b/jquery.pickadate/jquery.pickadate.d.ts index 4d5e52949..b1e4ebb28 100644 --- a/jquery.pickadate/jquery.pickadate.d.ts +++ b/jquery.pickadate/jquery.pickadate.d.ts @@ -280,11 +280,11 @@ declare module Pickadate { stop(): TPickerObject; /** - * Refresh the picker box after adding something to the holder. - * By default, only the "face" of the picker (i.e. the box element) - * has it’s contents re-rendered. To render the entire picker from - * the root up, pass true as the first argument. - */ + * Refresh the picker box after adding something to the holder. + * By default, only the "face" of the picker (i.e. the box element) + * has it’s contents re-rendered. To render the entire picker from + * the root up, pass true as the first argument. + */ render(entirePicker?: boolean): TPickerObject; /** Clear the value in the picker's input element. */ From 0ebd3ae49c2e1b56b40435a72595d4a3060665ec Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Sun, 19 Apr 2015 18:06:15 -0500 Subject: [PATCH 023/534] SetOptions can have an optional format --- jquery.pickadate/jquery.pickadate.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jquery.pickadate/jquery.pickadate.d.ts b/jquery.pickadate/jquery.pickadate.d.ts index b1e4ebb28..0754fa765 100644 --- a/jquery.pickadate/jquery.pickadate.d.ts +++ b/jquery.pickadate/jquery.pickadate.d.ts @@ -260,7 +260,8 @@ declare module Pickadate { * By default, any callbacks bound with the on method will be fired when its relevant thing is set. * To silently set a thing, pass an options object with the muted parameter set to true. */ - muted: boolean; + muted?: boolean; + format?: string; } interface Picker { From cdd08b72e65740475a5621e94f09f488b1cf3fc9 Mon Sep 17 00:00:00 2001 From: peferron Date: Mon, 20 Apr 2015 15:48:52 -0700 Subject: [PATCH 024/534] lodash: add _.sum --- lodash/lodash-tests.ts | 26 ++++++++- lodash/lodash.d.ts | 116 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 1 deletion(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 10900315f..8297014f8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -39,6 +39,10 @@ interface IKey { code: number; } +interface IDictionary { + [index: string]: T; +} + var foodsOrganic: IFoodOrganic[] = [ { name: 'banana', organic: true }, { name: 'beet', organic: false }, @@ -61,7 +65,10 @@ var stoogesAges: IStoogesAge[] = [ { 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 } ]; - +var stoogesAgesDict: IDictionary = { + first: { 'name': 'moe', 'age': 40 }, + second: { 'name': 'larry', 'age': 50 } +}; var stoogesCombined: IStoogesCombined[] = [ { 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, { 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] } @@ -501,6 +508,23 @@ result = <_.LoDashWrapper>_([4, 2, 8, 6]).min(); result = <_.LoDashWrapper>_(stoogesAges).min(function (stooge) { return stooge.age; }); result = <_.LoDashWrapper>_(stoogesAges).min('age'); +result = _.sum([4, 2, 8, 6]); +result = _.sum([4, 2, 8, 6], function(v) { return v; }); +result = _.sum({a: 2, b: 4}); +result = _.sum({a: 2, b: 4}, function(v) { return v; }); +result = _.sum(stoogesAges, function (stooge) { return stooge.age; }); +result = _.sum(stoogesAges, 'age'); +result = _.sum(stoogesAgesDict, function(stooge) { return stooge.age; }); +result = _.sum(stoogesAgesDict, 'age'); +result = _([4, 2, 8, 6]).sum(); +result = _([4, 2, 8, 6]).sum(function(v) { return v; }); +result = _({a: 2, b: 4}).sum(); +result = _({a: 2, b: 4}).sum(function(v) { return v; }); +result = _(stoogesAges).sum(function (stooge) { return stooge.age; }); +result = _(stoogesAges).sum('age'); +result = _(stoogesAgesDict).sum(function (stooge) { return stooge.age; }); +result = _(stoogesAgesDict).sum('age'); + result = _.pluck(stoogesAges, 'name'); result = _(stoogesAges).pluck('name').value(); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 01238b769..145849230 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3842,6 +3842,122 @@ declare module _ { min( whereValue: W): LoDashWrapper; } + + //_.sum + interface LoDashStatic { + /** + * Gets the sum of the values in collection. + * + * @param collection The collection to iterate over. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the sum. + **/ + sum( + collection: Array): number; + + /** + * @see _.sum + **/ + sum( + collection: List): number; + + /** + * @see _.sum + **/ + sum( + collection: Dictionary): number; + + /** + * @see _.sum + **/ + sum( + collection: Array, + iteratee: ListIterator, + thisArg?: any): number; + + /** + * @see _.sum + **/ + sum( + collection: List, + iteratee: ListIterator, + thisArg?: any): number; + + /** + * @see _.sum + **/ + sum( + collection: Dictionary, + iteratee: ObjectIterator, + thisArg?: any): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + collection: Array, + property: string): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + collection: List, + property: string): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + collection: Dictionary, + property: string): number; + } + + interface LoDashArrayWrapper { + /** + * @see _.sum + **/ + sum(): number + + /** + * @see _.sum + **/ + sum( + iteratee: ListIterator, + thisArg?: any): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + property: string): number; + } + + interface LoDashObjectWrapper { + /** + * @see _.sum + **/ + sum(): number + + /** + * @see _.sum + **/ + sum( + iteratee: ObjectIterator, + thisArg?: any): number; + + /** + * @see _.sum + * @param property _.property callback shorthand. + **/ + sum( + property: string): number; + } //_.pluck interface LoDashStatic { From a83e9f9af0b3634381df0988f95b4e001efcd147 Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Tue, 21 Apr 2015 18:33:39 +0200 Subject: [PATCH 025/534] Pass query parameters as an object Query parameters should now be passed as an object instead of key/value pairs, see https://github.com/chaijs/chai-http/pull/33 for details --- chai-http/chai-http.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chai-http/chai-http.d.ts b/chai-http/chai-http.d.ts index fed2a8416..d77159945 100644 --- a/chai-http/chai-http.d.ts +++ b/chai-http/chai-http.d.ts @@ -41,7 +41,7 @@ declare module chaiHttp { attach(field: string, file: string, filename: string): Request; attach(field: string, file: Buffer, filename: string): Request; set(field: string, val: string): Request; - query(key: string, value: string): Request; + query(params: Object): Request; send(data: Object): Request; auth(user: string, name: string): Request; field(name: string, val: string): Request; From 892778cfafa33d782c609285ee848ede388f2cf9 Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Sun, 26 Apr 2015 21:49:16 +0400 Subject: [PATCH 026/534] Type definitions for Victor.js 0.8.0 --- victor/victor.d.ts | 356 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 356 insertions(+) create mode 100644 victor/victor.d.ts diff --git a/victor/victor.d.ts b/victor/victor.d.ts new file mode 100644 index 000000000..c3d1ac9dd --- /dev/null +++ b/victor/victor.d.ts @@ -0,0 +1,356 @@ +/** + * Type definitions for Victor.js 0.8.0 + * Project: http://victorjs.org/ + * Definitions by: Ivane Gegia + * Definitions: https://github.com/borisyankov/DefinitelyTyped + */ + +interface VictorCoordinates +{ + x:number + y:number +} + +declare class Victor +{ + x:number; + y:number; + + /** + * Can be used without the new keyword. + * @param x The X component + * @param y The Y component + */ + constructor(x:number,y:number); + + /** + * Creates vector from array. + * @param arr array An array that contains the X component in the first element and the Y component in the second + */ + static fromArray(arr:Array):Victor; + + /** + * Creates vector from object. + * @param obj An object containing the X component in the x property and the Y component in the y property + */ + static fromObject(obj:VictorCoordinates):Victor; + + /** + * Creates a new Victor with the same X and Y components. + */ + clone():Victor; + + /** + * Copies the X component of another vector in to itself. + * @param vector + */ + copyX(vector:Victor):Victor; + + /** + * Copies the Y component of another vector in to itself. + * @param vector + */ + copyY(vector:Victor):Victor; + + /** + * Copies the X and Y components of another vector in to itself. + * @param vector + */ + copy(vector:Victor):Victor; + + /** + * Returns a string representation of the X and Y components. + */ + toString():string; + + /** + * Returns an array representation of the X and Y components. + */ + toArray():Array; + + /** + * Returns an object representation of tha X and Y components. + */ + toObject():VictorCoordinates; + + /** + * Adds another vector's X component to itself. + * @param vector + */ + addX(vector:Victor):Victor; + + /** + * Adds another vector's Y component to itself. + * @param vector + */ + addY(vector:Victor):Victor; + + /** + * Adds another vector to itself. + * @param vector + */ + add(vector:Victor):Victor; + + /** + * Subtracts another vector's X component from itself. + * @param vector + */ + subtractX(vector:Victor):Victor; + + /** + * Subtracts another vector's Y component from itself. + * @param vector + */ + subtractY(vector:Victor):Victor; + + /** + * Subtracts another vector from itself. + * @param vector + */ + subtract(vector:Victor):Victor; + + /** + * Multiplies the X component with the X component of another vector. + * @param vector + */ + multiplyX(vector:Victor):Victor; + + /** + * Multiplies the Y component with the Y component of another vector. + * @param vector + */ + multiplyY(vector:Victor):Victor; + + /** + * Multiplies both components with another vector. + * @param vector + */ + multiply(vector:Victor):Victor; + + /** + * Divides the X component by the X component of another vector. + * @param vector + */ + divideX(vector:Victor):Victor; + + /** + * Divides the Y component by the Y component of another vector. + * @param vector + */ + divideY(vector:Victor):Victor; + + /** + * Divides both components by another vector. + * @param scalar + */ + divide(scalar:Victor):Victor; + + /** + * Inverts the X component. + */ + invertX():Victor; + + /** + * Inverts the Y component. + */ + invertY():Victor; + + /** + * Inverts both components. + */ + invert():Victor; + + /** + * Performs a linear blend / interpolation of the X component towards another vector. + * @param vector Number amount Value between 0 and 1. Default: 0.5 + * @param ammount + */ + mixX(vector:Victor, ammount:number):Victor; + + /** + * Performs a linear blend / interpolation of the Y component towards another vector. + * @param vector + * @param ammount + */ + mixY(vector:Victor, ammount:number):Victor; + + /** + * Performs a linear blend / interpolation towards another vector. + * @param vector + * @param ammount + */ + mix(vector:Victor, ammount:number):Victor; + + /** + * Normalizes the vector by scaling it down to a length of 1 while keeping its direction. + */ + normalize():Victor; + + /** + * Alias of normalize. + */ + norm():Victor; + + /** + * If either component is greater than max, multiplies the component by multiplier. + * @param max + * @param multiplier + */ + limit(max:number, multiplier:number):Victor; + + /** + * Rounds the components to integer numbers. + */ + unfloat():Victor; + + /** + * Rotates the vector to a certain angle, in radians CCW from +X axis. + * @param angle + */ + rotate(angle:number):Victor; + + /** + * Same as rotate but uses degrees + * @param angle + */ + rotateDeg(angle:number):Victor; + + /** + * Rotates the vector by a rotation angle, given in radians CCW from +X axis. + * @param rotation + */ + rotateBy(rotation:number):Victor; + + /** + * Same as rotateBy but uses degrees + * @param rotation + */ + rotateByDeg(rotation:number):Victor; + + /** + * Randomizes the X component with a value between topLeft and bottomRight. + * @param topLeft + * @param bottomRight + */ + randomizeX(topLeft:Victor, bottomRight:Victor):Victor; + + /** + * Randomizes the Y component with a value between topLeft and bottomRight. + * @param topLeft + * @param bottomRight + */ + randomizeY(topLeft:Victor, bottomRight:Victor):Victor; + + /** + * Randomizes the components with a value between topLeft and bottomRight. + * @param topLeft + * @param bottomRight + */ + randomize(topLeft:Victor, bottomRight:Victor):Victor; + + /** + * Randomly randomizes either the X component or the Y component with a value between topLeft and bottomRight. + * @param topLeft + * @param bottomRight + */ + randomizeAny(topLeft:Victor, bottomRight:Victor):Victor; + + /** + * Returns the dot product of two vectors. + * @param vector + */ + dot(vector:Victor):number; + + /** + * Returns the cross product of two vectors. + * @param vector + */ + cross(vector:Victor):number; + + /** + * Returns the length / magnitude. + */ + length():number; + + /** + * Alias for length. + */ + magnitude():number; + + /** + * Returns the squared length / magnitude. If the length is only needed for comparison, this function is faster than length. + */ + lengthSq():number; + + /** + * Returns the distance of the X component from another vector. + * @param vector + */ + distanceX(vector:Victor):number; + + /** + * Same as distanceX but always returns an absolute value. + * @param vector + */ + absDistanceX(vector:Victor):number; + + /** + * Returns the distance of the Y component from another vector. + * @param vector + */ + distanceY(vector:Victor):number; + + /** + * Same as distanceY but always returns an absolute value. + * @param vector + */ + absDistanceY(vector:Victor):number; + + /** + * Returns the euclidean distance between two vectors. + * @param vector + */ + distance(vector:Victor):number; + + /** + * Returns the squared euclidean distance between two vectors. If the distance is only needed for comparison, this function is faster than distance. + * @param vector + */ + distanceSq(vector:Victor):number; + + /** + * Returns the angle towards X in radians. + */ + horizontalAngle():number; + + /** + * Alias for horizontalAngle. + */ + angle():number; + + /** + * Alias for horizontalAngle. + */ + direction():number; + + /** + * Same as horizontalAngle but returns degrees. + */ + horizontalAngleDeg():number; + + /** + * Alias for horizontalAngleDeg. + */ + angleDeg():number; + + /** + * Returns the angle towards Y in radians. + */ + verticalAngle():number; + + /** + * Same as verticalAngle but returns degrees. + */ + verticalAngleDeg():number; + +} \ No newline at end of file From 3a15153a27dcd614ede0083d59f96792fa4f2b20 Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Sun, 26 Apr 2015 22:02:54 +0400 Subject: [PATCH 027/534] Changed header format --- victor/victor.d.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/victor/victor.d.ts b/victor/victor.d.ts index c3d1ac9dd..2b2d1e523 100644 --- a/victor/victor.d.ts +++ b/victor/victor.d.ts @@ -1,9 +1,8 @@ -/** - * Type definitions for Victor.js 0.8.0 - * Project: http://victorjs.org/ - * Definitions by: Ivane Gegia - * Definitions: https://github.com/borisyankov/DefinitelyTyped - */ +// Type definitions for Victor.js 0.8.0 +// Project: http://victorjs.org/ +// Definitions by: Ivane Gegia +// Definitions: https://github.com/borisyankov/DefinitelyTyped + interface VictorCoordinates { @@ -353,4 +352,4 @@ declare class Victor */ verticalAngleDeg():number; -} \ No newline at end of file +} From 4de0015908abffe51b1cf99ba1c98ba36255b5d3 Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Mon, 27 Apr 2015 00:10:26 +0400 Subject: [PATCH 028/534] Corrected victor version number --- victor/victor.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/victor/victor.d.ts b/victor/victor.d.ts index 2b2d1e523..4206ffeb6 100644 --- a/victor/victor.d.ts +++ b/victor/victor.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Victor.js 0.8.0 +// Type definitions for Victor.js 0.2.5 // Project: http://victorjs.org/ // Definitions by: Ivane Gegia // Definitions: https://github.com/borisyankov/DefinitelyTyped From 7ca777533d7e7dbcc87b57229d914c567fcad002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Mon, 27 Apr 2015 18:00:56 +0200 Subject: [PATCH 029/534] three.d.ts: SkinnedMesh accepts BufferGeometry too THREE.js's SkinnedMesh class accepts BufferGeometry, not only Geometry for its first parameter --- threejs/three.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index a9255f3b5..d51e8da35 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -4151,13 +4151,13 @@ declare module THREE { } export class SkinnedMesh extends Mesh { - constructor(geometry?: Geometry, material?: MeshBasicMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshDepthMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshFaceMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshLambertMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshNormalMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: MeshPhongMaterial, useVertexTexture?: boolean); - constructor(geometry?: Geometry, material?: ShaderMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshBasicMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshDepthMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshFaceMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshLambertMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshNormalMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: MeshPhongMaterial, useVertexTexture?: boolean); + constructor(geometry?: Geometry|BufferGeometry, material?: ShaderMaterial, useVertexTexture?: boolean); bindMode: string; bindMatrix: Matrix4; From 146bca18c8c726176242e1208af577015b9a57d2 Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Tue, 28 Apr 2015 15:46:17 +0400 Subject: [PATCH 030/534] Matter js physics engine type definition file --- matter/matter.d.ts | 1509 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1509 insertions(+) create mode 100644 matter/matter.d.ts diff --git a/matter/matter.d.ts b/matter/matter.d.ts new file mode 100644 index 000000000..ddcaba5d6 --- /dev/null +++ b/matter/matter.d.ts @@ -0,0 +1,1509 @@ +// Type definitions for Matter.js 0.8.0 +// Project: http://brm.io/matter-src/ +// Definitions by: Ivane Gegia +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module Matter +{ + export interface IEngineOptions + { + + } + + export interface IEngineTimingOptions + { + /** + *A Number that specifies the time correction factor to apply to the current timestep. It is automatically handled when using Engine.run, but is also only optional even if you use your own game loop. The value is defined as delta / lastDelta, i.e. the percentage change of delta between steps. This value is always 1 (no correction) when frame rate is constant or engine.timing.isFixed is true. If the framerate and hence delta are changing, then correction should be applied to the current update to account for the change. See the paper on Time Corrected Verlet for more information. + */ + correction:number; + + /** + * A Number that specifies the time step between updates in milliseconds. If engine.timing.isFixed is set to true, then delta is fixed. If it is false, then delta can dynamically change to maintain the correct apparant simulation speed. + */ + delta:number; + + /** + * A Number that specifies the global scaling factor of time for all bodies. A value of 0 freezes the simulation. A value of 0.1 gives a slow-motion effect. A value of 1.2 gives a speed-up effect. + */ + timeScale:number; + + /** + * A Number that specifies the current simulation-time in milliseconds starting from 0. It is incremented on every Engine.update by the timing.delta. + */ + timestamp:number; + + /** + * An integer Number that specifies the number of velocity iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. + */ + velocityIterations:number; + + } + + export class Engine + { + /** + * Clears the engine including the world, pairs and broadphase. + * @param engine + */ + static clear(engine:Engine); + + /** + * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. + * @param element + * @param options + */ + static create(element?: HTMLElement|IEngineOptions, options?:IEngineOptions):Engine; + + /** + * Merges two engines by keeping the configuration of engineA but replacing the world with the one from engineB. + * @param engineA + * @param engineB + */ + static merge(engineA:Engine, engineB:Engine); + + /** + * Renders the world by calling its defined renderer engine.render.controller. Triggers beforeRender and afterRender events. + * @param engineA + * @param engineB + */ + static render(engineA:Engine, engineB:Engine); + + /** + * An optional utility function that provides a game loop, that handles updating the engine for you. Calls Engine.update and Engine.render on the requestAnimationFrame event automatically. Handles time correction and non-fixed dynamic timing (if enabled). Triggers beforeTick, tick and afterTick events. + * @param engine + */ + static run(engine:Engine); + + /** + * Moves the simulation forward in time by delta ms. Triggers beforeUpdate and afterUpdate events. + * + * @param engine + * @param delta + * @param correction + */ + static update(engine:Engine, delta:number, correction?:number); + + /** + * An integer Number that specifies the number of constraint iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. The default value of 2 is usually very adequate. + */ + constraintIterations:number; + + /** + * A flag that specifies whether the engine is running or not. + */ + enabled:boolean; + + /** + * A flag that specifies whether the engine should allow sleeping via the Matter.Sleeping module. Sleeping can improve stability and performance, but often at the expense of accuracy. + */ + enableSleeping:boolean; + + /** + * An integer Number that specifies the number of position iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. + */ + positionIterations:number; + + /** + * An instance of a Render controller. The default value is a Matter.Render instance created by Engine.create. One may also develop a custom renderer module based on Matter.Render and pass an instance of it to Engine.create via options.render. + A minimal custom renderer object must define at least three functions: create, clear and world (see Matter.Render). It is also possible to instead pass the module reference via options.render.controller and Engine.create will instantiate one for you. + */ + render:Render; + + /** + * An Object containing properties regarding the timing systems of the engine. + */ + timing:IEngineTimingOptions; + + /** + * A World composite object that will contain all simulated bodies and constraints. + */ + world:World; + } + + interface IWorldOptions + { + + } + + /** + * The Matter.World module contains methods for creating and manipulating the world composite. A Matter.World is a Matter.Composite body, which is a collection of Matter.Body, Matter.Constraint and other Matter.Composite. A Matter.World has a few additional properties including gravity and bounds. It is important to use the functions in the Matter.Composite module to modify the world composite, rather than directly modifying its properties. There are also a few methods here that alias those in Matter.Composite for easier readability. + */ + export class World + { + /** + * Add objects or arrays of objects of types: Body, Constraint, Composite + * @param world + * @param body + * @returns world + */ + static add(world:World, body:Body|Array|Composite|Array|Constraint|Array):World; + + /** + * An alias for Composite.addBody since World is also a Composite + * @param world + * @param body + * @returns world + */ + static addBody(world:World, body:Body):World; + + /** + * An alias for Composite.add since World is also a Composite + * @param world + * @param composite + */ + static addComposite(world:World, composite:Composite):World; + + /** + * An alias for Composite.addConstraint since World is also a Composite. + * @param world + * @param constraint + */ + static addConstraint(world:World, constraint:Constraint):World; + + /** + * An alias for Composite.clear since World is also a Composite. + * @param world + * @param keepStatic + */ + static clear(world:World, keepStatic:boolean); + + /** + * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section below for detailed information on what you can pass via the options object. + * @param options + */ + static create(options:IWorldOptions):World; + + } + + export interface IBodyDefinition + { + angle?:number; + angularSpeed?:number; + angularVelocity?:number; + area?:number; + axes?:Array; + bounds?:Bounds; + density?:number; + force?:Vector; + friction?:number; + frictionAir?:number; + groupId?:number; + id?:number; + inertia?:number; + inverseInertia?:number; + inverseMass?:number; + isSleeping?:boolean; + isStatic?:boolean; + label?:string; + mass?:number; + motion?:number; + position?:Vector; + render?:IBodyRenderOptions; + restitution?:number; + sleepThreshold?:number; + slop?:number; + speed?:number; + timeScale?:number; + torque?:number; + type?:string; + velocity?:Vector; + vertices?:Array; + } + + /** + * The Matter.Body module contains methods for creating and manipulating body models. A Matter.Body is a rigid body that can be simulated by a Matter.Engine. Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module Matter.Bodies. + */ + export class Body + { + /** + * Applies a force to a body from a given world-space position, including resulting torque. + * @param body + * @param position + * @param force + */ + static applyForce(body:Body, position:Vector, force:Vector); + + /** + * Applys a mass dependant force to all given bodies. + * @param bodies + * @param gravity + */ + static applyGravityAll(bodies:Array, gravity:Vector); + + /** + * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. + * @param options + */ + static create(options:IBodyDefinition):Body; + + /** + * Returns the next unique groupID number. + */ + static nextGroupId():number; + + /** + * Zeroes the body.force and body.torque force buffers. + * @param bodies + */ + static resetForcesAll(bodies:Array); + + /** + * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity. + * @param body + * @param angle + */ + static rotate(body:Body, angle:number); + + /** + * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity. + * @param isStatic + */ + setStatic(isStatic:boolean); + + /** + * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre). + * @param body + * @param scaleX + * @param scaleY + * @param poinst + */ + static scale(body:Body, scaleX:number, scaleY:number, poinst?:Vector); + + /** + * Moves a body by a given vector relative to its current position, without imparting any velocity. + * + * @param body + * @param translation + */ + static translate(body:Body, translation:Vector); + + /** + *Performs a simulation step for the given body, including updating position and angle using Verlet integration. + * + * @param body + * @param deltaTime + * @param timeScale + * @param correction + */ + static update(body:Body, deltaTime:number, timeScale:number, correction:number); + + /** + * Applys Body.update to all given bodies. + * + * @param bodies + * @param deltaTime + * @param timeScale + * @param correction + * @param worldBounds + */ + static updateAll ( bodies:Array, deltaTime:number, timeScale:number, correction:number, worldBounds:Bounds ); + + /** + * A Number specifying the angle of the body, in radians. + */ + angle:number; + + /** + * A Number that measures the current angular speed of the body after the last Body.update. It is read-only and always positive (it's the magnitude of body.angularVelocity). + */ + angularSpeed:number; + + /** + * A Number that measures the current angular velocity of the body after the last Body.update. It is read-only. If you need to modify a body's angular velocity directly, you should apply a torque or simply change the body's angle (as the engine uses position-Verlet integration). + */ + angularVelocity:number; + + /** + * A Number that measures the area of the body's convex hull, calculated at creation by Body.create. + */ + area:number; + + /** + * An array of unique axis vectors (edge normals) used for collision detection. These are automatically calculated from the given convex hull (vertices array) in Body.create. They are constantly updated by Body.update during the simulation. + */ + axes:Array; + + /** + * A Bounds object that defines the AABB region for the body. It is automatically calculated from the given convex hull (vertices array) in Body.create and constantly updated by Body.update during simulation. + */ + bounds:Bounds; + + /** + * A Number that defines the density of the body, that is its mass per unit area. If you pass the density via Body.create the mass property is automatically calculated for you based on the size (area) of the object. This is generally preferable to simply setting mass and allows for more intuitive definition of materials (e.g. rock has a higher density than wood). + */ + density:number; + + /** + * A Vector that specifies the force to apply in the current step. It is zeroed after every Body.update. See also Body.applyForce. + */ + force:Vector; + + /** + * A Number that defines the friction of the body. The value is always positive and is in the range (0, 1). A value of 0 means that the body may slide indefinitely. A value of 1 means the body may come to a stop almost instantly after a force is applied. + The effects of the value may be non-linear. High values may be unstable depending on the body. The engine uses a Coulomb friction model including static and kinetic friction. Note that collision response is based on pairs of bodies, and that friction values are combined with the following formula: + Math.min(bodyA.friction, bodyB.friction) + */ + friction:number; + + /** + * A Number that defines the air friction of the body (air resistance). A value of 0 means the body will never slow as it moves through space. The higher the value, the faster a body slows when moving through space. The effects of the value are non-linear. + Default: 0.01 + */ + frictionAir:number; + + /** + * An integer Number that specifies the collision group the body belongs to. Bodies with the same groupId are considered as-one body and therefore do not interact. This allows for creation of segmented bodies that can self-intersect, such as a rope. The default value 0 means the body does not belong to a group, and can interact with all other bodies. + Default: 0 + */ + groupId:number; + + /** + * An integer Number uniquely identifying number generated in Body.create by Common.nextId. + */ + id:number; + + /** + * A Number that defines the moment of inertia (i.e. second moment of area) of the body. It is automatically calculated from the given convex hull (vertices array) and density in Body.create. If you modify this value, you must also modify the body.inverseInertia property (1 / inertia). + */ + inertia:number; + + /** + * A Number that defines the inverse moment of inertia of the body (1 / inertia). If you modify this value, you must also modify the body.inertia property. + */ + inverseInertia:number; + + /** + * A Number that defines the inverse mass of the body (1 / mass). If you modify this value, you must also modify the body.mass property. + */ + inverseMass:number; + + /** + * A flag that indicates whether the body is considered sleeping. A sleeping body acts similar to a static body, except it is only temporary and can be awoken. If you need to set a body as sleeping, you should use Sleeping.set as this requires more than just setting this flag. + Default: false + */ + isSleeping:boolean; + + /** + * A flag that indicates whether a body is considered static. A static body can never change position or angle and is completely fixed. If you need to set a body as static after its creation, you should use Body.setStatic as this requires more than just setting this flag. + Default: false + */ + isStatic:boolean; + + /** + * An arbitrary String name to help the user identify and manage bodies. + Default: "Body" + */ + label:string; + + /** + * A Number that defines the mass of the body, although it may be more appropriate to specify the density property instead. If you modify this value, you must also modify the body.inverseMass property (1 / mass). + */ + mass:number; + + /** + * A Number that measures the amount of movement a body currently has (a combination of speed and angularSpeed). It is read-only and always positive. It is used and updated by the Matter.Sleeping module during simulation to decide if a body has come to rest. + Default: 0 + */ + motion:number; + + /** + * A Vector that specifies the current world-space position of the body. + Default: { x: 0, y: 0 } + */ + position:Vector; + + /** + * An Object that defines the rendering properties to be consumed by the module Matter.Render. + */ + render:IBodyRenderOptions; + + /** + * A Number that defines the restitution (elasticity) of the body. The value is always positive and is in the range (0, 1). A value of 0 means collisions may be perfectly inelastic and no bouncing may occur. A value of 0.8 means the body may bounce back with approximately 80% of its kinetic energy. Note that collision response is based on pairs of bodies, and that restitution values are combined with the following formula: + Math.max(bodyA.restitution, bodyB.restitution) + Default: 0 + */ + restitution:number; + + /** + * A Number that defines the number of updates in which this body must have near-zero velocity before it is set as sleeping by the Matter.Sleeping module (if sleeping is enabled by the engine). + Default: 60 + */ + sleepThreshold:number; + + /** + * A Number that specifies a tollerance on how far a body is allowed to 'sink' or rotate into other bodies. Avoid changing this value unless you understand the purpose of slop in physics engines. The default should generally suffice, although very large bodies may require larger values for stable stacking. + Default: 0.05 + */ + slop:number; + + /** + * A Number that measures the current speed of the body after the last Body.update. It is read-only and always positive (it's the magnitude of body.velocity). + Default: 0 + */ + speed:number; + + /** + * A Number that allows per-body time scaling, e.g. a force-field where bodies inside are in slow-motion, while others are at full speed. + Default: 1 + */ + timeScale:number; + + /** + * A Number that specifies the torque (turning force) to apply in the current step. It is zeroed after every Body.update. + Default: 0 + */ + torque:number; + + /** + *A String denoting the type of object. + Default: "body" + */ + type:string; + + /** + * A Vector that measures the current velocity of the body after the last Body.update. It is read-only. If you need to modify a body's velocity directly, you should either apply a force or simply change the body's position (as the engine uses position-Verlet integration). + Default: { x: 0, y: 0 } + */ + velocity:Vector; + + /** + * An array of Vector objects that specify the convex hull of the rigid body. These should be provided about the origin (0, 0). E.g. + [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + When passed via Body.create, the verticies are translated relative to body.position (i.e. world-space, and constantly updated by Body.update during simulation). The Vector objects are also augmented with additional properties required for efficient collision detection. + Other properties such as inertia and bounds are automatically calculated from the passed vertices (unless provided via options). Concave hulls are not currently supported. The module Matter.Vertices contains useful methods for working with vertices. + */ + vertices:Array; + + } + + export class Bodies { + /** + * Creates a new rigid body model with a circle hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. + * + * @param x + * @param y + * @param radius + * @param options + * @param maxSides + */ + static circle(x:number, y:number, radius:number, options?:IBodyDefinition, maxSides?:number):Body; + + /** + * Creates a new rigid body model with a regular polygon hull with the given number of sides. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. + * + * @param x + * @param y + * @param sides + * @param radius + * @param options + */ + static polygon(x:number, y:number, sides:number, radius:number, options?:IBodyDefinition):Body; + + /** + * Creates a new rigid body model with a rectangle hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. + * + * @param x + * @param y + * @param width + * @param height + * @param options + */ + static rectangle(x:number, y:number, width:number, height:number, options?:IBodyDefinition):Body; + + /** + * Creates a new rigid body model with a trapezoid hull. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section of the Matter.Body module for detailed information on what you can pass via the options object. + * + * @param x + * @param y + * @param width + * @param height + * @param slope + * @param options + */ + static trapezoid(x:number, y:number, width:number, height:number, slope:number, options?:IBodyDefinition):Body; + + + } + + export interface IBodyRenderOptions + { + /** + * A String that defines the fill style to use when rendering the body (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. + Default: a random colour + */ + fillStyle:string; + + /** + * A Number that defines the line width to use when rendering the body outline (if a sprite is not defined). A value of 0 means no outline will be rendered. + Default: 1.5 + */ + lineWidth:number; + + /** + * An Object that defines the sprite properties to use when rendering, if any. + */ + sprite:IBodyRenderOptionsSprite; + + /** + * A String that defines the stroke style to use when rendering the body outline (if a sprite is not defined). It is the same as when using a canvas, so it accepts CSS style property values. + Default: a random colour + */ + strokeStyle:string; + + /** + * A flag that indicates if the body should be rendered. + Default: true + */ + visible:boolean; + + } + + export interface IBodyRenderOptionsSprite + { + /** + * An String that defines the path to the image to use as the sprite texture, if any. + */ + texture:string; + + /** + * A Number that defines the scaling in the x-axis for the sprite, if any. + Default: 1 + */ + xScale:number; + + /** + * A Number that defines the scaling in the y-axis for the sprite, if any. + Default: 1 + */ + yScale:number; + } + + export class Bounds + { + + } + + export class Vector + { + + x:number; + y:number; + + /** + * Adds the two vectors. + * + * @param vectorA + * @param vectorB + * @returns A new vector of vectorA and vectorB added. + */ + static add ( vectorA:Vector, vectorB:Vector ):Vector; + + /** + * Returns the angle in radians between the two vectors relative to the x-axis. + * + * @param vectorA + * @param vectorB + * @returns The angle in radians. + */ + static angle ( vectorA:Vector, vectorB:Vector ):number; + + /** + * Returns the cross-product of two vectors. + * + * @param vectorA + * @param vectorB + * @returns The cross product of the two vectors. + */ + static cross ( vectorA:Vector, vectorB:Vector ):number; + + /** + * Divides a vector and a scalar. + * + * @param vector + * @param scalar + * @returns A new vector divided by scalar. + */ + static div ( vector:Vector, scalar:number ):Vector; + + /** + * Returns the dot-product of two vectors. + * + * @param vectorA + * @param vectorB + * @returns The dot product of the two vectors + */ + static dot ( vectorA:Vector, vectorB:Vector ):Number; + + /** + * Returns the magnitude (length) of a vector. + * + * @param vector + * @returns The magnitude of the vector + */ + static magnitude ( vector:Vector ):number; + + /** + * Returns the magnitude (length) of a vector (therefore saving a sqrt operation). + * + * @param vector + * @returns The squared magnitude of the vector. + */ + static magnitudeSquared ( vector:Vector ):number; + + /** + * Multiplies a vector and a scalar. + * + * @param vector + * @param scalar + * @returns A new vector multiplied by scalar + */ + static mult ( vector:Vector, scalar:number ):Vector; + + /** + * Negates both components of a vector such that it points in the opposite direction. + * @param vector + * @returns The negated vector. + */ + static neg ( vector:Vector ):Vector; + + /** + * Normalises a vector (such that its magnitude is 1). + * + * @param vector + * @returns A new vector normalised + */ + static normalise ( vector:Vector ):Vector; + + /** + * Returns the perpendicular vector. Set negate to true for the perpendicular in the opposite direction. + * + * @param vector + * @param negate + * @returns The perpendicular vector + */ + static perp ( vector:Vector, negate?:boolean ):Vector; + + /** + * Rotates the vector about (0, 0) by specified angle. + * + * @param vector + * @param angle + * @returns A new vector rotated about (0, 0) + */ + static rotate ( vector:Vector, angle:number ):Vector; + + /** + * Rotates the vector about a specified point by specified angle. + * + * @param vector + * @param angle + * @param point + * @returns A new vector rotated about the point + */ + static rotateAbout ( vector:Vector, angle:number, point:Vector ):Vector; + + /** + * Subtracts the two vectors. + * + * @param vectorA + * @param vectorB + * @returns A new vector of vectorA and vectorB subtracted + */ + static sub ( vectorA:Vector, vectorB:Vector ):Vector; + } + + export class Constraint + { + /** + * Creates a new constraint. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. + * + * @param options + * @returns constraint + */ + static create(options:IConstraintDefinition):Constraint; + + /** + * The first possible Body that this constraint is attached to. + */ + bodyA:Body; + + /** + * The second possible Body that this constraint is attached to. + */ + bodyB:Body; + + /** + * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. + */ + id:number; + + /** + * An arbitrary String name to help the user identify and manage bodies. + * Default: "Constraint" + */ + label:string; + + /** + * A Number that specifies the target resting length of the constraint. It is calculated automatically in Constraint.create from intial positions of the constraint.bodyA and constraint.bodyB. + */ + length:number; + + /** + * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. + Default: { x: 0, y: 0 } + */ + pointA:Vector; + + /** + * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. + Default: { x: 0, y: 0 } + */ + pointB:Vector; + + /** + * An Object that defines the rendering properties to be consumed by the module Matter.Render. + */ + render:IConstraintRenderRefinition; + + /** + * A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting constraint.length. A value of 1 means the constraint should be very stiff. A value of 0.2 means the constraint acts like a soft spring. + Default: 1 + */ + stiffness:number; + + /** + * A String denoting the type of object. + Default: "constraint" + */ + type:string; + } + + export class MouseConstraint + { + create(engine:Engine, options:IMouseConstraintDefinition):MouseConstraint; + + /** + * The Constraint object that is used to move the body during interaction. + */ + constraint:Constraint; + + /** + * The Body that is currently being moved by the user, or null if no body. + Default: null + */ + dragBody:Body; + + /** + * The Vector offset at which the drag started relative to the dragBody, if any. + Default: null + */ + dragPoint:Vector; + + /** + * The Mouse instance in use. + Default: engine.input.mouse + */ + mouse:Mouse; + + /** + * A String denoting the type of object. + Default: "constraint" + */ + type:string; + } + + export interface IMouseConstraintDefinition + { + /** + * The Constraint object that is used to move the body during interaction. + */ + constraint?:Constraint; + + /** + * The Body that is currently being moved by the user, or null if no body. + Default: null + */ + dragBody?:Body; + + /** + * The Vector offset at which the drag started relative to the dragBody, if any. + Default: null + */ + dragPoint?:Vector; + + /** + * The Mouse instance in use. + Default: engine.input.mouse + */ + mouse?:Mouse; + + /** + * A String denoting the type of object. + Default: "constraint" + */ + type?:string; + } + + export class Mouse + { + + } + + export interface IConstraintRenderRefinition + { + /** + * A Number that defines the line width to use when rendering the constraint outline. A value of 0 means no outline will be rendered. + Default: 2 + */ + lineWidth:number; + + /** + * A String that defines the stroke style to use when rendering the constraint outline. It is the same as when using a canvas, so it accepts CSS style property values. + Default: a random colour + */ + strokeStyle:string; + + /** + * A flag that indicates if the constraint should be rendered. + Default: true + */ + visible:boolean; + } + + export interface IConstraintDefinition + { + /** + * The first possible Body that this constraint is attached to. + */ + bodyA?:Body; + + /** + * The second possible Body that this constraint is attached to. + */ + bodyB?:Body; + + /** + * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. + */ + id?:number; + + /** + * An arbitrary String name to help the user identify and manage bodies. + * Default: "Constraint" + */ + label?:string; + + /** + * A Number that specifies the target resting length of the constraint. It is calculated automatically in Constraint.create from intial positions of the constraint.bodyA and constraint.bodyB. + */ + length?:number; + + /** + * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. + Default: { x: 0, y: 0 } + */ + pointA?:Vector; + + /** + * A Vector that specifies the offset of the constraint from center of the constraint.bodyA if defined, otherwise a world-space position. + Default: { x: 0, y: 0 } + */ + pointB?:Vector; + + /** + * An Object that defines the rendering properties to be consumed by the module Matter.Render. + */ + render?:IConstraintRenderRefinition; + + /** + * A Number that specifies the stiffness of the constraint, i.e. the rate at which it returns to its resting constraint.length. A value of 1 means the constraint should be very stiff. A value of 0.2 means the constraint acts like a soft spring. + Default: 1 + */ + stiffness?:number; + + /** + * A String denoting the type of object. + Default: "constraint" + */ + type?:string; + } + + export class Composite + { + /** + * Generic add function. Adds one or many body(s), constraint(s) or a composite(s) to the given composite. + * + * @param composite + * @param object + * + * @returns The original composite with the objects added + */ + static add(composite:Composite, object:Body|Composite|Constraint ):Composite; + + /** + * Adds a body to the given composite + * + * @param composite + * @param body + * + * @returns Composite The original composite with the body added + */ + static addBody(composite:Composite, body:Body):Composite; + + /** + * Adds a composite to the given composite + * + * @param compositeA + * @param compositeB + * + * @returns The original compositeA with the objects from compositeB added + */ + static addComposite(compositeA:Composite, compositeB:Composite):Composite; + + /** + * + * @param composite + * @param constraint + * @returns The original composite with the constraint added + */ + static addConstraint(composite:Composite, constraint:Constraint):Composite; + + /** + * Returns all bodies in the given composite, including all bodies in its children, recursively. + * + * @param composite + * @returns Body[] All the bodies + */ + static allBodies(composite:Composite):Array; + + /** + * Returns all composites in the given composite, including all composites in its children, recursively. + * + * @param composite + * @returns Composite[] All the composites + */ + static allComposites(composite:Composite):Array; + + /** + * Returns all constraints in the given composite, including all constraints in its children, recursively. + * + * @param composite + * @returns Constraint[] All the constraints + */ + static allConstraints(composite:Composite):Array; + + /** + * Removes all bodies, constraints and composites from the given composite Optionally clearing its children recursively. + * + * @param world + * @param keepStatic + * @param deep + */ + static clear(world:World, keepStatic:boolean, deep?:boolean); + + /** + * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section below for detailed information on what you can pass via the options object. + * + * @param options + * @returns A new composite + */ + static create(options:ICompositeDefinition):Composite; + + /** + * Searches the composite recursively for an object matching the type and id supplied, null if not found + * + * @param composite + * @param id + * @param type + * @returns The requested object, if found. + */ + static get(composite:Composite,id:number,type:string):Body|Composite|Constraint; + + /** + * Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add) + * + * @param compositeA + * @param objects + * @param compositeB + * @returns Returns compositeA + */ + static move(compositeA:Composite, objects:Array, compositeB:Composite):Composite; + + /** + * Assigns new ids for all objects in the composite, recursively. + * + * @param composite + * @returns Returns composite + */ + static rebase(composite:Composite):Composite; + + /** + * Generic remove function. Removes one or many body(s), constraint(s) or a composite(s) to the given composite. Optionally searching its children recursively. + * + * @param composite + * @param object + * @param deep + * @returns The original composite with the objects removed. + */ + static remove(composite:Composite, object:Body|Composite|Constraint, deep?:boolean):Composite; + + /** + * Removes a body from the given composite, and optionally searching its children recursively. + * + * @param composite + * @param body + * @param deep + * @returns The original composite with the body removed. + */ + static removeBody(composite:Composite, body:Body, deep?:boolean):Composite; + + /** + * Removes a body from the given composite. + * + * @param composite + * @param position + * @returns The original composite with the body removed. + */ + static removeBodyAt(composite:Composite, position:number):Composite; + + /** + * Removes a composite from the given composite, and optionally searching its children recursively + * + * @param compositeA + * @param compositeB + * @returns The original compositeA with the composite removed. + */ + static removeComposite(compositeA:Composite, compositeB:Composite, deep?:boolean):Composite; + + /** + * Removes a composite from the given composite + * + * @param composite + * @param position + * @returns The original composite with the composite removed. + */ + static removeCompositeAt(composite:Composite, position:number):Composite; + + /** + * Removes a constraint from the given composite, and optionally searching its children recursively + * + * @param composite + * @param constraint + * @param deep + * + * @returns The original composite with the constraint removed + */ + static removeConstraint(composite:Composite, constraint:Constraint, deep?:boolean):Composite; + + /** + * Removes a body from the given composite + * @param composite + * @param position + * @returns The original composite with the constraint removed + */ + static removeConstraintAt(composite:Composite, position:number):Composite; + + /** + * Sets the composite's isModified flag. If updateParents is true, all parents will be set (default: false). If updateChildren is true, all children will be set (default: false). + * + * @param composite + * @param isModified + * @param updateParents + */ + static setModified(composite:Composite, isModified:boolean, updateParents?:boolean); + + /** + * An array of Body that are direct children of this composite. To add or remove bodies you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allBodies method. + */ + bodies:Array; + + /** + * An array of Composite that are direct children of this composite. To add or remove composites you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allComposites method. + */ + composites:Array; + + /** + * An array of Constraint that are direct children of this composite. To add or remove constraints you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allConstraints method. + */ + constraints:Array; + + /** + * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. + */ + id:number; + + /** + * A flag that specifies whether the composite has been modified during the current step. Most Matter.Composite methods will automatically set this flag to true to inform the engine of changes to be handled. If you need to change it manually, you should use the Composite.setModified method. + */ + isModified:boolean; + + /** + * An arbitrary String name to help the user identify and manage composites. + * Default: "Composite" + */ + label:string; + + /** + * The Composite that is the parent of this composite. It is automatically managed by the Matter.Composite methods. + */ + parent:Composite; + + /** + * A String denoting the type of object. + */ + type:String; + + } + + export class Composites + { + /** + * It will create car composite, wheels, car body and constraints. + * + * @param xx + * @param yy + * @param width + * @param height + * @param wheelSize + * + * @returns A new composite car body + */ + static car ( xx:number, yy:number, width:number, height:number, wheelSize:number ):Composite; + + /** + * Creates chain + * @param composite + * @param xOffsetA + * @param yOffsetA + * @param xOffsetB + * @param yOffsetB + * @param options + */ + static chain ( composite:Composite, xOffsetA:number, yOffsetA:number, xOffsetB:number, yOffsetB:number, options:any ):Composite; + + /** + *Connects bodies in the composite with constraints in a grid pattern, with optional cross braces + * + * @param composite + * @param columns + * @param rows + * @param crossBrace + * @param options + * @returns The composite containing objects meshed together with constraints + */ + static mesh(composite:Composite, columns:number, rows:number, crossBrace:boolean, options:any ):Composite; + + /** + * Creates newton cradle + * @param xx + * @param yy + * @param _number + * @param size + * @param length + * @returns A new composite newtonsCradle body + */ + newtonsCradle(xx:number, yy:number, _number:number, size:number, length:number):Composite; + + /** + * Creates pyramid + * + * @param xx + * @param yy + * @param columns + * @param rows + * @param columnGap + * @param rowGap + * @param callback + * @return A new composite containing objects created in the callback + */ + static pyramid(xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, callback:Function):Composite; + + /** + * Creates a simple soft body like object + * + * @param xx + * @param yy + * @param columns + * @param rows + * @param columnGap + * @param rowGap + * @param crossBrace + * @param particleRadius + * @param particleOptions + * @param constraintOptions + * + * @returns A new composite softBody + */ + static softBody ( xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, crossBrace:boolean, particleRadius:number, particleOptions:any, constraintOptions:any ):Composite; + + /** + * Creates objects in and stacks them up. + * @param xx + * @param yy + * @param columns + * @param rows + * @param columnGap + * @param rowGap + * @param callback + * @returns A new composite containing objects created in the callback + */ + static stack ( xx:number, yy:number, columns:number, rows:number, columnGap:number, rowGap:number, callback:Function ):Composite; + } + + export interface ICompositeDefinition + { + /** + * An array of Body that are direct children of this composite. To add or remove bodies you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allBodies method. + */ + bodies?:Array; + + /** + * An array of Composite that are direct children of this composite. To add or remove composites you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allComposites method. + */ + composites?:Array; + + /** + * An array of Constraint that are direct children of this composite. To add or remove constraints you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allConstraints method. + */ + constraints?:Array; + + /** + * An integer Number uniquely identifying number generated in Composite.create by Common.nextId. + */ + id?:number; + + /** + * A flag that specifies whether the composite has been modified during the current step. Most Matter.Composite methods will automatically set this flag to true to inform the engine of changes to be handled. If you need to change it manually, you should use the Composite.setModified method. + */ + isModified?:boolean; + + /** + * An arbitrary String name to help the user identify and manage composites. + * Default: "Composite" + */ + label?:string; + + /** + * The Composite that is the parent of this composite. It is automatically managed by the Matter.Composite methods. + */ + parent?:Composite; + + /** + * A String denoting the type of object. + */ + type?:String; + } + + export class Vertices + { + /** + * Returns the area of the set of vertices. + * + * @param vertices + * @param signed + */ + static area ( vertices:Array, signed:boolean ):number; + + /** + * Returns the centre (centroid) of the set of vertices. + * @param vertices + * @returns The centre point + */ + static centre ( vertices:Array ):Vector; + + /** + * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices. The radius parameter is a single number or an array to specify the radius for each vertex. + * @param vertices + */ + static chamfer ( vertices:Array, radius:Array, quality:number, qualityMin:number, qualityMax:number ); + + + /** + * Returns true if the point is inside the set of vertices. + * + * @param vertices + * @returns True if the vertices contains point, otherwise false. + */ + static contains ( vertices:Array, point:Vector ):boolean; + + /** + * Creates a new set of Matter.Body compatible vertices. The vertices argument accepts an array of Matter.Vector orientated around the origin (0, 0), for example: + [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }] + The Vertices.create method then inserts additional indexing properties required for efficient collision detection routines. + + * @param vertices + * @param body + */ + static create ( vertices:Array, body:Body); + + /** + * Parses a simple SVG-style path into a set of Matter.Vector points. + * + * @param path + * @returns vertices + */ + static fromPath ( path ):Array; + + /** + * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass. + * + * @param vertices + * @returns The polygon's moment of inertia + */ + static inertia( vertices:Array, mass:number ):number; + + /** + * Rotates the set of vertices in-place. + * + * @param vertices + * @param angle + * @param point + */ + static static ( vertices:Array, angle:number, point:Vector ); + + /** + * Scales the vertices from a point (default is centre) in-place. + * + * @param vertices + * @param scaleX + * @param scaleY + * @param point + */ + static scale( vertices:Array, scaleX:number, scaleY:number, point:Vector ); + + /** + * Translates the set of vertices in-place. + * + * @param vertices + */ + static translate ( vertices:Array, vector:Vector, scalar:number ); + } + + export class Render + { + + } + + export class Events + { + /** + * Fired after rendering + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"afterRender", callback:(e:any) => void ):void; + + /** + * Fired after engine update and after rendering + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"afterUpdate", callback:(e:any) => void ):void; + + /** + * Fired just before rendering + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"beforeRender", callback:(e:any) => void ):void; + + /** + * Fired at the start of a tick, before any updates to the engine or timing + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"beforeTick", callback:(e:any) => void ):void; + + /** + * Fired just before an update + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"beforeUpdate", callback:(e:any) => void ):void; + + /** + * Fired after engine update, provides a list of all pairs that are colliding in the current tick (if any) + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"collisionActive", callback:(e:any) => void ):void; + + + /** + * Fired after engine update, provides a list of all pairs that have ended collision in the current tick (if any) + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"collisionEnd", callback:(e:any) => void ):void; + + /** + * Fired after engine update, provides a list of all pairs that have started to collide in the current tick (if any) + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"collisionStart", callback:(e:any) => void ):void; + + /** + * Fired when the mouse is down (or a touch has started) during the last step + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"mousedown", callback:(e:any) => void ):void; + + /** + * Fired when the mouse has moved (or a touch moves) during the last step + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"mousemove", callback:(e:any) => void ):void; + + /** + * Fired when the mouse is up (or a touch has ended) during the last step + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"mouseup", callback:(e:any) => void ):void; + + /** + * Fired after engine timing updated, but just before engine state updated + * @param obj + * @param name + * @param callback + */ + static on(obj:Engine, name:"tick", callback:(e:any) => void ):void; + + static on(obj:Engine, name:string, callback:(e:any) => void ):void; + + /** + * Removes the given event callback. If no callback, clears all callbacks in eventNames. If no eventNames, clears all events. + * + * @param obj + * @param eventName + * @param callback + */ + static off(obj:any, eventName:string, callback: (e:any) => void ):void; + + /** + * Fires all the callbacks subscribed to the given object's eventName, in the order they subscribed, if any. + * + * @param object + * @param eventNames + * @param event + */ + static trigger( object:any, eventNames:string, event: (e:any) => void ):void; + + } +} + From a118d187ac3ce6d1474912e1f1350f610217fae6 Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Tue, 28 Apr 2015 15:51:32 +0400 Subject: [PATCH 031/534] Added void return types to functions --- matter/matter.d.ts | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/matter/matter.d.ts b/matter/matter.d.ts index ddcaba5d6..cc9384703 100644 --- a/matter/matter.d.ts +++ b/matter/matter.d.ts @@ -46,7 +46,7 @@ declare module Matter * Clears the engine including the world, pairs and broadphase. * @param engine */ - static clear(engine:Engine); + static clear(engine:Engine):void; /** * Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. @@ -60,20 +60,20 @@ declare module Matter * @param engineA * @param engineB */ - static merge(engineA:Engine, engineB:Engine); + static merge(engineA:Engine, engineB:Engine):void; /** * Renders the world by calling its defined renderer engine.render.controller. Triggers beforeRender and afterRender events. * @param engineA * @param engineB */ - static render(engineA:Engine, engineB:Engine); + static render(engineA:Engine, engineB:Engine):void; /** * An optional utility function that provides a game loop, that handles updating the engine for you. Calls Engine.update and Engine.render on the requestAnimationFrame event automatically. Handles time correction and non-fixed dynamic timing (if enabled). Triggers beforeTick, tick and afterTick events. * @param engine */ - static run(engine:Engine); + static run(engine:Engine):void; /** * Moves the simulation forward in time by delta ms. Triggers beforeUpdate and afterUpdate events. @@ -82,7 +82,7 @@ declare module Matter * @param delta * @param correction */ - static update(engine:Engine, delta:number, correction?:number); + static update(engine:Engine, delta:number, correction?:number):void; /** * An integer Number that specifies the number of constraint iterations to perform each update. The higher the value, the higher quality the simulation will be at the expense of performance. The default value of 2 is usually very adequate. @@ -166,7 +166,7 @@ declare module Matter * @param world * @param keepStatic */ - static clear(world:World, keepStatic:boolean); + static clear(world:World, keepStatic:boolean):void; /** * Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section below for detailed information on what you can pass via the options object. @@ -222,14 +222,14 @@ declare module Matter * @param position * @param force */ - static applyForce(body:Body, position:Vector, force:Vector); + static applyForce(body:Body, position:Vector, force:Vector):void; /** * Applys a mass dependant force to all given bodies. * @param bodies * @param gravity */ - static applyGravityAll(bodies:Array, gravity:Vector); + static applyGravityAll(bodies:Array, gravity:Vector):void; /** * Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults. All properties have default values, and many are pre-calculated automatically based on other properties. See the properites section below for detailed information on what you can pass via the options object. @@ -246,20 +246,20 @@ declare module Matter * Zeroes the body.force and body.torque force buffers. * @param bodies */ - static resetForcesAll(bodies:Array); + static resetForcesAll(bodies:Array):void; /** * Rotates a body by a given angle relative to its current angle, without imparting any angular velocity. * @param body * @param angle */ - static rotate(body:Body, angle:number); + static rotate(body:Body, angle:number):void; /** * Sets the body as static, including isStatic flag and setting mass and inertia to Infinity. * @param isStatic */ - setStatic(isStatic:boolean); + setStatic(isStatic:boolean):void; /** * Scales the body, including updating physical properties (mass, area, axes, inertia), from a world-space point (default is body centre). @@ -268,7 +268,7 @@ declare module Matter * @param scaleY * @param poinst */ - static scale(body:Body, scaleX:number, scaleY:number, poinst?:Vector); + static scale(body:Body, scaleX:number, scaleY:number, poinst?:Vector):void; /** * Moves a body by a given vector relative to its current position, without imparting any velocity. @@ -276,7 +276,7 @@ declare module Matter * @param body * @param translation */ - static translate(body:Body, translation:Vector); + static translate(body:Body, translation:Vector):void; /** *Performs a simulation step for the given body, including updating position and angle using Verlet integration. @@ -286,7 +286,7 @@ declare module Matter * @param timeScale * @param correction */ - static update(body:Body, deltaTime:number, timeScale:number, correction:number); + static update(body:Body, deltaTime:number, timeScale:number, correction:number):void; /** * Applys Body.update to all given bodies. @@ -297,7 +297,7 @@ declare module Matter * @param correction * @param worldBounds */ - static updateAll ( bodies:Array, deltaTime:number, timeScale:number, correction:number, worldBounds:Bounds ); + static updateAll ( bodies:Array, deltaTime:number, timeScale:number, correction:number, worldBounds:Bounds ):void; /** * A Number specifying the angle of the body, in radians. @@ -1000,7 +1000,7 @@ declare module Matter * @param keepStatic * @param deep */ - static clear(world:World, keepStatic:boolean, deep?:boolean); + static clear(world:World, keepStatic:boolean, deep?:boolean):void; /** * Creates a new composite. The options parameter is an object that specifies any properties you wish to override the defaults. See the properites section below for detailed information on what you can pass via the options object. @@ -1111,7 +1111,7 @@ declare module Matter * @param isModified * @param updateParents */ - static setModified(composite:Composite, isModified:boolean, updateParents?:boolean); + static setModified(composite:Composite, isModified:boolean, updateParents?:boolean):void; /** * An array of Body that are direct children of this composite. To add or remove bodies you should use Composite.add and Composite.remove methods rather than directly modifying this property. If you wish to recursively find all descendants, you should use the Composite.allBodies method. @@ -1316,7 +1316,7 @@ declare module Matter * Chamfers a set of vertices by giving them rounded corners, returns a new set of vertices. The radius parameter is a single number or an array to specify the radius for each vertex. * @param vertices */ - static chamfer ( vertices:Array, radius:Array, quality:number, qualityMin:number, qualityMax:number ); + static chamfer ( vertices:Array, radius:Array, quality:number, qualityMin:number, qualityMax:number ):void; /** @@ -1335,7 +1335,7 @@ declare module Matter * @param vertices * @param body */ - static create ( vertices:Array, body:Body); + static create ( vertices:Array, body:Body):void; /** * Parses a simple SVG-style path into a set of Matter.Vector points. @@ -1360,7 +1360,7 @@ declare module Matter * @param angle * @param point */ - static static ( vertices:Array, angle:number, point:Vector ); + static static ( vertices:Array, angle:number, point:Vector ):void; /** * Scales the vertices from a point (default is centre) in-place. @@ -1370,14 +1370,14 @@ declare module Matter * @param scaleY * @param point */ - static scale( vertices:Array, scaleX:number, scaleY:number, point:Vector ); + static scale( vertices:Array, scaleX:number, scaleY:number, point:Vector ):void; /** * Translates the set of vertices in-place. * * @param vertices */ - static translate ( vertices:Array, vector:Vector, scalar:number ); + static translate ( vertices:Array, vector:Vector, scalar:number ):void; } export class Render From 151b76f1aa75bb34b00a8982c491b0a69c229dfc Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Tue, 28 Apr 2015 15:54:26 +0400 Subject: [PATCH 032/534] Corrected fromPath parameter type --- matter/matter.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matter/matter.d.ts b/matter/matter.d.ts index cc9384703..61a10fa02 100644 --- a/matter/matter.d.ts +++ b/matter/matter.d.ts @@ -1343,7 +1343,7 @@ declare module Matter * @param path * @returns vertices */ - static fromPath ( path ):Array; + static fromPath ( path:string ):Array; /** * Returns the moment of inertia (second moment of area) of the set of vertices given the total mass. From 2b2172b95484643e10bec2c936bee1b34048ade3 Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Tue, 28 Apr 2015 22:21:44 +0400 Subject: [PATCH 033/534] Corrected matter.js project url --- matter/matter.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/matter/matter.d.ts b/matter/matter.d.ts index 61a10fa02..b386514d7 100644 --- a/matter/matter.d.ts +++ b/matter/matter.d.ts @@ -1,5 +1,5 @@ // Type definitions for Matter.js 0.8.0 -// Project: http://brm.io/matter-src/ +// Project: http://brm.io/matter-js/ // Definitions by: Ivane Gegia // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -1506,4 +1506,3 @@ declare module Matter } } - From ef740284e7d1fd3a83f5fb2a651d7c1625916fe5 Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Tue, 28 Apr 2015 22:36:44 +0400 Subject: [PATCH 034/534] Changed matter-js project url to github --- matter/matter.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matter/matter.d.ts b/matter/matter.d.ts index b386514d7..1365ccca2 100644 --- a/matter/matter.d.ts +++ b/matter/matter.d.ts @@ -1,5 +1,5 @@ // Type definitions for Matter.js 0.8.0 -// Project: http://brm.io/matter-js/ +// Project: https://github.com/liabru/matter-js // Definitions by: Ivane Gegia // Definitions: https://github.com/borisyankov/DefinitelyTyped From 21645357ba960c4444548bee7eef4ac097f7879f Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Tue, 28 Apr 2015 22:40:02 +0400 Subject: [PATCH 035/534] matter -> matter-js renamed folder/file from matter to matter-js --- matter/matter.d.ts => matter-js/matter-js.d.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename matter/matter.d.ts => matter-js/matter-js.d.ts (100%) diff --git a/matter/matter.d.ts b/matter-js/matter-js.d.ts similarity index 100% rename from matter/matter.d.ts rename to matter-js/matter-js.d.ts From 90360d69d98f95825f5390b96c44db0a6d72ad1c Mon Sep 17 00:00:00 2001 From: peferron Date: Tue, 28 Apr 2015 12:19:53 -0700 Subject: [PATCH 036/534] lodash: make `sum()` only callable on wrapped arrays of numbers This change triggers a compilation error when typing e.g. _(["abc"]).sum() --- lodash/lodash.d.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 145849230..331ec46ae 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -41,6 +41,7 @@ declare module _ { (value: number): LoDashWrapper; (value: string): LoDashWrapper; (value: boolean): LoDashWrapper; + (value: Array): LoDashNumberArrayWrapper; (value: Array): LoDashArrayWrapper; (value: T): LoDashObjectWrapper; (value: any): LoDashWrapper; @@ -205,6 +206,8 @@ declare module _ { unshift(...items: any[]): LoDashWrapper; } + interface LoDashNumberArrayWrapper extends LoDashArrayWrapper { } + //_.chain interface LoDashStatic { /** @@ -3917,12 +3920,21 @@ declare module _ { property: string): number; } - interface LoDashArrayWrapper { + interface LoDashNumberArrayWrapper { /** * @see _.sum **/ sum(): number + /** + * @see _.sum + **/ + sum( + iteratee: ListIterator, + thisArg?: any): number; + } + + interface LoDashArrayWrapper { /** * @see _.sum **/ From 1a525768565290bfe9f3d777cc65c040de2f157d Mon Sep 17 00:00:00 2001 From: Jed Mao Date: Tue, 28 Apr 2015 11:23:50 -0500 Subject: [PATCH 037/534] Fix chai libraries, plugins --- chai-as-promised/chai-as-promised-tests.ts | 2 +- chai-as-promised/chai-as-promised.d.ts | 20 +- chai-datetime/chai-datetime-tests.ts | 17 +- chai-datetime/chai-datetime.d.ts | 55 +- chai-fuzzy/chai-fuzzy-tests.ts | 35 + chai-fuzzy/chai-fuzzy.d.ts | 75 +- chai-fuzzy/chai-fuzzy.d.ts.tscparams | 1 - chai-http/chai-http-tests.ts | 20 +- chai-http/chai-http.d.ts | 55 +- chai-jquery/chai-jquery-tests.ts | 8 +- chai-jquery/chai-jquery-tests.ts.tscparams | 1 - chai-jquery/chai-jquery.d.ts | 2597 +++++++++++++++++++- chai/chai-tests.ts | 1451 +++++------ chai/chai-tests.ts.tscparams | 1 - chai/chai.d.ts | 315 ++- sinon-chai/sinon-chai-tests.ts | 18 +- sinon-chai/sinon-chai.d.ts | 94 +- sinon/sinon-tests.ts | 114 +- sinon/sinon.d.ts | 814 +++--- 19 files changed, 4189 insertions(+), 1504 deletions(-) create mode 100644 chai-fuzzy/chai-fuzzy-tests.ts delete mode 100644 chai-fuzzy/chai-fuzzy.d.ts.tscparams delete mode 100644 chai-jquery/chai-jquery-tests.ts.tscparams delete mode 100644 chai/chai-tests.ts.tscparams diff --git a/chai-as-promised/chai-as-promised-tests.ts b/chai-as-promised/chai-as-promised-tests.ts index 20a773cdd..a2dcb72ed 100644 --- a/chai-as-promised/chai-as-promised-tests.ts +++ b/chai-as-promised/chai-as-promised-tests.ts @@ -1,4 +1,3 @@ -/// /// import chai = require('chai'); @@ -6,6 +5,7 @@ import chaiAsPromised = require('chai-as-promised'); chai.use(chaiAsPromised); +// ReSharper disable WrongExpressionStatement var promise: any; chai.expect(promise).to.eventually.equal(3); chai.expect(promise).to.become(3); diff --git a/chai-as-promised/chai-as-promised.d.ts b/chai-as-promised/chai-as-promised.d.ts index 20b697bb5..6ff150eb4 100644 --- a/chai-as-promised/chai-as-promised.d.ts +++ b/chai-as-promised/chai-as-promised.d.ts @@ -6,21 +6,21 @@ /// declare module 'chai-as-promised' { - import chai = require('chai'); - function chaiAsPromised(chai: any, utils: any): void; - export = chaiAsPromised; } -declare module chai { +declare module Chai { + + interface Assertion { + become(expected: any): Assertion; + rejected: Assertion; + rejectedWith(expected: any): Assertion; + notify(fn: Function): Assertion; + } interface LanguageChains { - become(expected: any): Expect; - eventually: Expect; - rejected: Expect; - rejectedWith(expected: any): Expect; - notify(fn: Function): Expect; + eventually: Assertion; } interface Assert { @@ -32,4 +32,4 @@ declare module chai { isRejected(promise: any, expected: any, message?: string): void; isRejected(promise: any, match: RegExp, message?: string): void; } -} \ No newline at end of file +} diff --git a/chai-datetime/chai-datetime-tests.ts b/chai-datetime/chai-datetime-tests.ts index 8f8238b4e..5c15326f4 100644 --- a/chai-datetime/chai-datetime-tests.ts +++ b/chai-datetime/chai-datetime-tests.ts @@ -1,13 +1,16 @@ -/// /// +import chai = require('chai'); +import chaiDateTime = require('chai-datetime'); + +chai.use(chaiDateTime); var expect = chai.expect; var assert = chai.assert; function test_equalTime(){ var date: Date = new Date(2014, 1, 1); - expect(date).to.be.equalTime(date); - date.should.be.equalTime(date); + expect(date).to.equalTime(date); + date.should.equalTime(date); assert.equalTime(date, date); } @@ -34,14 +37,14 @@ function test_equalDate(){ function test_beforeDate(){ var date: Date = new Date(2014, 1, 1); - expect(date).to.beforeDate(date); - date.should.beforeDate(date); + expect(date).to.be.beforeDate(date); + date.should.be.beforeDate(date); assert.beforeDate(date, date); } function test_afterDate(){ var date: Date = new Date(2014, 1, 1); - expect(date).to.afterDate(date); - date.should.afterDate(date); + expect(date).to.be.afterDate(date); + date.should.be.afterDate(date); assert.afterDate(date, date); } diff --git a/chai-datetime/chai-datetime.d.ts b/chai-datetime/chai-datetime.d.ts index bce063443..b6140689c 100644 --- a/chai-datetime/chai-datetime.d.ts +++ b/chai-datetime/chai-datetime.d.ts @@ -5,35 +5,38 @@ /// -declare module chai { +declare module Chai { - interface Expect { - afterDate(date: Date): boolean; - beforeDate(date: Date): boolean; - equalDate(date: Date): boolean; + interface Assertion { + afterDate(date: Date): Assertion; + beforeDate(date: Date): Assertion; + equalDate(date: Date): Assertion; + afterTime(date: Date): Assertion; + beforeTime(date: Date): Assertion; + equalTime(date: Date): Assertion; + } - afterTime(date: Date): boolean; - beforeTime(date: Date): boolean; - equalTime(date: Date): boolean; - } - - interface Assert { - equalTime(val: Date, exp: Date, msg?: string): boolean; - notEqualTime(val: Date, exp: Date, msg?: string): boolean; - beforeTime(val: Date, exp: Date, msg?: string): boolean; - notBeforeTime(val: Date, exp: Date, msg?: string): boolean; - afterTime(val: Date, exp: Date, msg?: string): boolean; - notAfterTime(val: Date, exp: Date, msg?: string): boolean; - - equalDate(val: Date, exp: Date, msg?: string): boolean; - notEqualDate(val: Date, exp: Date, msg?: string): boolean; - beforeDate(val: Date, exp: Date, msg?: string): boolean; - notBeforeDate(val: Date, exp: Date, msg?: string): boolean; - afterDate(val: Date, exp: Date, msg?: string): boolean; - notAfterDate(val: Date, exp: Date, msg?: string): boolean; - } + interface Assert { + equalTime(val: Date, exp: Date, msg?: string): void; + notEqualTime(val: Date, exp: Date, msg?: string): void; + beforeTime(val: Date, exp: Date, msg?: string): void; + notBeforeTime(val: Date, exp: Date, msg?: string): void; + afterTime(val: Date, exp: Date, msg?: string): void; + notAfterTime(val: Date, exp: Date, msg?: string): void; + equalDate(val: Date, exp: Date, msg?: string): void; + notEqualDate(val: Date, exp: Date, msg?: string): void; + beforeDate(val: Date, exp: Date, msg?: string): void; + notBeforeDate(val: Date, exp: Date, msg?: string): void; + afterDate(val: Date, exp: Date, msg?: string): void; + notAfterDate(val: Date, exp: Date, msg?: string): void; + } } interface Date { - should: chai.Expect; + should: Chai.Assertion; +} + +declare module "chai-datetime" { + function chaiDateTime(chai: any, utils: any): void; + export = chaiDateTime; } diff --git a/chai-fuzzy/chai-fuzzy-tests.ts b/chai-fuzzy/chai-fuzzy-tests.ts new file mode 100644 index 000000000..292b25002 --- /dev/null +++ b/chai-fuzzy/chai-fuzzy-tests.ts @@ -0,0 +1,35 @@ +/// + +// tests taken from http://chaijs.com/plugins/chai-fuzzy + +import chai = require('chai'); +import chaiFuzzy = require('chai-fuzzy'); + +chai.use(chaiFuzzy); +var expect = chai.expect; +var assert = chai.assert; + +/** + * compare object attributes and values rather than checking to see if they're the same reference + */ +function like() { + var subject = { a: 'a' }; + + expect(subject).to.be.like({ a: 'a' }); + expect(subject).not.to.be.like({ x: 'x' }); + expect(subject).not.to.be.like({ a: 'a', b: 'b' }); + + assert.like(subject, { a: 'a' }); + assert.notLike(subject, { x: 'x' }); + assert.notLike(subject, { a: 'a', b: 'b' }); + + var subject2 = ['a']; + + expect(subject2).to.be.like(['a']); + expect(subject2).not.to.be.like(['x']); + expect(subject2).not.to.be.like(['a', 'b']); + + assert.like(subject2, ['a']); + assert.notLike(subject2, ['x']); + assert.notLike(subject2, ['a', 'b']); +} diff --git a/chai-fuzzy/chai-fuzzy.d.ts b/chai-fuzzy/chai-fuzzy.d.ts index acfb515f4..90955e1e1 100644 --- a/chai-fuzzy/chai-fuzzy.d.ts +++ b/chai-fuzzy/chai-fuzzy.d.ts @@ -5,13 +5,72 @@ /// -declare module chai { - interface Assert { - like(act:any, exp:any, msg?:string); - notLike(act:any, exp:any, msg?:string); - containOneLike(act:any, exp:any, msg?:string); - notContainOneLike(act:any, exp:any, msg?:string); - jsonOf(act:any, exp:any, msg?:string); - notJsonOf(act:any, exp:any, msg?:string); +declare module Chai { + + interface Assertion { + /** + * Compare object attributes and values rather than checking to see if + * they're the same reference. + */ + like(expected: any, message?: string): Assertion; + /** + * Compare object attributes and values rather than checking to see if + * they're the same reference. + */ + notLike(expected: any, message?: string): Assertion; + /** + * Check the first level of the container for a value like the one provided. + */ + containOneLike(expected: any, message?: string): Assertion; + /** + * Check the first level of the container for a value like the one provided. + */ + notContainOneLike(expected: any, message?: string): Assertion; + /** + * Check that the given javascript object is like the JSON-ified expected + * value. Useful for checking stringification and parsing of an object. + */ + jsonOf(expected: any, message?: string): Assertion; + /** + * Check that the given javascript object is like the JSON-ified expected + * value. Useful for checking stringification and parsing of an object. + */ + notJsonOf(expected: any, message?: string): Assertion; + } + + export interface Assert { + /** + * Compare object attributes and values rather than checking to see if + * they're the same reference. + */ + like(actual: any, expected: any, message?: string): void; + /** + * Compare object attributes and values rather than checking to see if + * they're the same reference. + */ + notLike(actual: any, expected: any, message?: string): void; + /** + * Check the first level of the container for a value like the one provided. + */ + containOneLike(actual: any, expected: any, message?: string): void; + /** + * Check the first level of the container for a value like the one provided. + */ + notContainOneLike(actual: any, expected: any, message?: string): void; + /** + * Check that the given javascript object is like the JSON-ified expected + * value. Useful for checking stringification and parsing of an object. + */ + jsonOf(actual: any, expected: any, message?: string): void; + /** + * Check that the given javascript object is like the JSON-ified expected + * value. Useful for checking stringification and parsing of an object. + */ + notJsonOf(actual: any, expected: any, message?: string): void; } } + +declare module "chai-fuzzy" { + function chaiFuzzy(chai: any, utils: any): void; + export = chaiFuzzy; +} diff --git a/chai-fuzzy/chai-fuzzy.d.ts.tscparams b/chai-fuzzy/chai-fuzzy.d.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/chai-fuzzy/chai-fuzzy.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/chai-http/chai-http-tests.ts b/chai-http/chai-http-tests.ts index e6e471321..e11914f7b 100644 --- a/chai-http/chai-http-tests.ts +++ b/chai-http/chai-http-tests.ts @@ -1,20 +1,21 @@ /// -/// +/// import fs = require('fs'); import http = require('http'); import chai = require('chai'); -import chaiHttp = require('chai-http'); +import ChaiHttp = require('chai-http'); import when = require('when'); -chai.use(chaiHttp); +chai.use(ChaiHttp); + +// ReSharper disable WrongExpressionStatement // Add promise support if this does not exist natively. if (!global.Promise) { chai.request.addPromises(when.promise); } - var app: http.Server; chai.request(app).get('/'); @@ -47,7 +48,7 @@ chai.request(app) chai.request(app) .put('/user/me') .send({ passsword: '123', confirmPassword: '123' }) - .end((err: any, res: chaiHttp.Response) => { + .end((err: any, res: ChaiHttp.Response) => { chai.expect(err).to.be.null; chai.expect(res).to.have.status(200); }); @@ -55,7 +56,7 @@ chai.request(app) chai.request(app) .put('/user/me') .send({ passsword: '123', confirmPassword: '123' }) - .then((res: chaiHttp.Response) => chai.expect(res).to.have.status(200)) + .then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200)) .catch((err: any) => { throw err; }); var agent = chai.request.agent(app); @@ -63,17 +64,17 @@ var agent = chai.request.agent(app); agent .post('/session') .send({ username: 'me', password: '123' }) - .then((res: chaiHttp.Response) => { + .then((res: ChaiHttp.Response) => { chai.expect(res).to.have.cookie('sessionid'); // The `agent` now has the sessionid cookie saved, and will send it // back to the server in the next request: return agent.get('/user/me') - .then((res: chaiHttp.Response) => chai.expect(res).to.have.status(200)); + .then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200)); }); function test1() { var req = chai.request(app).get('/'); - req.then((res: chaiHttp.Response) => { + req.then((res: ChaiHttp.Response) => { chai.expect(res).to.have.status(200); chai.expect(res).to.have.header('content-type', 'text/plain'); chai.expect(res).to.have.header('content-type', /^text/); @@ -99,5 +100,4 @@ function test1() { }); } - when(chai.request(app).get('/')).done(() => console.log('success'), () => console.log('failure')); diff --git a/chai-http/chai-http.d.ts b/chai-http/chai-http.d.ts index fed2a8416..992c92687 100644 --- a/chai-http/chai-http.d.ts +++ b/chai-http/chai-http.d.ts @@ -6,27 +6,38 @@ /// /// -declare module chai { - export function request(server: any): chaiHttp.Agent; +declare module Chai { - export module request { - export function agent(server: any): chaiHttp.Agent; - export function addPromises(promiseConstructor: chaiHttp.PromiseConstructor): void; + interface ChaiStatic { + request: ChaiHttpRequest; } - interface Assertions extends chaiHttp.Assertions { + interface ChaiHttpRequest { + (server: any): ChaiHttp.Agent; + agent(server: any): ChaiHttp.Agent; + addPromises(promiseConstructor: any): void; } - interface TypeComparison extends chaiHttp.TypeComparison { + interface Assertion { + status(code: number): Assertion; + header(key: string, value?: string): Assertion; + header(key: string, value?: RegExp): Assertion; + headers: Assertion; + json: Assertion; + text: Assertion; + html: Assertion; + redirect: Assertion; + redirectTo(location: string): Assertion; + param(key: string, value?: string): Assertion; + cookie(key: string, value?: string): Assertion; + } + + interface TypeComparison { + ip: Assertion; } } -declare function chaiHttp(chai: any, utils: any): void; -declare module chaiHttp { - interface PromiseConstructor { - (resolver: (resolve: (value: T) => void, reject: (reason: any) => void) => void): Promise; - } - +declare module ChaiHttp { interface Promise { then(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U): Promise; } @@ -38,8 +49,7 @@ declare module chaiHttp { } interface Request extends FinishedRequest { - attach(field: string, file: string, filename: string): Request; - attach(field: string, file: Buffer, filename: string): Request; + attach(field: string, file: string|Buffer, filename: string): Request; set(field: string, val: string): Request; query(key: string, value: string): Request; send(data: Object): Request; @@ -63,25 +73,12 @@ declare module chaiHttp { patch(url: string, callback?: (err: any, res: Response) => void): Request; } - interface Assertions { - status(code: number): any; - header(key: string, value?: string): any; - header(key: string, value?: RegExp): any; - headers: any; - json: any; - // text: any; - // html: any; - redirect: any; - redirectTo(location: string): any; - param(key: string, value?: string): any; - cookie(key: string, value?: string): any; - } - interface TypeComparison { ip: any; } } declare module "chai-http" { + function chaiHttp(chai: any, utils: any): void; export = chaiHttp; } diff --git a/chai-jquery/chai-jquery-tests.ts b/chai-jquery/chai-jquery-tests.ts index 45c9981f5..64f6b040b 100644 --- a/chai-jquery/chai-jquery-tests.ts +++ b/chai-jquery/chai-jquery-tests.ts @@ -1,9 +1,9 @@ -/// /// // tests taken from https://github.com/chaijs/chai-jquery -declare var $; +declare var $: ChaiJQueryStatic; +import chai = require('chai'); var expect = chai.expect; function test_attr() { @@ -19,7 +19,7 @@ function test_css() { function test_data() { expect($('#foo')).to.have.data('toggle'); expect($('#foo')).to.have.css('toggle', 'true'); - expect($('body')).to.have.css('font-family').match(/sans-serif/); + expect($('body')).to.have.css('font-family').and.match(/sans-serif/); } function test_class() { @@ -88,4 +88,4 @@ function test_be_selector() { function test_have_selector() { $('body').should.have('h1'); expect($('#foo')).to.have('div'); -} \ No newline at end of file +} diff --git a/chai-jquery/chai-jquery-tests.ts.tscparams b/chai-jquery/chai-jquery-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/chai-jquery/chai-jquery-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/chai-jquery/chai-jquery.d.ts b/chai-jquery/chai-jquery.d.ts index 826e66579..d4eb7465f 100644 --- a/chai-jquery/chai-jquery.d.ts +++ b/chai-jquery/chai-jquery.d.ts @@ -4,34 +4,2577 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// -declare module chai { - interface NameValueRegexMatcher { - match(value: RegExp): boolean; - } +declare module Chai { - interface NameValueMatcher { - (name: string, value?: string): boolean; - } - - interface Have { - attr: NameValueMatcher; - css: NameValueMatcher; - data: NameValueMatcher; - class(className: string): boolean; - id(id: string): boolean; - html(html: string): boolean; - text(text: string): boolean; - value(text: string): boolean; - (selector: string): boolean; - } - - interface Be { - visible: boolean; - hidden: boolean; - selected: boolean; - checked: boolean; - disabled: boolean; - (selector: string): boolean; + interface Assertion { + attr: (name: string, value?: string) => Assertion; + css: (name: string, value?: string) => Assertion; + data: (name: string, value?: string) => Assertion; + class(className: string): Assertion; + id(id: string): Assertion; + html(html: string): Assertion; + text(text: string): Assertion; + value(text: string): Assertion; + (selector: string): Assertion; + visible: Assertion; + hidden: Assertion; + selected: Assertion; + checked: Assertion; + disabled: Assertion; + (selector: string): Assertion; } } + +/** + * Static members of chai-jquery (those on $ and jQuery themselves) + */ +interface ChaiJQueryStatic { + + /** + * Perform an asynchronous HTTP (Ajax) request. + * + * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). + */ + ajax(settings: JQueryAjaxSettings): JQueryXHR; + /** + * Perform an asynchronous HTTP (Ajax) request. + * + * @param url A string containing the URL to which the request is sent. + * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). + */ + ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR; + + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). + * + * @param dataTypes An optional string containing one or more space-separated dataTypes + * @param handler A handler to set default values for future Ajax requests. + */ + ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). + * + * @param handler A handler to set default values for future Ajax requests. + */ + ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; + + ajaxSettings: JQueryAjaxSettings; + + /** + * Set default values for future Ajax requests. Its use is not recommended. + * + * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. + */ + ajaxSetup(options: JQueryAjaxSettings): void; + + /** + * Load data from the server using a HTTP GET request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). + */ + get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + /** + * Load data from the server using a HTTP GET request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). + */ + get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + */ + getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. + */ + getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; + /** + * Load a JavaScript file from the server using a GET HTTP request, then execute it. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + */ + getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; + + /** + * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. + */ + param: JQueryParam; + + /** + * Load data from the server using a HTTP POST request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + */ + post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + /** + * Load data from the server using a HTTP POST request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + */ + post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + + /** + * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. + * + * @param flags An optional list of space-separated flags that change how the callback list behaves. + */ + Callbacks(flags?: string): JQueryCallback; + + /** + * Holds or releases the execution of jQuery's ready event. + * + * @param hold Indicates whether the ready hold is being requested or released + */ + holdReady(hold: boolean): void; + + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param selector A string containing a selector expression + * @param context A DOM Element, Document, or jQuery to use as context + */ + (selector: string, context?: Element|JQuery): ChaiJQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param element A DOM element to wrap in a jQuery object. + */ + (element: Element): ChaiJQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. + */ + (elementArray: Element[]): ChaiJQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param object A plain object to wrap in a jQuery object. + */ + (object: {}): ChaiJQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param object An existing jQuery object to clone. + */ + (object: JQuery): ChaiJQuery; + /** + * Specify a function to execute when the DOM is fully loaded. + */ + (): ChaiJQuery; + + /** + * Creates DOM elements on the fly from the provided string of raw HTML. + * + * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. + * @param ownerDocument A document in which the new elements will be created. + */ + (html: string, ownerDocument?: Document): ChaiJQuery; + /** + * Creates DOM elements on the fly from the provided string of raw HTML. + * + * @param html A string defining a single, standalone, HTML element (e.g.
or
). + * @param attributes An object of attributes, events, and methods to call on the newly-created element. + */ + (html: string, attributes: Object): ChaiJQuery; + + /** + * Binds a function to be executed when the DOM has finished loading. + * + * @param callback A function to execute after the DOM is ready. + */ + (callback: Function): ChaiJQuery; + + /** + * Relinquish jQuery's control of the $ variable. + * + * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). + */ + noConflict(removeAll?: boolean): Object; + + /** + * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. + * + * @param deferreds One or more Deferred objects, or plain JavaScript objects. + */ + when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; + + /** + * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. + */ + cssHooks: { [key: string]: any; }; + cssNumber: any; + + /** + * Store arbitrary data associated with the specified element. Returns the value that was set. + * + * @param element The DOM element to associate with the data. + * @param key A string naming the piece of data to set. + * @param value The new data value. + */ + data(element: Element, key: string, value: T): T; + /** + * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. + * + * @param element The DOM element to associate with the data. + * @param key A string naming the piece of data to set. + */ + data(element: Element, key: string): any; + /** + * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. + * + * @param element The DOM element to associate with the data. + */ + data(element: Element): any; + + /** + * Execute the next function on the queue for the matched element. + * + * @param element A DOM element from which to remove and execute a queued function. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + dequeue(element: Element, queueName?: string): void; + + /** + * Determine whether an element has any jQuery data associated with it. + * + * @param element A DOM element to be checked for data. + */ + hasData(element: Element): boolean; + + /** + * Show the queue of functions to be executed on the matched element. + * + * @param element A DOM element to inspect for an attached queue. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + queue(element: Element, queueName?: string): any[]; + /** + * Manipulate the queue of functions to be executed on the matched element. + * + * @param element A DOM element where the array of queued functions is attached. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param newQueue An array of functions to replace the current queue contents. + */ + queue(element: Element, queueName: string, newQueue: Function[]): ChaiJQuery; + /** + * Manipulate the queue of functions to be executed on the matched element. + * + * @param element A DOM element on which to add a queued function. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param callback The new function to add to the queue. + */ + queue(element: Element, queueName: string, callback: Function): ChaiJQuery; + + /** + * Remove a previously-stored piece of data. + * + * @param element A DOM element from which to remove data. + * @param name A string naming the piece of data to remove. + */ + removeData(element: Element, name?: string): ChaiJQuery; + + /** + * A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. + * + * @param beforeStart A function that is called just before the constructor returns. + */ + Deferred(beforeStart?: (deferred: JQueryDeferred) => any): JQueryDeferred; + + /** + * Effects + */ + fx: { + tick: () => void; + /** + * The rate (in milliseconds) at which animations fire. + */ + interval: number; + stop: () => void; + speeds: { slow: number; fast: number; }; + /** + * Globally disable all animations. + */ + off: boolean; + step: any; + }; + + /** + * Takes a function and returns a new one that will always have a particular context. + * + * @param fnction The function whose context will be changed. + * @param context The object to which the context (this) of the function should be set. + * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. + */ + proxy(fnction: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any; + /** + * Takes a function and returns a new one that will always have a particular context. + * + * @param context The object to which the context (this) of the function should be set. + * @param name The name of the function whose context will be changed (should be a property of the context object). + * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. + */ + proxy(context: Object, name: string, ...additionalArguments: any[]): any; + + Event: JQueryEventConstructor; + + /** + * Takes a string and throws an exception containing it. + * + * @param message The message to send out. + */ + error(message: any): ChaiJQuery; + + expr: any; + fn: any; //TODO: Decide how we want to type this + + isReady: boolean; + + // Properties + support: JQuerySupport; + + /** + * Check to see if a DOM element is a descendant of another DOM element. + * + * @param container The DOM element that may contain the other element. + * @param contained The DOM element that may be contained by (a descendant of) the other element. + */ + contains(container: Element, contained: Element): boolean; + + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * + * @param collection The object or array to iterate over. + * @param callback The function that will be executed on every object. + */ + each( + collection: T[], + callback: (indexInArray: number, valueOfElement: T) => any + ): any; + + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * + * @param collection The object or array to iterate over. + * @param callback The function that will be executed on every object. + */ + each( + collection: any, + callback: (indexInArray: any, valueOfElement: any) => any + ): any; + + /** + * Merge the contents of two or more objects together into the first object. + * + * @param target An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument. + * @param object1 An object containing additional properties to merge in. + * @param objectN Additional objects containing properties to merge in. + */ + extend(target: any, object1?: any, ...objectN: any[]): any; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param deep If true, the merge becomes recursive (aka. deep copy). + * @param target The object to extend. It will receive the new properties. + * @param object1 An object containing additional properties to merge in. + * @param objectN Additional objects containing properties to merge in. + */ + extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any; + + /** + * Execute some JavaScript code globally. + * + * @param code The JavaScript code to execute. + */ + globalEval(code: string): any; + + /** + * Finds the elements of an array which satisfy a filter function. The original array is not affected. + * + * @param array The array to search through. + * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object. + * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false. + */ + grep(array: T[], func: (elementOfArray: T, indexInArray: number) => boolean, invert?: boolean): T[]; + + /** + * Search for a specified value within an array and return its index (or -1 if not found). + * + * @param value The value to search for. + * @param array An array through which to search. + * @param fromIndex he index of the array at which to begin the search. The default is 0, which will search the whole array. + */ + inArray(value: T, array: T[], fromIndex?: number): number; + + /** + * Determine whether the argument is an array. + * + * @param obj Object to test whether or not it is an array. + */ + isArray(obj: any): boolean; + /** + * Check to see if an object is empty (contains no enumerable properties). + * + * @param obj The object that will be checked to see if it's empty. + */ + isEmptyObject(obj: any): boolean; + /** + * Determine if the argument passed is a Javascript function object. + * + * @param obj Object to test whether or not it is a function. + */ + isFunction(obj: any): boolean; + /** + * Determines whether its argument is a number. + * + * @param obj The value to be tested. + */ + isNumeric(value: any): boolean; + /** + * Check to see if an object is a plain object (created using "{}" or "new Object"). + * + * @param obj The object that will be checked to see if it's a plain object. + */ + isPlainObject(obj: any): boolean; + /** + * Determine whether the argument is a window. + * + * @param obj Object to test whether or not it is a window. + */ + isWindow(obj: any): boolean; + /** + * Check to see if a DOM node is within an XML document (or is an XML document). + * + * @param node he DOM node that will be checked to see if it's in an XML document. + */ + isXMLDoc(node: Node): boolean; + + /** + * Convert an array-like object into a true JavaScript array. + * + * @param obj Any object to turn into a native Array. + */ + makeArray(obj: any): any[]; + + /** + * Translate all items in an array or object to new array of items. + * + * @param array The Array to translate. + * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object. + */ + map(array: T[], callback: (elementOfArray: T, indexInArray: number) => U): U[]; + /** + * Translate all items in an array or object to new array of items. + * + * @param arrayOrObject The Array or Object to translate. + * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. + */ + map(arrayOrObject: any, callback: (value: any, indexOrKey: any) => any): any; + + /** + * Merge the contents of two arrays together into the first array. + * + * @param first The first array to merge, the elements of second added. + * @param second The second array to merge into the first, unaltered. + */ + merge(first: T[], second: T[]): T[]; + + /** + * An empty function. + */ + noop(): any; + + /** + * Return a number representing the current time. + */ + now(): number; + + /** + * Takes a well-formed JSON string and returns the resulting JavaScript object. + * + * @param json The JSON string to parse. + */ + parseJSON(json: string): any; + + /** + * Parses a string into an XML document. + * + * @param data a well-formed XML string to be parsed + */ + parseXML(data: string): XMLDocument; + + /** + * Remove the whitespace from the beginning and end of a string. + * + * @param str Remove the whitespace from the beginning and end of a string. + */ + trim(str: string): string; + + /** + * Determine the internal JavaScript [[Class]] of an object. + * + * @param obj Object to get the internal JavaScript [[Class]] of. + */ + type(obj: any): string; + + /** + * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. + * + * @param array The Array of DOM elements. + */ + unique(array: Element[]): Element[]; + + /** + * Parses a string into an array of DOM nodes. + * + * @param data HTML string to be parsed + * @param context DOM element to serve as the context in which the HTML fragment will be created + * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string + */ + parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[]; + + /** + * Parses a string into an array of DOM nodes. + * + * @param data HTML string to be parsed + * @param context DOM element to serve as the context in which the HTML fragment will be created + * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string + */ + parseHTML(data: string, context?: Document, keepScripts?: boolean): any[]; +} + +/** + * The chai-jquery instance members + */ +interface ChaiJQuery { + /** + * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. + * + * @param handler The function to be invoked. + */ + ajaxComplete(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any): ChaiJQuery; + /** + * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxError(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxSettings: JQueryAjaxSettings, thrownError: any) => any): ChaiJQuery; + /** + * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): ChaiJQuery; + /** + * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxStart(handler: () => any): ChaiJQuery; + /** + * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxStop(handler: () => any): ChaiJQuery; + /** + * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. + * + * @param handler The function to be invoked. + */ + ajaxSuccess(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any): ChaiJQuery; + + /** + * Load data from the server and place the returned HTML into the matched element. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param complete A callback function that is executed when the request completes. + */ + load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): ChaiJQuery; + + /** + * Encode a set of form elements as a string for submission. + */ + serialize(): string; + /** + * Encode a set of form elements as an array of names and values. + */ + serializeArray(): JQuerySerializeArrayElement[]; + + /** + * Adds the specified class(es) to each of the set of matched elements. + * + * @param className One or more space-separated classes to be added to the class attribute of each matched element. + */ + addClass(className: string): ChaiJQuery; + /** + * Adds the specified class(es) to each of the set of matched elements. + * + * @param function A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. + */ + addClass(func: (index: number, className: string) => string): ChaiJQuery; + + /** + * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. + */ + addBack(selector?: string): ChaiJQuery; + + /** + * Get the value of an attribute for the first element in the set of matched elements. + * + * @param attributeName The name of the attribute to get. + */ + attr(attributeName: string): string; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributeName The name of the attribute to set. + * @param value A value to set for the attribute. + */ + attr(attributeName: string, value: string|number): ChaiJQuery; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributeName The name of the attribute to set. + * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments. + */ + attr(attributeName: string, func: (index: number, attr: string) => string|number): ChaiJQuery; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributes An object of attribute-value pairs to set. + */ + attr(attributes: Object): ChaiJQuery; + + /** + * Determine whether any of the matched elements are assigned the given class. + * + * @param className The class name to search for. + */ + hasClass(className: string): boolean; + + /** + * Get the HTML contents of the first element in the set of matched elements. + */ + html(): string; + /** + * Set the HTML contents of each element in the set of matched elements. + * + * @param htmlString A string of HTML to set as the content of each matched element. + */ + html(htmlString: string): ChaiJQuery; + /** + * Set the HTML contents of each element in the set of matched elements. + * + * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. + */ + html(func: (index: number, oldhtml: string) => string): ChaiJQuery; + /** + * Set the HTML contents of each element in the set of matched elements. + * + * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. + */ + + /** + * Get the value of a property for the first element in the set of matched elements. + * + * @param propertyName The name of the property to get. + */ + prop(propertyName: string): any; + /** + * Set one or more properties for the set of matched elements. + * + * @param propertyName The name of the property to set. + * @param value A value to set for the property. + */ + prop(propertyName: string, value: string|number|boolean): ChaiJQuery; + /** + * Set one or more properties for the set of matched elements. + * + * @param properties An object of property-value pairs to set. + */ + prop(properties: Object): ChaiJQuery; + /** + * Set one or more properties for the set of matched elements. + * + * @param propertyName The name of the property to set. + * @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element. + */ + prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): ChaiJQuery; + + /** + * Remove an attribute from each element in the set of matched elements. + * + * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. + */ + removeAttr(attributeName: string): ChaiJQuery; + + /** + * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. + * + * @param className One or more space-separated classes to be removed from the class attribute of each matched element. + */ + removeClass(className?: string): ChaiJQuery; + /** + * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. + * + * @param function A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments. + */ + removeClass(func: (index: number, className: string) => string): ChaiJQuery; + + /** + * Remove a property for the set of matched elements. + * + * @param propertyName The name of the property to remove. + */ + removeProp(propertyName: string): ChaiJQuery; + + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. + * + * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. + * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. + */ + toggleClass(className: string, swtch?: boolean): ChaiJQuery; + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. + * + * @param swtch A boolean value to determine whether the class should be added or removed. + */ + toggleClass(swtch?: boolean): ChaiJQuery; + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. + * + * @param func A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments. + * @param swtch A boolean value to determine whether the class should be added or removed. + */ + toggleClass(func: (index: number, className: string, swtch: boolean) => string, swtch?: boolean): ChaiJQuery; + + /** + * Get the current value of the first element in the set of matched elements. + */ + val(): any; + /** + * Set the value of each element in the set of matched elements. + * + * @param value A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked. + */ + val(value: string|string[]): ChaiJQuery; + /** + * Set the value of each element in the set of matched elements. + * + * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. + */ + val(func: (index: number, value: string) => string): ChaiJQuery; + + + /** + * Get the value of style properties for the first element in the set of matched elements. + * + * @param propertyName A CSS property. + */ + css(propertyName: string): string; + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param propertyName A CSS property name. + * @param value A value to set for the property. + */ + css(propertyName: string, value: string|number): ChaiJQuery; + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param propertyName A CSS property name. + * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. + */ + css(propertyName: string, value: (index: number, value: string) => string|number): ChaiJQuery; + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param properties An object of property-value pairs to set. + */ + css(properties: Object): ChaiJQuery; + + /** + * Get the current computed height for the first element in the set of matched elements. + */ + height(): number; + /** + * Set the CSS height of every matched element. + * + * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). + */ + height(value: number|string): ChaiJQuery; + /** + * Set the CSS height of every matched element. + * + * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. + */ + height(func: (index: number, height: number) => number|string): ChaiJQuery; + + /** + * Get the current computed height for the first element in the set of matched elements, including padding but not border. + */ + innerHeight(): number; + + /** + * Sets the inner height on elements in the set of matched elements, including padding but not border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + innerHeight(height: number|string): ChaiJQuery; + + /** + * Get the current computed width for the first element in the set of matched elements, including padding but not border. + */ + innerWidth(): number; + + /** + * Sets the inner width on elements in the set of matched elements, including padding but not border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + innerWidth(width: number|string): ChaiJQuery; + + /** + * Get the current coordinates of the first element in the set of matched elements, relative to the document. + */ + offset(): JQueryCoordinates; + /** + * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. + * + * @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. + */ + offset(coordinates: JQueryCoordinates): ChaiJQuery; + /** + * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. + * + * @param func A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties. + */ + offset(func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates): ChaiJQuery; + + /** + * Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements. + * + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + */ + outerHeight(includeMargin?: boolean): number; + + /** + * Sets the outer height on elements in the set of matched elements, including padding and border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + outerHeight(height: number|string): ChaiJQuery; + + /** + * Get the current computed width for the first element in the set of matched elements, including padding and border. + * + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + */ + outerWidth(includeMargin?: boolean): number; + + /** + * Sets the outer width on elements in the set of matched elements, including padding and border. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + outerWidth(width: number|string): ChaiJQuery; + + /** + * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. + */ + position(): JQueryCoordinates; + + /** + * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element. + */ + scrollLeft(): number; + /** + * Set the current horizontal position of the scroll bar for each of the set of matched elements. + * + * @param value An integer indicating the new position to set the scroll bar to. + */ + scrollLeft(value: number): ChaiJQuery; + + /** + * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. + */ + scrollTop(): number; + /** + * Set the current vertical position of the scroll bar for each of the set of matched elements. + * + * @param value An integer indicating the new position to set the scroll bar to. + */ + scrollTop(value: number): ChaiJQuery; + + /** + * Get the current computed width for the first element in the set of matched elements. + */ + width(): number; + /** + * Set the CSS width of each element in the set of matched elements. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). + */ + width(value: number|string): ChaiJQuery; + /** + * Set the CSS width of each element in the set of matched elements. + * + * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. + */ + width(func: (index: number, width: number) => number|string): ChaiJQuery; + + /** + * Remove from the queue all items that have not yet been run. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + clearQueue(queueName?: string): ChaiJQuery; + + /** + * Store arbitrary data associated with the matched elements. + * + * @param key A string naming the piece of data to set. + * @param value The new data value; it can be any Javascript type including Array or Object. + */ + data(key: string, value: any): ChaiJQuery; + /** + * Store arbitrary data associated with the matched elements. + * + * @param obj An object of key-value pairs of data to update. + */ + data(obj: { [key: string]: any; }): ChaiJQuery; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + * + * @param key Name of the data stored. + */ + data(key: string): any; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. + */ + data(): any; + + /** + * Execute the next function on the queue for the matched elements. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + dequeue(queueName?: string): ChaiJQuery; + + /** + * Remove a previously-stored piece of data. + * + * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete. + */ + removeData(name: string): ChaiJQuery; + /** + * Remove a previously-stored piece of data. + * + * @param list An array of strings naming the pieces of data to delete. + */ + removeData(list: string[]): ChaiJQuery; + + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. + * + * @param type The type of queue that needs to be observed. (default: fx) + * @param target Object onto which the promise methods have to be attached + */ + promise(type?: string, target?: Object): JQueryPromise; + + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + animate(properties: Object, duration?: string|number, complete?: Function): ChaiJQuery; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. (default: swing) + * @param complete A function to call once the animation is complete. + */ + animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): ChaiJQuery; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param options A map of additional options to pass to the method. + */ + animate(properties: Object, options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Set a timer to delay execution of subsequent items in the queue. + * + * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + delay(duration: number, queueName?: string): ChaiJQuery; + + /** + * Display the matched elements by fading them to opaque. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + fadeIn(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements by fading them to opaque. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeIn(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements by fading them to opaque. + * + * @param options A map of additional options to pass to the method. + */ + fadeIn(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Hide the matched elements by fading them to transparent. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + fadeOut(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements by fading them to transparent. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeOut(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements by fading them to transparent. + * + * @param options A map of additional options to pass to the method. + */ + fadeOut(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Adjust the opacity of the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param opacity A number between 0 and 1 denoting the target opacity. + * @param complete A function to call once the animation is complete. + */ + fadeTo(duration: string|number, opacity: number, complete?: Function): ChaiJQuery; + /** + * Adjust the opacity of the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param opacity A number between 0 and 1 denoting the target opacity. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): ChaiJQuery; + + /** + * Display or hide the matched elements by animating their opacity. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + fadeToggle(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements by animating their opacity. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + fadeToggle(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements by animating their opacity. + * + * @param options A map of additional options to pass to the method. + */ + fadeToggle(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. + * + * @param queue The name of the queue in which to stop animations. + */ + finish(queue?: string): ChaiJQuery; + + /** + * Hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + hide(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + hide(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements. + * + * @param options A map of additional options to pass to the method. + */ + hide(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Display the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + show(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + show(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements. + * + * @param options A map of additional options to pass to the method. + */ + show(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Display the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + slideDown(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + slideDown(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display the matched elements with a sliding motion. + * + * @param options A map of additional options to pass to the method. + */ + slideDown(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Display or hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + slideToggle(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + slideToggle(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements with a sliding motion. + * + * @param options A map of additional options to pass to the method. + */ + slideToggle(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + slideUp(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + slideUp(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Hide the matched elements with a sliding motion. + * + * @param options A map of additional options to pass to the method. + */ + slideUp(options: JQueryAnimationOptions): ChaiJQuery; + + /** + * Stop the currently-running animation on the matched elements. + * + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + */ + stop(clearQueue?: boolean, jumpToEnd?: boolean): ChaiJQuery; + /** + * Stop the currently-running animation on the matched elements. + * + * @param queue The name of the queue in which to stop animations. + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + */ + stop(queue?: string, clearQueue?: boolean, jumpToEnd?: boolean): ChaiJQuery; + + /** + * Display or hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete. + */ + toggle(duration?: number|string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete. + */ + toggle(duration?: number|string, easing?: string, complete?: Function): ChaiJQuery; + /** + * Display or hide the matched elements. + * + * @param options A map of additional options to pass to the method. + */ + toggle(options: JQueryAnimationOptions): ChaiJQuery; + /** + * Display or hide the matched elements. + * + * @param showOrHide A Boolean indicating whether to show or hide the elements. + */ + toggle(showOrHide: boolean): ChaiJQuery; + + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. + */ + bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. + */ + bind(eventType: string, eventData: any, preventBubble: boolean): ChaiJQuery; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. + */ + bind(eventType: string, preventBubble: boolean): ChaiJQuery; + /** + * Attach a handler to an event for the elements. + * + * @param events An object containing one or more DOM event types and functions to execute for them. + */ + bind(events: any): ChaiJQuery; + + /** + * Trigger the "blur" event on an element + */ + blur(): ChaiJQuery; + /** + * Bind an event handler to the "blur" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + blur(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "blur" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "change" event on an element. + */ + change(): ChaiJQuery; + /** + * Bind an event handler to the "change" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + change(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "change" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "click" event on an element. + */ + click(): ChaiJQuery; + /** + * Bind an event handler to the "click" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + */ + click(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "click" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "dblclick" event on an element. + */ + dblclick(): ChaiJQuery; + /** + * Bind an event handler to the "dblclick" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + dblclick(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "dblclick" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + delegate(selector: any, eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "focus" event on an element. + */ + focus(): ChaiJQuery; + /** + * Bind an event handler to the "focus" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + focus(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "focus" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Bind an event handler to the "focusin" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + focusin(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "focusin" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + focusin(eventData: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Bind an event handler to the "focusout" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + focusout(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "focusout" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + focusout(eventData: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. + * + * @param handlerIn A function to execute when the mouse pointer enters the element. + * @param handlerOut A function to execute when the mouse pointer leaves the element. + */ + hover(handlerIn: (eventObject: JQueryEventObject) => any, handlerOut: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements. + * + * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. + */ + hover(handlerInOut: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "keydown" event on an element. + */ + keydown(): ChaiJQuery; + /** + * Bind an event handler to the "keydown" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + keydown(handler: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "keydown" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + + /** + * Trigger the "keypress" event on an element. + */ + keypress(): ChaiJQuery; + /** + * Bind an event handler to the "keypress" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + keypress(handler: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "keypress" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + + /** + * Trigger the "keyup" event on an element. + */ + keyup(): ChaiJQuery; + /** + * Bind an event handler to the "keyup" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + keyup(handler: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "keyup" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): ChaiJQuery; + + /** + * Bind an event handler to the "load" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + load(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "load" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mousedown" event on an element. + */ + mousedown(): ChaiJQuery; + /** + * Bind an event handler to the "mousedown" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mousedown(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "mousedown" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mousedown(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mouseenter" event on an element. + */ + mouseenter(): ChaiJQuery; + /** + * Bind an event handler to be fired when the mouse enters an element. + * + * @param handler A function to execute when the event is triggered. + */ + mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to be fired when the mouse enters an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseenter(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mouseleave" event on an element. + */ + mouseleave(): ChaiJQuery; + /** + * Bind an event handler to be fired when the mouse leaves an element. + * + * @param handler A function to execute when the event is triggered. + */ + mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to be fired when the mouse leaves an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseleave(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mousemove" event on an element. + */ + mousemove(): ChaiJQuery; + /** + * Bind an event handler to the "mousemove" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mousemove(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "mousemove" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mousemove(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mouseout" event on an element. + */ + mouseout(): ChaiJQuery; + /** + * Bind an event handler to the "mouseout" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mouseout(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "mouseout" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseout(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mouseover" event on an element. + */ + mouseover(): ChaiJQuery; + /** + * Bind an event handler to the "mouseover" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mouseover(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "mouseover" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseover(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Trigger the "mouseup" event on an element. + */ + mouseup(): ChaiJQuery; + /** + * Bind an event handler to the "mouseup" JavaScript event. + * + * @param handler A function to execute when the event is triggered. + */ + mouseup(handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "mouseup" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + mouseup(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): ChaiJQuery; + + /** + * Remove an event handler. + */ + off(): ChaiJQuery; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". + * @param handler A handler function previously attached for the event(s), or the special value false. + */ + off(events: string, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Remove an event handler. + * + * @param events An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s). + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + */ + off(events: { [key: string]: any; }, selector?: string): ChaiJQuery; + + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). + */ + on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): ChaiJQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): ChaiJQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): ChaiJQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): ChaiJQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + on(events: { [key: string]: any; }, selector?: string, data?: any): ChaiJQuery; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + on(events: { [key: string]: any; }, data?: any): ChaiJQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute at the time the event is triggered. + */ + one(events: string, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. + * @param data An object containing data that will be passed to the event handler. + * @param handler A function to execute at the time the event is triggered. + */ + one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. + */ + one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + one(events: { [key: string]: any; }, selector?: string, data?: any): ChaiJQuery; + + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). + * @param data Data to be passed to the handler in event.data when an event occurs. + */ + one(events: { [key: string]: any; }, data?: any): ChaiJQuery; + + + /** + * Specify a function to execute when the DOM is fully loaded. + * + * @param handler A function to execute after the DOM is ready. + */ + ready(handler: Function): ChaiJQuery; + + /** + * Trigger the "resize" event on an element. + */ + resize(): ChaiJQuery; + /** + * Bind an event handler to the "resize" JavaScript event. + * + * @param handler A function to execute each time the event is triggered. + */ + resize(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "resize" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + resize(eventData: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "scroll" event on an element. + */ + scroll(): ChaiJQuery; + /** + * Bind an event handler to the "scroll" JavaScript event. + * + * @param handler A function to execute each time the event is triggered. + */ + scroll(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "scroll" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + scroll(eventData: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "select" event on an element. + */ + select(): ChaiJQuery; + /** + * Bind an event handler to the "select" JavaScript event. + * + * @param handler A function to execute each time the event is triggered. + */ + select(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "select" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + select(eventData: Object, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Trigger the "submit" event on an element. + */ + submit(): ChaiJQuery; + /** + * Bind an event handler to the "submit" JavaScript event + * + * @param handler A function to execute each time the event is triggered. + */ + submit(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "submit" JavaScript event + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + */ + submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(eventType: string, extraParameters?: any[]|Object): ChaiJQuery; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param event A jQuery.Event object. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(event: JQueryEventObject, extraParameters?: any[]|Object): ChaiJQuery; + + /** + * Execute all handlers attached to an element for an event. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters An array of additional parameters to pass along to the event handler. + */ + triggerHandler(eventType: string, ...extraParameters: any[]): Object; + + /** + * Remove a previously-attached event handler from the elements. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param handler The function that is to be no longer executed. + */ + unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Remove a previously-attached event handler from the elements. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). + */ + unbind(eventType: string, fls: boolean): ChaiJQuery; + /** + * Remove a previously-attached event handler from the elements. + * + * @param evt A JavaScript event object as passed to an event handler. + */ + unbind(evt: any): ChaiJQuery; + + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + */ + undelegate(): ChaiJQuery; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * + * @param selector A selector which will be used to filter the event results. + * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" + * @param handler A function to execute at the time the event is triggered. + */ + undelegate(selector: string, eventType: string, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * + * @param selector A selector which will be used to filter the event results. + * @param events An object of one or more event types and previously bound functions to unbind from them. + */ + undelegate(selector: string, events: Object): ChaiJQuery; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. + * + * @param namespace A string containing a namespace to unbind all events from. + */ + undelegate(namespace: string): ChaiJQuery; + + /** + * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) + * + * @param handler A function to execute when the event is triggered. + */ + unload(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) + * + * @param eventData A plain object of data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. (DEPRECATED from v1.10) + */ + context: Element; + + jquery: string; + + /** + * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) + * + * @param handler A function to execute when the event is triggered. + */ + error(handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + /** + * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) + * + * @param eventData A plain object of data that will be passed to the event handler. + * @param handler A function to execute when the event is triggered. + */ + error(eventData: any, handler: (eventObject: JQueryEventObject) => any): ChaiJQuery; + + /** + * Add a collection of DOM elements onto the jQuery stack. + * + * @param elements An array of elements to push onto the stack and make into a new jQuery object. + */ + pushStack(elements: any[]): ChaiJQuery; + /** + * Add a collection of DOM elements onto the jQuery stack. + * + * @param elements An array of elements to push onto the stack and make into a new jQuery object. + * @param name The name of a jQuery method that generated the array of elements. + * @param arguments The arguments that were passed in to the jQuery method (for serialization). + */ + pushStack(elements: any[], name: string, arguments: any[]): ChaiJQuery; + + /** + * Insert content, specified by the parameter, after each element in the set of matched elements. + * + * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. + */ + after(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): ChaiJQuery; + /** + * Insert content, specified by the parameter, after each element in the set of matched elements. + * + * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + after(func: (index: number, html: string) => string|Element|JQuery): ChaiJQuery; + + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * + * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. + */ + append(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): ChaiJQuery; + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * + * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. + */ + append(func: (index: number, html: string) => string|Element|JQuery): ChaiJQuery; + + /** + * Insert every element in the set of matched elements to the end of the target. + * + * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. + */ + appendTo(target: JQuery|any[]|Element|string): ChaiJQuery; + + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * + * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. + */ + before(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): ChaiJQuery; + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * + * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + before(func: (index: number, html: string) => string|Element|JQuery): ChaiJQuery; + + /** + * Create a deep copy of the set of matched elements. + * + * param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. + * param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false). + */ + clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): ChaiJQuery; + + /** + * Remove the set of matched elements from the DOM. + * + * param selector A selector expression that filters the set of matched elements to be removed. + */ + detach(selector?: string): ChaiJQuery; + + /** + * Remove all child nodes of the set of matched elements from the DOM. + */ + empty(): ChaiJQuery; + + /** + * Insert every element in the set of matched elements after the target. + * + * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. + */ + insertAfter(target: JQuery|any[]|Element|Text|string): ChaiJQuery; + + /** + * Insert every element in the set of matched elements before the target. + * + * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. + */ + insertBefore(target: JQuery|any[]|Element|Text|string): ChaiJQuery; + + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * + * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. + * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. + */ + prepend(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): ChaiJQuery; + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * + * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. + */ + prepend(func: (index: number, html: string) => string|Element|JQuery): ChaiJQuery; + + /** + * Insert every element in the set of matched elements to the beginning of the target. + * + * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. + */ + prependTo(target: JQuery|any[]|Element|string): ChaiJQuery; + + /** + * Remove the set of matched elements from the DOM. + * + * @param selector A selector expression that filters the set of matched elements to be removed. + */ + remove(selector?: string): ChaiJQuery; + + /** + * Replace each target element with the set of matched elements. + * + * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. + */ + replaceAll(target: JQuery|any[]|Element|string): ChaiJQuery; + + /** + * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. + * + * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. + */ + replaceWith(newContent: JQuery|any[]|Element|Text|string): ChaiJQuery; + /** + * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. + * + * param func A function that returns content with which to replace the set of matched elements. + */ + replaceWith(func: () => Element|JQuery): ChaiJQuery; + + /** + * Get the combined text contents of each element in the set of matched elements, including their descendants. + */ + text(): string; + /** + * Set the content of each element in the set of matched elements to the specified text. + * + * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. + */ + text(text: string|number|boolean): ChaiJQuery; + /** + * Set the content of each element in the set of matched elements to the specified text. + * + * @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments. + */ + text(func: (index: number, text: string) => string): ChaiJQuery; + + /** + * Retrieve all the elements contained in the jQuery set, as an array. + */ + toArray(): any[]; + + /** + * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. + */ + unwrap(): ChaiJQuery; + + /** + * Wrap an HTML structure around each element in the set of matched elements. + * + * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. + */ + wrap(wrappingElement: JQuery|Element|string): ChaiJQuery; + /** + * Wrap an HTML structure around each element in the set of matched elements. + * + * @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + wrap(func: (index: number) => string|JQuery): ChaiJQuery; + + /** + * Wrap an HTML structure around all elements in the set of matched elements. + * + * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. + */ + wrapAll(wrappingElement: JQuery|Element|string): ChaiJQuery; + wrapAll(func: (index: number) => string): ChaiJQuery; + + /** + * Wrap an HTML structure around the content of each element in the set of matched elements. + * + * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. + */ + wrapInner(wrappingElement: JQuery|Element|string): ChaiJQuery; + /** + * Wrap an HTML structure around the content of each element in the set of matched elements. + * + * @param func A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. + */ + wrapInner(func: (index: number) => string): ChaiJQuery; + + /** + * Iterate over a jQuery object, executing a function for each matched element. + * + * @param func A function to execute for each matched element. + */ + each(func: (index: number, elem: Element) => any): ChaiJQuery; + + /** + * Retrieve one of the elements matched by the jQuery object. + * + * @param index A zero-based integer indicating which element to retrieve. + */ + get(index: number): HTMLElement; + /** + * Retrieve the elements matched by the jQuery object. + */ + get(): any[]; + + /** + * Search for a given element from among the matched elements. + */ + index(): number; + /** + * Search for a given element from among the matched elements. + * + * @param selector A selector representing a jQuery collection in which to look for an element. + */ + index(selector: string|JQuery|Element): number; + + /** + * The number of elements in the jQuery object. + */ + length: number; + /** + * A selector representing selector passed to jQuery(), if any, when creating the original set. + * version deprecated: 1.7, removed: 1.9 + */ + selector: string; + [index: string]: any; + [index: number]: HTMLElement; + + /** + * Add elements to the set of matched elements. + * + * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. + * @param context The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method. + */ + add(selector: string, context?: Element): ChaiJQuery; + /** + * Add elements to the set of matched elements. + * + * @param elements One or more elements to add to the set of matched elements. + */ + add(...elements: Element[]): ChaiJQuery; + /** + * Add elements to the set of matched elements. + * + * @param html An HTML fragment to add to the set of matched elements. + */ + add(html: string): ChaiJQuery; + /** + * Add elements to the set of matched elements. + * + * @param obj An existing jQuery object to add to the set of matched elements. + */ + add(obj: JQuery): ChaiJQuery; + + /** + * Get the children of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + children(selector?: string): ChaiJQuery; + + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param selector A string containing a selector expression to match elements against. + */ + closest(selector: string): ChaiJQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param selector A string containing a selector expression to match elements against. + * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. + */ + closest(selector: string, context?: Element): ChaiJQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param obj A jQuery object to match elements against. + */ + closest(obj: JQuery): ChaiJQuery; + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * + * @param element An element to match elements against. + */ + closest(element: Element): ChaiJQuery; + + /** + * Get an array of all the elements and selectors matched against the current element up through the DOM tree. + * + * @param selectors An array or string containing a selector expression to match elements against (can also be a jQuery object). + * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. + */ + closest(selectors: any, context?: Element): any[]; + + /** + * Get the children of each element in the set of matched elements, including text and comment nodes. + */ + contents(): ChaiJQuery; + + /** + * End the most recent filtering operation in the current chain and return the set of matched elements to its previous state. + */ + end(): ChaiJQuery; + + /** + * Reduce the set of matched elements to the one at the specified index. + * + * @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set. + * + */ + eq(index: number): ChaiJQuery; + + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param selector A string containing a selector expression to match the current set of elements against. + */ + filter(selector: string): ChaiJQuery; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param func A function used as a test for each element in the set. this is the current DOM element. + */ + filter(func: (index: number, element: Element) => any): ChaiJQuery; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param element An element to match the current set of elements against. + */ + filter(element: Element): ChaiJQuery; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param obj An existing jQuery object to match the current set of elements against. + */ + filter(obj: JQuery): ChaiJQuery; + + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. + * + * @param selector A string containing a selector expression to match elements against. + */ + find(selector: string): ChaiJQuery; + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. + * + * @param element An element to match elements against. + */ + find(element: Element): ChaiJQuery; + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. + * + * @param obj A jQuery object to match elements against. + */ + find(obj: JQuery): ChaiJQuery; + + /** + * Reduce the set of matched elements to the first in the set. + */ + first(): ChaiJQuery; + + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param selector A string containing a selector expression to match elements against. + */ + has(selector: string): ChaiJQuery; + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param contained A DOM element to match elements against. + */ + has(contained: Element): ChaiJQuery; + + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param selector A string containing a selector expression to match elements against. + */ + is(selector: string): boolean; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param func A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element. + */ + is(func: (index: number, element: Element) => boolean): boolean; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param obj An existing jQuery object to match the current set of elements against. + */ + is(obj: JQuery): boolean; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. + * + * @param elements One or more elements to match the current set of elements against. + */ + is(elements: any): boolean; + + /** + * Reduce the set of matched elements to the final one in the set. + */ + last(): ChaiJQuery; + + /** + * Pass each element in the current matched set through a function, producing a new jQuery object containing the return values. + * + * @param callback A function object that will be invoked for each element in the current set. + */ + map(callback: (index: number, domElement: Element) => any): ChaiJQuery; + + /** + * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + next(selector?: string): ChaiJQuery; + + /** + * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + nextAll(selector?: string): ChaiJQuery; + + /** + * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. + * + * @param selector A string containing a selector expression to indicate where to stop matching following sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + nextUntil(selector?: string, filter?: string): ChaiJQuery; + /** + * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. + * + * @param element A DOM node or jQuery object indicating where to stop matching following sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + nextUntil(element?: Element, filter?: string): ChaiJQuery; + /** + * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. + * + * @param obj A DOM node or jQuery object indicating where to stop matching following sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + nextUntil(obj?: JQuery, filter?: string): ChaiJQuery; + + /** + * Remove elements from the set of matched elements. + * + * @param selector A string containing a selector expression to match elements against. + */ + not(selector: string): ChaiJQuery; + /** + * Remove elements from the set of matched elements. + * + * @param func A function used as a test for each element in the set. this is the current DOM element. + */ + not(func: (index: number, element: Element) => boolean): ChaiJQuery; + /** + * Remove elements from the set of matched elements. + * + * @param elements One or more DOM elements to remove from the matched set. + */ + not(...elements: Element[]): ChaiJQuery; + /** + * Remove elements from the set of matched elements. + * + * @param obj An existing jQuery object to match the current set of elements against. + */ + not(obj: JQuery): ChaiJQuery; + + /** + * Get the closest ancestor element that is positioned. + */ + offsetParent(): ChaiJQuery; + + /** + * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + parent(selector?: string): ChaiJQuery; + + /** + * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + parents(selector?: string): ChaiJQuery; + + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param selector A string containing a selector expression to indicate where to stop matching ancestor elements. + * @param filter A string containing a selector expression to match elements against. + */ + parentsUntil(selector?: string, filter?: string): ChaiJQuery; + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param element A DOM node or jQuery object indicating where to stop matching ancestor elements. + * @param filter A string containing a selector expression to match elements against. + */ + parentsUntil(element?: Element, filter?: string): ChaiJQuery; + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param obj A DOM node or jQuery object indicating where to stop matching ancestor elements. + * @param filter A string containing a selector expression to match elements against. + */ + parentsUntil(obj?: JQuery, filter?: string): ChaiJQuery; + + /** + * Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + prev(selector?: string): ChaiJQuery; + + /** + * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + prevAll(selector?: string): ChaiJQuery; + + /** + * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + prevUntil(selector?: string, filter?: string): ChaiJQuery; + /** + * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param element A DOM node or jQuery object indicating where to stop matching preceding sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + prevUntil(element?: Element, filter?: string): ChaiJQuery; + /** + * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. + * + * @param obj A DOM node or jQuery object indicating where to stop matching preceding sibling elements. + * @param filter A string containing a selector expression to match elements against. + */ + prevUntil(obj?: JQuery, filter?: string): ChaiJQuery; + + /** + * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + */ + siblings(selector?: string): ChaiJQuery; + + /** + * Reduce the set of matched elements to a subset specified by a range of indices. + * + * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set. + * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. + */ + slice(start: number, end?: number): ChaiJQuery; + + /** + * Show the queue of functions to be executed on the matched elements. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + */ + queue(queueName?: string): any[]; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param newQueue An array of functions to replace the current queue contents. + */ + queue(newQueue: Function[]): ChaiJQuery; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. + */ + queue(callback: Function): ChaiJQuery; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param newQueue An array of functions to replace the current queue contents. + */ + queue(queueName: string, newQueue: Function[]): ChaiJQuery; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. + */ + queue(queueName: string, callback: Function): ChaiJQuery; + should: Chai.Assertion; +} diff --git a/chai/chai-tests.ts b/chai/chai-tests.ts index ddaa84ee2..c3f6fe06a 100644 --- a/chai/chai-tests.ts +++ b/chai/chai-tests.ts @@ -1,4 +1,7 @@ /// +import chai = require('chai'); + +// ReSharper disable WrongExpressionStatement var expect = chai.expect; var assert = chai.assert; @@ -13,6 +16,7 @@ function assertion() { expect('foo').to.equal('foo'); } +// ReSharper disable once InconsistentNaming function _true() { expect(true).to.be.true; expect(false).to.not.be.true; @@ -20,7 +24,7 @@ function _true() { err(() => { expect('test').to.be.true; - }, "expected 'test' to be true") + }, 'expected \'test\' to be true'); } function ok() { @@ -31,11 +35,11 @@ function ok() { err(() => { expect('').to.be.ok; - }, "expected '' to be truthy"); + }, 'expected \'\' to be truthy'); err(() => { expect('test').to.not.be.ok; - }, "expected 'test' to be falsy"); + }, 'expected \'test\' to be falsy'); } function _false() { @@ -45,7 +49,7 @@ function _false() { err(() => { expect('').to.be.false; - }, "expected '' to be false") + }, 'expected \'\' to be false'); } function _null() { @@ -54,7 +58,7 @@ function _null() { err(() => { expect('').to.be.null; - }, "expected '' to be null") + }, 'expected \'\' to be null'); } function _undefined() { @@ -63,14 +67,13 @@ function _undefined() { err(() => { expect('').to.be.undefined; - }, "expected '' to be undefined") + }, 'expected \'\' to be undefined'); } function exist() { - var foo = 'bar' - , bar; + var foo = 'bar'; expect(foo).to.exist; - expect(bar).to.not.exist; + expect(void(0)).to.not.exist; } function arguments() { @@ -82,8 +85,7 @@ function arguments() { } function equal() { - var foo; - expect(undefined).to.equal(foo); + expect(undefined).to.equal(void(0)); } function _typeof() { @@ -91,7 +93,7 @@ function _typeof() { err(() => { expect('test').to.not.be.a('string'); - }, "expected 'test' not to be a string"); + }, 'expected \'test\' not to be a string'); expect(arguments).to.be.an('arguments'); @@ -103,24 +105,24 @@ function _typeof() { expect(new Object()).to.be.a('object'); expect({}).to.be.a('object'); expect([]).to.be.a('array'); - expect(function () { }).to.be.a('function'); + expect(() => { }).to.be.a('function'); expect(null).to.be.a('null'); err(() => { expect(5).to.not.be.a('number', 'blah'); - }, "blah: expected 5 not to be a number"); + }, 'blah: expected 5 not to be a number'); } +class Foo { } function _instanceof() { - function Foo() { } expect(new Foo()).to.be.an.instanceof(Foo); err(() => { expect(3).to.an.instanceof(Foo, 'blah'); - }, "blah: expected 3 to be an instance of Foo"); + }, 'blah: expected 3 to be an instance of Foo'); } -function within(start, finish) { +function within() { expect(5).to.be.within(5, 10); expect(5).to.be.within(3, 6); expect(5).to.be.within(3, 5); @@ -130,22 +132,22 @@ function within(start, finish) { err(() => { expect(5).to.not.be.within(4, 6, 'blah'); - }, "blah: expected 5 to not be within 4..6", 'blah'); + }, 'blah: expected 5 to not be within 4..6', 'blah'); err(() => { expect(10).to.be.within(50, 100, 'blah'); - }, "blah: expected 10 to be within 50..100"); + }, 'blah: expected 10 to be within 50..100'); err(() => { expect('foo').to.have.length.within(5, 7, 'blah'); - }, "blah: expected \'foo\' to have a length within 5..7"); + }, 'blah: expected \'foo\' to have a length within 5..7'); err(() => { expect([1, 2, 3]).to.have.length.within(5, 7, 'blah'); - }, "blah: expected [ 1, 2, 3 ] to have a length within 5..7"); + }, 'blah: expected [ 1, 2, 3 ] to have a length within 5..7'); } -function above(n) { +function above() { expect(5).to.be.above(2); expect(5).to.be.greaterThan(2); expect(5).to.not.be.above(5); @@ -155,22 +157,22 @@ function above(n) { err(() => { expect(5).to.be.above(6, 'blah'); - }, "blah: expected 5 to be above 6", 'blah'); + }, 'blah: expected 5 to be above 6', 'blah'); err(() => { expect(10).to.not.be.above(6, 'blah'); - }, "blah: expected 10 to be at most 6"); + }, 'blah: expected 10 to be at most 6'); err(() => { expect('foo').to.have.length.above(4, 'blah'); - }, "blah: expected \'foo\' to have a length above 4 but got 3"); + }, 'blah: expected \'foo\' to have a length above 4 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.above(4, 'blah'); - }, "blah: expected [ 1, 2, 3 ] to have a length above 4 but got 3"); + }, 'blah: expected [ 1, 2, 3 ] to have a length above 4 but got 3'); } -function least(n) { +function least() { expect(5).to.be.at.least(2); expect(5).to.be.at.least(5); expect(5).to.not.be.at.least(6); @@ -179,26 +181,26 @@ function least(n) { err(() => { expect(5).to.be.at.least(6, 'blah'); - }, "blah: expected 5 to be at least 6", 'blah'); + }, 'blah: expected 5 to be at least 6', 'blah'); err(() => { expect(10).to.not.be.at.least(6, 'blah'); - }, "blah: expected 10 to be below 6"); + }, 'blah: expected 10 to be below 6'); err(() => { expect('foo').to.have.length.of.at.least(4, 'blah'); - }, "blah: expected \'foo\' to have a length at least 4 but got 3"); + }, 'blah: expected \'foo\' to have a length at least 4 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.of.at.least(4, 'blah'); - }, "blah: expected [ 1, 2, 3 ] to have a length at least 4 but got 3"); + }, 'blah: expected [ 1, 2, 3 ] to have a length at least 4 but got 3'); err(() => { expect([1, 2, 3, 4]).to.not.have.length.of.at.least(4, 'blah'); - }, "blah: expected [ 1, 2, 3, 4 ] to have a length below 4"); + }, 'blah: expected [ 1, 2, 3, 4 ] to have a length below 4'); } -function below(n) { +function below() { expect(2).to.be.below(5); expect(2).to.be.lessThan(5); expect(2).to.not.be.below(2); @@ -208,22 +210,22 @@ function below(n) { err(() => { expect(6).to.be.below(5, 'blah'); - }, "blah: expected 6 to be below 5"); + }, 'blah: expected 6 to be below 5'); err(() => { expect(6).to.not.be.below(10, 'blah'); - }, "blah: expected 6 to be at least 10"); + }, 'blah: expected 6 to be at least 10'); err(() => { expect('foo').to.have.length.below(2, 'blah'); - }, "blah: expected \'foo\' to have a length below 2 but got 3"); + }, 'blah: expected \'foo\' to have a length below 2 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.below(2, 'blah'); - }, "blah: expected [ 1, 2, 3 ] to have a length below 2 but got 3"); + }, 'blah: expected [ 1, 2, 3 ] to have a length below 2 but got 3'); } -function most(n) { +function most() { expect(2).to.be.at.most(5); expect(2).to.be.at.most(2); expect(2).to.not.be.at.most(1); @@ -233,39 +235,39 @@ function most(n) { err(() => { expect(6).to.be.at.most(5, 'blah'); - }, "blah: expected 6 to be at most 5"); + }, 'blah: expected 6 to be at most 5'); err(() => { expect(6).to.not.be.at.most(10, 'blah'); - }, "blah: expected 6 to be above 10"); + }, 'blah: expected 6 to be above 10'); err(() => { expect('foo').to.have.length.of.at.most(2, 'blah'); - }, "blah: expected \'foo\' to have a length at most 2 but got 3"); + }, 'blah: expected \'foo\' to have a length at most 2 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.of.at.most(2, 'blah'); - }, "blah: expected [ 1, 2, 3 ] to have a length at most 2 but got 3"); + }, 'blah: expected [ 1, 2, 3 ] to have a length at most 2 but got 3'); err(() => { expect([1, 2]).to.not.have.length.of.at.most(2, 'blah'); - }, "blah: expected [ 1, 2 ] to have a length above 2"); + }, 'blah: expected [ 1, 2 ] to have a length above 2'); } -function match(regexp) { +function match() { expect('foobar').to.match(/^foo/); expect('foobar').to.not.match(/^bar/); err(() => { - expect('foobar').to.match(/^bar/i, 'blah') -}, "blah: expected 'foobar' to match /^bar/i"); + expect('foobar').to.match(/^bar/i, 'blah'); + }, 'blah: expected \'foobar\' to match /^bar/i'); err(() => { - expect('foobar').to.not.match(/^foo/i, 'blah') -}, "blah: expected 'foobar' not to match /^foo/i"); + expect('foobar').to.not.match(/^foo/i, 'blah'); + }, 'blah: expected \'foobar\' not to match /^foo/i'); } -function length2(n) { +function length2() { expect('test').to.have.length(4); expect('test').to.not.have.length(3); expect([1, 2, 3]).to.have.length(3); @@ -276,10 +278,10 @@ function length2(n) { err(() => { expect('asd').to.not.have.length(3, 'blah'); - }, "blah: expected 'asd' to not have a length of 3"); + }, 'blah: expected \'asd\' to not have a length of 3'); } -function eql(val) { +function eql() { expect('test').to.eql('test'); expect({ foo: 'bar' }).to.eql({ foo: 'bar' }); expect(1).to.eql(1); @@ -290,8 +292,11 @@ function eql(val) { }, 'blah: expected 4 to deeply equal 3'); } +class Buffer { + constructor(arr: number[]) { + } +} function buffer() { - var Buffer; expect(new Buffer([1])).to.eql(new Buffer([1])); err(() => { @@ -299,7 +304,7 @@ function buffer() { }, 'expected to deeply equal '); } -function equal2(val) { +function equal2() { expect('test').to.equal('test'); expect(1).to.equal(1); @@ -309,10 +314,10 @@ function equal2(val) { err(() => { expect('4').to.equal(4, 'blah'); - }, "blah: expected '4' to equal 4"); + }, 'blah: expected \'4\' to equal 4'); } -function deepEqual(val) { +function deepEqual() { expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' }); expect({ foo: 'bar' }).not.to.deep.equal({ foo: 'baz' }); } @@ -329,21 +334,25 @@ function deepEqual2() { expect(/a/m).not.to.deep.equal(/b/m); } -function deepEqual3(Date) { - var a = new Date(1, 2, 3) - , b = new Date(4, 5, 6); +// ReSharper disable once InconsistentNaming +function deepEqual3() { + var a = new Date(1, 2, 3); + var b = new Date(4, 5, 6); expect(a).to.deep.equal(a); expect(a).not.to.deep.equal(b); expect(a).not.to.deep.equal({}); } -function deepInclude(val) { +function deepInclude() { expect(['foo', 'bar']).to.deep.include(['bar', 'foo']); expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz' ]); } +class FakeArgs { + length: number; +} + function empty() { - function FakeArgs() { }; FakeArgs.prototype.length = 0; expect('').to.be.empty; @@ -357,38 +366,38 @@ function empty() { err(() => { expect('').not.to.be.empty; - }, "expected \'\' not to be empty"); + }, 'expected \'\' not to be empty'); err(() => { expect('foo').to.be.empty; - }, "expected \'foo\' to be empty"); + }, 'expected \'foo\' to be empty'); err(() => { expect([]).not.to.be.empty; - }, "expected [] not to be empty"); + }, 'expected [] not to be empty'); err(() => { expect(['foo']).to.be.empty; - }, "expected [ \'foo\' ] to be empty"); + }, 'expected [ \'foo\' ] to be empty'); err(() => { expect(new FakeArgs).not.to.be.empty; - }, "expected { length: 0 } not to be empty"); + }, 'expected { length: 0 } not to be empty'); err(() => { expect({ arguments: 0 }).to.be.empty; - }, "expected { arguments: 0 } to be empty"); + }, 'expected { arguments: 0 } to be empty'); err(() => { expect({}).not.to.be.empty; - }, "expected {} not to be empty"); + }, 'expected {} not to be empty'); err(() => { expect({ foo: 'bar' }).to.be.empty; - }, "expected { foo: \'bar\' } to be empty"); + }, 'expected { foo: \'bar\' } to be empty'); } -function property(name) { +function property() { expect('test').to.have.property('length'); expect(4).to.not.have.property('length'); @@ -399,14 +408,14 @@ function property(name) { err(() => { expect('asd').to.have.property('foo'); - }, "expected 'asd' to have a property 'foo'"); + }, 'expected \'asd\' to have a property \'foo\''); err(() => { expect({ foo: { bar: 'baz' } }) .to.have.property('foo.bar'); - }, "expected { foo: { bar: 'baz' } } to have a property 'foo.bar'"); + }, 'expected { foo: { bar: \'baz\' } } to have a property \'foo.bar\''); } -function deepProperty(name) { +function deepProperty() { expect({ 'foo.bar': 'baz' }) .to.not.have.deep.property('foo.bar'); expect({ foo: { bar: 'baz' } }) @@ -415,56 +424,56 @@ function deepProperty(name) { err(() => { expect({ 'foo.bar': 'baz' }) .to.have.deep.property('foo.bar'); - }, "expected { 'foo.bar': 'baz' } to have a deep property 'foo.bar'"); + }, 'expected { \'foo.bar\': \'baz\' } to have a deep property \'foo.bar\''); } -function property2(name, val) { +function property2() { expect('test').to.have.property('length', 4); expect('asd').to.have.property('constructor', String); err(() => { expect('asd').to.have.property('length', 4, 'blah'); - }, "blah: expected 'asd' to have a property 'length' of 4, but got 3"); + }, 'blah: expected \'asd\' to have a property \'length\' of 4, but got 3'); err(() => { expect('asd').to.not.have.property('length', 3, 'blah'); - }, "blah: expected 'asd' to not have a property 'length' of 3"); + }, 'blah: expected \'asd\' to not have a property \'length\' of 3'); err(() => { expect('asd').to.not.have.property('foo', 3, 'blah'); - }, "blah: 'asd' has no property 'foo'"); + }, 'blah: \'asd\' has no property \'foo\''); err(() => { expect('asd').to.have.property('constructor', Number, 'blah'); - }, "blah: expected 'asd' to have a property 'constructor' of [Function: Number], but got [Function: String]"); + }, 'blah: expected \'asd\' to have a property \'constructor\' of [Function: Number], but got [Function: String]'); } -function deepProperty2(name, val) { +function deepProperty2() { expect({ foo: { bar: 'baz' } }) .to.have.deep.property('foo.bar', 'baz'); err(() => { expect({ foo: { bar: 'baz' } }) .to.have.deep.property('foo.bar', 'quux', 'blah'); - }, "blah: expected { foo: { bar: 'baz' } } to have a deep property 'foo.bar' of 'quux', but got 'baz'"); + }, 'blah: expected { foo: { bar: \'baz\' } } to have a deep property \'foo.bar\' of \'quux\', but got \'baz\''); err(() => { expect({ foo: { bar: 'baz' } }) .to.not.have.deep.property('foo.bar', 'baz', 'blah'); - }, "blah: expected { foo: { bar: 'baz' } } to not have a deep property 'foo.bar' of 'baz'"); + }, 'blah: expected { foo: { bar: \'baz\' } } to not have a deep property \'foo.bar\' of \'baz\''); err(() => { expect({ foo: 5 }) .to.not.have.deep.property('foo.bar', 'baz', 'blah'); - }, "blah: { foo: 5 } has no deep property 'foo.bar'"); + }, 'blah: { foo: 5 } has no deep property \'foo.bar\''); } -function ownProperty(name) { +function ownProperty() { expect('test').to.have.ownProperty('length'); expect('test').to.haveOwnProperty('length'); expect({ length: 12 }).to.have.ownProperty('length'); err(() => { expect({ length: 12 }).to.not.have.ownProperty('length', 'blah'); - }, "blah: expected { length: 12 } to not have own property 'length'"); + }, 'blah: expected { length: 12 } to not have own property \'length\''); } function string() { @@ -474,15 +483,15 @@ function string() { err(() => { expect(3).to.have.string('baz'); - }, "expected 3 to be a string"); + }, 'expected 3 to be a string'); err(() => { expect('foobar').to.have.string('baz', 'blah'); - }, "blah: expected 'foobar' to contain 'baz'"); + }, 'blah: expected \'foobar\' to contain \'baz\''); err(() => { expect('foobar').to.not.have.string('bar', 'blah'); - }, "blah: expected 'foobar' to not contain 'bar'"); + }, 'blah: expected \'foobar\' to not contain \'bar\''); } function include() { @@ -495,14 +504,14 @@ function include() { err(() => { expect(['foo']).to.include('bar', 'blah'); - }, "blah: expected [ 'foo' ] to include 'bar'"); + }, 'blah: expected [ \'foo\' ] to include \'bar\''); err(() => { expect(['bar', 'foo']).to.not.include('foo', 'blah'); - }, "blah: expected [ 'bar', 'foo' ] to not include 'foo'"); + }, 'blah: expected [ \'bar\', \'foo\' ] to not include \'foo\''); } -function keys(array) { +function keys() { expect({ foo: 1 }).to.have.keys(['foo']); expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']); expect({ foo: 1, bar: 2 }).to.have.keys('foo', 'bar'); @@ -524,51 +533,51 @@ function keys(array) { err(() => { expect({ foo: 1 }).to.have.keys(); - }, "keys required"); + }, 'keys required'); err(() => { expect({ foo: 1 }).to.have.keys([]); - }, "keys required"); + }, 'keys required'); err(() => { expect({ foo: 1 }).to.not.have.keys([]); - }, "keys required"); + }, 'keys required'); err(() => { expect({ foo: 1 }).to.contain.keys([]); - }, "keys required"); + }, 'keys required'); err(() => { expect({ foo: 1 }).to.have.keys(['bar']); - }, "expected { foo: 1 } to have key 'bar'"); + }, 'expected { foo: 1 } to have key \'bar\''); err(() => { expect({ foo: 1 }).to.have.keys(['bar', 'baz']); - }, "expected { foo: 1 } to have keys 'bar', and 'baz'"); + }, 'expected { foo: 1 } to have keys \'bar\', and \'baz\''); err(() => { expect({ foo: 1 }).to.have.keys(['foo', 'bar', 'baz']); - }, "expected { foo: 1 } to have keys 'foo', 'bar', and 'baz'"); + }, 'expected { foo: 1 } to have keys \'foo\', \'bar\', and \'baz\''); err(() => { expect({ foo: 1 }).to.not.have.keys(['foo']); - }, "expected { foo: 1 } to not have key 'foo'"); + }, 'expected { foo: 1 } to not have key \'foo\''); err(() => { expect({ foo: 1 }).to.not.have.keys(['foo']); - }, "expected { foo: 1 } to not have key 'foo'"); + }, 'expected { foo: 1 } to not have key \'foo\''); err(() => { expect({ foo: 1, bar: 2 }).to.not.have.keys(['foo', 'bar']); - }, "expected { foo: 1, bar: 2 } to not have keys 'foo', and 'bar'"); + }, 'expected { foo: 1, bar: 2 } to not have keys \'foo\', and \'bar\''); err(() => { expect({ foo: 1 }).to.not.contain.keys(['foo']); - }, "expected { foo: 1 } to not contain key 'foo'"); + }, 'expected { foo: 1 } to not contain key \'foo\''); err(() => { expect({ foo: 1 }).to.contain.keys('foo', 'bar'); - }, "expected { foo: 1 } to contain keys 'foo', and 'bar'"); + }, 'expected { foo: 1 } to contain keys \'foo\', and \'bar\''); } function chaining() { @@ -577,23 +586,21 @@ function chaining() { err(() => { expect(tea).to.have.property('extras').with.lengthOf(4); - }, "expected [ 'milk', 'sugar', 'smile' ] to have a length of 4 but got 3"); + }, 'expected [ \'milk\', \'sugar\', \'smile\' ] to have a length of 4 but got 3'); expect(tea).to.be.a('object').and.have.property('name', 'chai'); } +class PoorlyConstructedError {} function _throw() { // See GH-45: some poorly-constructed custom errors don't have useful names // on either their constructor or their constructor prototype, but instead // only set the name inside the constructor itself. - var PoorlyConstructedError = () => { - this.name = 'PoorlyConstructedError'; - }; PoorlyConstructedError.prototype = Object.create(Error.prototype); var specificError = new RangeError('boo'); - var goodFn = () => { 1 == 1; } + var goodFn = () => { } , badFn = () => { throw new Error('testing'); } , refErrFn = () => { throw new ReferenceError('hello'); } , ickyErrFn = () => { throw new PoorlyConstructedError(); } @@ -627,39 +634,39 @@ function _throw() { err(() => { expect(goodFn).to.throw(); - }, "expected [Function] to throw an error"); + }, 'expected [Function] to throw an error'); err(() => { expect(goodFn).to.throw(ReferenceError); - }, "expected [Function] to throw ReferenceError"); + }, 'expected [Function] to throw ReferenceError'); err(() => { expect(goodFn).to.throw(specificError); - }, "expected [Function] to throw [RangeError: boo]"); + }, 'expected [Function] to throw [RangeError: boo]'); err(() => { expect(badFn).to.not.throw(); - }, "expected [Function] to not throw an error but [Error: testing] was thrown"); + }, 'expected [Function] to not throw an error but [Error: testing] was thrown'); err(() => { expect(badFn).to.throw(ReferenceError); - }, "expected [Function] to throw 'ReferenceError' but [Error: testing] was thrown"); + }, 'expected [Function] to throw \'ReferenceError\' but [Error: testing] was thrown'); err(() => { expect(badFn).to.throw(specificError); - }, "expected [Function] to throw [RangeError: boo] but [Error: testing] was thrown"); + }, 'expected [Function] to throw [RangeError: boo] but [Error: testing] was thrown'); err(() => { expect(badFn).to.not.throw(Error); - }, "expected [Function] to not throw 'Error' but [Error: testing] was thrown"); + }, 'expected [Function] to not throw \'Error\' but [Error: testing] was thrown'); err(() => { expect(refErrFn).to.not.throw(ReferenceError); - }, "expected [Function] to not throw 'ReferenceError' but [ReferenceError: hello] was thrown"); + }, 'expected [Function] to not throw \'ReferenceError\' but [ReferenceError: hello] was thrown'); err(() => { expect(badFn).to.throw(PoorlyConstructedError); - }, "expected [Function] to throw 'PoorlyConstructedError' but [Error: testing] was thrown"); + }, 'expected [Function] to throw \'PoorlyConstructedError\' but [Error: testing] was thrown'); err(() => { expect(ickyErrFn).to.not.throw(PoorlyConstructedError); @@ -671,37 +678,37 @@ function _throw() { err(() => { expect(specificErrFn).to.throw(new ReferenceError('eek')); - }, "expected [Function] to throw [ReferenceError: eek] but [RangeError: boo] was thrown"); + }, 'expected [Function] to throw [ReferenceError: eek] but [RangeError: boo] was thrown'); err(() => { expect(specificErrFn).to.not.throw(specificError); - }, "expected [Function] to not throw [RangeError: boo]"); + }, 'expected [Function] to not throw [RangeError: boo]'); err(() => { expect(badFn).to.not.throw(/testing/); - }, "expected [Function] to throw error not matching /testing/"); + }, 'expected [Function] to throw error not matching /testing/'); err(() => { expect(badFn).to.throw(/hello/); - }, "expected [Function] to throw error matching /hello/ but got 'testing'"); + }, 'expected [Function] to throw error matching /hello/ but got \'testing\''); err(() => { expect(badFn).to.throw(Error, /hello/, 'blah'); - }, "blah: expected [Function] to throw error matching /hello/ but got 'testing'"); + }, 'blah: expected [Function] to throw error matching /hello/ but got \'testing\''); err(() => { expect(badFn).to.throw(Error, 'hello', 'blah'); - }, "blah: expected [Function] to throw error including 'hello' but got 'testing'"); + }, 'blah: expected [Function] to throw error including \'hello\' but got \'testing\''); } function use(){ - chai.use(function (_chai, utils) { + // ReSharper disable once InconsistentNaming + chai.use((_chai) => { _chai.can.use.any(); }); } function respondTo() { - function Foo() {}; var bar = {}; expect(Foo).to.respondTo('bar'); @@ -721,15 +728,15 @@ function respondTo() { } function satisfy() { - function matcher(num) { + function matcher(num: number) { return num === 1; - }; + } expect(1).to.satisfy(matcher); err(() => { expect(2).to.satisfy(matcher, 'blah'); - }, "blah: expected 2 to satisfy [Function: matcher]"); + }, 'blah: expected 2 to satisfy [Function: matcher]'); } function closeTo() { @@ -739,11 +746,11 @@ function closeTo() { err(() => { expect(2).to.be.closeTo(1.0, 0.5, 'blah'); - }, "blah: expected 2 to be close to 1 +/- 0.5"); + }, 'blah: expected 2 to be close to 1 +/- 0.5'); err(() => { expect(-10).to.be.closeTo(20, 29, 'blah'); - }, "blah: expected -10 to be close to 20 +/- 29"); + }, 'blah: expected -10 to be close to 20 +/- 29'); } function includeMembers() { @@ -779,617 +786,611 @@ declare function suite(description: string, action: Function):void; declare function test(description: string, action: Function):void; interface FieldObj { - field: any; -} -class Foo { - constructor() { - - } + field: any; } class CrashyObject { - inspect (): void { - throw new Error("Arg's inspect() called even though the test passed"); - } + inspect (): void { + throw new Error('Arg\'s inspect() called even though the test passed'); + } } -suite('assert', function () { +suite('assert', () => { - test('assert', function () { - var foo = 'bar'; - assert(foo == 'bar', "expected foo to equal `bar`"); + test('assert', () => { + var foo = 'bar'; + assert(foo === 'bar', 'expected foo to equal `bar`'); - err(function () { - assert(foo == 'baz', "expected foo to equal `bar`"); - }, "expected foo to equal `bar`"); - }); + err(() => { + assert(foo === 'baz', 'expected foo to equal `bar`'); + }, 'expected foo to equal `bar`'); + }); - test('isTrue', function () { - assert.isTrue(true); - - err(function () { - assert.isTrue(false); - }, "expected false to be true"); + test('isTrue', () => { + assert.isTrue(true); - err(function () { - assert.isTrue(1); - }, "expected 1 to be true"); - - err(function () { - assert.isTrue('test'); - }, "expected 'test' to be true"); - }); + err(() => { + assert.isTrue(false); + }, 'expected false to be true'); - test('ok', function () { - assert.ok(true); - assert.ok(1); - assert.ok('test'); - - err(function () { - assert.ok(false); - }, "expected false to be truthy"); - - err(function () { - assert.ok(0); - }, "expected 0 to be truthy"); - - err(function () { - assert.ok(''); - }, "expected '' to be truthy"); - }); - - test('isFalse', function () { - assert.isFalse(false); - - err(function () { - assert.isFalse(true); - }, "expected true to be false"); - - err(function () { - assert.isFalse(0); - }, "expected 0 to be false"); - }); + err(() => { + assert.isTrue(1); + }, 'expected 1 to be true'); - test('equal', function () { - var foo: any; - assert.equal(foo, undefined); - }); + err(() => { + assert.isTrue('test'); + }, 'expected \'test\' to be true'); + }); - test('typeof / notTypeOf', function () { - assert.typeOf('test', 'string'); - assert.typeOf(true, 'boolean'); - assert.typeOf(5, 'number'); + test('ok', () => { + assert.ok(true); + assert.ok(1); + assert.ok('test'); + + err(() => { + assert.ok(false); + }, 'expected false to be truthy'); + + err(() => { + assert.ok(0); + }, 'expected 0 to be truthy'); + + err(() => { + assert.ok(''); + }, 'expected \'\' to be truthy'); + }); + + test('isFalse', () => { + assert.isFalse(false); + + err(() => { + assert.isFalse(true); + }, 'expected true to be false'); + + err(() => { + assert.isFalse(0); + }, 'expected 0 to be false'); + }); - err(function () { - assert.typeOf(5, 'string'); - }, "expected 5 to be a string"); + test('equal', () => { + assert.equal(void(0), undefined); + }); - }); + test('typeof / notTypeOf', () => { + assert.typeOf('test', 'string'); + assert.typeOf(true, 'boolean'); + assert.typeOf(5, 'number'); - test('notTypeOf', function () { - assert.notTypeOf('test', 'number'); - - err(function () { - assert.notTypeOf(5, 'number'); - }, "expected 5 not to be a number"); - }); + err(() => { + assert.typeOf(5, 'string'); + }, 'expected 5 to be a string'); - test('instanceOf', function () { - assert.instanceOf(new Foo(), Foo); - - err(function () { - assert.instanceOf(5, Foo); - }, "expected 5 to be an instance of Foo"); - assert.instanceOf(new CrashyObject(), CrashyObject); - }); - - test('notInstanceOf', function () { - assert.notInstanceOf(new Foo(), String); - - err(function () { - assert.notInstanceOf(new Foo(), Foo); - }, "expected {} to not be an instance of Foo"); - }); - - test('isObject', function () { - assert.isObject({}); - assert.isObject(new Foo()); - - err(function () { - assert.isObject(true); - }, "expected true to be an object"); - - err(function () { - assert.isObject(Foo); - }, "expected [Function: Foo] to be an object"); - - err(function () { - assert.isObject('foo'); - }, "expected 'foo' to be an object"); - }); - - test('isNotObject', function () { - assert.isNotObject(5); - - err(function () { - assert.isNotObject({}); - }, "expected {} not to be an object"); - }); - - test('notEqual', function () { - assert.notEqual(3, 4); - - err(function () { - assert.notEqual(5, 5); - }, "expected 5 to not equal 5"); - }); - - test('strictEqual', function () { - assert.strictEqual('foo', 'foo'); - - err(function () { - assert.strictEqual('5', 5); - }, "expected \'5\' to equal 5"); - }); - - test('notStrictEqual', function () { - assert.notStrictEqual(5, '5'); - - err(function () { - assert.notStrictEqual(5, 5); - }, "expected 5 to not equal 5"); - }); - - test('deepEqual', function () { - assert.deepEqual({tea: 'chai'}, {tea: 'chai'}); - - err(function () { - assert.deepEqual({tea: 'chai'}, {tea: 'black'}); - }, "expected { tea: \'chai\' } to deeply equal { tea: \'black\' }"); - - var obja = Object.create({ tea: 'chai' }) - , objb = Object.create({ tea: 'chai' }); - - assert.deepEqual(obja, objb); - - var obj1 = Object.create({tea: 'chai'}) - , obj2 = Object.create({tea: 'black'}); - - err(function () { - assert.deepEqual(obj1, obj2); - }, "expected { tea: \'chai\' } to deeply equal { tea: \'black\' }"); - }); - - test('deepEqual (ordering)', function () { - var a = { a: 'b', c: 'd' } - , b = { c: 'd', a: 'b' }; - assert.deepEqual(a, b); - }); - - test('deepEqual (circular)', function () { - var circularObject:any = {} - , secondCircularObject:any = {}; - circularObject.field = circularObject; - secondCircularObject.field = secondCircularObject; - - assert.deepEqual(circularObject, secondCircularObject); - - err(function () { - secondCircularObject.field2 = secondCircularObject; - assert.deepEqual(circularObject, secondCircularObject); - }, "expected { field: [Circular] } to deeply equal { Object (field, field2) }"); - }); - - test('notDeepEqual', function () { - assert.notDeepEqual({tea: 'jasmine'}, {tea: 'chai'}); - err(function () { - assert.notDeepEqual({tea: 'chai'}, {tea: 'chai'}); - }, "expected { tea: \'chai\' } to not deeply equal { tea: \'chai\' }"); - }); - - test('notDeepEqual (circular)', function () { - var circularObject:any = {} - , secondCircularObject:any = { tea: 'jasmine' }; - circularObject.field = circularObject; - secondCircularObject.field = secondCircularObject; - - assert.notDeepEqual(circularObject, secondCircularObject); - - err(function () { - delete secondCircularObject.tea; - assert.notDeepEqual(circularObject, secondCircularObject); - }, "expected { field: [Circular] } to not deeply equal { field: [Circular] }"); - }); - - test('isNull', function () { - assert.isNull(null); - - err(function () { - assert.isNull(undefined); - }, "expected undefined to equal null"); - }); - - test('isNotNull', function () { - assert.isNotNull(undefined); - - err(function () { - assert.isNotNull(null); - }, "expected null to not equal null"); - }); - - test('isUndefined', function () { - assert.isUndefined(undefined); - - err(function () { - assert.isUndefined(null); - }, "expected null to equal undefined"); - }); - - test('isDefined', function () { - assert.isDefined(null); - - err(function () { - assert.isDefined(undefined); - }, "expected undefined to not equal undefined"); - }); - - test('isFunction', function () { - var func = function () { - }; - assert.isFunction(func); - - err(function () { - assert.isFunction({}); - }, "expected {} to be a function"); - }); - - test('isNotFunction', function () { - assert.isNotFunction(5); - - err(function () { - assert.isNotFunction(function () { - }); - }, "expected [Function] not to be a function"); - }); - - test('isArray', function () { - assert.isArray([]); - assert.isArray(new Array()); - - err(function () { - assert.isArray({}); - }, "expected {} to be an array"); - }); - - test('isNotArray', function () { - assert.isNotArray(3); - - err(function () { - assert.isNotArray([]); - }, "expected [] not to be an array"); - - err(function () { - assert.isNotArray(new Array()); - }, "expected [] not to be an array"); - }); - - test('isString', function () { - assert.isString('Foo'); - assert.isString(new String('foo')); - - err(function () { - assert.isString(1); - }, "expected 1 to be a string"); - }); - - test('isNotString', function () { - assert.isNotString(3); - assert.isNotString([ 'hello' ]); - - err(function () { - assert.isNotString('hello'); - }, "expected 'hello' not to be a string"); - }); - - test('isNumber', function () { - assert.isNumber(1); - assert.isNumber(Number('3')); - - err(function () { - assert.isNumber('1'); - }, "expected \'1\' to be a number"); - }); - - test('isNotNumber', function () { - assert.isNotNumber('hello'); - assert.isNotNumber([ 5 ]); - - err(function () { - assert.isNotNumber(4); - }, "expected 4 not to be a number"); - }); - - test('isBoolean', function () { - assert.isBoolean(true); - assert.isBoolean(false); - - err(function () { - assert.isBoolean('1'); - }, "expected \'1\' to be a boolean"); - }); - - test('isNotBoolean', function () { - assert.isNotBoolean('true'); - - err(function () { - assert.isNotBoolean(true); - }, "expected true not to be a boolean"); - - err(function () { - assert.isNotBoolean(false); - }, "expected false not to be a boolean"); - }); - - test('include', function () { - assert.include('foobar', 'bar'); - assert.include([ 1, 2, 3], 3); - - err(function () { - assert.include('foobar', 'baz'); - }, "expected \'foobar\' to contain \'baz\'"); - - err(function () { - assert.include(undefined, 'bar'); - }, "expected an array or string"); - }); - - test('notInclude', function () { - assert.notInclude('foobar', 'baz'); - assert.notInclude([ 1, 2, 3 ], 4); - - err(function () { - assert.notInclude('foobar', 'bar'); - }, "expected \'foobar\' to not contain \'bar\'"); - - err(function () { - assert.notInclude(undefined, 'bar'); - }, "expected an array or string"); - }); - - test('lengthOf', function () { - assert.lengthOf([1, 2, 3], 3); - assert.lengthOf('foobar', 6); - - err(function () { - assert.lengthOf('foobar', 5); - }, "expected 'foobar' to have a length of 5 but got 6"); - - err(function () { - assert.lengthOf(1, 5); - }, "expected 1 to have a property \'length\'"); - }); - - test('match', function () { - assert.match('foobar', /^foo/); - assert.notMatch('foobar', /^bar/); - - err(function () { - assert.match('foobar', /^bar/i); - }, "expected 'foobar' to match /^bar/i"); - - err(function () { - assert.notMatch('foobar', /^foo/i); - }, "expected 'foobar' not to match /^foo/i"); - }); - - test('property', function () { - var obj = { foo: { bar: 'baz' } }; - var simpleObj = { foo: 'bar' }; - assert.property(obj, 'foo'); - assert.deepProperty(obj, 'foo.bar'); - assert.notProperty(obj, 'baz'); - assert.notProperty(obj, 'foo.bar'); - assert.notDeepProperty(obj, 'foo.baz'); - assert.deepPropertyVal(obj, 'foo.bar', 'baz'); - assert.deepPropertyNotVal(obj, 'foo.bar', 'flow'); - - err(function () { - assert.property(obj, 'baz'); - }, "expected { foo: { bar: 'baz' } } to have a property 'baz'"); - - err(function () { - assert.deepProperty(obj, 'foo.baz'); - }, "expected { foo: { bar: 'baz' } } to have a deep property 'foo.baz'"); - - err(function () { - assert.notProperty(obj, 'foo'); - }, "expected { foo: { bar: 'baz' } } to not have property 'foo'"); - - err(function () { - assert.notDeepProperty(obj, 'foo.bar'); - }, "expected { foo: { bar: 'baz' } } to not have deep property 'foo.bar'"); - - err(function () { - assert.propertyVal(simpleObj, 'foo', 'ball'); - }, "expected { foo: 'bar' } to have a property 'foo' of 'ball', but got 'bar'"); - - err(function () { - assert.deepPropertyVal(obj, 'foo.bar', 'ball'); - }, "expected { foo: { bar: 'baz' } } to have a deep property 'foo.bar' of 'ball', but got 'baz'"); - - err(function () { - assert.propertyNotVal(simpleObj, 'foo', 'bar'); - }, "expected { foo: 'bar' } to not have a property 'foo' of 'bar'"); - - err(function () { - assert.deepPropertyNotVal(obj, 'foo.bar', 'baz'); - }, "expected { foo: { bar: 'baz' } } to not have a deep property 'foo.bar' of 'baz'"); - }); - - test('throws', function () { - assert.throws(function () { - throw new Error('foo'); - }); - assert.throws(function () { - throw new Error('bar'); - }, 'bar'); - assert.throws(function () { - throw new Error('bar'); - }, /bar/); - assert.throws(function () { - throw new Error('bar'); - }, Error); - assert.throws(function () { - throw new Error('bar'); - }, Error, 'bar'); - - err(function () { - assert.throws(function () { - throw new Error('foo') - }, TypeError); - }, "expected [Function] to throw 'TypeError' but [Error: foo] was thrown") - - err(function () { - assert.throws(function () { - throw new Error('foo') - }, 'bar'); - }, "expected [Function] to throw error including 'bar' but got 'foo'") - - err(function () { - assert.throws(function () { - throw new Error('foo') - }, Error, 'bar'); - }, "expected [Function] to throw error including 'bar' but got 'foo'") - - err(function () { - assert.throws(function () { - throw new Error('foo') - }, TypeError, 'bar'); - }, "expected [Function] to throw 'TypeError' but [Error: foo] was thrown") - - err(function () { - assert.throws(function () { - }); - }, "expected [Function] to throw an error"); - - err(function () { - assert.throws(function () { - throw new Error('') - }, 'bar'); - }, "expected [Function] to throw error including 'bar' but got ''"); - - err(function () { - assert.throws(function () { - throw new Error('') - }, /bar/); - }, "expected [Function] to throw error matching /bar/ but got ''"); - }); - - test('doesNotThrow', function () { - assert.doesNotThrow(function () { - }); - assert.doesNotThrow(function () { - }, 'foo'); - - err(function () { - assert.doesNotThrow(function () { - throw new Error('foo'); - }); - }, 'expected [Function] to not throw an error but [Error: foo] was thrown'); - }); - - test('ifError', function () { - assert.ifError(false); - assert.ifError(null); - assert.ifError(undefined); - - err(function () { - assert.ifError('foo'); - }, "expected \'foo\' to be falsy"); - }); - - test('operator', function () { - assert.operator(1, '<', 2); - assert.operator(2, '>', 1); - assert.operator(1, '==', 1); - assert.operator(1, '<=', 1); - assert.operator(1, '>=', 1); - assert.operator(1, '!=', 2); - assert.operator(1, '!==', 2); - - err(function () { - assert.operator(1, '=', 2); - }, 'Invalid operator "="'); - - err(function () { - assert.operator(2, '<', 1); - }, "expected 2 to be < 1"); - - err(function () { - assert.operator(1, '>', 2); - }, "expected 1 to be > 2"); - - err(function () { - assert.operator(1, '==', 2); - }, "expected 1 to be == 2"); - - err(function () { - assert.operator(2, '<=', 1); - }, "expected 2 to be <= 1"); - - err(function () { - assert.operator(1, '>=', 2); - }, "expected 1 to be >= 2"); - - err(function () { - assert.operator(1, '!=', 1); - }, "expected 1 to be != 1"); - - err(function () { - assert.operator(1, '!==', '1'); - }, "expected 1 to be !== \'1\'"); - }); - - test('closeTo', function () { - assert.closeTo(1.5, 1.0, 0.5); - assert.closeTo(10, 20, 20); - assert.closeTo(-10, 20, 30); - - err(function () { - assert.closeTo(2, 1.0, 0.5); - }, "expected 2 to be close to 1 +/- 0.5"); - - err(function () { - assert.closeTo(-10, 20, 29); - }, "expected -10 to be close to 20 +/- 29"); - }); - - test('members', function () { - assert.includeMembers([1, 2, 3], [2, 3]); - assert.includeMembers([1, 2, 3], []); - assert.includeMembers([1, 2, 3], [3]); - - err(function () { - assert.includeMembers([5, 6], [7, 8]); - }, 'expected [ 5, 6 ] to be a superset of [ 7, 8 ]'); - - err(function () { - assert.includeMembers([5, 6], [5, 6, 0]); - }, 'expected [ 5, 6 ] to be a superset of [ 5, 6, 0 ]'); - }); - - test('memberEquals', function () { - assert.sameMembers([], []); - assert.sameMembers([1, 2, 3], [3, 2, 1]); - assert.sameMembers([4, 2], [4, 2]); - - err(function () { - assert.sameMembers([], [1, 2]); - }, 'expected [] to have the same members as [ 1, 2 ]'); - - err(function () { - assert.sameMembers([1, 54], [6, 1, 54]); - }, 'expected [ 1, 54 ] to have the same members as [ 6, 1, 54 ]'); - }); + }); + + test('notTypeOf', () => { + assert.notTypeOf('test', 'number'); + + err(() => { + assert.notTypeOf(5, 'number'); + }, 'expected 5 not to be a number'); + }); + + test('instanceOf', () => { + assert.instanceOf(new Foo(), Foo); + + err(() => { + assert.instanceOf(5, Foo); + }, 'expected 5 to be an instance of Foo'); + assert.instanceOf(new CrashyObject(), CrashyObject); + }); + + test('notInstanceOf', () => { + assert.notInstanceOf(new Foo(), String); + + err(() => { + assert.notInstanceOf(new Foo(), Foo); + }, 'expected {} to not be an instance of Foo'); + }); + + test('isObject', () => { + assert.isObject({}); + assert.isObject(new Foo()); + + err(() => { + assert.isObject(true); + }, 'expected true to be an object'); + + err(() => { + assert.isObject(Foo); + }, 'expected [Function: Foo] to be an object'); + + err(() => { + assert.isObject('foo'); + }, 'expected \'foo\' to be an object'); + }); + + test('isNotObject', () => { + assert.isNotObject(5); + + err(() => { + assert.isNotObject({}); + }, 'expected {} not to be an object'); + }); + + test('notEqual', () => { + assert.notEqual(3, 4); + + err(() => { + assert.notEqual(5, 5); + }, 'expected 5 to not equal 5'); + }); + + test('strictEqual', () => { + assert.strictEqual('foo', 'foo'); + + err(() => { + assert.strictEqual('5', 5); + }, 'expected \'5\' to equal 5'); + }); + + test('notStrictEqual', () => { + assert.notStrictEqual(5, '5'); + + err(() => { + assert.notStrictEqual(5, 5); + }, 'expected 5 to not equal 5'); + }); + + test('deepEqual', () => { + assert.deepEqual({tea: 'chai'}, {tea: 'chai'}); + + err(() => { + assert.deepEqual({tea: 'chai'}, {tea: 'black'}); + }, 'expected { tea: \'chai\' } to deeply equal { tea: \'black\' }'); + + var obja = Object.create({ tea: 'chai' }) + , objb = Object.create({ tea: 'chai' }); + + assert.deepEqual(obja, objb); + + var obj1 = Object.create({tea: 'chai'}) + , obj2 = Object.create({tea: 'black'}); + + err(() => { + assert.deepEqual(obj1, obj2); + }, 'expected { tea: \'chai\' } to deeply equal { tea: \'black\' }'); + }); + + test('deepEqual (ordering)', () => { + var a = { a: 'b', c: 'd' } + , b = { c: 'd', a: 'b' }; + assert.deepEqual(a, b); + }); + + test('deepEqual (circular)', () => { + var circularObject:any = {} + , secondCircularObject:any = {}; + circularObject.field = circularObject; + secondCircularObject.field = secondCircularObject; + + assert.deepEqual(circularObject, secondCircularObject); + + err(() => { + secondCircularObject.field2 = secondCircularObject; + assert.deepEqual(circularObject, secondCircularObject); + }, 'expected { field: [Circular] } to deeply equal { Object (field, field2) }'); + }); + + test('notDeepEqual', () => { + assert.notDeepEqual({tea: 'jasmine'}, {tea: 'chai'}); + err(() => { + assert.notDeepEqual({tea: 'chai'}, {tea: 'chai'}); + }, 'expected { tea: \'chai\' } to not deeply equal { tea: \'chai\' }'); + }); + + test('notDeepEqual (circular)', () => { + var circularObject:any = {} + , secondCircularObject:any = { tea: 'jasmine' }; + circularObject.field = circularObject; + secondCircularObject.field = secondCircularObject; + + assert.notDeepEqual(circularObject, secondCircularObject); + + err(() => { + delete secondCircularObject.tea; + assert.notDeepEqual(circularObject, secondCircularObject); + }, 'expected { field: [Circular] } to not deeply equal { field: [Circular] }'); + }); + + test('isNull', () => { + assert.isNull(null); + + err(() => { + assert.isNull(undefined); + }, 'expected undefined to equal null'); + }); + + test('isNotNull', () => { + assert.isNotNull(undefined); + + err(() => { + assert.isNotNull(null); + }, 'expected null to not equal null'); + }); + + test('isUndefined', () => { + assert.isUndefined(undefined); + + err(() => { + assert.isUndefined(null); + }, 'expected null to equal undefined'); + }); + + test('isDefined', () => { + assert.isDefined(null); + + err(() => { + assert.isDefined(undefined); + }, 'expected undefined to not equal undefined'); + }); + + test('isFunction', () => { + var func = () => { + }; + assert.isFunction(func); + + err(() => { + assert.isFunction({}); + }, 'expected {} to be a function'); + }); + + test('isNotFunction', () => { + assert.isNotFunction(5); + + err(() => { + assert.isNotFunction(() => { + }); + }, 'expected [Function] not to be a function'); + }); + + test('isArray', () => { + assert.isArray([]); + assert.isArray(new Array()); + + err(() => { + assert.isArray({}); + }, 'expected {} to be an array'); + }); + + test('isNotArray', () => { + assert.isNotArray(3); + + err(() => { + assert.isNotArray([]); + }, 'expected [] not to be an array'); + + err(() => { + assert.isNotArray(new Array()); + }, 'expected [] not to be an array'); + }); + + test('isString', () => { + assert.isString('Foo'); + assert.isString(new String('foo')); + + err(() => { + assert.isString(1); + }, 'expected 1 to be a string'); + }); + + test('isNotString', () => { + assert.isNotString(3); + assert.isNotString([ 'hello' ]); + + err(() => { + assert.isNotString('hello'); + }, 'expected \'hello\' not to be a string'); + }); + + test('isNumber', () => { + assert.isNumber(1); + assert.isNumber(Number('3')); + + err(() => { + assert.isNumber('1'); + }, 'expected \'1\' to be a number'); + }); + + test('isNotNumber', () => { + assert.isNotNumber('hello'); + assert.isNotNumber([ 5 ]); + + err(() => { + assert.isNotNumber(4); + }, 'expected 4 not to be a number'); + }); + + test('isBoolean', () => { + assert.isBoolean(true); + assert.isBoolean(false); + + err(() => { + assert.isBoolean('1'); + }, 'expected \'1\' to be a boolean'); + }); + + test('isNotBoolean', () => { + assert.isNotBoolean('true'); + + err(() => { + assert.isNotBoolean(true); + }, 'expected true not to be a boolean'); + + err(() => { + assert.isNotBoolean(false); + }, 'expected false not to be a boolean'); + }); + + test('include', () => { + assert.include('foobar', 'bar'); + assert.include([ 1, 2, 3], 3); + + err(() => { + assert.include('foobar', 'baz'); + }, 'expected \'foobar\' to contain \'baz\''); + + err(() => { + assert.include(undefined, 'bar'); + }, 'expected an array or string'); + }); + + test('notInclude', () => { + assert.notInclude('foobar', 'baz'); + assert.notInclude([ 1, 2, 3 ], 4); + + err(() => { + assert.notInclude('foobar', 'bar'); + }, 'expected \'foobar\' to not contain \'bar\''); + + err(() => { + assert.notInclude(undefined, 'bar'); + }, 'expected an array or string'); + }); + + test('lengthOf', () => { + assert.lengthOf([1, 2, 3], 3); + assert.lengthOf('foobar', 6); + + err(() => { + assert.lengthOf('foobar', 5); + }, 'expected \'foobar\' to have a length of 5 but got 6'); + + err(() => { + assert.lengthOf(1, 5); + }, 'expected 1 to have a property \'length\''); + }); + + test('match', () => { + assert.match('foobar', /^foo/); + assert.notMatch('foobar', /^bar/); + + err(() => { + assert.match('foobar', /^bar/i); + }, 'expected \'foobar\' to match /^bar/i'); + + err(() => { + assert.notMatch('foobar', /^foo/i); + }, 'expected \'foobar\' not to match /^foo/i'); + }); + + test('property', () => { + var obj = { foo: { bar: 'baz' } }; + var simpleObj = { foo: 'bar' }; + assert.property(obj, 'foo'); + assert.deepProperty(obj, 'foo.bar'); + assert.notProperty(obj, 'baz'); + assert.notProperty(obj, 'foo.bar'); + assert.notDeepProperty(obj, 'foo.baz'); + assert.deepPropertyVal(obj, 'foo.bar', 'baz'); + assert.deepPropertyNotVal(obj, 'foo.bar', 'flow'); + + err(() => { + assert.property(obj, 'baz'); + }, 'expected { foo: { bar: \'baz\' } } to have a property \'baz\''); + + err(() => { + assert.deepProperty(obj, 'foo.baz'); + }, 'expected { foo: { bar: \'baz\' } } to have a deep property \'foo.baz\''); + + err(() => { + assert.notProperty(obj, 'foo'); + }, 'expected { foo: { bar: \'baz\' } } to not have property \'foo\''); + + err(() => { + assert.notDeepProperty(obj, 'foo.bar'); + }, 'expected { foo: { bar: \'baz\' } } to not have deep property \'foo.bar\''); + + err(() => { + assert.propertyVal(simpleObj, 'foo', 'ball'); + }, 'expected { foo: \'bar\' } to have a property \'foo\' of \'ball\', but got \'bar\''); + + err(() => { + assert.deepPropertyVal(obj, 'foo.bar', 'ball'); + }, 'expected { foo: { bar: \'baz\' } } to have a deep property \'foo.bar\' of \'ball\', but got \'baz\''); + + err(() => { + assert.propertyNotVal(simpleObj, 'foo', 'bar'); + }, 'expected { foo: \'bar\' } to not have a property \'foo\' of \'bar\''); + + err(() => { + assert.deepPropertyNotVal(obj, 'foo.bar', 'baz'); + }, 'expected { foo: { bar: \'baz\' } } to not have a deep property \'foo.bar\' of \'baz\''); + }); + + test('throws', () => { + assert.throws(() => { + throw new Error('foo'); + }); + assert.throws(() => { + throw new Error('bar'); + }, 'bar'); + assert.throws(() => { + throw new Error('bar'); + }, /bar/); + assert.throws(() => { + throw new Error('bar'); + }, Error); + assert.throws(() => { + throw new Error('bar'); + }, Error, 'bar'); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, TypeError); + }, 'expected [Function] to throw \'TypeError\' but [Error: foo] was thrown'); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, 'bar'); + }, 'expected [Function] to throw error including \'bar\' but got \'foo\''); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, Error, 'bar'); + }, 'expected [Function] to throw error including \'bar\' but got \'foo\''); + + err(() => { + assert.throws(() => { + throw new Error('foo'); + }, TypeError, 'bar'); + }, 'expected [Function] to throw \'TypeError\' but [Error: foo] was thrown'); + + err(() => { + assert.throws(() => { + }); + }, 'expected [Function] to throw an error'); + + err(() => { + assert.throws(() => { + throw new Error(''); + }, 'bar'); + }, 'expected [Function] to throw error including \'bar\' but got \'\''); + + err(() => { + assert.throws(() => { + throw new Error(''); + }, /bar/); + }, 'expected [Function] to throw error matching /bar/ but got \'\''); + }); + + test('doesNotThrow', () => { + assert.doesNotThrow(() => { + }); + assert.doesNotThrow(() => { + }, 'foo'); + + err(() => { + assert.doesNotThrow(() => { + throw new Error('foo'); + }); + }, 'expected [Function] to not throw an error but [Error: foo] was thrown'); + }); + + test('ifError', () => { + assert.ifError(false); + assert.ifError(null); + assert.ifError(undefined); + + err(() => { + assert.ifError('foo'); + }, 'expected \'foo\' to be falsy'); + }); + + test('operator', () => { + assert.operator(1, '<', 2); + assert.operator(2, '>', 1); + assert.operator(1, '==', 1); + assert.operator(1, '<=', 1); + assert.operator(1, '>=', 1); + assert.operator(1, '!=', 2); + assert.operator(1, '!==', 2); + + err(() => { + assert.operator(1, '=', 2); + }, 'Invalid operator "="'); + + err(() => { + assert.operator(2, '<', 1); + }, 'expected 2 to be < 1'); + + err(() => { + assert.operator(1, '>', 2); + }, 'expected 1 to be > 2'); + + err(() => { + assert.operator(1, '==', 2); + }, 'expected 1 to be == 2'); + + err(() => { + assert.operator(2, '<=', 1); + }, 'expected 2 to be <= 1'); + + err(() => { + assert.operator(1, '>=', 2); + }, 'expected 1 to be >= 2'); + + err(() => { + assert.operator(1, '!=', 1); + }, 'expected 1 to be != 1'); + + err(() => { + assert.operator(1, '!==', '1'); + }, 'expected 1 to be !== \'1\''); + }); + + test('closeTo', () => { + assert.closeTo(1.5, 1.0, 0.5); + assert.closeTo(10, 20, 20); + assert.closeTo(-10, 20, 30); + + err(() => { + assert.closeTo(2, 1.0, 0.5); + }, 'expected 2 to be close to 1 +/- 0.5'); + + err(() => { + assert.closeTo(-10, 20, 29); + }, 'expected -10 to be close to 20 +/- 29'); + }); + + test('members', () => { + assert.includeMembers([1, 2, 3], [2, 3]); + assert.includeMembers([1, 2, 3], []); + assert.includeMembers([1, 2, 3], [3]); + + err(() => { + assert.includeMembers([5, 6], [7, 8]); + }, 'expected [ 5, 6 ] to be a superset of [ 7, 8 ]'); + + err(() => { + assert.includeMembers([5, 6], [5, 6, 0]); + }, 'expected [ 5, 6 ] to be a superset of [ 5, 6, 0 ]'); + }); + + test('memberEquals', () => { + assert.sameMembers([], []); + assert.sameMembers([1, 2, 3], [3, 2, 1]); + assert.sameMembers([4, 2], [4, 2]); + + err(() => { + assert.sameMembers([], [1, 2]); + }, 'expected [] to have the same members as [ 1, 2 ]'); + + err(() => { + assert.sameMembers([1, 54], [6, 1, 54]); + }, 'expected [ 1, 54 ] to have the same members as [ 6, 1, 54 ]'); + }); }); diff --git a/chai/chai-tests.ts.tscparams b/chai/chai-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/chai/chai-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/chai/chai.d.ts b/chai/chai.d.ts index dd0adf974..1134b137d 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -1,67 +1,46 @@ // Type definitions for chai 2.0.0 // Project: http://chaijs.com/ -// Definitions by: Jed Hunsaker , Bart van der Schoor +// Definitions by: Jed Mao , Bart van der Schoor // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module chai { - export class AssertionError { - constructor(message: string, _props?: any, ssf?: Function); - name: string; - message: string; - showDiff: boolean; - stack: string; +declare module Chai { + + interface ChaiStatic { + expect: ExpectStatic; + /** + * Provides a way to extend the internals of Chai + */ + use(fn: (chai: any, utils: any) => void): any; + assert: AssertStatic; + config: Config; } - export function expect(target: any, message?: string): Expect; - - export var assert: Assert; - export var config: Config; - - export interface Config { - includeStack: boolean; + export interface ExpectStatic extends AssertionStatic { } - // Provides a way to extend the internals of Chai - function use(fn: (chai: any, utils: any) => void): any; - - interface ExpectStatic { - (target: any): Expect; + export interface AssertStatic extends Assert { } - interface Assertions { - attr(name: string, value?: string): any; - css(name: string, value?: string): any; - data(name: string, value?: string): any; - class(className: string): any; - id(id: string): any; - html(html: string): any; - text(text: string): any; - value(value: string): any; - visible: any; - hidden: any; - selected: any; - checked: any; - disabled: any; - empty: any; - exist: any; + export interface AssertionStatic { + (target: any, message?: string): Assertion; } - interface Expect extends LanguageChains, NumericComparison, TypeComparison, Assertions { - not: Expect; + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + not: Assertion; deep: Deep; a: TypeComparison; an: TypeComparison; include: Include; contain: Include; - ok: Expect; - true: Expect; - false: Expect; - null: Expect; - undefined: Expect; - exist: Expect; - empty: Expect; - arguments: Expect; - Arguments: Expect; + ok: Assertion; + true: Assertion; + false: Assertion; + null: Assertion; + undefined: Assertion; + exist: Assertion; + empty: Assertion; + arguments: Assertion; + Arguments: Assertion; equal: Equal; equals: Equal; eq: Equal; @@ -72,34 +51,34 @@ declare module chai { haveOwnProperty: OwnProperty; length: Length; lengthOf: Length; - match(RegularExpression: RegExp, message?: string): Expect; - string(string: string, message?: string): Expect; + match(regexp: RegExp|string, message?: string): Assertion; + string(string: string, message?: string): Assertion; keys: Keys; - key(string: string): Expect; + key(string: string): Assertion; throw: Throw; throws: Throw; Throw: Throw; - respondTo(method: string, message?: string): Expect; - itself: Expect; - satisfy(matcher: Function, message?: string): Expect; - closeTo(expected: number, delta: number, message?: string): Expect; + respondTo(method: string, message?: string): Assertion; + itself: Assertion; + satisfy(matcher: Function, message?: string): Assertion; + closeTo(expected: number, delta: number, message?: string): Assertion; members: Members; } interface LanguageChains { - to: Expect; - be: Expect; - been: Expect; - is: Expect; - that: Expect; - which: Expect; - and: Expect; - have: Expect; - has: Expect; - with: Expect; - at: Expect; - of: Expect; - same: Expect; + to: Assertion; + be: Assertion; + been: Assertion; + is: Assertion; + that: Assertion; + which: Assertion; + and: Assertion; + has: Assertion; + have: Assertion; + with: Assertion; + at: Assertion; + of: Assertion; + same: Assertion; } interface NumericComparison { @@ -113,21 +92,21 @@ declare module chai { lessThan: NumberComparer; most: NumberComparer; lte: NumberComparer; - within(start: number, finish: number, message?: string): Expect; + within(start: number, finish: number, message?: string): Assertion; } interface NumberComparer { - (value: number, message?: string): Expect; + (value: number, message?: string): Assertion; } interface TypeComparison { - (type: string, message?: string): Expect; + (type: string, message?: string): Assertion; instanceof: InstanceOf; instanceOf: InstanceOf; } interface InstanceOf { - (constructor: Object, message?: string): Expect; + (constructor: Object, message?: string): Assertion; } interface Deep { @@ -137,150 +116,168 @@ declare module chai { } interface Equal { - (value: any, message?: string): Expect; + (value: any, message?: string): Assertion; } interface Property { - (name: string, value?: any, message?: string): Expect; + (name: string, value?: any, message?: string): Assertion; } interface OwnProperty { - (name: string, message?: string): Expect; + (name: string, message?: string): Assertion; } interface Length extends LanguageChains, NumericComparison { - (length: number, message?: string): Expect; + (length: number, message?: string): Assertion; } interface Include { - (value: Object, message?: string): Expect; - (value: string, message?: string): Expect; - (value: number, message?: string): Expect; + (value: Object, message?: string): Assertion; + (value: string, message?: string): Assertion; + (value: number, message?: string): Assertion; keys: Keys; members: Members; } interface Keys { - (...keys: string[]): Expect; - (keys: any[]): Expect; - } - - interface Members { - (set: any[], message?: string): Expect; + (...keys: string[]): Assertion; + (keys: any[]): Assertion; } interface Throw { - (): Expect; - (expected: string, message?: string): Expect; - (expected: RegExp, message?: string): Expect; - (constructor: Error, expected?: string, message?: string): Expect; - (constructor: Error, expected?: RegExp, message?: string): Expect; - (constructor: Function, expected?: string, message?: string): Expect; - (constructor: Function, expected?: RegExp, message?: string): Expect; + (): Assertion; + (expected: string, message?: string): Assertion; + (expected: RegExp, message?: string): Assertion; + (constructor: Error, expected?: string, message?: string): Assertion; + (constructor: Error, expected?: RegExp, message?: string): Assertion; + (constructor: Function, expected?: string, message?: string): Assertion; + (constructor: Function, expected?: RegExp, message?: string): Assertion; + } + + interface Members { + (set: any[], message?: string): Assertion; } export interface Assert { - (express: any, msg?: string):void; + /** + * @param expression Expression to test for truthiness. + * @param message Message to display on error. + */ + (expression: any, message?: string): void; - fail(actual?: any, expected?: any, msg?: string, operator?: string):void; + fail(actual?: any, expected?: any, msg?: string, operator?: string): void; - ok(val: any, msg?: string):void; - notOk(val: any, msg?: string):void; + ok(val: any, msg?: string): void; + notOk(val: any, msg?: string): void; - equal(act: any, exp: any, msg?: string):void; - notEqual(act: any, exp: any, msg?: string):void; + equal(act: any, exp: any, msg?: string): void; + notEqual(act: any, exp: any, msg?: string): void; - strictEqual(act: any, exp: any, msg?: string):void; - notStrictEqual(act: any, exp: any, msg?: string):void; + strictEqual(act: any, exp: any, msg?: string): void; + notStrictEqual(act: any, exp: any, msg?: string): void; - deepEqual(act: any, exp: any, msg?: string):void; - notDeepEqual(act: any, exp: any, msg?: string):void; + deepEqual(act: any, exp: any, msg?: string): void; + notDeepEqual(act: any, exp: any, msg?: string): void; - isTrue(val: any, msg?: string):void; - isFalse(val: any, msg?: string):void; + isTrue(val: any, msg?: string): void; + isFalse(val: any, msg?: string): void; - isNull(val: any, msg?: string):void; - isNotNull(val: any, msg?: string):void; + isNull(val: any, msg?: string): void; + isNotNull(val: any, msg?: string): void; - isUndefined(val: any, msg?: string):void; - isDefined(val: any, msg?: string):void; + isUndefined(val: any, msg?: string): void; + isDefined(val: any, msg?: string): void; - isFunction(val: any, msg?: string):void; - isNotFunction(val: any, msg?: string):void; + isFunction(val: any, msg?: string): void; + isNotFunction(val: any, msg?: string): void; - isObject(val: any, msg?: string):void; - isNotObject(val: any, msg?: string):void; + isObject(val: any, msg?: string): void; + isNotObject(val: any, msg?: string): void; - isArray(val: any, msg?: string):void; - isNotArray(val: any, msg?: string):void; + isArray(val: any, msg?: string): void; + isNotArray(val: any, msg?: string): void; - isString(val: any, msg?: string):void; - isNotString(val: any, msg?: string):void; + isString(val: any, msg?: string): void; + isNotString(val: any, msg?: string): void; - isNumber(val: any, msg?: string):void; - isNotNumber(val: any, msg?: string):void; + isNumber(val: any, msg?: string): void; + isNotNumber(val: any, msg?: string): void; - isBoolean(val: any, msg?: string):void; - isNotBoolean(val: any, msg?: string):void; + isBoolean(val: any, msg?: string): void; + isNotBoolean(val: any, msg?: string): void; - typeOf(val: any, type: string, msg?: string):void; - notTypeOf(val: any, type: string, msg?: string):void; + typeOf(val: any, type: string, msg?: string): void; + notTypeOf(val: any, type: string, msg?: string): void; - instanceOf(val: any, type: Function, msg?: string):void; - notInstanceOf(val: any, type: Function, msg?: string):void; + instanceOf(val: any, type: Function, msg?: string): void; + notInstanceOf(val: any, type: Function, msg?: string): void; - include(exp: string, inc: any, msg?: string):void; - include(exp: any[], inc: any, msg?: string):void; + include(exp: string, inc: any, msg?: string): void; + include(exp: any[], inc: any, msg?: string): void; - notInclude(exp: string, inc: any, msg?: string):void; - notInclude(exp: any[], inc: any, msg?: string):void; + notInclude(exp: string, inc: any, msg?: string): void; + notInclude(exp: any[], inc: any, msg?: string): void; - match(exp: any, re: RegExp, msg?: string):void; - notMatch(exp: any, re: RegExp, msg?: string):void; + match(exp: any, re: RegExp, msg?: string): void; + notMatch(exp: any, re: RegExp, msg?: string): void; - property(obj: Object, prop: string, msg?: string):void; - notProperty(obj: Object, prop: string, msg?: string):void; - deepProperty(obj: Object, prop: string, msg?: string):void; - notDeepProperty(obj: Object, prop: string, msg?: string):void; + property(obj: Object, prop: string, msg?: string): void; + notProperty(obj: Object, prop: string, msg?: string): void; + deepProperty(obj: Object, prop: string, msg?: string): void; + notDeepProperty(obj: Object, prop: string, msg?: string): void; - propertyVal(obj: Object, prop: string, val: any, msg?: string):void; - propertyNotVal(obj: Object, prop: string, val: any, msg?: string):void; + propertyVal(obj: Object, prop: string, val: any, msg?: string): void; + propertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - deepPropertyVal(obj: Object, prop: string, val: any, msg?: string):void; - deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string):void; + deepPropertyVal(obj: Object, prop: string, val: any, msg?: string): void; + deepPropertyNotVal(obj: Object, prop: string, val: any, msg?: string): void; - lengthOf(exp: any, len: number, msg?: string):void; + lengthOf(exp: any, len: number, msg?: string): void; //alias frenzy - throw(fn: Function, msg?: string):void; - throw(fn: Function, regExp: RegExp):void; - throw(fn: Function, errType: Function, msg?: string):void; - throw(fn: Function, errType: Function, regExp: RegExp):void; + throw(fn: Function, msg?: string): void; + throw(fn: Function, regExp: RegExp): void; + throw(fn: Function, errType: Function, msg?: string): void; + throw(fn: Function, errType: Function, regExp: RegExp): void; - throws(fn: Function, msg?: string):void; - throws(fn: Function, regExp: RegExp):void; - throws(fn: Function, errType: Function, msg?: string):void; - throws(fn: Function, errType: Function, regExp: RegExp):void; + throws(fn: Function, msg?: string): void; + throws(fn: Function, regExp: RegExp): void; + throws(fn: Function, errType: Function, msg?: string): void; + throws(fn: Function, errType: Function, regExp: RegExp): void; - Throw(fn: Function, msg?: string):void; - Throw(fn: Function, regExp: RegExp):void; - Throw(fn: Function, errType: Function, msg?: string):void; - Throw(fn: Function, errType: Function, regExp: RegExp):void; + Throw(fn: Function, msg?: string): void; + Throw(fn: Function, regExp: RegExp): void; + Throw(fn: Function, errType: Function, msg?: string): void; + Throw(fn: Function, errType: Function, regExp: RegExp): void; - doesNotThrow(fn: Function, msg?: string):void; - doesNotThrow(fn: Function, regExp: RegExp):void; - doesNotThrow(fn: Function, errType: Function, msg?: string):void; - doesNotThrow(fn: Function, errType: Function, regExp: RegExp):void; + doesNotThrow(fn: Function, msg?: string): void; + doesNotThrow(fn: Function, regExp: RegExp): void; + doesNotThrow(fn: Function, errType: Function, msg?: string): void; + doesNotThrow(fn: Function, errType: Function, regExp: RegExp): void; - operator(val: any, operator: string, val2: any, msg?: string):void; - closeTo(act: number, exp: number, delta: number, msg?: string):void; + operator(val: any, operator: string, val2: any, msg?: string): void; + closeTo(act: number, exp: number, delta: number, msg?: string): void; - sameMembers(set1: any[], set2: any[], msg?: string):void; - includeMembers(set1: any[], set2: any[], msg?: string):void; + sameMembers(set1: any[], set2: any[], msg?: string): void; + includeMembers(set1: any[], set2: any[], msg?: string): void; - ifError(val: any, msg?: string):void; + ifError(val: any, msg?: string): void; + } + + export interface Config { + includeStack: boolean; + } + + export class AssertionError { + constructor(message: string, _props?: any, ssf?: Function); + name: string; + message: string; + showDiff: boolean; + stack: string; } } +declare var chai: Chai.ChaiStatic; + declare module "chai" { export = chai; } diff --git a/sinon-chai/sinon-chai-tests.ts b/sinon-chai/sinon-chai-tests.ts index 48ac47ee9..65036219e 100644 --- a/sinon-chai/sinon-chai-tests.ts +++ b/sinon-chai/sinon-chai-tests.ts @@ -1,19 +1,17 @@ -/// /// -declare var expect: chai.ExpectStatic; - import chai = require('chai'); import sinonChai = require('sinon-chai'); chai.use(sinonChai); +var expect = chai.expect; +declare var spy: Sinon.SinonSpy; +declare var anotherSpy: Sinon.SinonSpy; +declare var context: {}; +declare var match: RegExp; +// ReSharper disable WrongExpressionStatement function test() { - var spy: Function; - var anotherSpy: Function; - var context: any; - var match: any; - expect(spy).to.have.been.called; expect(spy).to.have.been.calledOnce; expect(spy).to.have.been.calledTwice; @@ -32,6 +30,10 @@ function test() { expect(spy).to.always.have.been.calledWithMatch(match); expect(spy).to.have.returned(1); expect(spy).to.have.always.returned(1); + expect(spy).to.have.thrown(new Error()); + expect(spy).to.have.thrown(Error); expect(spy).to.have.thrown('an error'); + expect(spy).to.have.always.thrown(new Error()); + expect(spy).to.have.always.thrown(Error); expect(spy).to.have.always.thrown('an error'); } diff --git a/sinon-chai/sinon-chai.d.ts b/sinon-chai/sinon-chai.d.ts index d16969dd9..03bd0e81d 100644 --- a/sinon-chai/sinon-chai.d.ts +++ b/sinon-chai/sinon-chai.d.ts @@ -1,34 +1,84 @@ -// Type definitions for sinon-chai 2.4.0 +// Type definitions for sinon-chai 2.7.0 // Project: https://github.com/domenic/sinon-chai -// Definitions by: Kazi Manzur Rashid +// Definitions by: Kazi Manzur Rashid , Jed Mao // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// -declare module chai { - interface Expect { - called: Expect; - calledOnce: Expect; - calledTwice: Expect; - calledThrice: Expect; - callCount(count: number): Expect; - calledBefore(spy: Function): Expect; - calledAfter(spy: Function): Expect; - calledWithNew: Expect; - calledOn(context: any): Expect; - calledWith(...args: any[]): Expect; - calledWithExactly(...args: any[]): Expect; - calledWithMatch(...args: any[]): Expect; - returned(returnVal: any): Expect; - thrown(errorObjOrErrorTypeStringOrNothing: any): Expect; - } +declare module Chai { interface LanguageChains { - always: Expect; + always: Assertion; + } + + interface Assertion { + /** + * true if the spy was called at least once. + */ + called: Assertion; + /** + * @param count The number of recorded calls. + */ + callCount(count: number): Assertion; + /** + * true if the spy was called exactly once. + */ + calledOnce: Assertion; + /** + * true if the spy was called exactly twice. + */ + calledTwice: Assertion; + /** + * true if the spy was called exactly thrice. + */ + calledThrice: Assertion; + /** + * Returns true if the spy was called before anotherSpy. + */ + calledBefore(anotherSpy: Sinon.SinonSpy): Assertion; + /** + * Returns true if the spy was called after anotherSpy. + */ + calledAfter(anotherSpy: Sinon.SinonSpy): Assertion; + /** + * Returns true if spy/stub was called with the new operator. Beware that + * this is inferred based on the value of the this object and the spy + * function's prototype, so it may give false positives if you actively + * return the right kind of object. + */ + calledWithNew: Assertion; + /** + * Returns true if context was this for this call. + */ + calledOn(context: any): Assertion; + /** + * Returns true if call received provided arguments (and possibly others). + */ + calledWith(...args: any[]): Assertion; + /** + * Returns true if call received provided arguments and no others. + */ + calledWithExactly(...args: any[]): Assertion; + /** + * Returns true if call received matching arguments (and possibly others). + * This behaves the same as spyCall.calledWith(sinon.match(arg1), sinon.match(arg2), ...). + */ + calledWithMatch(...args: any[]): Assertion; + /** + * Returns true if spy returned the provided value at least once. Uses + * deep comparison for objects and arrays. Use spy.returned(sinon.match.same(obj)) + * for strict comparison (see matchers). + */ + returned(obj: any): Assertion; + /** + * Returns true if spy threw the provided exception object at least once. + */ + thrown(obj?: Error|typeof Error|string): Assertion; } } declare module "sinon-chai" { - function exports(_chai: typeof chai, utils: any): void; - export = exports; + function sinonChai(chai: any, utils: any): void; + export = sinonChai; } diff --git a/sinon/sinon-tests.ts b/sinon/sinon-tests.ts index b9b71c10e..ccc9819e5 100644 --- a/sinon/sinon-tests.ts +++ b/sinon/sinon-tests.ts @@ -1,95 +1,91 @@ /// function once(fn: Function) { - var returnValue: any, called = false; - return function () { - if (!called) { - called = true; - returnValue = fn.apply(this, arguments); - } - return returnValue; - }; + var returnValue: any, called = false; + return function () { + if (!called) { + called = true; + returnValue = fn.apply(this, arguments); + } + return returnValue; + }; } function testOne() { - var callback = sinon.spy(); - var proxy = once(callback); - proxy(); - if (callback.calledOnce) { console.log("test1 calledOnce success"); } else { console.log("test1 calledOnce failure"); } + var callback = sinon.spy(); + var proxy = once(callback); + proxy(); + if (callback.calledOnce) { console.log("test1 calledOnce success"); } else { console.log("test1 calledOnce failure"); } } function testTwo() { - var callback = sinon.spy(() => {}); - var proxy = once(callback); - proxy(); - proxy(); - if (callback.calledOnce) { console.log("test2 calledOnce success"); } else { console.log("test2 calledOnce failure"); } + var callback = sinon.spy(() => {}); + var proxy = once(callback); + proxy(); + proxy(); + if (callback.calledOnce) { console.log("test2 calledOnce success"); } else { console.log("test2 calledOnce failure"); } } function testThree() { - var obj = { thisObj: true }; - var callback = sinon.spy({}, "method"); - var proxy = once(callback); - proxy.call(obj, callback, 1, 2, 3); - if (callback.calledOn(obj)) { console.log("test3 calledOn success"); } else { console.log("test3 calledOn failure"); } - if (callback.calledWith(callback, 1, 2, 3)) { console.log("test3 calledWith success"); } else { console.log("test3 calledWith failure"); } + var obj = { thisObj: true }; + var callback = sinon.spy({}, "method"); + var proxy = once(callback); + proxy.call(obj, callback, 1, 2, 3); + if (callback.calledOn(obj)) { console.log("test3 calledOn success"); } else { console.log("test3 calledOn failure"); } + if (callback.calledWith(callback, 1, 2, 3)) { console.log("test3 calledWith success"); } else { console.log("test3 calledWith failure"); } } function testFour() { - var obj = { thisObj: true }; - var callback = sinon.stub().returns(42); - var proxy = once(callback); - var val = proxy.apply(callback, [1, 2, 3]); - if (val == 42) { console.log("test4 returns success"); } else { console.log("test4 returns failure"); } + var callback = sinon.stub().returns(42); + var proxy = once(callback); + var val = proxy.apply(callback, [1, 2, 3]); + if (val === 42) { console.log("test4 returns success"); } else { console.log("test4 returns failure"); } } function testFive() { - var obj = { thisObj: true }; - var callback = sinon.stub().returnsArg(1); - var proxy = once(callback); - var val = proxy.apply(callback, [1, 2, 3]); - if (val == 2) { console.log("test5 returnsArg success"); } else { console.log("test5 returnsArg failure"); } + var callback = sinon.stub().returnsArg(1); + var proxy = once(callback); + var val = proxy.apply(callback, [1, 2, 3]); + if (val === 2) { console.log("test5 returnsArg success"); } else { console.log("test5 returnsArg failure"); } } var objectUnderTest: any = { - process: function (obj: any) { - // It doesn't really matter what's here because the stub is going to replace this function - var dummy = true; - if (dummy) { return obj.success(99); } else { obj.failure(99); } - } + process: (obj: any) => { + // It doesn't really matter what's here because the stub is going to replace this function + return obj.success(99); + } }; function testSix() { - var obj = { thisObj: true }; - var stub = sinon.stub(objectUnderTest, "process").yieldsTo("success"); - var val = objectUnderTest.process({ - success: function () { console.log("test6 yieldsTo success"); }, - failure: function () { console.log("test6 yieldsTo failure"); } - }); - stub.restore(); + var stub = sinon.stub(objectUnderTest, "process").yieldsTo("success"); + objectUnderTest.process({ + success: () => { console.log("test6 yieldsTo success"); }, + failure: () => { console.log("test6 yieldsTo failure"); } + }); + stub.restore(); } function testSeven() { - var obj = { functionToTest : function () { } }; - var mockObj = sinon.mock(obj); - obj.functionToTest(); - mockObj.expects('functionToTest').once(); + var obj = { functionToTest : () => { } }; + var mockObj = sinon.mock(obj); + obj.functionToTest(); + mockObj.expects('functionToTest').once(); } function testEight() { - var combinedMatcher = sinon.match.typeOf("object").and(sinon.match.has("pages")); + sinon.match.typeOf("object").and(sinon.match.has("pages")); } function testSandbox() { - var sandbox = sinon.sandbox.create(); - if (sandbox.spy().called) { - sandbox.stub(objectUnderTest, "process").yieldsTo("success"); - sandbox.mock(objectUnderTest).expects("process").once(); - } - sandbox.useFakeTimers(); - sandbox.useFakeXMLHttpRequest(); - sandbox.useFakeServer(); - sandbox.restore(); + var sandbox = sinon.sandbox.create(); + if (sandbox.spy().called) { + sandbox.stub(objectUnderTest, "process").yieldsTo("success"); + sandbox.mock(objectUnderTest).expects("process").once(); + } + sandbox.useFakeTimers(); + sandbox.useFakeXMLHttpRequest(); + sandbox.useFakeServer(); + sandbox.restore(); } testOne(); diff --git a/sinon/sinon.d.ts b/sinon/sinon.d.ts index 4b8656661..7dc5bc1d6 100644 --- a/sinon/sinon.d.ts +++ b/sinon/sinon.d.ts @@ -3,415 +3,417 @@ // Definitions by: William Sears // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface SinonSpyCallApi { - // Properties - thisValue: any; - args: any[]; - exception: any; - returnValue: any; +declare module Sinon { + interface SinonSpyCallApi { + // Properties + thisValue: any; + args: any[]; + exception: any; + returnValue: any; - // Methods - calledOn(obj: any): boolean; - calledWith(...args: any[]): boolean; - calledWithExactly(...args: any[]): boolean; - calledWithMatch(...args: SinonMatcher[]): boolean; - notCalledWith(...args: any[]): boolean; - notCalledWithMatch(...args: SinonMatcher[]): boolean; - returned(value: any): boolean; - threw(): boolean; - threw(type: string): boolean; - threw(obj: any): boolean; - callArg(pos: number): void; - callArgOn(pos: number, obj: any, ...args: any[]): void; - callArgWith(pos: number, ...args: any[]): void; - callArgOnWith(pos: number, obj: any, ...args: any[]): void; - yield(...args: any[]): void; - yieldOn(obj: any, ...args: any[]): void; - yieldTo(property: string, ...args: any[]): void; - yieldToOn(property: string, obj: any, ...args: any[]): void; + // Methods + calledOn(obj: any): boolean; + calledWith(...args: any[]): boolean; + calledWithExactly(...args: any[]): boolean; + calledWithMatch(...args: SinonMatcher[]): boolean; + notCalledWith(...args: any[]): boolean; + notCalledWithMatch(...args: SinonMatcher[]): boolean; + returned(value: any): boolean; + threw(): boolean; + threw(type: string): boolean; + threw(obj: any): boolean; + callArg(pos: number): void; + callArgOn(pos: number, obj: any, ...args: any[]): void; + callArgWith(pos: number, ...args: any[]): void; + callArgOnWith(pos: number, obj: any, ...args: any[]): void; + yield(...args: any[]): void; + yieldOn(obj: any, ...args: any[]): void; + yieldTo(property: string, ...args: any[]): void; + yieldToOn(property: string, obj: any, ...args: any[]): void; + } + + interface SinonSpyCall extends SinonSpyCallApi { + calledBefore(call: SinonSpyCall): boolean; + calledAfter(call: SinonSpyCall): boolean; + calledWithNew(call: SinonSpyCall): boolean; + } + + interface SinonSpy extends SinonSpyCallApi { + // Properties + callCount: number; + called: boolean; + notCalled: boolean; + calledOnce: boolean; + calledTwice: boolean; + calledThrice: boolean; + firstCall: SinonSpyCall; + secondCall: SinonSpyCall; + thirdCall: SinonSpyCall; + lastCall: SinonSpyCall; + thisValues: any[]; + args: any[][]; + exceptions: any[]; + returnValues: any[]; + + // Methods + (...args: any[]): any; + calledBefore(anotherSpy: SinonSpy): boolean; + calledAfter(anotherSpy: SinonSpy): boolean; + calledWithNew(spy: SinonSpy): boolean; + withArgs(...args: any[]): SinonSpy; + alwaysCalledOn(obj: any): boolean; + alwaysCalledWith(...args: any[]): boolean; + alwaysCalledWithExactly(...args: any[]): boolean; + alwaysCalledWithMatch(...args: SinonMatcher[]): boolean; + neverCalledWith(...args: any[]): boolean; + neverCalledWithMatch(...args: SinonMatcher[]): boolean; + alwaysThrew(): boolean; + alwaysThrew(type: string): boolean; + alwaysThrew(obj: any): boolean; + alwaysReturned(): boolean; + invokeCallback(...args: any[]): void; + getCall(n: number): SinonSpyCall; + reset(): void; + printf(format: string, ...args: any[]): string; + restore(): void; + } + + interface SinonSpyStatic { + (): SinonSpy; + (func: any): SinonSpy; + (obj: any, method: string): SinonSpy; + } + + interface SinonStatic { + spy: SinonSpyStatic; + } + + interface SinonStub extends SinonSpy { + resetBehavior(): void; + returns(obj: any): SinonStub; + returnsArg(index: number): SinonStub; + throws(type?: string): SinonStub; + throws(obj: any): SinonStub; + callsArg(index: number): SinonStub; + callsArgOn(index: number, context: any): SinonStub; + callsArgWith(index: number, ...args: any[]): SinonStub; + callsArgOnWith(index: number, context: any, ...args: any[]): SinonStub; + callsArgAsync(index: number): SinonStub; + callsArgOnAsync(index: number, context: any): SinonStub; + callsArgWithAsync(index: number, ...args: any[]): SinonStub; + callsArgOnWithAsync(index: number, context: any, ...args: any[]): SinonStub; + onCall(n: number): SinonStub; + onFirstCall(): SinonStub; + onSecondCall(): SinonStub; + onThirdCall(): SinonStub; + yields(...args: any[]): SinonStub; + yieldsOn(context: any, ...args: any[]): SinonStub; + yieldsTo(property: string, ...args: any[]): SinonStub; + yieldsToOn(property: string, context: any, ...args: any[]): SinonStub; + yieldsAsync(...args: any[]): SinonStub; + yieldsOnAsync(context: any, ...args: any[]): SinonStub; + yieldsToAsync(property: string, ...args: any[]): SinonStub; + yieldsToOnAsync(property: string, context: any, ...args: any[]): SinonStub; + withArgs(...args: any[]): SinonStub; + } + + interface SinonStubStatic { + (): SinonStub; + (obj: any): SinonStub; + (obj: any, method: string): SinonStub; + (obj: any, method: string, func: any): SinonStub; + } + + interface SinonStatic { + stub: SinonStubStatic; + } + + interface SinonExpectation extends SinonStub { + atLeast(n: number): SinonExpectation; + atMost(n: number): SinonExpectation; + never(): SinonExpectation; + once(): SinonExpectation; + twice(): SinonExpectation; + thrice(): SinonExpectation; + exactly(n: number): SinonExpectation; + withArgs(...args: any[]): SinonExpectation; + withExactArgs(...args: any[]): SinonExpectation; + on(obj: any): SinonExpectation; + verify(): SinonExpectation; + restore(): void; + } + + interface SinonExpectationStatic { + create(methodName?: string): SinonExpectation; + } + + interface SinonMock { + expects(method: string): SinonExpectation; + restore(): void; + verify(): void; + } + + interface SinonMockStatic { + (): SinonExpectation; + (obj: any): SinonMock; + } + + interface SinonStatic { + expectation: SinonExpectationStatic; + mock: SinonMockStatic; + } + + interface SinonFakeTimers { + now: number; + create(now: number): SinonFakeTimers; + setTimeout(callback: (...args: any[]) => void, timeout: number, ...args: any[]): number; + clearTimeout(id: number): void; + setInterval(callback: (...args: any[]) => void, timeout: number, ...args: any[]): number; + clearInterval(id: number): void; + tick(ms: number): number; + reset(): void; + Date(): Date; + Date(year: number): Date; + Date(year: number, month: number): Date; + Date(year: number, month: number, day: number): Date; + Date(year: number, month: number, day: number, hour: number): Date; + Date(year: number, month: number, day: number, hour: number, minute: number): Date; + Date(year: number, month: number, day: number, hour: number, minute: number, second: number): Date; + Date(year: number, month: number, day: number, hour: number, minute: number, second: number, ms: number): Date; + restore(): void; + } + + interface SinonFakeTimersStatic { + (): SinonFakeTimers; + (...timers: string[]): SinonFakeTimers; + (now: number, ...timers: string[]): SinonFakeTimers; + } + + interface SinonStatic { + useFakeTimers: SinonFakeTimersStatic; + clock: SinonFakeTimers; + } + + interface SinonFakeUploadProgress { + eventListeners: { + progress: any[]; + load: any[]; + abort: any[]; + error: any[]; + }; + + addEventListener(event: string, listener: (e: Event) => any): void; + removeEventListener(event: string, listener: (e: Event) => any): void; + dispatchEvent(event: Event): void; + } + + interface SinonFakeXMLHttpRequest { + // Properties + onCreate: (xhr: SinonFakeXMLHttpRequest) => void; + url: string; + method: string; + requestHeaders: any; + requestBody: string; + status: number; + statusText: string; + async: boolean; + username: string; + password: string; + withCredentials: boolean; + upload: SinonFakeUploadProgress; + responseXML: Document; + getResponseHeader(header: string): string; + getAllResponseHeaders(): any; + + // Methods + restore(): void; + useFilters: boolean; + addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void; + setResponseHeaders(headers: any): void; + setResponseBody(body: string): void; + respond(status: number, headers: any, body: string): void; + autoRespond(ms: number): void; + } + + interface SinonFakeXMLHttpRequestStatic { + (): SinonFakeXMLHttpRequest; + } + + interface SinonStatic { + useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; + FakeXMLHttpRequest: SinonFakeXMLHttpRequest; + } + + interface SinonFakeServer { + // Properties + autoRespond: boolean; + autoRespondAfter: number; + fakeHTTPMethods: boolean; + getHTTPMethod: (request: SinonFakeXMLHttpRequest) => string; + requests: SinonFakeXMLHttpRequest[]; + + // Methods + respondWith(body: string): void; + respondWith(response: any[]): void; + respondWith(fn: (xhr: SinonFakeXMLHttpRequest) => void): void; + respondWith(url: string, body: string): void; + respondWith(url: string, response: any[]): void; + respondWith(url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; + respondWith(method: string, url: string, body: string): void; + respondWith(method: string, url: string, response: any[]): void; + respondWith(method: string, url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; + respondWith(url: RegExp, body: string): void; + respondWith(url: RegExp, response: any[]): void; + respondWith(url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; + respondWith(method: string, url: RegExp, body: string): void; + respondWith(method: string, url: RegExp, response: any[]): void; + respondWith(method: string, url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; + respond(): void; + restore(): void; + } + + interface SinonFakeServerStatic { + create(): SinonFakeServer; + } + + interface SinonStatic { + fakeServer: SinonFakeServerStatic; + fakeServerWithClock: SinonFakeServerStatic; + } + + interface SinonExposeOptions { + prefix?: string; + includeFail?: boolean; + } + + interface SinonAssert { + // Properties + failException: string; + fail: (message?: string) => void; // Overridable + pass: (assertion: any) => void; // Overridable + + // Methods + notCalled(spy: SinonSpy): void; + called(spy: SinonSpy): void; + calledOnce(spy: SinonSpy): void; + calledTwice(spy: SinonSpy): void; + calledThrice(spy: SinonSpy): void; + callCount(spy: SinonSpy, count: number): void; + callOrder(...spies: SinonSpy[]): void; + calledOn(spy: SinonSpy, obj: any): void; + alwaysCalledOn(spy: SinonSpy, obj: any): void; + calledWith(spy: SinonSpy, ...args: any[]): void; + alwaysCalledWith(spy: SinonSpy, ...args: any[]): void; + neverCalledWith(spy: SinonSpy, ...args: any[]): void; + calledWithExactly(spy: SinonSpy, ...args: any[]): void; + alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void; + calledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; + alwaysCalledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; + neverCalledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; + threw(spy: SinonSpy): void; + threw(spy: SinonSpy, exception: string): void; + threw(spy: SinonSpy, exception: any): void; + alwaysThrew(spy: SinonSpy): void; + alwaysThrew(spy: SinonSpy, exception: string): void; + alwaysThrew(spy: SinonSpy, exception: any): void; + expose(obj: any, options?: SinonExposeOptions): void; + } + + interface SinonStatic { + assert: SinonAssert; + } + + interface SinonMatcher { + and(expr: SinonMatcher): SinonMatcher; + or(expr: SinonMatcher): SinonMatcher; + } + + interface SinonMatch { + (value: number): SinonMatcher; + (value: string): SinonMatcher; + (expr: RegExp): SinonMatcher; + (obj: any): SinonMatcher; + (callback: (value: any) => boolean): SinonMatcher; + any: SinonMatcher; + defined: SinonMatcher; + truthy: SinonMatcher; + falsy: SinonMatcher; + bool: SinonMatcher; + number: SinonMatcher; + string: SinonMatcher; + object: SinonMatcher; + func: SinonMatcher; + array: SinonMatcher; + regexp: SinonMatcher; + date: SinonMatcher; + same(obj: any): SinonMatcher; + typeOf(type: string): SinonMatcher; + instanceOf(type: any): SinonMatcher; + has(property: string, expect?: any): SinonMatcher; + hasOwn(property: string, expect?: any): SinonMatcher; + } + + interface SinonStatic { + match: SinonMatch; + } + + interface SinonSandboxConfig { + injectInto?: any; + properties?: string[]; + useFakeTimers?: any; + useFakeServer?: any; + } + + interface SinonSandbox { + clock: SinonFakeTimers; + requests: SinonFakeXMLHttpRequest; + server: SinonFakeServer; + spy: SinonSpyStatic; + stub: SinonStubStatic; + mock: SinonMockStatic; + useFakeTimers: SinonFakeTimersStatic; + useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; + useFakeServer(): SinonFakeServer; + restore(): void; + } + + interface SinonSandboxStatic { + create(): SinonSandbox; + create(config: SinonSandboxConfig): SinonSandbox; + } + + interface SinonStatic { + sandbox: SinonSandboxStatic; + } + + interface SinonTestConfig { + injectIntoThis?: boolean; + injectInto?: any; + properties?: string[]; + useFakeTimers?: boolean; + useFakeServer?: boolean; + } + + interface SinonTestWrapper extends SinonSandbox { + (...args: any[]): any; + } + + interface SinonStatic { + config: SinonTestConfig; + test(fn: (...args: any[]) => any): SinonTestWrapper; + testCase(tests: any): any; + } + + // Utility overridables + interface SinonStatic { + createStubInstance(constructor: any): SinonStub; + format(obj: any): string; + log(message: string): void; + restore(object: any): void; + } } -interface SinonSpyCall extends SinonSpyCallApi { - calledBefore(call: SinonSpyCall): boolean; - calledAfter(call: SinonSpyCall): boolean; - calledWithNew(call: SinonSpyCall): boolean; -} - -interface SinonSpy extends SinonSpyCallApi { - // Properties - callCount: number; - called: boolean; - notCalled: boolean; - calledOnce: boolean; - calledTwice: boolean; - calledThrice: boolean; - firstCall: SinonSpyCall; - secondCall: SinonSpyCall; - thirdCall: SinonSpyCall; - lastCall: SinonSpyCall; - thisValues: any[]; - args: any[][]; - exceptions: any[]; - returnValues: any[]; - - // Methods - (...args: any[]): any; - calledBefore(anotherSpy: SinonSpy): boolean; - calledAfter(anotherSpy: SinonSpy): boolean; - calledWithNew(spy: SinonSpy): boolean; - withArgs(...args: any[]): SinonSpy; - alwaysCalledOn(obj: any): boolean; - alwaysCalledWith(...args: any[]): boolean; - alwaysCalledWithExactly(...args: any[]): boolean; - alwaysCalledWithMatch(...args: SinonMatcher[]): boolean; - neverCalledWith(...args: any[]): boolean; - neverCalledWithMatch(...args: SinonMatcher[]): boolean; - alwaysThrew(): boolean; - alwaysThrew(type: string): boolean; - alwaysThrew(obj: any): boolean; - alwaysReturned(): boolean; - invokeCallback(...args: any[]): void; - getCall(n: number): SinonSpyCall; - reset(): void; - printf(format: string, ...args: any[]): string; - restore(): void; -} - -interface SinonSpyStatic { - (): SinonSpy; - (func: any): SinonSpy; - (obj: any, method: string): SinonSpy; -} - -interface SinonStatic { - spy: SinonSpyStatic; -} - -interface SinonStub extends SinonSpy { - resetBehavior(): void; - returns(obj: any): SinonStub; - returnsArg(index: number): SinonStub; - throws(type?: string): SinonStub; - throws(obj: any): SinonStub; - callsArg(index: number): SinonStub; - callsArgOn(index: number, context: any): SinonStub; - callsArgWith(index: number, ...args: any[]): SinonStub; - callsArgOnWith(index: number, context: any, ...args: any[]): SinonStub; - callsArgAsync(index: number): SinonStub; - callsArgOnAsync(index: number, context: any): SinonStub; - callsArgWithAsync(index: number, ...args: any[]): SinonStub; - callsArgOnWithAsync(index: number, context: any, ...args: any[]): SinonStub; - onCall(n: number): SinonStub; - onFirstCall(): SinonStub; - onSecondCall(): SinonStub; - onThirdCall(): SinonStub; - yields(...args: any[]): SinonStub; - yieldsOn(context: any, ...args: any[]): SinonStub; - yieldsTo(property: string, ...args: any[]): SinonStub; - yieldsToOn(property: string, context: any, ...args: any[]): SinonStub; - yieldsAsync(...args: any[]): SinonStub; - yieldsOnAsync(context: any, ...args: any[]): SinonStub; - yieldsToAsync(property: string, ...args: any[]): SinonStub; - yieldsToOnAsync(property: string, context: any, ...args: any[]): SinonStub; - withArgs(...args: any[]): SinonStub; -} - -interface SinonStubStatic { - (): SinonStub; - (obj: any): SinonStub; - (obj: any, method: string): SinonStub; - (obj: any, method: string, func: any): SinonStub; -} - -interface SinonStatic { - stub: SinonStubStatic; -} - -interface SinonExpectation extends SinonStub { - atLeast(n: number): SinonExpectation; - atMost(n: number): SinonExpectation; - never(): SinonExpectation; - once(): SinonExpectation; - twice(): SinonExpectation; - thrice(): SinonExpectation; - exactly(n: number): SinonExpectation; - withArgs(...args: any[]): SinonExpectation; - withExactArgs(...args: any[]): SinonExpectation; - on(obj: any): SinonExpectation; - verify(): SinonExpectation; - restore(): void; -} - -interface SinonExpectationStatic { - create(methodName?: string): SinonExpectation; -} - -interface SinonMock { - expects(method: string): SinonExpectation; - restore(): void; - verify(): void; -} - -interface SinonMockStatic { - (): SinonExpectation; - (obj: any): SinonMock; -} - -interface SinonStatic { - expectation: SinonExpectationStatic; - mock: SinonMockStatic; -} - -interface SinonFakeTimers { - now: number; - create(now: number): SinonFakeTimers; - setTimeout(callback: (...args: any[]) => void , timeout: number, ...args: any[]): number; - clearTimeout(id: number): void; - setInterval(callback: (...args: any[]) => void , timeout: number, ...args: any[]): number; - clearInterval(id: number): void; - tick(ms: number): number; - reset(): void; - Date(): Date; - Date(year: number): Date; - Date(year: number, month: number): Date; - Date(year: number, month: number, day: number): Date; - Date(year: number, month: number, day: number, hour: number): Date; - Date(year: number, month: number, day: number, hour: number, minute: number): Date; - Date(year: number, month: number, day: number, hour: number, minute: number, second: number): Date; - Date(year: number, month: number, day: number, hour: number, minute: number, second: number, ms: number): Date; - restore(): void; -} - -interface SinonFakeTimersStatic { - (): SinonFakeTimers; - (...timers: string[]): SinonFakeTimers; - (now: number, ...timers: string[]): SinonFakeTimers; -} - -interface SinonStatic { - useFakeTimers: SinonFakeTimersStatic; - clock: SinonFakeTimers; -} - -interface SinonFakeUploadProgress { - eventListeners: { - progress: any[]; - load: any[]; - abort: any[]; - error: any[]; - }; - - addEventListener(event: string, listener: (e: Event) => any): void; - removeEventListener(event: string, listener: (e: Event) => any): void; - dispatchEvent(event: Event): void; -} - -interface SinonFakeXMLHttpRequest { - // Properties - onCreate: (xhr: SinonFakeXMLHttpRequest) => void; - url: string; - method: string; - requestHeaders: any; - requestBody: string; - status: number; - statusText: string; - async: boolean; - username: string; - password: string; - withCredentials: boolean; - upload: SinonFakeUploadProgress; - responseXML: Document; - getResponseHeader(header: string): string; - getAllResponseHeaders(): any; - - // Methods - restore(): void; - useFilters: boolean; - addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void; - setResponseHeaders(headers: any): void; - setResponseBody(body: string): void; - respond(status: number, headers: any, body: string): void; - autoRespond(ms: number): void; -} - -interface SinonFakeXMLHttpRequestStatic { - (): SinonFakeXMLHttpRequest; -} - -interface SinonStatic { - useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; - FakeXMLHttpRequest: SinonFakeXMLHttpRequest; -} - -interface SinonFakeServer { - // Properties - autoRespond: boolean; - autoRespondAfter: number; - fakeHTTPMethods: boolean; - getHTTPMethod: (request: SinonFakeXMLHttpRequest) => string; - requests: SinonFakeXMLHttpRequest[]; - - // Methods - respondWith(body: string): void; - respondWith(response: any[]): void; - respondWith(fn: (xhr: SinonFakeXMLHttpRequest) => void ): void; - respondWith(url: string, body: string): void; - respondWith(url: string, response: any[]): void; - respondWith(url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void ): void; - respondWith(method: string, url: string, body: string): void; - respondWith(method: string, url: string, response: any[]): void; - respondWith(method: string, url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void ): void; - respondWith(url: RegExp, body: string): void; - respondWith(url: RegExp, response: any[]): void; - respondWith(url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void ): void; - respondWith(method: string, url: RegExp, body: string): void; - respondWith(method: string, url: RegExp, response: any[]): void; - respondWith(method: string, url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void ): void; - respond(): void; - restore(): void; -} - -interface SinonFakeServerStatic { - create(): SinonFakeServer; -} - -interface SinonStatic { - fakeServer: SinonFakeServerStatic; - fakeServerWithClock: SinonFakeServerStatic; -} - -interface SinonExposeOptions { - prefix?: string; - includeFail?: boolean; -} - -interface SinonAssert { - // Properties - failException: string; - fail: (message?: string) => void; // Overridable - pass: (assertion: any) => void; // Overridable - - // Methods - notCalled(spy: SinonSpy): void; - called(spy: SinonSpy): void; - calledOnce(spy: SinonSpy): void; - calledTwice(spy: SinonSpy): void; - calledThrice(spy: SinonSpy): void; - callCount(spy: SinonSpy, count: number): void; - callOrder(...spies: SinonSpy[]): void; - calledOn(spy: SinonSpy, obj: any): void; - alwaysCalledOn(spy: SinonSpy, obj: any): void; - calledWith(spy: SinonSpy, ...args: any[]): void; - alwaysCalledWith(spy: SinonSpy, ...args: any[]): void; - neverCalledWith(spy: SinonSpy, ...args: any[]): void; - calledWithExactly(spy: SinonSpy, ...args: any[]): void; - alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void; - calledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; - alwaysCalledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; - neverCalledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; - threw(spy: SinonSpy): void; - threw(spy: SinonSpy, exception: string): void; - threw(spy: SinonSpy, exception: any): void; - alwaysThrew(spy: SinonSpy): void; - alwaysThrew(spy: SinonSpy, exception: string): void; - alwaysThrew(spy: SinonSpy, exception: any): void; - expose(obj: any, options?: SinonExposeOptions): void; -} - -interface SinonStatic { - assert: SinonAssert; -} - -interface SinonMatcher { - and(expr: SinonMatcher): SinonMatcher; - or(expr: SinonMatcher): SinonMatcher; -} - -interface SinonMatch { - (value: number): SinonMatcher; - (value: string): SinonMatcher; - (expr: RegExp): SinonMatcher; - (obj: any): SinonMatcher; - (callback: (value: any) => boolean): SinonMatcher; - any: SinonMatcher; - defined: SinonMatcher; - truthy: SinonMatcher; - falsy: SinonMatcher; - bool: SinonMatcher; - number: SinonMatcher; - string: SinonMatcher; - object: SinonMatcher; - func: SinonMatcher; - array: SinonMatcher; - regexp: SinonMatcher; - date: SinonMatcher; - same(obj: any): SinonMatcher; - typeOf(type: string): SinonMatcher; - instanceOf(type: any): SinonMatcher; - has(property: string, expect?: any): SinonMatcher; - hasOwn(property: string, expect?: any): SinonMatcher; -} - -interface SinonStatic { - match: SinonMatch; -} - -interface SinonSandboxConfig { - injectInto?: any; - properties?: string[]; - useFakeTimers?: any; - useFakeServer?: any; -} - -interface SinonSandbox { - clock: SinonFakeTimers; - requests: SinonFakeXMLHttpRequest; - server: SinonFakeServer; - spy: SinonSpyStatic; - stub: SinonStubStatic; - mock: SinonMockStatic; - useFakeTimers: SinonFakeTimersStatic; - useFakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; - useFakeServer(): SinonFakeServer; - restore(): void; -} - -interface SinonSandboxStatic { - create(): SinonSandbox; - create(config: SinonSandboxConfig): SinonSandbox; -} - -interface SinonStatic { - sandbox: SinonSandboxStatic; -} - -interface SinonTestConfig { - injectIntoThis?: boolean; - injectInto?: any; - properties?: string[]; - useFakeTimers?: boolean; - useFakeServer?: boolean; -} - -interface SinonTestWrapper extends SinonSandbox { - (...args: any[]): any; -} - -interface SinonStatic { - config: SinonTestConfig; - test(fn: (...args: any[]) => any): SinonTestWrapper; - testCase(tests: any): any; -} - -// Utility overridables -interface SinonStatic { - createStubInstance: (constructor: any) => SinonStub; - format: (obj: any) => string; - log: (message: string) => void; - restore(object: any): void; -} - -declare var sinon: SinonStatic; +declare var sinon: Sinon.SinonStatic; declare module "sinon" { export = sinon; From 5fad551b59701377fb8a678b8ea3797b783c0e48 Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 29 Apr 2015 12:03:44 +0900 Subject: [PATCH 038/534] merge acl-mongodbBackend.d.ts and acl-redisBackend.d.ts into acl.d.ts --- acl/acl-mongodbBackend-tests.ts | 3 +-- acl/acl-mongodbBackend.d.ts | 22 ---------------------- acl/acl-redisBackend-test.ts | 2 +- acl/acl-redisBackend.d.ts | 21 --------------------- acl/acl.d.ts | 30 ++++++++++++++++++++++++++++++ 5 files changed, 32 insertions(+), 46 deletions(-) delete mode 100644 acl/acl-mongodbBackend.d.ts delete mode 100644 acl/acl-redisBackend.d.ts diff --git a/acl/acl-mongodbBackend-tests.ts b/acl/acl-mongodbBackend-tests.ts index 31411b65c..01c9af908 100644 --- a/acl/acl-mongodbBackend-tests.ts +++ b/acl/acl-mongodbBackend-tests.ts @@ -1,4 +1,4 @@ -/// +/// // https://github.com/OptimalBits/node_acl/blob/master/Readme.md import Acl = require('acl'); @@ -14,4 +14,3 @@ acl.allow('guest', 'blogs', 'view'); // allow function accepts arrays as any parameter acl.allow('member', 'blogs', ['edit','view', 'delete']); - diff --git a/acl/acl-mongodbBackend.d.ts b/acl/acl-mongodbBackend.d.ts deleted file mode 100644 index 8dbfb7e90..000000000 --- a/acl/acl-mongodbBackend.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Type definitions for node_acl 0.4.7 -// Project: https://github.com/optimalbits/node_acl -// Definitions by: Qubo -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// -/// - -declare module "acl" { - import mongo = require('mongodb'); - - interface AclStatic { - mongodbBackend: MongodbBackendStatic; - } - - interface MongodbBackend extends Backend { } - interface MongodbBackendStatic { - new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend; - new(db: mongo.Db, prefix: string): MongodbBackend; - new(db: mongo.Db): MongodbBackend; - } -} diff --git a/acl/acl-redisBackend-test.ts b/acl/acl-redisBackend-test.ts index e1bf29af4..273aeab3b 100644 --- a/acl/acl-redisBackend-test.ts +++ b/acl/acl-redisBackend-test.ts @@ -1,4 +1,4 @@ -/// +/// // https://github.com/OptimalBits/node_acl/blob/master/Readme.md import Acl = require('acl'); diff --git a/acl/acl-redisBackend.d.ts b/acl/acl-redisBackend.d.ts deleted file mode 100644 index e199f8b81..000000000 --- a/acl/acl-redisBackend.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Type definitions for node_acl 0.4.7 -// Project: https://github.com/optimalbits/node_acl -// Definitions by: Qubo -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// -/// - -declare module "acl" { - import redis = require('redis'); - - interface AclStatic { - redisBackend: RedisBackendStatic; - } - - interface RedisBackend extends Backend { } - interface RedisBackendStatic { - new(redis: redis.RedisClient, prefix: string): RedisBackend; - new(redis: redis.RedisClient): RedisBackend; - } -} diff --git a/acl/acl.d.ts b/acl/acl.d.ts index 5d0498fed..57e85d9d5 100644 --- a/acl/acl.d.ts +++ b/acl/acl.d.ts @@ -6,6 +6,9 @@ /// /// +/// +/// + declare module "acl" { import http = require('http'); import Promise = require("bluebird"); @@ -115,6 +118,33 @@ declare module "acl" { end: () => void; } + // for redis backend + import redis = require('redis'); + + interface AclStatic { + redisBackend: RedisBackendStatic; + } + + interface RedisBackend extends Backend { } + interface RedisBackendStatic { + new(redis: redis.RedisClient, prefix: string): RedisBackend; + new(redis: redis.RedisClient): RedisBackend; + } + + // for mongodb backend + import mongo = require('mongodb'); + + interface AclStatic { + mongodbBackend: MongodbBackendStatic; + } + + interface MongodbBackend extends Backend { } + interface MongodbBackendStatic { + new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend; + new(db: mongo.Db, prefix: string): MongodbBackend; + new(db: mongo.Db): MongodbBackend; + } + var _: AclStatic; export = _; } From 5cd28fd0e38cbe8a4eb54e90e88f0917a91d7da1 Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 29 Apr 2015 12:05:02 +0900 Subject: [PATCH 039/534] Revert "merge acl-mongodbBackend.d.ts and acl-redisBackend.d.ts into acl.d.ts" This reverts commit 5fad551b59701377fb8a678b8ea3797b783c0e48. --- acl/acl-mongodbBackend-tests.ts | 3 ++- acl/acl-mongodbBackend.d.ts | 22 ++++++++++++++++++++++ acl/acl-redisBackend-test.ts | 2 +- acl/acl-redisBackend.d.ts | 21 +++++++++++++++++++++ acl/acl.d.ts | 30 ------------------------------ 5 files changed, 46 insertions(+), 32 deletions(-) create mode 100644 acl/acl-mongodbBackend.d.ts create mode 100644 acl/acl-redisBackend.d.ts diff --git a/acl/acl-mongodbBackend-tests.ts b/acl/acl-mongodbBackend-tests.ts index 01c9af908..31411b65c 100644 --- a/acl/acl-mongodbBackend-tests.ts +++ b/acl/acl-mongodbBackend-tests.ts @@ -1,4 +1,4 @@ -/// +/// // https://github.com/OptimalBits/node_acl/blob/master/Readme.md import Acl = require('acl'); @@ -14,3 +14,4 @@ acl.allow('guest', 'blogs', 'view'); // allow function accepts arrays as any parameter acl.allow('member', 'blogs', ['edit','view', 'delete']); + diff --git a/acl/acl-mongodbBackend.d.ts b/acl/acl-mongodbBackend.d.ts new file mode 100644 index 000000000..8dbfb7e90 --- /dev/null +++ b/acl/acl-mongodbBackend.d.ts @@ -0,0 +1,22 @@ +// Type definitions for node_acl 0.4.7 +// Project: https://github.com/optimalbits/node_acl +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "acl" { + import mongo = require('mongodb'); + + interface AclStatic { + mongodbBackend: MongodbBackendStatic; + } + + interface MongodbBackend extends Backend { } + interface MongodbBackendStatic { + new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend; + new(db: mongo.Db, prefix: string): MongodbBackend; + new(db: mongo.Db): MongodbBackend; + } +} diff --git a/acl/acl-redisBackend-test.ts b/acl/acl-redisBackend-test.ts index 273aeab3b..e1bf29af4 100644 --- a/acl/acl-redisBackend-test.ts +++ b/acl/acl-redisBackend-test.ts @@ -1,4 +1,4 @@ -/// +/// // https://github.com/OptimalBits/node_acl/blob/master/Readme.md import Acl = require('acl'); diff --git a/acl/acl-redisBackend.d.ts b/acl/acl-redisBackend.d.ts new file mode 100644 index 000000000..e199f8b81 --- /dev/null +++ b/acl/acl-redisBackend.d.ts @@ -0,0 +1,21 @@ +// Type definitions for node_acl 0.4.7 +// Project: https://github.com/optimalbits/node_acl +// Definitions by: Qubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "acl" { + import redis = require('redis'); + + interface AclStatic { + redisBackend: RedisBackendStatic; + } + + interface RedisBackend extends Backend { } + interface RedisBackendStatic { + new(redis: redis.RedisClient, prefix: string): RedisBackend; + new(redis: redis.RedisClient): RedisBackend; + } +} diff --git a/acl/acl.d.ts b/acl/acl.d.ts index 57e85d9d5..5d0498fed 100644 --- a/acl/acl.d.ts +++ b/acl/acl.d.ts @@ -6,9 +6,6 @@ /// /// -/// -/// - declare module "acl" { import http = require('http'); import Promise = require("bluebird"); @@ -118,33 +115,6 @@ declare module "acl" { end: () => void; } - // for redis backend - import redis = require('redis'); - - interface AclStatic { - redisBackend: RedisBackendStatic; - } - - interface RedisBackend extends Backend { } - interface RedisBackendStatic { - new(redis: redis.RedisClient, prefix: string): RedisBackend; - new(redis: redis.RedisClient): RedisBackend; - } - - // for mongodb backend - import mongo = require('mongodb'); - - interface AclStatic { - mongodbBackend: MongodbBackendStatic; - } - - interface MongodbBackend extends Backend { } - interface MongodbBackendStatic { - new(db: mongo.Db, prefix: string, useSingle: boolean): MongodbBackend; - new(db: mongo.Db, prefix: string): MongodbBackend; - new(db: mongo.Db): MongodbBackend; - } - var _: AclStatic; export = _; } From 2e46165db4b4fc35e30a5bcfd920882a3121a699 Mon Sep 17 00:00:00 2001 From: Jed Mao Date: Tue, 28 Apr 2015 23:41:20 -0500 Subject: [PATCH 040/534] Introduce EditorConfig --- .editorconfig | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..5ebf4a129 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +trim_trailing_whitespace = true +insert_final_newline = true + +[{*.json,*.yml}] +indent_style = space +indent_size = 2 From 8a59de2c855abe09771ba2904ae5397ba713706a Mon Sep 17 00:00:00 2001 From: Jeffrey Ko Date: Wed, 29 Apr 2015 00:57:16 -0400 Subject: [PATCH 041/534] type definition for twix.js 0.6.3 --- twix/twix-tests.ts | 223 +++++++++++++++++++++++++++++++++++++++++++++ twix/twix.d.ts | 134 +++++++++++++++++++++++++++ 2 files changed, 357 insertions(+) create mode 100644 twix/twix-tests.ts create mode 100644 twix/twix.d.ts diff --git a/twix/twix-tests.ts b/twix/twix-tests.ts new file mode 100644 index 000000000..3d614fac5 --- /dev/null +++ b/twix/twix-tests.ts @@ -0,0 +1,223 @@ +var someMoment = moment("20111031", "YYYYMMDD"); +var otherMoment = moment("20120620", "YYYYMMDD"); +var startTime = moment('20120701'); +var endTime = moment('20120801'); + +someMoment.twix(otherMoment); +someMoment.twix('2012-05-25'); +someMoment.twix({ year: 2012, month: 5, day: 25 }); +someMoment.twix("05/25/1982", "MM/DD/YYYY", { parseStrict: true }); + +someMoment.twix(otherMoment, "MM/DD/YYYY", { parseStrict: true }); + +var range = moment(someMoment).twix(otherMoment); +var range2 = moment.twix(someMoment, otherMoment); +var range3 = someMoment.twix(otherMoment); + +moment('1982-05-25').twix('1982-05-26', { allDay: true }); + +moment('1982-05-25').twix('1982-05-26', true); + +moment().twix(moment()).isValid(); //=> true +moment().twix(moment().add(1, "day")).isValid(); //=> true +moment().twix(moment().subtract(1, "day")).isValid(); //=> false + +moment("1982-05-25T05:00").twix("1982-05-26T06:00").isSame("day"); //=> false +moment("1982-05-25T05:00").twix("1982-05-25T06:00").isSame("day"); //=> true +moment("1982-05-25T05:00").twix("1982-05-25T06:00").isSame("year"); //=> true + +moment("1982-05-25").twix("1982-05-26").isPast(); //=> true + +moment("2054-05-25").twix("2054-05-26").isFuture(); //=> true + +moment("2054-05-25").twix(moment().add(1, "hour")).isCurrent(); //=> true + +moment("1982-05-25").twix("1982-05-28").contains("1982-05-26"); //=> true + +moment("1982-05-25T5:30").twix("1982-05-25T6:30").length("hours") //=> 1 +moment("1982-05-25T5:00").twix("1982-05-30T6:00").length("days") //=> 6 + +moment("1982-05-25T5:00").twix("1982-05-25T6:00").count("days") //=> 1 +moment("1982-05-25T5:00").twix("1982-05-26T6:00").count("days") //=> 2 + +moment("1982-05-25T5:00").twix("1982-05-25T6:00").countInner("days") //=> 0 +moment("1982-05-24T5:00").twix("1982-05-26T6:00").countInner("days") //=> 1 + +var iter = moment("1982-05-25T5:00").twix("1982-05-26T6:00").iterate("days"); +iter.hasNext(); //=> true +iter.next(); //=> moment("1982-05-25") +iter.next(); //=> moment("1982-05-26") +iter.hasNext(); //=> false +iter.next(); //=> null + +var iter = moment("16", "hh").twix("1982-05-26T6:00").iterate(2, 'hours'); +iter.next().format('LT'); //=> '4:00 PM' +iter.next().format('LT'); //=> '6:00 PM' + +var duration = moment.duration({ hours: 2, minutes: 30, seconds: 20 }); +var iter = moment("16", "hh").twix(someMoment).iterate(duration); +iter.next().format('LT'); //=> '4:00 PM' +iter.next().format('LT'); //=> '6:30 PM' +iter.next().format('LT'); //=> '9:00 PM' + +var iter2 = moment("1982-05-24T5:00").twix("1982-05-27T6:00").iterateInner("days"); +iter.hasNext(); //=> true +iter.next(); //=> moment("1982-05-25") +iter.next(); //=> moment("1982-05-26") +iter.hasNext(); //=> false +iter.next(); //=> null + +var range1 = moment("1982-05-25").twix("1982-05-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.overlaps(range2); //=> true + +var range1 = moment("1982-05-25").twix("1982-08-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.engulfs(range2); //=> true +range2.engulfs(range1); //=> false + +var range1 = moment("1982-05-25").twix("1982-08-30"); +var range2 = moment("1982-05-25").twix("1982-08-30"); + +range1.equals(range2); //=> true +range2.equals(range1); //=> true + +var range1 = moment("1982-05-25").twix("1982-05-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.union(range2); //=> 5/25/82 - 6/13/1982 + +var range1 = moment("1982-05-25").twix("1982-05-30"); +var range2 = moment("1982-05-27").twix("1982-06-13"); + +range1.intersection(range2); //=> 5/27/82 - 5/30/1982 + +var range1 = moment("1982-05-24").twix("1982-05-28", true); +var range2 = moment("1982-05-22").twix("1982-05-26", true); +var xorred = range1.xor(range2); + +xorred[0].format() //=> 'May 22 - 23, 1982' +xorred[1].format() //=> 'May 27 - 28, 1982' + +var range1 = moment("1982-05-23").twix("1982-05-28", true); +var range2 = moment("1982-05-25").twix("1982-05-26", true); +var diff = range1.difference(range2); + +diff[0].format(); //=> 'May 23 - 24, 1982' +diff[1].format(); //=> 'May 27 - 28, 1982' + +var range = moment("1982-05-25T05:01").twix("1982-05-25T07:30"); + +var splits = range.split(1, "hour"); +splits[0].format({ showDate: false }); //=> '5:01 - 6:01 AM' +splits[1].format({ showDate: false }); //=> '6:01 - 7:01 AM' +splits[2].format({ showDate: false }); //=> '7:01 - 7:30 AM' + +//other signatures +range.split(moment.duration({ "h": 1 })).length; //=> 3 +range.split(moment("1982-05-25T06:00")).length; //=> 2 +range.split(moment("1982-05-25T06:00"), moment("1982-05-25T07:00")).length; //=> 3 + +var d = moment.duration(2, "days"); +var range4 = d.afterMoment("1982-05-25"); //=> 5/25/1982 - 5/27/1982 + +var d = moment.duration(2, "days"); +d.beforeMoment("1982-05-25"); //=> 5/23/1982 - 5/25/1982 + +var range = moment("1982-05-25").twix("1982-05-28"); +range.asDuration("days"); //=> duration object with {days: 3} + +var range = moment("1982-05-25T8:00").twix("1982-05-25T10:00"); +range.humanizeLength(); //=> "2 hours" + +range = moment("1982-05-25").twix("2013-01-01"); +range.humanizeLength(); //=> 31 years + +var range = moment("1982-05-25T9:00").twix("1982-05-25T12:00"); + +range.simpleFormat(); //=> '1982-05-25T09:00:00-04:00 - 1982-05-25T12:00:00-04:00' + +range.simpleFormat("ddd, hA"); //=> 'Tue, 9AM - Tue, 12PM' + +var range = moment("1982-05-25").twix("1982-05-26", { allDay: true }); + +range.simpleFormat(); //=> '1982-05-25T00:00:00-04:00 - 1982-05-26T00:00:00-04:00 (all day)' +range.simpleFormat("YYYY - MM - DD"); //=> '1982-05-25 - 1982-05-26 (all day)' + +range.simpleFormat(null, { allDay: "-- all day! --" }); //=> '1982-05-25T00:00:00-04:00 - 1982-05-26T00:00:00-04:00 -- all day! --' + +range.simpleFormat(null, { allDay: null }); //=> '1982-05-25T00:00:00-04:00 - 1982-05-26T00:00:00-04:00' + +range.simpleFormat("HH:mm", { template: function (left, right) { return left + " | " + right; } }); //=> '16:21 | 17:21' + +moment.twixClass.formatTemplate = function (left, right) { return left + " | " + right; }; +range.simpleFormat("HH:mm"); //=> '16:29 | 17:29' + +moment("1982-01-25T09:00").twix("1982-01-25T11:00").format(); //=> 'Jan 25, 1982, 9 - 11 AM' +moment("1982-01-25T9:00").twix("1982-01-26T13:00").format(); //=> 'Jan 25, 9 AM - Jan 26, 1 PM, 1982' + +moment("2012-01-25").twix("2012-01-25", { allDay: true }).format(); //=> Jan 25 +moment("1982-01-25").twix("1982-01-25", { allDay: true }).format(); //=> Jan 25, 1982 +moment("2012-01-25").twix("2012-01-26", { allDay: true }).format(); //=> Jan 25 - 26 +moment("1982-01-25").twix("1982-02-25", { allDay: true }).format(); //=> Jan 25 - Feb 25, 1982 +moment("1982-01-25").twix(new Date(), { allDay: true }).format(); //=> Jan 25, 1982 - Jan 9, 2012 + +moment("1982-01-25T9:30").twix("1/25/1982 1:30 PM").format(); //=> Jan 25, 1982, 9:30 AM - 1:30 PM +moment("1982-01-25T9:30").twix(new Date()).format(); //=> Jan 25, 1982, 9:30 AM - Jan 9, 2012, 3:05 AM +moment("1982-01-25").twix("1982-01-27").format(); //=> Jan 25, 12 AM - Jan 27, 12 AM, 1982 + +var twix = moment("2012-05-25T9:00").twix("2012-05-25T10:00"); + +twix.format(); //=> May 25, 9 - 10 AM +twix.format({ implicitMinutes: false, groupMeridiems: false }); //=> May 25, 9:00 AM - 10:00 AM + +var twix = moment().twix(moment().add('days', 1)); +twix.format({ implicitYear: false }); //=> Mar 28, 1:13 AM - Mar 29, 1:13 AM, 2013 + +moment("2012-05-25T16:00").twix("2012-05-25T17:00").format({ twentyFourHour: true }); //=> May 25, 16:00 - 17:00 + +moment("2012-01-25T8:00").twix("2012-01-25T17:00").format({ + monthFormat: "MMMM", + dayFormat: "Do" +}); + +moment("2012-05-25T8:00").twix("2012-05-25T17:00").format({ spaceBeforeMeridiem: false }); //=> May 25, 8AM - 5PM + +moment("2012-05-25T8:00").twix("2012-05-25T17:00").format({ showDate: false }); //=> 8 AM - 5 PM + +moment("2012-01-25").twix("2012-01-25", { allDay: true }).format({ showDate: false }); //=> All day + +moment.lang("fr"); +moment().twix(moment().add(3, "month")).simpleFormat("MMMM"); //=> 'juillet - octobre' + +moment("1982-05-25").twix(moment("1982-05-27")).format(); //=> '25 mai, 0:00 - 27 mai, 0:00, 1982' + +moment("1982-05-25").twix(moment("1982-05-27")).format({ + groupMeridiems: true, + spaceBeforeMeridiem: true, + showDate: true, + showDayOfWeek: false, + twentyFourHour: false, + implicitMinutes: true, + implicitYear: true, + yearFormat: "YYYY", + monthFormat: "MMM", + weekdayFormat: "ddd", + dayFormat: "D", + meridiemFormat: "A", + hourFormat: "h", + minuteFormat: "mm", + allDay: "all day", + explicitAllDay: false, + lastNightEndsAt: 0 +}); //=> '25 mai, 0:00 - 27 mai, 0:00, 1982' + +var t = moment("1982-01-25T09:30").twix("1982-01-25T13:30"); + +t.format(); //=> Jan 25, 1982, 9:30 AM - 1:30 PM + +t.isSame("day"); //=> true +t.humanizeLength(); //=> "4 hours" +t.count("days"); //=> 1 \ No newline at end of file diff --git a/twix/twix.d.ts b/twix/twix.d.ts new file mode 100644 index 000000000..eb3d29c02 --- /dev/null +++ b/twix/twix.d.ts @@ -0,0 +1,134 @@ +// Type definitions for twix.js 0.6.3 +// Project: https://github.com/icambron/twix.js +// Definitions by: j3ko +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module moment { + interface Moment { + twix(date: Date): Twix; + twix(date: Date, allDay: boolean): Twix; + twix(date: Date, options: TwixFormatOptions): Twix; + twix(date: Date, format: string, options: TwixFormatOptions): Twix; + + twix(date: Moment): Twix; + twix(date: Moment, allDay: boolean): Twix; + twix(date: Moment, options: TwixFormatOptions): Twix; + twix(date: Moment, format: string, options: TwixFormatOptions): Twix; + + twix(date: MomentInput): Twix; + twix(date: MomentInput, allDay: boolean): Twix; + twix(date: MomentInput, options: TwixFormatOptions): Twix; + twix(date: MomentInput, format: string, options: TwixFormatOptions): Twix; + + twix(date: number): Twix; + twix(date: number, allDay: boolean): Twix; + twix(date: number, options: TwixFormatOptions): Twix; + twix(date: number, format: string, options: TwixFormatOptions): Twix; + + twix(date: number[]): Twix; + twix(date: number[], allDay: boolean): Twix; + twix(date: number[], options: TwixFormatOptions): Twix; + twix(date: number[], format: string, options: TwixFormatOptions): Twix; + + twix(date: string): Twix; + twix(date: string, allDay: boolean): Twix; + twix(date: string, options: TwixFormatOptions): Twix; + twix(date: string, format: string, options: TwixFormatOptions): Twix; + } + + interface MomentStatic { + twix(start: Moment, end: Moment): Twix; + twixClass: TwixStatic; + } + + interface TwixFormatOptions { + groupMeridiems?: boolean; + spaceBeforeMeridiem?: boolean; + showDate?: boolean; + showDayOfWeek?: boolean; + twentyFourHour?: boolean; + implicitMinutes?: boolean; + implicitYear?: boolean; + yearFormat?: string; + monthFormat?: string; + weekdayFormat?: string; + dayFormat?: string; + meridiemFormat?: string; + hourFormat?: string; + minuteFormat?: string; + allDay?: any; // boolean | string + explicitAllDay?: boolean; + lastNightEndsAt?: number; + } + + interface TwixSimpleFormatOptions { + allDay?: string; + template?: (left, right) => any; + } + + interface TwixIter { + hasNext(): boolean; + next(): Twix; + } + + interface Duration { + afterMoment(date: string): string; + beforeMoment(date: string): string; + } + + interface Twix { + isPast(): boolean; + isFuture(): boolean; + isCurrent(): boolean; + isSame(period: string): boolean; + contains(date: string): boolean; + contains(date: Date): boolean; + contains(date: Moment): boolean; + length(period: string): number; + count(period: string): number; + countInner(period: string): number; + + iterate(period: string): TwixIter; + iterate(num: number, period: string): TwixIter; + iterate(duration: Duration): TwixIter; + + iterateInner(period: string): TwixIter; + iterateInner(num: number, period: string): TwixIter; + + overlaps(other: Twix): boolean; + engulfs(other: Twix): boolean; + equals(other: Twix): boolean; + union(other: Twix): string; + intersection(other: Twix): string; + + xor(other: Twix): Twix[]; + difference(other: Twix): Twix[]; + split(num: number, period: string): Twix[]; + split(other: Moment): Twix[]; + split(start: Moment, end: Moment): Twix[]; + split(duration: Duration): Twix[]; + + humanizeLength(): string; + simpleFormat(): string; + simpleFormat(format: string): string; + simpleFormat(format: string, options: TwixSimpleFormatOptions): string; + + format(): string; + format(options: TwixFormatOptions): string; + + asDuration(period: string): Duration; + isValid(): boolean; + } + + interface TwixStatic { + formatTemplate?: (left, right) => any; + } +} + +declare module 'twix' { + var _tmp: moment.MomentStatic; + + export = _tmp; +} \ No newline at end of file From d3822c8412b66ec83b859d3be8ba5bcade8a4301 Mon Sep 17 00:00:00 2001 From: Jeffrey Ko Date: Wed, 29 Apr 2015 01:11:07 -0400 Subject: [PATCH 042/534] fix twix tests --- twix/twix-tests.ts | 4 +++- twix/twix.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/twix/twix-tests.ts b/twix/twix-tests.ts index 3d614fac5..bc0ef9ae1 100644 --- a/twix/twix-tests.ts +++ b/twix/twix-tests.ts @@ -1,4 +1,6 @@ -var someMoment = moment("20111031", "YYYYMMDD"); +/// + +var someMoment = moment("20111031", "YYYYMMDD"); var otherMoment = moment("20120620", "YYYYMMDD"); var startTime = moment('20120701'); var endTime = moment('20120801'); diff --git a/twix/twix.d.ts b/twix/twix.d.ts index eb3d29c02..e82df73be 100644 --- a/twix/twix.d.ts +++ b/twix/twix.d.ts @@ -65,7 +65,7 @@ declare module moment { interface TwixSimpleFormatOptions { allDay?: string; - template?: (left, right) => any; + template?: (left: any, right: any) => any; } interface TwixIter { @@ -123,7 +123,7 @@ declare module moment { } interface TwixStatic { - formatTemplate?: (left, right) => any; + formatTemplate?: (left: any, right: any) => any; } } From b9e995eb9b93ee6933835d5555173ba185acb303 Mon Sep 17 00:00:00 2001 From: Marvin Luchs Date: Wed, 29 Apr 2015 10:09:09 +0200 Subject: [PATCH 043/534] ICollectionPromise should extend ng.IPromise with an array of T ICollectionPromise extends ng.IPromise is the equivalent of interface IPromise extends ng.IPromise for arrays of T. Therefore it makes no sense to extend ng.IPromise with just T. Instead it has to be an array of T. The consequence of this bug can be observed when calling Restangular.all('someEntity').getList().then((entities) => {...}) In this case the TypeScript compiler handles entities as SomeEntity, not SomeEntity[]. --- restangular/restangular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index 5a4e87483..7b8480895 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -15,7 +15,7 @@ declare module restangular { $object: T; } - interface ICollectionPromise extends ng.IPromise { + interface ICollectionPromise extends ng.IPromise { push(object: any): ICollectionPromise; call(methodName: string, params?: any): ICollectionPromise; get(fieldName: string): ICollectionPromise; From a29ca9590b4e42619a2df026cefce331550be748 Mon Sep 17 00:00:00 2001 From: yutopp Date: Wed, 29 Apr 2015 20:09:11 +0900 Subject: [PATCH 044/534] add "setSize" method to WebGLRenderTarget https://github.com/mrdoob/three.js/blob/master/src/renderers/WebGLRenderTarget.js#L40 --- threejs/three.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index d51e8da35..7c4aca592 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -4517,6 +4517,7 @@ declare module THREE { generateMipmaps: boolean; shareDepthFrom: any; + setSize(width: number, height: number): void; clone(): WebGLRenderTarget; dispose(): void; From a013599373f97ab70ccc6722d29695a2ff72eac2 Mon Sep 17 00:00:00 2001 From: Marvin Luchs Date: Wed, 29 Apr 2015 13:38:43 +0200 Subject: [PATCH 045/534] Added missing plain() and clone() methods to Restangular's IElement and ICollection restangularizeCollection() [1] and restangularizeElem() [2] are used to create objects that implement IElement and ICollection respectively. Both use restangularizeBase() [3] which adds the clone() and plane() methods. Therefore both IElement and ICollection should both implement clone() and plain(). Additionally I added a generic variant of the already existing plain() method in IElement to both IElement and ICollection. [1] https://github.com/mgonto/restangular/blob/master/src/restangular.js#L982 [2] https://github.com/mgonto/restangular/blob/master/src/restangular.js#L951 [3] https://github.com/mgonto/restangular/blob/master/src/restangular.js#L764 --- restangular/restangular.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index 7b8480895..f2388fc12 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -114,6 +114,7 @@ declare module restangular { patch(queryParams?: any, headers?: any): IPromise; clone(): IElement; plain(): any; + plain(): T; withHttpConfig(httpConfig: IRequestConfig): IElement; save(queryParams?: any, headers?: any): IPromise; getRestangularUrl(): string; @@ -130,6 +131,9 @@ declare module restangular { patch(queryParams?: any, headers?: any): IPromise; putElement(idx: any, params: any, headers: any): IPromise; withHttpConfig(httpConfig: IRequestConfig): ICollection; + clone(): ICollection; + plain(): any; + plain(): T[]; getRestangularUrl(): string; } } From 5e8f5e9587891b927014d1439417ffced183f7f5 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Wed, 29 Apr 2015 18:00:26 +0200 Subject: [PATCH 046/534] Add definition for "angular-i18next" --- angular-i18next/angular-i18next.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 angular-i18next/angular-i18next.d.ts diff --git a/angular-i18next/angular-i18next.d.ts b/angular-i18next/angular-i18next.d.ts new file mode 100644 index 000000000..33af5c42c --- /dev/null +++ b/angular-i18next/angular-i18next.d.ts @@ -0,0 +1,12 @@ +// Type definitions for i18next v0.3.6 +// Project: https://github.com/i18next/ng-i18next +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module angular.i18next { + interface I18nextProvider { + options: I18nextOptions; + } +} \ No newline at end of file From bfc68a72a8f372711842e52caeda7f0a063315e8 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Wed, 29 Apr 2015 18:03:29 +0200 Subject: [PATCH 047/534] Add test for "angular-i18next" definition. --- angular-i18next/angular-i18next-tests.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 angular-i18next/angular-i18next-tests.ts diff --git a/angular-i18next/angular-i18next-tests.ts b/angular-i18next/angular-i18next-tests.ts new file mode 100644 index 000000000..27c43fc53 --- /dev/null +++ b/angular-i18next/angular-i18next-tests.ts @@ -0,0 +1,8 @@ +/// +/** +* @summary Test for "angular-i18next" with options. +*/ +function testOptions() { + var $provider: I18nextProvider; + $provider.options = {}; +} From 9d53ca0b9b8017bff46f0017b10613d118ae1bab Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Wed, 29 Apr 2015 18:22:49 +0200 Subject: [PATCH 048/534] Fix error. --- angular-i18next/angular-i18next-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-i18next/angular-i18next-tests.ts b/angular-i18next/angular-i18next-tests.ts index 27c43fc53..d38285ba9 100644 --- a/angular-i18next/angular-i18next-tests.ts +++ b/angular-i18next/angular-i18next-tests.ts @@ -3,6 +3,6 @@ * @summary Test for "angular-i18next" with options. */ function testOptions() { - var $provider: I18nextProvider; + var $provider: angular.i18next.I18nextProvider; $provider.options = {}; } From 573cd80b1cc9f757620d08764ee1f7d4380e1604 Mon Sep 17 00:00:00 2001 From: Eric Byers Date: Wed, 29 Apr 2015 12:24:00 -0500 Subject: [PATCH 049/534] Fixing formatting, using express.Request since it is now extended properly --- express-validator/express-validator-tests.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/express-validator/express-validator-tests.ts b/express-validator/express-validator-tests.ts index d6ae4addb..74bd277e4 100644 --- a/express-validator/express-validator-tests.ts +++ b/express-validator/express-validator-tests.ts @@ -9,7 +9,7 @@ var app = express(); app.use(expressValidator()); -app.post('/:urlparam', function(req: expressValidator.ValidatedRequest, res: express.Response) { +app.post('/:urlparam', function(req: express.Request, res: express.Response) { // checkBody only checks req.body; none of the other req parameters // Similarly checkParams only checks in req.params (URL params) and @@ -17,17 +17,17 @@ app.post('/:urlparam', function(req: expressValidator.ValidatedRequest, res: exp req.checkBody('postparam', 'Invalid postparam').notEmpty().isInt(); req.checkParams('urlparam', 'Invalid urlparam').isAlpha(); req.checkQuery('getparam', 'Invalid getparam').isInt(); - req.checkHeader('testHeader', 'Invalid testHeader').isLowercase().isUppercase(); - req.checkFiles('testFiles', 'Invalid testFiles').isUrl(); + req.checkHeader('testHeader', 'Invalid testHeader').isLowercase().isUppercase(); + req.checkFiles('testFiles', 'Invalid testFiles').isUrl(); - // OR assert can be used to check on all 3 types of params. + // OR assert can be used to check on all 3 types of params. // req.assert('postparam', 'Invalid postparam').notEmpty().isInt(); // req.assert('urlparam', 'Invalid urlparam').isAlpha(); // req.assert('getparam', 'Invalid getparam').isInt(); req.sanitize('postparam').toBoolean(); - req.filter('postparam').toBoolean(); + req.filter('postparam').toBoolean(); var errors = req.validationErrors(); var mappedErrors = req.validationErrors(true); From 2c7c3f958e41c6f71697b3a7e632bdcbdad37e80 Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Wed, 29 Apr 2015 23:39:43 +0400 Subject: [PATCH 050/534] added victor test file --- .gitignore | 1 + victor/victor-tests.ts | 52 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 victor/victor-tests.ts diff --git a/.gitignore b/.gitignore index 7bfdb8b53..eae84bd56 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ _infrastructure/tests/build node_modules .sublimets +.settings/launch.json diff --git a/victor/victor-tests.ts b/victor/victor-tests.ts new file mode 100644 index 000000000..76eb79c22 --- /dev/null +++ b/victor/victor-tests.ts @@ -0,0 +1,52 @@ +/// + +var vector1 = new Victor(10,10) +var vector2 = new Victor(20,20) + +vector1.add(vector2).addX(vector2).addY(vector2) + +vector1.clone().copy(vector2).toString() + +vector1.toArray() +vector1.toObject() + +vector1.subtract(vector2).subtractX(vector2).subtractY(vector2) +.multiply(vector2).multiplyX(vector2).multiplyY(vector2) +.divide(vector2).divideX(vector2).divideY(vector2) +.invert().invertX().invertY() +.mix(vector2, 0.5).mixX(vector2,0.5).mixY(vector2,0.5) +.normalize().norm() +.limit(100,5) +.unfloat() +.rotate(10) +.rotateDeg(10) +.rotateBy(10) +.rotateByDeg(10) +.randomize(new Victor(10,10), new Victor(100,100)).randomizeY(new Victor(10,10), new Victor(100,100)).randomizeX(new Victor(10,10), new Victor(100,100)).randomizeAny(new Victor(10,10), new Victor(100,100)) + +vector2.dot(vector1) +vector2.cross(vector1) + +vector1.length() +vector1.lengthSq() + +vector1.distance(vector2) +vector1.distanceSq(vector2) + +vector1.distanceX(vector2) +vector1.distanceY(vector2) + +vector1.horizontalAngle() +vector1.horizontalAngleDeg() +vector1.angle() +vector1.angleDeg() +vector1.verticalAngle() +vector1.verticalAngleDeg() + + + + + + + + From fcc48530e36f079533a702a9ed68862913dfab3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Wed, 29 Apr 2015 23:00:06 +0200 Subject: [PATCH 051/534] socket.io: SocketIO.Namespace has an "in" method --- socket.io/socket.io.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index 258b573d5..ba7a5ba70 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -46,6 +46,7 @@ declare module SocketIO { name: string; connected: { [id: string]: Socket }; use(fn: Function): Namespace; + in(room: string): Namespace; on(event: 'connection', listener: (socket: Socket) => void): Namespace; on(event: 'connect', listener: (socket: Socket) => void): Namespace; From bbb3bc06906df2e440d1ee306bb1aafb38a1f37b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Thu, 30 Apr 2015 01:14:30 +0200 Subject: [PATCH 052/534] Add overload for http.Server.listen The backlog parameter should be optional while still accepting the port parameter. --- node/node.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/node/node.d.ts b/node/node.d.ts index 3771ba822..b0a7b77e5 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -340,6 +340,7 @@ declare module "http" { export interface Server extends events.EventEmitter { listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server; + listen(port: number, hostname?: string, callback?: Function): Server; listen(path: string, callback?: Function): Server; listen(handle: any, listeningListener?: Function): Server; close(cb?: any): Server; From 73f40823e5b98683d2dc81876deaa0f27dc6fc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e=20Maurer?= Date: Thu, 30 Apr 2015 04:54:08 +0200 Subject: [PATCH 053/534] Add recursive-readdir library --- recursive-readdir/recursive-readdir-tests.ts | 6 ++++++ recursive-readdir/recursive-readdir.d.ts | 11 +++++++++++ 2 files changed, 17 insertions(+) create mode 100644 recursive-readdir/recursive-readdir-tests.ts create mode 100644 recursive-readdir/recursive-readdir.d.ts diff --git a/recursive-readdir/recursive-readdir-tests.ts b/recursive-readdir/recursive-readdir-tests.ts new file mode 100644 index 000000000..2d3e1d7c9 --- /dev/null +++ b/recursive-readdir/recursive-readdir-tests.ts @@ -0,0 +1,6 @@ +/// + +import recursiveReaddir = require("recursive-readdir"); + +recursiveReaddir("some/path", (err, files) => {}); +recursiveReaddir("some/path", ["foo.cs", "*.html"], (err, files) => {}); diff --git a/recursive-readdir/recursive-readdir.d.ts b/recursive-readdir/recursive-readdir.d.ts new file mode 100644 index 000000000..5e7ecee0a --- /dev/null +++ b/recursive-readdir/recursive-readdir.d.ts @@ -0,0 +1,11 @@ +// Type definitions for recursive-readdir v1.2.1 +// Project: https://github.com/jergason/recursive-readdir/ +// Definitions by: Elisée Maurer +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "recursive-readdir" { + function readdir(path: string, callback: (error: Error, files: string[]) => any): void; + // ignorePattern supports glob syntax via https://github.com/isaacs/minimatch + function readdir(path: string, ignorePattern: string[], callback: (error: Error, files: string[]) => any): void; + export = readdir; +} From dacbb54147b14eeffd1626fd857495bd37bc8da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e=20Maurer?= Date: Thu, 30 Apr 2015 05:06:47 +0200 Subject: [PATCH 054/534] Fix module to work with ES6 import syntax --- recursive-readdir/recursive-readdir.d.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/recursive-readdir/recursive-readdir.d.ts b/recursive-readdir/recursive-readdir.d.ts index 5e7ecee0a..b948fac87 100644 --- a/recursive-readdir/recursive-readdir.d.ts +++ b/recursive-readdir/recursive-readdir.d.ts @@ -4,8 +4,15 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module "recursive-readdir" { - function readdir(path: string, callback: (error: Error, files: string[]) => any): void; - // ignorePattern supports glob syntax via https://github.com/isaacs/minimatch - function readdir(path: string, ignorePattern: string[], callback: (error: Error, files: string[]) => any): void; - export = readdir; + + module RecursiveReaddir { + interface readdir { + (path: string, callback: (error: Error, files: string[]) => any): void; + // ignorePattern supports glob syntax via https://github.com/isaacs/minimatch + (path: string, ignorePattern: string[], callback: (error: Error, files: string[]) => any): void; + } + } + + var r: RecursiveReaddir.readdir; + export = r; } From 1fe804314867cf0db933b7cc76212960a50a8935 Mon Sep 17 00:00:00 2001 From: Robert Dennis Date: Wed, 29 Apr 2015 23:09:49 -0400 Subject: [PATCH 055/534] jquery.dataTables - fix FunctionColumnRender and FunctionColumnData signitures. --- jquery.dataTables/jquery.dataTables-tests.ts | 7 ++++++- jquery.dataTables/jquery.dataTables.d.ts | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/jquery.dataTables/jquery.dataTables-tests.ts b/jquery.dataTables/jquery.dataTables-tests.ts index c90b40d09..552b997b8 100755 --- a/jquery.dataTables/jquery.dataTables-tests.ts +++ b/jquery.dataTables/jquery.dataTables-tests.ts @@ -44,6 +44,9 @@ $(document).ready(function () { }; var colDataFunc: DataTables.FunctionColumnData = function (row, type, set, meta) { + meta.col; + meta.row; + meta.settings; }; var colRenderObject: DataTables.ObjectColumnRender = { @@ -54,7 +57,9 @@ $(document).ready(function () { }; var colRenderFunc: DataTables.FunctionColumnRender = function (data, type, row, meta) { - + meta.col; + meta.row; + meta.settings; }; var col: DataTables.ColumnSettings = diff --git a/jquery.dataTables/jquery.dataTables.d.ts b/jquery.dataTables/jquery.dataTables.d.ts index cbcb1c025..50ff52edd 100755 --- a/jquery.dataTables/jquery.dataTables.d.ts +++ b/jquery.dataTables/jquery.dataTables.d.ts @@ -1498,7 +1498,7 @@ declare module DataTables { } interface FunctionColumnData { - (row: any, t: string, s: any, meta: Object): void; + (row: any, t: string, s: any, meta: CellMetaSettings): void; } interface ObjectColumnData { @@ -1513,7 +1513,13 @@ declare module DataTables { } interface FunctionColumnRender { - (data: Node, t: Node, row: Node, meta: Object): void; + (data: any, t: string, row: any, meta: CellMetaSettings): void; + } + + interface CellMetaSettings { + row: number; + col: number; + settings: DataTables.Settings; } //#endregion "colunm-settings" From c3a1f48983487c1d1bb6ddb35973931e7bb320af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e=20Maurer?= Date: Thu, 30 Apr 2015 06:12:32 +0200 Subject: [PATCH 056/534] Add SocketIO.Socket.handshake --- socket.io/socket.io.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index ba7a5ba70..ac5381f09 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -59,6 +59,17 @@ declare module SocketIO { conn: any; request: any; id: string; + handshake: { + headers: any; + time: string; + address: any; + xdomain: boolean; + secure: boolean; + issued: number; + url: string; + query: any; + }; + emit(name: string, ...args: any[]): Socket; join(name: string, fn?: Function): Socket; leave(name: string, fn?: Function): Socket; From 7341bf55b6b1bdc53ad59ee54a452e50888db8a4 Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Thu, 30 Apr 2015 13:03:03 +0400 Subject: [PATCH 057/534] matter-js, matter-js-tests Added Query declaration to matter-js Added tests for matter-js --- matter-js/matter-js-tests.ts | 57 ++++++++++++++++++++++++++++++++++++ matter-js/matter-js.d.ts | 26 +++++++++++++++- 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 matter-js/matter-js-tests.ts diff --git a/matter-js/matter-js-tests.ts b/matter-js/matter-js-tests.ts new file mode 100644 index 000000000..cc9b7d99d --- /dev/null +++ b/matter-js/matter-js-tests.ts @@ -0,0 +1,57 @@ +/// + +var Engine = Matter.Engine, + World = Matter.World, + Body = Matter.Body, + Bodies = Matter.Bodies, + Composites = Matter.Composites, + Constraint = Matter.Constraint, + Events = Matter.Events, + Query = Matter.Query + + +var engine = Engine.create(document.body) + +//Bodies +var box1 = Bodies.rectangle(400,200,80,80) +var box2 = Bodies.rectangle(400,610,810,60, { + angle: 10, + angularSpeed: 11, + angularVelocity: 1, + density: 4, + isStatic: true +}) + +var circle1 = Bodies.circle(100,100,50) + +World.addBody(engine.world, box1) +World.add(engine.world, [box2, circle1]) + + +//Composites +var stack = Composites.stack(0, 100, 5, 1, 20, 0, function(x, y, column, row) { + return Bodies.circle(x, y, 75, { restitution: 0.9 }); + }); + +World.add(engine.world, stack); + +//Constraints +var constraint1 = Constraint.create({ + bodyA: box1, + bodyB: box2, + stiffness: 0.02 +}) + +//Query +var collisions = Query.ray([box1, box2, circle1], {x:1, y:2}, {x:3, y:4}); + +World.addConstraint(engine.world, constraint1) + + +//events +Events.on(engine, "beforeTick", (e:any)=>{ + +}) + + +Engine.run(engine) diff --git a/matter-js/matter-js.d.ts b/matter-js/matter-js.d.ts index 1365ccca2..5c4426ea2 100644 --- a/matter-js/matter-js.d.ts +++ b/matter-js/matter-js.d.ts @@ -44,7 +44,7 @@ declare module Matter { /** * Clears the engine including the world, pairs and broadphase. - * @param engine + * @param engine */ static clear(engine:Engine):void; @@ -844,6 +844,30 @@ declare module Matter */ type?:string; } + + export class Query + { + /** + * Casts a ray segment against a set of bodies and returns all collisions, ray width is optional. Intersection points are not provided. + * + * @param bodies + * @param startPoint + * @param endPoint + * @param [rayWidth] + * + * @returns Object[] Collisions + */ + static ray( bodies:Array, startPoint:Vector, endPoint:Vector, rayWidth?:number ):Array; + + /** + * Returns all bodies whose bounds are inside (or outside if set) the given set of bounds, from the given set of bodies. + * + * @param bodies + * @param bounds + * @returns Body[] The bodies matching the query + */ + static region( bodies:Array, bounds:Bounds, outside?:boolean ):Array; + } export class Mouse { From e2bd29e394c311174112874b19d99fa2b8dc9fb1 Mon Sep 17 00:00:00 2001 From: ivanegegia Date: Thu, 30 Apr 2015 13:20:57 +0400 Subject: [PATCH 058/534] Added types to matter-js-tests --- matter-js/matter-js-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matter-js/matter-js-tests.ts b/matter-js/matter-js-tests.ts index cc9b7d99d..31649fc44 100644 --- a/matter-js/matter-js-tests.ts +++ b/matter-js/matter-js-tests.ts @@ -29,7 +29,7 @@ World.add(engine.world, [box2, circle1]) //Composites -var stack = Composites.stack(0, 100, 5, 1, 20, 0, function(x, y, column, row) { +var stack = Composites.stack(0, 100, 5, 1, 20, 0, function(x:number, y:number, column:number, row:number) { return Bodies.circle(x, y, 75, { restitution: 0.9 }); }); From b39c82145d1431f8ed11d6b36c97ca3e5d4d01fb Mon Sep 17 00:00:00 2001 From: Troels Leth Jensen Date: Thu, 30 Apr 2015 13:04:49 +0200 Subject: [PATCH 059/534] 'this' in context of a RaphaelSet is a RaphaelSet. --- raphael/raphael.d.ts | 104 +++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/raphael/raphael.d.ts b/raphael/raphael.d.ts index bef33d99c..593d5eb61 100644 --- a/raphael/raphael.d.ts +++ b/raphael/raphael.d.ts @@ -104,79 +104,79 @@ interface RaphaelSet { exclude(element: RaphaelElement): boolean; forEach(callback: Function, thisArg?: any): RaphaelSet; pop(): RaphaelElement; - push(...RaphaelElement: any[]): RaphaelElement; + push(...RaphaelElement: any[]): RaphaelSet; splice(index: number, count: number): RaphaelSet; splice(index: number, count: number, ...insertion: RaphaelElement[]): RaphaelSet; length: number; [key: number]: RaphaelElement; - animate(params: { [key: string]: any; }, ms: number, easing?: string, callback?: Function): RaphaelElement; - animate(animation: RaphaelAnimation): RaphaelElement; - animateWith(el: RaphaelElement, anim: RaphaelAnimation, params: any, ms: number, easing?: string, callback?: Function): RaphaelElement; - animateWith(el: RaphaelElement, anim: RaphaelAnimation, animation: RaphaelAnimation): RaphaelElement; - attr(attrName: string, value: any): RaphaelElement; - attr(params: { [key: string]: any; }): RaphaelElement; + animate(params: { [key: string]: any; }, ms: number, easing?: string, callback?: Function): RaphaelSet; + animate(animation: RaphaelAnimation): RaphaelSet; + animateWith(el: RaphaelElement, anim: RaphaelAnimation, params: any, ms: number, easing?: string, callback?: Function): RaphaelSet; + animateWith(el: RaphaelElement, anim: RaphaelAnimation, animation: RaphaelAnimation): RaphaelSet; + attr(attrName: string, value: any): RaphaelSet; + attr(params: { [key: string]: any; }): RaphaelSet; attr(attrName: string): any; attr(attrNames: string[]): any[]; - click(handler: Function): RaphaelElement; - clone(): RaphaelElement; + click(handler: Function): RaphaelSet; + clone(): RaphaelSet; data(key: string): any; - data(key: string, value: any): RaphaelElement; - dblclick(handler: Function): RaphaelElement; - drag(onmove: (dx: number, dy: number, x: number, y: number, event: DragEvent) =>{ }, onstart: (x: number, y: number, event: DragEvent) =>{ }, onend: (DragEvent: any) =>{ }, mcontext?: any, scontext?: any, econtext?: any): RaphaelElement; + data(key: string, value: any): RaphaelSet; + dblclick(handler: Function): RaphaelSet; + drag(onmove: (dx: number, dy: number, x: number, y: number, event: DragEvent) =>{ }, onstart: (x: number, y: number, event: DragEvent) =>{ }, onend: (DragEvent: any) =>{ }, mcontext?: any, scontext?: any, econtext?: any): RaphaelSet; getBBox(isWithoutTransform?: boolean): BoundingBox; glow(glow?: { width?: number; fill?: boolean; opacity?: number; offsetx?: number; offsety?: number; color?: string; }): RaphaelSet; - hide(): RaphaelElement; - hover(f_in: Function, f_out: Function, icontext?: any, ocontext?: any): RaphaelElement; + hide(): RaphaelSet; + hover(f_in: Function, f_out: Function, icontext?: any, ocontext?: any): RaphaelSet; id: string; - insertAfter(): RaphaelElement; - insertBefore(): RaphaelElement; + insertAfter(): RaphaelSet; + insertBefore(): RaphaelSet; isPointInside(x: number, y: number): boolean; isVisible(): boolean; matrix: RaphaelMatrix; - mousedown(handler: Function): RaphaelElement; - mousemove(handler: Function): RaphaelElement; - mouseout(handler: Function): RaphaelElement; - mouseover(handler: Function): RaphaelElement; - mouseup(handler: Function): RaphaelElement; - next: RaphaelElement; - onDragOver(f: Function): RaphaelElement; + mousedown(handler: Function): RaphaelSet; + mousemove(handler: Function): RaphaelSet; + mouseout(handler: Function): RaphaelSet; + mouseover(handler: Function): RaphaelSet; + mouseup(handler: Function): RaphaelSet; + next: RaphaelSet; + onDragOver(f: Function): RaphaelSet; paper: RaphaelPaper; - pause(anim?: RaphaelAnimation): RaphaelElement; - prev: RaphaelElement; + pause(anim?: RaphaelAnimation): RaphaelSet; + prev: RaphaelSet; raphael: RaphaelStatic; remove(): void; - removeData(key?: string): RaphaelElement; - resume(anim?: RaphaelAnimation): RaphaelElement; + removeData(key?: string): RaphaelSet; + resume(anim?: RaphaelAnimation): RaphaelSet; setTime(anim: RaphaelAnimation): void; - setTime(anim: RaphaelAnimation, value: number): RaphaelElement; - show(): RaphaelElement; + setTime(anim: RaphaelAnimation, value: number): RaphaelSet; + show(): RaphaelSet; status(): { anim: RaphaelAnimation; status: number; }[]; status(anim: RaphaelAnimation): number; - status(anim: RaphaelAnimation, value: number): RaphaelElement; - stop(anim?: RaphaelAnimation): RaphaelElement; - toBack(): RaphaelElement; - toFront(): RaphaelElement; - touchcancel(handler: Function): RaphaelElement; - touchend(handler: Function): RaphaelElement; - touchmove(handler: Function): RaphaelElement; - touchstart(handler: Function): RaphaelElement; + status(anim: RaphaelAnimation, value: number): RaphaelSet; + stop(anim?: RaphaelAnimation): RaphaelSet; + toBack(): RaphaelSet; + toFront(): RaphaelSet; + touchcancel(handler: Function): RaphaelSet; + touchend(handler: Function): RaphaelSet; + touchmove(handler: Function): RaphaelSet; + touchstart(handler: Function): RaphaelSet; transform(): string; - transform(tstr: string): RaphaelElement; - unclick(handler: Function): RaphaelElement; - undblclick(handler: Function): RaphaelElement; - undrag(): RaphaelElement; - unhover(): RaphaelElement; - unhover(f_in: Function, f_out: Function): RaphaelElement; - unmousedown(handler: Function): RaphaelElement; - unmousemove(handler: Function): RaphaelElement; - unmouseout(handler: Function): RaphaelElement; - unmouseover(handler: Function): RaphaelElement; - unmouseup(handler: Function): RaphaelElement; - untouchcancel(handler: Function): RaphaelElement; - untouchend(handler: Function): RaphaelElement; - untouchmove(handler: Function): RaphaelElement; - untouchstart(handler: Function): RaphaelElement; + transform(tstr: string): RaphaelSet; + unclick(handler: Function): RaphaelSet; + undblclick(handler: Function): RaphaelSet; + undrag(): RaphaelSet; + unhover(): RaphaelSet; + unhover(f_in: Function, f_out: Function): RaphaelSet; + unmousedown(handler: Function): RaphaelSet; + unmousemove(handler: Function): RaphaelSet; + unmouseout(handler: Function): RaphaelSet; + unmouseover(handler: Function): RaphaelSet; + unmouseup(handler: Function): RaphaelSet; + untouchcancel(handler: Function): RaphaelSet; + untouchend(handler: Function): RaphaelSet; + untouchmove(handler: Function): RaphaelSet; + untouchstart(handler: Function): RaphaelSet; } interface RaphaelMatrix { From 2017b81457cce2d3d284ebc30e5315293eb27e51 Mon Sep 17 00:00:00 2001 From: CallMeTango Date: Thu, 30 Apr 2015 17:10:21 +0200 Subject: [PATCH 060/534] Support custom equality testers and custom matchers improvements - Added support for custom equality testers. Fixed existing function signature and added interfaces - Improved typings for custom matchers to be more strict and modeled the construction process via corresponding interfaces - Added tests for the custom equality testers and custom matchers --- jasmine/jasmine-tests.ts | 76 ++++++++++++++++++++++++++++++++++++++++ jasmine/jasmine.d.ts | 42 ++++++++++++++++++++-- 2 files changed, 115 insertions(+), 3 deletions(-) diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index 8e3365eaf..1bdf964dd 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -748,6 +748,82 @@ describe("Fail", function () { }); +// test based on http://jasmine.github.io/2.2/custom_equality.html +describe("custom equality", function() { + var myCustomEquality: jasmine.CustomEqualityTester = function(first: any, second: any): boolean { + if (typeof first == "string" && typeof second == "string") { + return first[0] == second[1]; + } + }; + + beforeEach(function() { + jasmine.addCustomEqualityTester(myCustomEquality); + }); + + + it("should be custom equal", function() { + expect("abc").toEqual("aaa"); + }); + + it("should be custom not equal", function() { + expect("abc").not.toEqual("abc"); + }); +}); + +// test based on http://jasmine.github.io/2.2/custom_matcher.html +var customMatchers: jasmine.CustomMatcherFactories = { + toBeGoofy: function (util: jasmine.MatchersUtil, customEqualityTesters: Array) { + return { + compare: function (actual: any, expected: any): jasmine.CustomMatcherResult { + if (expected === undefined) { + expected = ''; + } + var result: jasmine.CustomMatcherResult = { pass: false, message: ''}; + + result.pass = util.equals(actual.hyuk, "gawrsh" + expected, customEqualityTesters); + + if (result.pass) { + result.message = "Expected " + actual + " not to be quite so goofy"; + } else { + result.message = "Expected " + actual + " to be goofy, but it was not very goofy"; + } + + return result; + } + }; + } +}; +// add the custom matchers to interface jasmine.Matchers via TypeScript declaration merging +declare module jasmine { + interface Matchers { + toBeGoofy(expected?: any): boolean; + } +} + +describe("Custom matcher: 'toBeGoofy'", function () { + beforeEach(function () { + jasmine.addMatchers(customMatchers); + }); + + it("is available on an expectation", function () { + expect({ + hyuk: 'gawrsh' + }).toBeGoofy(); + }); + + it("can take an 'expected' parameter", function () { + expect({ + hyuk: 'gawrsh is fun' + }).toBeGoofy(' is fun'); + }); + + it("can be negated", function () { + expect({ + hyuk: 'this is fun' + }).not.toBeGoofy(); + }); +}); + (() => { // from boot.js var env = jasmine.getEnv(); diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index 64936f442..43831c68a 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -52,7 +52,8 @@ declare module jasmine { function createSpyObj(baseName: string, methodNames: any[]): T; function pp(value: any): string; function getEnv(): Env; - function addMatchers(matchers: any): Any; + function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; + function addMatchers(matchers: CustomMatcherFactories): void; interface Any { @@ -62,6 +63,12 @@ declare module jasmine { jasmineToString(): string; } + // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains() + interface ArrayLike { + length: number; + [n: number]: T; + } + interface ObjectContaining { new (sample: any): any; @@ -91,6 +98,34 @@ declare module jasmine { tick(ms: number): void; } + interface CustomEqualityTester { + (first: any, second: any): boolean; + } + + interface CustomMatcher { + compare(actual: T, expected: T): CustomMatcherResult; + compare(actual: any, expected: any): CustomMatcherResult; + } + + interface CustomMatcherFactory { + (util: MatchersUtil, customEqualityTesters: Array): CustomMatcher; + } + + interface CustomMatcherFactories { + [index: string]: CustomMatcherFactory; + } + + interface CustomMatcherResult { + pass: boolean; + message: string; + } + + interface MatchersUtil { + equals(a: any, b: any, customTesters?: Array): boolean; + contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean; + buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string; + } + interface Env { setTimeout: any; clearTimeout: void; @@ -122,7 +157,8 @@ declare module jasmine { compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean; contains_(haystack: any, needle: any): boolean; - addEqualityTester(equalityTester: (a: any, b: any, env: Env, mismatchKeys: string[], mismatchValues: string[]) => boolean): void; + addCustomEqualityTester(equalityTester: CustomEqualityTester): void; + addMatchers(matchers: CustomMatcherFactories): void; specFilter(spec: Spec): boolean; } @@ -320,7 +356,7 @@ declare module jasmine { waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec; fail(e?: any): void; getMatchersClass_(): Matchers; - addMatchers(matchersPrototype: any): void; + addMatchers(matchersPrototype: CustomMatcherFactories): void; finishCallback(): void; finish(onComplete?: () => void): void; after(doAfter: SpecFunction): void; From 040d2efd5edbfa10a136ad3b83da477d6e191aa6 Mon Sep 17 00:00:00 2001 From: CallMeTango Date: Thu, 30 Apr 2015 18:00:45 +0200 Subject: [PATCH 061/534] gruntjs: Fixed type of IExpandedFilesConfig.cwd Changed type of IExpandedFilesConfig.cwd from boolean to string. Added simple test for interface IExpandedFilesConfig as well. fixes #4207 --- gruntjs/gruntjs-tests.ts | 12 +++++++++++- gruntjs/gruntjs.d.ts | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gruntjs/gruntjs-tests.ts b/gruntjs/gruntjs-tests.ts index 6b8607329..55f106d53 100644 --- a/gruntjs/gruntjs-tests.ts +++ b/gruntjs/gruntjs-tests.ts @@ -68,7 +68,17 @@ exports = (grunt: IGrunt) => { asyncedTwoArgs(2, "values", (result: string) => { console.log(result); }); - var fileMaps = grunt.file.expandMapping([''], '', { ext: '.js' }); + + // tests for module grunt.file + var expandedFilesConfig: grunt.file.IExpandedFilesConfig = { + expand: true, + cwd: 'src', + src: ['**/*.ts'], + dest: 'build', + ext: '.js', + flatten: false + }; + var fileMaps = grunt.file.expandMapping([''], '', expandedFilesConfig); fileMaps.length; fileMaps[0].src.length; fileMaps[0].dest; diff --git a/gruntjs/gruntjs.d.ts b/gruntjs/gruntjs.d.ts index baea9dcfb..850d0b226 100644 --- a/gruntjs/gruntjs.d.ts +++ b/gruntjs/gruntjs.d.ts @@ -604,7 +604,7 @@ declare module grunt { /** * All {@link IExpandedFilesConfig.src} matches are relative to (but don't include) this path. */ - cwd?: boolean + cwd?: string /** * Replace any existing extension with this value in generated {@link IExpandedFilesConfig.dest} paths. From 6524d47793060e05bb1bba595d427ba80d14a901 Mon Sep 17 00:00:00 2001 From: Markus Peloso Date: Thu, 30 Apr 2015 19:53:48 +0200 Subject: [PATCH 062/534] Add type definitions for Egg.js The egg.js-tests are based on the docs from Egg.js. The name is the same as the Egg.js bower project: http://bower.io/search/?q=egg.js (an npm project does not exists). And I run the tsc and npm tests. --- .gitignore | 3 ++ egg.js/egg.js-tests.ts | 27 ++++++++++++ egg.js/egg.js.d.ts | 93 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 egg.js/egg.js-tests.ts create mode 100644 egg.js/egg.js.d.ts diff --git a/.gitignore b/.gitignore index 7bfdb8b53..307e9b7ff 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,9 @@ _infrastructure/tests/build #decimal.js !decimal.js +#egg.js +!egg.js + #rx.js !rx.js diff --git a/egg.js/egg.js-tests.ts b/egg.js/egg.js-tests.ts new file mode 100644 index 000000000..d9eeefc86 --- /dev/null +++ b/egg.js/egg.js-tests.ts @@ -0,0 +1,27 @@ +/// + +var egg = new Egg(); +egg + .addCode("up,up,down,down,left,right,left,right,b,a", function () { + alert("Konami!"); +}, "konami-code") + .addHook(function () { + console.log("Hook called for: " + this.activeEgg.keys); + console.log(this.activeEgg.metadata); +}) + .listen(); + +var egg = new Egg("up,up,down,down,left,right,left,right,b,a", function () { + alert("Konami!"); +}).listen(); + +// EGGSAMPLE +var egg = new Egg(); +egg + .AddCode("up,up,down,down,left,right,left,right,b,a", function () { + alert("Konami!"); +}, "konami-code") + .AddHook(function () { + console.log("Hook called for: " + this.activeEgg.keys); + console.log(this.activeEgg.metadata); +}).Listen(); \ No newline at end of file diff --git a/egg.js/egg.js.d.ts b/egg.js/egg.js.d.ts new file mode 100644 index 000000000..14b57ba07 --- /dev/null +++ b/egg.js/egg.js.d.ts @@ -0,0 +1,93 @@ +// Type definitions for Egg.js 0.0.1 +// Project: https://github.com/mikeflynn/egg.js/ +// Definitions by: Markus Peloso +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var egg: Egg; + +declare module "egg" { + export = egg; +} + +/** + * Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter + * eggs by watching the user's key strokes. + */ +declare class Egg { + /** + * Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter + * eggs by watching the user's key strokes. + */ + constructor(); + /** + * Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter + * eggs by watching the user's key strokes. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + */ + constructor(keySequence: string, fn: () => any); + /** + * Egg.js is a simple JS library that has no prerequisites and allows you to easily add web easter + * eggs by watching the user's key strokes. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + * @param metadata An optional set of metadata. + */ + constructor(keySequence: string, fn: () => any, metadata: any); + /** + * Use to add in your easter eggs. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + */ + AddCode(keySequence: string, fn: () => any): Egg; + /** + * Use to add in your easter eggs. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + * @param metadata An optional set of metadata. + */ + AddCode(keySequence: string, fn: () => any, metadata: any): Egg; + /** + * Add a hook, that will run after any egg code is triggered. You could use it to fire a Google + * Analytics event or send out a tweet that someone finally found your easter egg. Hooks get + * access to the whole Egg.js object so you can pull information about the easter egg that + * fired via this.activeEgg. + * @param fn A function to trigger when it happens. + */ + AddHook(fn: () => any): Egg; + /** + * Start listening to key codes. + */ + Listen(): Egg; + /** + * Use to add in your easter eggs. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + */ + addCode(keySequence: string, fn: () => any): Egg; + /** + * Use to add in your easter eggs. + * @param keySequence You need to pass it the character sequence to trigger the easter egg + * callback (which can either be in plain English or JavaScript key codes). + * @param fn A function to trigger when it happens. + * @param metadata An optional set of metadata. + */ + addCode(keySequence: string, fn: () => any, metadata: any): Egg; + /** + * Add a hook, that will run after any egg code is triggered. You could use it to fire a Google + * Analytics event or send out a tweet that someone finally found your easter egg. Hooks get + * access to the whole Egg.js object so you can pull information about the easter egg that + * fired via this.activeEgg. + * @param fn A function to trigger when it happens. + */ + addHook(fn: () => any): Egg; + /** + * Start listening to key codes. + */ + listen(): Egg; +} \ No newline at end of file From 2034ab18e7eac536c794c503671bbcbe896f106b Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Fri, 1 May 2015 09:44:24 +0900 Subject: [PATCH 063/534] merge .js directories --- .gitignore | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 7bfdb8b53..7a300c0af 100644 --- a/.gitignore +++ b/.gitignore @@ -28,15 +28,7 @@ _infrastructure/tests/build .idea *.iml *.js.map - -#decimal.js -!decimal.js - -#rx.js -!rx.js - -#zip.js -!zip.js +!*.js/ node_modules From c969d6275cf4832f24aae3ea9a4eec3730f8c8da Mon Sep 17 00:00:00 2001 From: Florent Chiron Date: Fri, 1 May 2015 03:30:41 +0200 Subject: [PATCH 064/534] Add signature for promise.tap(onFulfilled) --- q/Q-tests.ts | 9 +++++++++ q/Q.d.ts | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/q/Q-tests.ts b/q/Q-tests.ts index 7872f23b2..2e9b7547b 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -64,6 +64,15 @@ Q.allResolved([]) }) }); +Q(42) + .tap(() => "hello") + .tap(x => { + console.log(x); + }) + .then(x => { + console.log("42 == " + x); + }); + declare var arrayPromise: Q.IPromise; declare var stringPromise: Q.IPromise; declare function returnsNumPromise(text: string): Q.Promise; diff --git a/q/Q.d.ts b/q/Q.d.ts index 590fd92ad..2a239dc18 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -122,6 +122,12 @@ declare module Q { * A sugar method, equivalent to promise.then(function () { throw reason; }). */ thenReject(reason: any): Promise; + + /** + * Attaches a handler that will observe the value of the promise when it becomes fulfilled, returning a promise for that same value, perhaps deferred but not replaced by the promise returned by the onFulfilled handler. + */ + tap(onFulfilled: (value: T) => any): Promise; + timeout(ms: number, message?: string): Promise; /** * Returns a promise that will have the same result as promise, but will only be fulfilled or rejected after at least ms milliseconds have passed. From 35036ae8dd9b89f4ccd9a7d0f8f5e75de01fe198 Mon Sep 17 00:00:00 2001 From: Daniel Beckwith Date: Fri, 1 May 2015 00:31:59 -0400 Subject: [PATCH 065/534] adds function type for Dictionary version of reduce (issue 4244) --- underscore/underscore.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 7ff9aa5eb..c5815f51a 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -53,6 +53,10 @@ declare module _ { (prev: TResult, curr: T, index: number, list: T[]): TResult; } + interface MemoObjectIterator { + (prev: TResult, curr: T, key: string, list: any): TResult; + } + interface Collection { } // Common interface between Arrays and jQuery objects @@ -181,7 +185,7 @@ interface UnderscoreStatic { reduce( list: _.Dictionary, - iterator: _.ObjectIterator, + iterator: _.MemoObjectIterator, memo?: TResult, context?: any): TResult; From 298a4d1cb25df4ba33667c6edb3815261abf7ac0 Mon Sep 17 00:00:00 2001 From: Jed Mao Date: Thu, 30 Apr 2015 01:30:25 -0500 Subject: [PATCH 066/534] Fix vinyl-fs defs --- vinyl-fs/vinyl-fs.d.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/vinyl-fs/vinyl-fs.d.ts b/vinyl-fs/vinyl-fs.d.ts index e9f549161..c9018c400 100644 --- a/vinyl-fs/vinyl-fs.d.ts +++ b/vinyl-fs/vinyl-fs.d.ts @@ -8,24 +8,20 @@ declare module NodeJS { interface WritableStream { - write(buffer: any/* Vinyl.IFile */, cb?: Function): boolean; + write(buffer: any/* Vinyl.File */, cb?: Function): boolean; } } declare module "vinyl-fs" { import _events = require("events"); + import File = require("vinyl"); - function src(globs:string, opt?:{read?:boolean;buffer?:boolean;}):NodeJS.ReadWriteStream; + function src(globs:string|string[], opt?:{read?:boolean;buffer?:boolean;}):NodeJS.ReadWriteStream; - function src(globs:string[], opt?:{read?:boolean;buffer?:boolean;}):NodeJS.ReadWriteStream; + function watch(globs:string|string[], cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; - function watch(globs:string, cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; + function watch(globs:string|string[], opt?:{interval?:number;debounceDelay?:number;cwd?:string;maxListeners?:Function;}, cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; - function watch(globs:string[], cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; - - function watch(globs:string, opt?:{interval?:number;debounceDelay?:number;cwd?:string;maxListeners?:Function;}, cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; - - function watch(globs:string[], opt?:{interval?:number;debounceDelay?:number;cwd?:string;maxListeners?:Function;}, cb?:(outEvt:{type:any;path:any;old:any;})=>void):_events.EventEmitter; - - function dest(folder:string, opt?:{cwd?:string; mode?:any/* number or string */;}):NodeJS.ReadWriteStream; + function dest(folder: string, opt?: { cwd?: string; mode?: number|string; }): NodeJS.ReadWriteStream; + function dest(getFolderPath: (file: File) => string): NodeJS.ReadWriteStream; } From 7d7eea82f1f92e40d17f01b5290e83fcdeffa097 Mon Sep 17 00:00:00 2001 From: Markus Peloso Date: Fri, 1 May 2015 11:17:43 +0200 Subject: [PATCH 067/534] Update sweetalert type definition to 1.0.0-beta --- sweetalert/sweetalert-tests.ts | 3 ++- sweetalert/sweetalert.d.ts | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/sweetalert/sweetalert-tests.ts b/sweetalert/sweetalert-tests.ts index 1ccb93ba3..9523bc010 100644 --- a/sweetalert/sweetalert-tests.ts +++ b/sweetalert/sweetalert-tests.ts @@ -72,7 +72,8 @@ swal({ type: "input", showCancelButton: true, closeOnConfirm: false, - animation: "slide-from-top" + animation: "slide-from-top", + inputPlaceholder: "Write something" }, function (inputValue) { if (inputValue === false) return false; diff --git a/sweetalert/sweetalert.d.ts b/sweetalert/sweetalert.d.ts index d5b4cd607..108e2b906 100644 --- a/sweetalert/sweetalert.d.ts +++ b/sweetalert/sweetalert.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SweetAlert 0.5.0 +// Type definitions for SweetAlert 1.0.0-beta // Project: https://github.com/t4t5/sweetalert/ // Definitions by: Markus Peloso // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -28,7 +28,7 @@ declare module SweetAlert { * If set to true, the user can dismiss the modal by pressing the Escape key. * Default: true */ - allowEsxcapeKey?: boolean; + allowEscapeKey?: boolean; /** * A custom CSS class for the modal. @@ -78,6 +78,12 @@ declare module SweetAlert { */ closeOnConfirm?: boolean; + /** + * Set to false if you want the modal to stay open even if the user presses the "Cancel"-button. This is especially useful if the function attached to the "Cancel"-button is another SweetAlert. + * Default: true + */ + closeOnCancel?: boolean; + /** * Add a customized icon for the modal.Should contain a string with the path to the image. * Default: null @@ -104,7 +110,7 @@ declare module SweetAlert { /** * If set to false, the modal's animation will be disabled. Possible animations: "slide-from-top", "slide-from-bottom", "pop" (use true instead) and "none" (use false instead). - * Default: true, "pop" + * Default: true */ animation?: boolean | string; @@ -113,6 +119,12 @@ declare module SweetAlert { * Default: "text" */ inputType?: string; + + /** + * When using the input-type, you can specify a placeholder to help the user. + * Default: null + */ + inputPlaceholder?: string; } interface Settings extends SettingsBase { From ee2357ab6de345132f971c1ab0d4fa98c9f0ad9f Mon Sep 17 00:00:00 2001 From: David Gardiner Date: Fri, 1 May 2015 19:24:09 +0930 Subject: [PATCH 068/534] Bring methods of Ember.Route up to date Extra RenderOptions Non-static CoreObject.create Generic alternate for get() Types for Promises --- ember/ember.d.ts | 620 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 596 insertions(+), 24 deletions(-) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 9fe420766..e5300d967 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Ember.js 1.0.0 +// Type definitions for Ember.js 1.11.3 // Project: http://emberjs.com/ // Definitions by: Jed Mao // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -387,8 +387,10 @@ interface DisconnectOutletOptions { interface RenderOptions { into?: string; - outlet?: string; controller?: string; + model?: any; + outlet?: string; + view?: string; } interface ModifyObserver { @@ -1683,7 +1685,21 @@ declare module Ember { cacheFor(keyName: string): any; decrementProperty(keyName: string, decrement?: number): number; endPropertyChanges(): Observable; + + /** + * Retrieves the value of a property from the object + * @param keyName + * @returns {} + */ get(keyName: string): any; + + /** + * Retrieves the value of a property from the object + * @param keyName + * @returns {} + */ + get(keyName: string): T; + getProperties(...args: string[]): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; @@ -1764,10 +1780,70 @@ declare module Ember { remove(obj: any): void; toArray(): any[]; } + + // FYI - RSVP source comes from https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/promise.js module RSVP { + interface PromiseResolve { + (value?: any): void; + } + interface PromiseReject { + (reason?: any): void; + } + interface PromiseResolverFunction { + (resolve: PromiseResolve, reject: PromiseReject): void; + } + class Promise { - constructor(resolver: Function, label?: string); - then(done?: Function, fail?: Function): Promise; + + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + @class RSVP.Promise + @param {function} resolver + @param {String} label optional string for labeling the promise. + Useful for tooling. + @constructor + */ + constructor(resolver: PromiseResolverFunction, label?: string); + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + @method then + @param {Function} onFulfilled + @param {Function} onRejected + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} + */ + then(onFulfilled?: Function, onRejected?: Function): Promise; + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + @method catch + @param {Function} onRejection + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} + */ + catch(onRejection: Function, label?: string): Promise; + + /** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + + @method finally + @param {Function} callback + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} + */ + finally(callback: Function, label?: string): Promise; } } class RenderBuffer { @@ -1789,41 +1865,531 @@ declare module Ember { elementTag: string; parentBuffer: RenderBuffer; } - class Route extends Object implements ActionHandlerMixin { - static detect(obj: any): boolean; - static detectInstance(obj: any): boolean; - /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ - static eachComputedProperty(callback: Function, binding: {}): void; - /** - Returns the original hash that was passed to meta(). - @param key property name - **/ - static metaForProperty(key: string): {}; + + /** + The `Ember.Route` class is used to define individual routes. Refer to + the [routing guide](http://emberjs.com/guides/routing/) for documentation. + */ + class Route extends Object implements ActionHandlerMixin, Evented { + static isClass: boolean; static isMethod: boolean; + + /** + This hook is executed when the router enters the route. It is not executed + when the model for the route changes. + @method activate + */ activate: Function; + + /** + This hook is called after this route's model has resolved. + It follows identical async/promise semantics to `beforeModel` + but is provided the route's resolved model in addition to + the `transition`, and is therefore suited to performing + logic that can only take place after the model has already + resolved. + + Refer to documentation for `beforeModel` for a description + of transition-pausing semantics when a promise is returned + from this hook. + @method afterModel + @param {Object} resolvedModel the value returned from `model`, + or its resolved value if it was a promise + @param {Transition} transition + @return {Promise} if the value returned from this hook is + a promise, the transition will pause until the transition + resolves. Otherwise, non-promise return values are not + utilized in any way. + */ afterModel(resolvedModel: any, transition: EmberStates.Transition): RSVP.Promise; + + /** + This hook is the first of the route entry validation hooks + called when an attempt is made to transition into a route + or one of its children. It is called before `model` and + `afterModel`, and is appropriate for cases when: + 1) A decision can be made to redirect elsewhere without + needing to resolve the model first. + 2) Any async operations need to occur first before the + model is attempted to be resolved. + This hook is provided the current `transition` attempt + as a parameter, which can be used to `.abort()` the transition, + save it for a later `.retry()`, or retrieve values set + on it from a previous hook. You can also just call + `this.transitionTo` to another route to implicitly + abort the `transition`. + You can return a promise from this hook to pause the + transition until the promise resolves (or rejects). This could + be useful, for instance, for retrieving async code from + the server that is required to enter a route. + + @method beforeModel + @param {Transition} transition + @return {Promise} if the value returned from this hook is + a promise, the transition will pause until the transition + resolves. Otherwise, non-promise return values are not + utilized in any way. + */ beforeModel(transition: EmberStates.Transition): RSVP.Promise; + + /** + The controller associated with this route. + + @property controller + @type Ember.Controller + @since 1.6.0 + */ + controller: Controller; + + /** + Returns the controller for a particular route or name. + The controller instance must already have been created, either through entering the + associated route or using `generateController`. + + @method controllerFor + @param {String} name the name of the route or controller + @return {Ember.Controller} + */ controllerFor(name: string): Controller; + + /** + The name of the controller to associate with this route. + By default, Ember will lookup a route's controller that matches the name + of the route (i.e. `App.PostController` for `App.PostRoute`). However, + if you would like to define a specific controller to use, you can do so + using this property. + This is useful in many ways, as the controller specified will be: + * passed to the `setupController` method. + * used as the controller for the view being rendered by the route. + * returned from a call to `controllerFor` for the route. + @property controllerName + @type String + @default null + @since 1.4.0 + */ + controllerName: string; + + /** + This hook is executed when the router completely exits this route. It is + not executed when the model for the route changes. + @method deactivate + */ deactivate: Function; - disconnectOutlet(options?: DisconnectOutletOptions): void; - generateController(name: string, model: {}): void; - model(params: {}, transition: EmberStates.Transition): any; + + /** + Deserializes value of the query parameter based on defaultValueType + @method deserializeQueryParam + @param {Object} value + @param {String} urlKey + @param {String} defaultValueType + */ + deserializeQueryParam(value: any, urlKey: string, defaultValueType: string): any; + + /** + Disconnects a view that has been rendered into an outlet. + You may pass any or all of the following options to `disconnectOutlet`: + * `outlet`: the name of the outlet to clear (default: 'main') + * `parentView`: the name of the view containing the outlet to clear + (default: the view rendered by the parent route) + + @method disconnectOutlet + @param {Object|String} options the options hash or outlet name + */ + disconnectOutlet(options: DisconnectOutletOptions|string): void; + + /** + @method findModel + @param {String} type the model type + @param {Object} value the value passed to find + */ + findModel(type: string, value: any): any; + + /** + Generates a controller for a route. + If the optional model is passed then the controller type is determined automatically, + e.g., an ArrayController for arrays. + + @method generateController + @param {String} name the name of the controller + @param {Object} model the model to infer the type of the controller (optional) + */ + generateController(name: string, model: {}): Controller; + + /** + Perform a synchronous transition into another route without attempting + to resolve promises, update the URL, or abort any currently active + asynchronous transitions (i.e. regular transitions caused by + `transitionTo` or URL changes). + This method is handy for performing intermediate transitions on the + way to a final destination route, and is called internally by the + default implementations of the `error` and `loading` handlers. + @method intermediateTransitionTo + @param {String} name the name of the route + @param {...Object} models the model(s) to be used while transitioning + to the route. + @since 1.2.0 + */ + intermediateTransitionTo(name: string, ...models: any[]): void; + + /** + A hook you can implement to convert the URL into the model for + this route. + + @method model + @param {Object} params the parameters extracted from the URL + @param {Transition} transition + @return {Object|Promise} the model for this route. If + a promise is returned, the transition will pause until + the promise resolves, and the resolved value of the promise + will be used as the model for this route. + */ + model(params: {}, transition: EmberStates.Transition): any|RSVP.Promise; + + /** + Returns the model of a parent (or any ancestor) route + in a route hierarchy. During a transition, all routes + must resolve a model object, and if a route + needs access to a parent route's model in order to + resolve a model (or just reuse the model from a parent), + it can call `this.modelFor(theNameOfParentRoute)` to + retrieve it. + + @method modelFor + @param {String} name the name of the route + @return {Object} the model object + */ modelFor(name: string): {}; + + /** + Retrieves parameters, for current route using the state.params + variable and getQueryParamsFor, using the supplied routeName. + @method paramsFor + @param {String} name + */ + paramsFor(name: string) : any; + + /** + Configuration hash for this route's queryParams. + @property queryParams + @for Ember.Route + @type Hash + */ + queryParams: {}; + + /** + Refresh the model on this route and any child routes, firing the + `beforeModel`, `model`, and `afterModel` hooks in a similar fashion + to how routes are entered when transitioning in from other route. + The current route params (e.g. `article_id`) will be passed in + to the respective model hooks, and if a different model is returned, + `setupController` and associated route hooks will re-fire as well. + An example usage of this method is re-querying the server for the + latest information using the same parameters as when the route + was first entered. + Note that this will cause `model` hooks to fire even on routes + that were provided a model object when the route was initially + entered. + @method refresh + @return {Transition} the transition object associated with this + attempted transition + @since 1.4.0 + */ + redirect(): EmberStates.Transition; + + + /** + Refresh the model on this route and any child routes, firing the + `beforeModel`, `model`, and `afterModel` hooks in a similar fashion + to how routes are entered when transitioning in from other route. + The current route params (e.g. `article_id`) will be passed in + to the respective model hooks, and if a different model is returned, + `setupController` and associated route hooks will re-fire as well. + An example usage of this method is re-querying the server for the + latest information using the same parameters as when the route + was first entered. + Note that this will cause `model` hooks to fire even on routes + that were provided a model object when the route was initially + entered. + @method refresh + @return {Transition} the transition object associated with this + attempted transition + @since 1.4.0 + */ + refresh(): EmberStates.Transition; + + /** + `render` is used to render a template into a region of another template + (indicated by an `{{outlet}}`). `render` is used both during the entry + phase of routing (via the `renderTemplate` hook) and later in response to + user interaction. + + @method render + @param {String} name the name of the template to render + @param {Object} [options] the options + @param {String} [options.into] the template to render into, + referenced by name. Defaults to the parent template + @param {String} [options.outlet] the outlet inside `options.template` to render into. + Defaults to 'main' + @param {String|Object} [options.controller] the controller to use for this template, + referenced by name or as a controller instance. Defaults to the Route's paired controller + @param {Object} [options.model] the model object to set on `options.controller`. + Defaults to the return value of the Route's model hook + */ render(name: string, options?: RenderOptions): void; + + /** + A hook you can use to render the template for the current route. + This method is called with the controller for the current route and the + model supplied by the `model` hook. By default, it renders the route's + template, configured with the controller for the route. + This method can be overridden to set up and render additional or + alternative templates. + + @method renderTemplate + @param {Object} controller the route's controller + @param {Object} model the route's model + */ renderTemplate(controller: Controller, model: {}): void; - // ReSharper disable once InconsistentNaming - replaceWith(name: string, ...object: any[]): void; - send(name: string, ...args: any[]): void; + + /** + Transition into another route while replacing the current URL, if possible. + This will replace the current history entry instead of adding a new one. + Beside that, it is identical to `transitionTo` in all other respects. See + 'transitionTo' for additional information regarding multiple models. + + @method replaceWith + @param {String} name the name of the route or a URL + @param {...Object} models the model(s) or identifier(s) to be used while + transitioning to the route. + @return {Transition} the transition object associated with this + attempted transition + */ + replaceWith(name: string, ...models: any[]): void; + + /** + A hook you can use to reset controller values either when the model + changes or the route is exiting. + + @method resetController + @param {Controller} controller instance + @param {Boolean} isExiting + @param {Object} transition + @since 1.7.0 + */ + resetController(controller: Ember.Controller, isExiting: boolean, transition: any): void; + + /** + A hook you can implement to convert the route's model into parameters + for the URL. + + The default `serialize` method will insert the model's `id` into the + route's dynamic segment (in this case, `:post_id`) if the segment contains '_id'. + If the route has multiple dynamic segments or does not contain '_id', `serialize` + will return `Ember.getProperties(model, params)` + This method is called when `transitionTo` is called with a context + in order to populate the URL. + @method serialize + @param {Object} model the route's model + @param {Array} params an Array of parameter names for the current + route (in the example, `['post_id']`. + @return {Object} the serialized parameters + */ serialize(model: {}, params: string[]): string; + + /** + Serializes value of the query parameter based on defaultValueType + @method serializeQueryParam + @param {Object} value + @param {String} urlKey + @param {String} defaultValueType + */ + serializeQueryParam(value: any, urlKey: string, defaultValueType: string): string; + + /** + Serializes the query parameter key + @method serializeQueryParamKey + @param {String} controllerPropertyName + */ + serializeQueryParamKey(controllerPropertyName: string): string; + + /** + A hook you can use to setup the controller for the current route. + This method is called with the controller for the current route and the + model supplied by the `model` hook. + By default, the `setupController` hook sets the `model` property of + the controller to the `model`. + If you implement the `setupController` hook in your Route, it will + prevent this default behavior. If you want to preserve that behavior + when implementing your `setupController` function, make sure to call + `_super` + @method setupController + @param {Controller} controller instance + @param {Object} model + */ setupController(controller: Controller, model: {}): void; - // ReSharper disable once InconsistentNaming + + /** + Store property provides a hook for data persistence libraries to inject themselves. + By default, this store property provides the exact same functionality previously + in the model hook. + Currently, the required interface is: + `store.find(modelName, findArguments)` + @method store + @param {Object} store + */ + store(store: any): any; + + /** + The name of the template to use by default when rendering this routes + template. + This is similar with `viewName`, but is useful when you just want a custom + template without a view. + + @property templateName + @type String + @default null + @since 1.4.0 + */ + templateName: string; + + /** + Transition the application into another route. The route may + be either a single route or route path + + @method transitionTo + @param {String} name the name of the route or a URL + @param {...Object} models the model(s) or identifier(s) to be used while + transitioning to the route. + @param {Object} [options] optional hash with a queryParams property + containing a mapping of query parameters + @return {Transition} the transition object associated with this + attempted transition + */ transitionTo(name: string, ...object: any[]): EmberStates.Transition; + + /** + The name of the view to use by default when rendering this routes template. + When rendering a template, the route will, by default, determine the + template and view to use from the name of the route itself. If you need to + define a specific view, set this property. + This is useful when multiple routes would benefit from using the same view + because it doesn't require a custom `renderTemplate` method. + @property viewName + @type String + @default null + @since 1.4.0 + */ + viewName: string; + + // ActionHandlerMixin methods + + /** + Sends an action to the router, which will delegate it to the currently + active route hierarchy per the bubbling rules explained under actions + + @method send + @param {String} actionName The action to trigger + @param {*} context a context to send with the action + */ + send(name: string, ...args: any[]): void; + + /** + The collection of functions, keyed by name, available on this + `ActionHandler` as action targets. + These functions will be invoked when a matching `{{action}}` is triggered + from within a template and the application's current route is this route. + Actions can also be invoked from other parts of your application + via `ActionHandler#send`. + The `actions` hash will inherit action handlers from + the `actions` hash defined on extended parent classes + or mixins rather than just replace the entire hash. + + Within a Controller, Route, View or Component's action handler, + the value of the `this` context is the Controller, Route, View or + Component object: + + It is also possible to call `this._super.apply(this, arguments)` from within an + action handler if it overrides a handler defined on a parent + class or mixin. + + ## Bubbling + By default, an action will stop bubbling once a handler defined + on the `actions` hash handles it. To continue bubbling the action, + you must return `true` from the handler + + @property actions + @type Hash + @default null + */ actions: ActionsHash; + + // Evented methods + + /** + Subscribes to a named event with given function. + + An optional target can be passed in as the 2nd argument that will + be set as the "this" for the callback. This is a good way to give your + function access to the object triggering the event. When the target + parameter is used the callback becomes the third argument. + + @method on + @param {String} name The name of the event + @param {Object} [target] The "this" binding for the callback + @param {Function} method The callback to execute + @return this + */ + on(name: string, target: any, method: Function): Evented; + + /** + Subscribes a function to a named event and then cancels the subscription + after the first time the event is triggered. It is good to use ``one`` when + you only care about the first time an event has taken place. + This function takes an optional 2nd argument that will become the "this" + value for the callback. If this argument is passed then the 3rd argument + becomes the function. + + @method one + @param {String} name The name of the event + @param {Object} [target] The "this" binding for the callback + @param {Function} method The callback to execute + @return this + */ + one(name: string, target: any, method: Function): Evented; + + /** + Triggers a named event for the object. Any additional arguments + will be passed as parameters to the functions that are subscribed to the + event. + + @method trigger + @param {String} name The name of the event + @param {Object...} args Optional arguments to pass on + */ + trigger(name: string, ...args: string[]): void; + + /** + Cancels subscription for given name, target, and method. + + @method off + @param {String} name The name of the event + @param {Object} target The target of the subscription + @param {Function} method The function of the subscription + @return this + */ + off(name: string, target:any , method: Function): Evented; + + /** + Checks to see if object has any subscriptions for named event. + + @method has + @param {String} name The name of the event + @return {Boolean} does the object have a subscription for event + */ + has(name: string): boolean; } + class Router extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; @@ -2531,6 +3097,9 @@ declare module Em { class Observable extends Ember.Observable { } class OrderedSet extends Ember.OrderedSet { } module RSVP { + interface PromiseResolve extends Ember.RSVP.PromiseResolve { } + interface PromiseReject extends Ember.RSVP.PromiseReject { } + interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { } class Promise extends Ember.RSVP.Promise { } } class RenderBuffer extends Ember.RenderBuffer { } @@ -2772,6 +3341,9 @@ declare module "Ember" { class Observable extends Ember.Observable { } class OrderedSet extends Ember.OrderedSet { } module RSVP { + interface PromiseResolve extends Ember.RSVP.PromiseResolve { } + interface PromiseReject extends Ember.RSVP.PromiseReject { } + interface PromiseResolverFunction extends Ember.RSVP.PromiseResolverFunction { } class Promise extends Ember.RSVP.Promise { } } class RenderBuffer extends Ember.RenderBuffer { } From 6a83bf1fc3b4f3e6851ec9c6472a13d99661e844 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Fri, 1 May 2015 15:26:24 +0200 Subject: [PATCH 069/534] Rename "angular-i18next" to "ng-i18next". --- .../ng-i18next-tests.ts | 4 ++-- .../angular-i18next.d.ts => ng-i18next/ng-i18next.d.ts | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename angular-i18next/angular-i18next-tests.ts => ng-i18next/ng-i18next-tests.ts (53%) rename angular-i18next/angular-i18next.d.ts => ng-i18next/ng-i18next.d.ts (100%) diff --git a/angular-i18next/angular-i18next-tests.ts b/ng-i18next/ng-i18next-tests.ts similarity index 53% rename from angular-i18next/angular-i18next-tests.ts rename to ng-i18next/ng-i18next-tests.ts index d38285ba9..243a39865 100644 --- a/angular-i18next/angular-i18next-tests.ts +++ b/ng-i18next/ng-i18next-tests.ts @@ -1,6 +1,6 @@ -/// +/// /** -* @summary Test for "angular-i18next" with options. +* @summary Test for "ng-i18next" with options. */ function testOptions() { var $provider: angular.i18next.I18nextProvider; diff --git a/angular-i18next/angular-i18next.d.ts b/ng-i18next/ng-i18next.d.ts similarity index 100% rename from angular-i18next/angular-i18next.d.ts rename to ng-i18next/ng-i18next.d.ts From dd824794707215c3d8eadaab3ce82f3dcf8dbea2 Mon Sep 17 00:00:00 2001 From: Arnaud Bosc Date: Fri, 1 May 2015 19:23:19 +0200 Subject: [PATCH 070/534] Update angularfire / firebase. --- angularfire/angularfire-tests.ts | 79 +++++++++++++++++++------------- angularfire/angularfire.d.ts | 32 ++++++++----- firebase/firebase.d.ts | 35 ++++++++++++-- 3 files changed, 99 insertions(+), 47 deletions(-) diff --git a/angularfire/angularfire-tests.ts b/angularfire/angularfire-tests.ts index 7d39e4181..d636c88e6 100644 --- a/angularfire/angularfire-tests.ts +++ b/angularfire/angularfire-tests.ts @@ -62,8 +62,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi obj.$save(); }); - // $inst() - if (obj.$inst() !== sync) throw "error"; + // $ref() + if (obj.$ref() !== sync) throw "error"; // $bindTo() obj.$bindTo($scope, "data").then(function () { @@ -81,8 +81,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi // $destroy() obj.$destroy(); - // $extendFactory() - var NewFactory = $FirebaseObject.$extendFactory({ + // $extend() + var NewFactory = $FirebaseObject.$extend({ getMyFavoriteColor: function () { return this.favoriteColor + ", no green!"; // obscure Monty Python reference } @@ -94,8 +94,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi { var list = sync.$asArray(); - // $inst() - if (list.$inst() !== sync) throw "error"; + // $ref() + if (list.$ref() !== sync) throw "error"; // $add() list.$add({ foo: "foo value" }); @@ -145,8 +145,8 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi // $destroy() list.$destroy(); - // $extendFactory() - var ArrayWithSum = $FirebaseArray.$extendFactory({ + // $extend() + var ArrayWithSum = $FirebaseArray.$extend({ sum: function () { var total = 0; angular.forEach(this.$list, function (rec) { @@ -167,30 +167,43 @@ interface AngularFireAuthScope extends ng.IScope { loginObj: AngularFireAuth; } -myapp.controller("MyAuthController", ["$scope", "$firebaseSimpleLogin", - function($scope: AngularFireAuthScope, $firebaseSimpleLogin: AngularFireAuthService) { +myapp.controller("MyAuthController", ["$scope", "$firebaseAuth", + function($scope: AngularFireAuthScope, $firebaseAuth: AngularFireAuthService) { var dataRef = new Firebase(url); - $scope.loginObj = $firebaseSimpleLogin(dataRef); - $scope.loginObj.$getCurrentUser().then(_ => { - }); - var email = 'my@email.com'; - var password = 'mypassword'; - $scope.loginObj.$login('password', { - email: email, - password: password - }).then(function(user) { - console.log('Logged in as: ', user.uid); - }, function(error) { - console.error('Login failed: ', error); - }); - $scope.loginObj.$logout(); - $scope.loginObj.$createUser(email, password).then(_ => { - }); - $scope.loginObj.$changePassword(email, password, password).then(_ => { - }); - $scope.loginObj.$removeUser(email, password).then(_ => { - }); - $scope.loginObj.$sendPasswordResetEmail(email).then(_ => { - }); + $scope.loginObj = $firebaseAuth(dataRef); + $scope.loginObj.$getAuth(); + var credentials = { + email: 'my@email.com', + password: 'mypassword' + }; + var resetPasswordCredentials = { + email: 'my@email.com' + }; + var changePasswordCredentials = { + email: 'my@email.com', + oldPassword: 'mypassword', + newPassword: 'mypassword' + }; + var changeUserCredentials = { + oldEmail: 'my@email.com', + newEmail: 'my@email.com', + password: 'mypassword' + }; + $scope.loginObj.$authWithCustomToken("token").then(_ => {}); + $scope.loginObj.$authAnonymously().then(_ => {}); + $scope.loginObj.$authWithPassword(credentials).then(_ => {}); + $scope.loginObj.$authWithOAuthPopup("github").then(_ => {}); + $scope.loginObj.$authWithOAuthRedirect("google").then(_ => {}); + $scope.loginObj.$authWithOAuthToken("twitter", "token").then(_ => {}); + $scope.loginObj.$getAuth(); + $scope.loginObj.$onAuth(() => {}); + $scope.loginObj.$unauth(); + $scope.loginObj.$waitForAuth(); + $scope.loginObj.$requireAuth(); + $scope.loginObj.$createUser(credentials).then(_ => {}); + $scope.loginObj.$removeUser(credentials).then(_ => {}); + $scope.loginObj.$changeEmail(changeUserCredentials).then(_ => {}); + $scope.loginObj.$changePassword(changePasswordCredentials).then(_ => {}); + $scope.loginObj.$resetPassword(resetPasswordCredentials).then(_ => {}); } -]); \ No newline at end of file +]); diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index e4129e4ba..195fde1a0 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -28,17 +28,18 @@ interface AngularFireObject extends AngularFireSimpleObject { $id: string; $priority: number; $value: any; + $remove(): ng.IPromise; $save(): ng.IPromise; $loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise; - $inst(): AngularFire; + $ref(): AngularFire; $bindTo(scope: ng.IScope, varName: string): ng.IPromise; $watch(callback: Function, context?: any): Function; $destroy(): void; } interface AngularFireObjectService { - $extendFactory(ChildClass: Object, methods?: Object): Object; + $extend(ChildClass: Object, methods?: Object): Object; } interface AngularFireArray extends Array { @@ -51,12 +52,12 @@ interface AngularFireArray extends Array { $loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise; - $inst(): AngularFire; + $ref(): AngularFire; $watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function; $destroy(): void; } interface AngularFireArrayService { - $extendFactory(ChildClass: Object, methods?: Object): Object; + $extend(ChildClass: Object, methods?: Object): Object; } interface AngularFireSimpleObject { @@ -72,11 +73,20 @@ interface AngularFireAuthService { } interface AngularFireAuth { - $getCurrentUser(): ng.IPromise; - $login(provider: string, options?: Object): ng.IPromise; - $logout(): void; - $createUser(email: string, password: string): ng.IPromise; - $changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise; - $removeUser(email: string, password: string): ng.IPromise; - $sendPasswordResetEmail(email: string): ng.IPromise; + $authWithCustomToken(authToken: string, options?: Object): ng.IPromise; + $authAnonymously(options?: Object): ng.IPromise; + $authWithPassword(credentials: FirebaseCredentials, options?: Object): ng.IPromise; + $authWithOAuthPopup(provider: string, options?: Object): ng.IPromise; + $authWithOAuthRedirect(provider: string, options?: Object): ng.IPromise; + $authWithOAuthToken(provider: string, credentials: Object|string, options?: Object): ng.IPromise; + $getAuth(): FirebaseAuthData; + $onAuth(callback: Function, context?: any): Function; + $unauth(): void; + $waitForAuth(): ng.IPromise; + $requireAuth(): ng.IPromise; + $createUser(credentials: FirebaseCredentials): ng.IPromise; + $removeUser(credentials: FirebaseCredentials): ng.IPromise; + $changeEmail(credentials: FirebaseNewUserCredentials): ng.IPromise; + $changePassword(credentials: FirebaseNewPasswordCredentials): ng.IPromise; + $resetPassword(credentials: FirebaseResetPasswordCredentials): ng.IPromise; } diff --git a/firebase/firebase.d.ts b/firebase/firebase.d.ts index fdb808ec4..4c9ac8659 100644 --- a/firebase/firebase.d.ts +++ b/firebase/firebase.d.ts @@ -9,6 +9,11 @@ interface FirebaseAuthResult { } interface FirebaseDataSnapshot { + /** + * Returns true if this DataSnapshot contains any data. + * It is slightly more efficient than using snapshot.val() !== null. + */ + exists(): boolean; /** * Gets the JavaScript object representation of the DataSnapshot. */ @@ -108,6 +113,10 @@ interface FirebaseQuery { * Generates a new Query object ordered by key name. */ orderByKey(): FirebaseQuery; + /** + * Generates a new Query object ordered by child values. + */ + orderByValue(): FirebaseQuery; /** * Generates a new Query object ordered by priority. */ @@ -255,10 +264,14 @@ interface Firebase extends FirebaseQuery { * Creates a new user account using an email / password combination. */ createUser(credentials: FirebaseCredentials, onComplete: (error: any) => void): void; + /** + * Updates the email associated with an email / password user account. + */ + changeEmail(credentials: FirebaseNewUserCredentials, onComplete: (error: any) => void): void; /** * Change the password of an existing user using an email / password combination. */ - changePassword(credentials: { email: string; oldPassword: string; newPassword: string }, onComplete: (error: any) => void): void; + changePassword(credentials: FirebaseNewPasswordCredentials, onComplete: (error: any) => void): void; /** * Removes an existing user account using an email / password combination. */ @@ -266,7 +279,7 @@ interface Firebase extends FirebaseQuery { /** * Sends a password-reset email to the owner of the account, containing a token that may be used to authenticate and change the user password. */ - resetPassword(credentials: { email: string }, onComplete: (error: any) => void): void; + resetPassword(credentials: FirebaseResetPasswordCredentials, onComplete: (error: any) => void): void; onDisconnect(): FirebaseOnDisconnect; } interface FirebaseStatic { @@ -305,4 +318,20 @@ interface FirebaseAuthData { interface FirebaseCredentials { email: string; password: string; -} \ No newline at end of file +} + +interface FirebaseNewPasswordCredentials { + email: string; + oldPassword: string; + newPassword: string; +} + +interface FirebaseNewUserCredentials { + oldEmail: string; + newEmail: string; + password: string; +} + +interface FirebaseResetPasswordCredentials { + email: string; +} From 09ba90cce0b63bedbe9986047f51bbe77e91bc84 Mon Sep 17 00:00:00 2001 From: Nathan Pitman Date: Fri, 1 May 2015 17:40:07 +1200 Subject: [PATCH 071/534] Added type bindings for the qtip2 library (including tooltip setup, excluding its API). --- qtip2/qtip2-tests.ts | 537 +++++++++++++++++++++++++++++++++ qtip2/qtip2-tests.ts.tscparams | 2 + qtip2/qtip2.d.ts | 153 ++++++++++ 3 files changed, 692 insertions(+) create mode 100644 qtip2/qtip2-tests.ts create mode 100644 qtip2/qtip2-tests.ts.tscparams create mode 100644 qtip2/qtip2.d.ts diff --git a/qtip2/qtip2-tests.ts b/qtip2/qtip2-tests.ts new file mode 100644 index 000000000..f6e0b8997 --- /dev/null +++ b/qtip2/qtip2-tests.ts @@ -0,0 +1,537 @@ +/// + +var $a = $('_'); + + +/** + * Test core properties (http://qtip2.com/options#core) + */ +function testCoreProperties() { + // Test with all core options specififed + $a.qtip({ + content: 'Jan Jansen', + id: 'jan-jansen', + prerender: true, + overwrite: true, + suppress: true, + metadata: { + type: 'html5', + name: 'qtipopts' + } + }); + + // Test ID as boolean + $a.qtip({ + content: 'yoshimo', + id: false + }); + + // Test with no options specified + $a.qtip({ + content: 'aerie' + }); +} + + +/** + * http://qtip2.com/options#content.text + */ +function testContentText() { + // Shorthand string + $a.qtip({ + content: 'valygar' + }); + + // Regular string + $a.qtip({ + content: { text: 'kivan' } + }); + + // Shorthand boolean + $a.qtip({ + content: true + }); + + // Regular boolean + $a.qtip({ + content: { text: true } + }); + + // Shorthand Deferred / Promise + $a.qtip({ + content: $.Deferred().resolve('cernd') + }); + + $a.qtip({ + content: $.Deferred().reject().promise() + }); + + // Regular Deferred / Promise + $a.qtip({ + content: { text: $.Deferred().resolve('horatio') } + }); + + $a.qtip({ + content: { text: $.Deferred().reject().promise() } + }); + + // Shorthand function + $a.qtip({ + content: function(event, api) { } + }); + + $a.qtip({ + content: function(event) { return 2; } + }); + + $a.qtip({ + content: function() { } + }); + + // Regular function + $a.qtip({ + content: { text: function(event, api) { } } + }); + + $a.qtip({ + content: { text: function(event) { return 2; } } + }); + + $a.qtip({ + content: { text: function() { } } + }); + + // Shorthand jQuery elements + $a.qtip({ + content: $('.irenicus') + }); + + // Regular jQuery elements + $a.qtip({ + content: { text: $('.irenicus') } + }); +} + + +/** + * http://qtip2.com/options#content.title + */ +function testContentTitle() { + // Shorthand string + $a.qtip({ + content: { title: 'keldorn' } + }); + + // Regular string + $a.qtip({ + content: { + title: { text: 'nalia' } + } + }); + + // Shorthand boolean + $a.qtip({ + content: { title: true } + }); + + // Regular boolean + $a.qtip({ + content: { + title: { text: true } + } + }); + + // Shorthand Deferred / Promise + $a.qtip({ + content: { title: $.Deferred().resolve('mazzy') } + }); + + $a.qtip({ + content: { title: $.Deferred().reject().promise() } + }); + + // Regular Deferred / Promise + $a.qtip({ + content: { title: { text: $.Deferred().resolve('bodhi') } } + }); + + $a.qtip({ + content: { title: { text: $.Deferred().reject().promise() } } + }); + + // Shorthand function + $a.qtip({ + content: { title: function(event, api) {} } + }); + + $a.qtip({ + content: { title: function(event) { return 2; } } + }); + + $a.qtip({ + content: { title: function() { } } + }); + + // Regular function + $a.qtip({ + content: { title: { text: function(event, api) { } } } + }); + + $a.qtip({ + content: { title: { text: function(event) { return 2; } } } + }); + + $a.qtip({ + content: { title: { text: function() { } } } + }); + + // Shorthand jQuery elements + $a.qtip({ + content: { title: $('.irenicus') } + }); + + // Regular jQuery elements + $a.qtip({ + content: { title: { text: $('.irenicus') } } + }); +} + + +/** + * http://qtip2.com/options#content.button + */ +function testContentButtonProperty() { + $a.qtip({ + content: { button: $('.minsc') } + }); + + $a.qtip({ + content: { button: 'jaheira' } + }); + + $a.qtip({ + content: { button: true } + }); +} + + +/** + * http://qtip2.com/options#content.attr + */ +function testContentAttrProperty() { + $a.qtip({ + content: { attr: 'viconia' } + }); +} + + +/** + * http://qtip2.com/options#position + */ +function testPositionProperty() { + // Shorthand + $a.qtip({ position: 'top left' }); + + // The below four calls test all combinations of all sub-properties + $a.qtip({ + position: { + target: $('.khalid'), + my: 'top left', + at: 'bottom right', + container: $('.edwin-odesseiron'), + viewport: $('.dynaheir'), + effect: function(api, pos, viewport) { }, + adjust: { x: 2 } + } + }); + + $a.qtip({ + position: { + target: [2, 2], + my: true, + at: true, + container: false, + viewport: true, + effect: function(api, pos) { return 2; }, + adjust: { y: 2 } + } + }); + + $a.qtip({ + position: { + target: 'mouse', + effect: function(api) {}, + adjust: { x: 2, y: 2 } + } + }); + + $a.qtip({ + position: { + target: false, + effect: function() {}, + adjust: { + mouse: true, + resize: true, + scroll: false, + method: 'flipinvert' + } + } + }); + + $a.qtip({ + position: { + adjust: { } + } + }); +} + + +/** + * http://qtip2.com/options#show + */ +function testShowProperty() { + // Shorthand + $a.qtip({ show: true }); + $a.qtip({ show: 'mouseenter' }); + $a.qtip({ show: $('.korgan') }); + + // The below calls test all combinations of all sub-properties + $a.qtip({ + show: { + target: $('.gorion'), + event: false, + delay: 42, + solo: $('.imoen'), + ready: true, + effect: function(offset) { + }, + modal: true + } + }); + + $a.qtip({ + show: { + target: false, + event: 'mouseenter', + solo: '.qtips', + effect: true, + modal: { + on: true, + blur: false, + escape: true, + stealfocus: true, + effect: true + } + } + }); + + $a.qtip({ + show: { + solo: false, + modal: { + effect: function(state) {} + } + } + }); + + $a.qtip({ + show: { + modal: {} + } + }); +} + + +/** + * http://qtip2.com/options#hide + */ +function testHideProperty() { + // Shorthand + $a.qtip({ hide: 'mouseenter' }); + $a.qtip({ hide: $('.montaron') }); + + // The below calls test all combinations of all sub-properties + $a.qtip({ + hide: { + target: $('.gorion'), + event: false, + delay: 42, + inactive: 64, + fixed: true, + leave: 'window', + distance: 32, + effect: function(offset) { + }, + } + }); + + $a.qtip({ + hide: { + target: false, + event: 'mouseenter', + inactive: false, + leave: false, + distance: false, + effect: true, + } + }); +} + + +/** + * http://qtip2.com/options#style + */ +function testStyleProperty() { + // Shorthand + $a.qtip({ style: 'kagain' }); + + // The below calls test all combinations of all sub-properties + $a.qtip({ + style: { + classes: 'anomen', + def: true, + widget: true, + width: '24pt', + height: '24pt', + tip: 'top left' + } + }); + + $a.qtip({ + show: { + classes: false, + width: 24, + height: 24, + tip: false + } + }); + + $a.qtip({ + show: { + classes: false, + width: false, + height: false, + tip: { + corner: 'bottom right', + mimic: 'bottom right', + border: 3, + width: 27, + height: 32, + offset: 1 + } + } + }); + + $a.qtip({ + show: { + tip: { + corner: true, + mimic: true, + border: false + } + } + }); + + $a.qtip({ + show: { + tip: { } + } + }); +} + + +function baseCase() { + $a.qtip(); + $a.qtip({}); + + $a.qtip('horatio'); + $a.qtip('activate'); + $a.qtip('deactivate'); +} + + +/** + * Test with all options specified. Copied from http://qtip2.com/options#global and amended. + */ +function allTogetherNow() { + $a.qtip({ + prerender: false, + id: false, + overwrite: true, + suppress: true, + content: { + title: true, + attr: 'title', + text: false, + button: false + }, + position: { + my: 'top left', + at: 'bottom right', + target: false, + container: false, + viewport: false, + adjust: { + x: 0, y: 0, + mouse: true, + resize: true, + method: 'flip flip' + }, + effect: function(api, pos, viewport) { + $(this).animate(pos, { + duration: 200, + queue: false + }); + } + }, + show: { + target: false, + event: 'mouseenter', + effect: true, + delay: 90, + solo: false, + ready: false, + modal: { + on: false, + effect: true, + blur: true, + escape: true + } + }, + hide: { + target: false, + event: 'mouseleave', + effect: true, + delay: 0, + fixed: false, + inactive: false, + leave: 'window', + distance: false + }, + style: { + classes: '', + widget: false, + width: false, + height: false, + tip: { + corner: true, + mimic: false, + width: 8, + height: 8, + border: true, + offset: 0 + } + }, + events: { + render: null, + move: null, + show: null, + hide: null, + toggle: null, + visible: null, + hidden: null, + focus: null, + blur: null + } + }); +} \ No newline at end of file diff --git a/qtip2/qtip2-tests.ts.tscparams b/qtip2/qtip2-tests.ts.tscparams new file mode 100644 index 000000000..2280b0116 --- /dev/null +++ b/qtip2/qtip2-tests.ts.tscparams @@ -0,0 +1,2 @@ + +--noImplicitAny \ No newline at end of file diff --git a/qtip2/qtip2.d.ts b/qtip2/qtip2.d.ts new file mode 100644 index 000000000..dd84052ce --- /dev/null +++ b/qtip2/qtip2.d.ts @@ -0,0 +1,153 @@ +// Type definitions for qtip2 v2.2.1 +// Project: http://http://qtip2.com/ +// Definitions by: Nathan Pitman +// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Notes: +// - Deprecated functionality is not supported. + + +/// + +declare module QTip2 { + /** + * Content property + */ + type Title = string | JQuery | Func | boolean | JQueryGenericPromise; + type Text = string | JQuery | Func | boolean | JQueryGenericPromise; + + interface Content { + title?: Title | { text: Title }; + text?: Text; + attr?: string; + button?: string | JQuery | boolean; + } + + + /** + * Position property + */ + interface PositionAdjust { + x?: number; + y?: number; + mouse?: boolean; + resize?: boolean; + scroll?: boolean; + method?: string; + } + + type Target = JQuery | number[] | string; + + interface Position { + my?: string | boolean; + at?: string | boolean; + target?: Target | boolean; + container?: JQuery | boolean; + viewport?: JQuery | boolean; + effect?: boolean | ((api: any, pos: any, viewport: any) => any); + adjust?: PositionAdjust; + } + + + /** + * Show property + */ + interface Show { + target?: JQuery | boolean; + event?: string | boolean; + delay?: number; + solo?: JQuery | string | boolean; + ready?: boolean; + effect?: boolean | ((offset: any) => any); + modal?: boolean | Modal; + } + + interface Modal + { + on?: boolean; + blur?: boolean; + escape?: boolean; + stealfocus?: boolean; + effect?: boolean | ((state: any) => any); + } + + + /** + * Hide property + */ + interface Hide { + target?: JQuery | boolean; + event?: string | boolean; + delay?: number; + inactive?: number | boolean; + fixed?: boolean; + // TODO: What is going on here? + leave?: string | boolean; + distance?: number | boolean; + effect?: boolean | ((offset: any) => any); + } + + + /** + * Style property + */ + interface Tip { + corner?: string | boolean; + mimic?: string | boolean; + border?: number | boolean; + width?: number; + height?: number; + offset?: number; + } + + interface Style { + classes?: string | boolean; + def?: boolean; + widget?: boolean; + width: string | number | boolean; + height: string | number | boolean; + tip?: string | boolean | Tip; + } + + + /** + * Events property + */ + type Func = (event: any, api: any) => any; + + interface Events { + render?: Func; + show?: Func; + hide?: Func; + toggle?: Func; + visible?: Func; + hidden?: Func; + move?: Func; + focus?: Func; + blur?: Func; + } + + + /** + * Options + */ + interface QTipOptions { + id?: string | boolean; + prerender?: boolean; + overwrite?: boolean; + suppress?: boolean; + metadata?: any; + content?: Text | Content; + position?: string | Position; + style?: string | Style; + show?: string | boolean | JQuery | Show; + hide?: string | JQuery | Hide; + events?: Events; + } +} + + +interface JQuery { + qtip(): JQuery; + + qtip(options: QTip2.QTipOptions): JQuery; +} From b02be7c1c8c305b7dc71b2a335730f4d44f36795 Mon Sep 17 00:00:00 2001 From: Nathan Pitman Date: Sat, 2 May 2015 20:22:43 +1200 Subject: [PATCH 072/534] Added type bindings for QTip2 API. --- qtip2/qtip2-tests.ts | 536 ++++++++++++++++++++++++++++++++++++++++++- qtip2/qtip2.d.ts | 318 ++++++++++++++++++++++--- 2 files changed, 812 insertions(+), 42 deletions(-) diff --git a/qtip2/qtip2-tests.ts b/qtip2/qtip2-tests.ts index f6e0b8997..ea4e16099 100644 --- a/qtip2/qtip2-tests.ts +++ b/qtip2/qtip2-tests.ts @@ -77,11 +77,11 @@ function testContentText() { // Shorthand function $a.qtip({ - content: function(event, api) { } + content: function(event: Event, api: QTip2.Api) { } }); $a.qtip({ - content: function(event) { return 2; } + content: function(event: Event) { return 2; } }); $a.qtip({ @@ -90,11 +90,11 @@ function testContentText() { // Regular function $a.qtip({ - content: { text: function(event, api) { } } + content: { text: function(event: Event, api: QTip2.Api) {} } }); $a.qtip({ - content: { text: function(event) { return 2; } } + content: { text: function(event: Event) { return 2; } } }); $a.qtip({ @@ -161,11 +161,11 @@ function testContentTitle() { // Shorthand function $a.qtip({ - content: { title: function(event, api) {} } + content: { title: function(event: Event, api: QTip2.Api) {} } }); $a.qtip({ - content: { title: function(event) { return 2; } } + content: { title: function(event: Event) { return 2; } } }); $a.qtip({ @@ -174,11 +174,11 @@ function testContentTitle() { // Regular function $a.qtip({ - content: { title: { text: function(event, api) { } } } + content: { title: { text: function(event: Event, api: QTip2.Api) { } } } }); $a.qtip({ - content: { title: { text: function(event) { return 2; } } } + content: { title: { text: function(event: Event) { return 2; } } } }); $a.qtip({ @@ -240,7 +240,7 @@ function testPositionProperty() { at: 'bottom right', container: $('.edwin-odesseiron'), viewport: $('.dynaheir'), - effect: function(api, pos, viewport) { }, + effect: function(api: QTip2.Api, pos: any, viewport: any) { }, adjust: { x: 2 } } }); @@ -252,7 +252,7 @@ function testPositionProperty() { at: true, container: false, viewport: true, - effect: function(api, pos) { return 2; }, + effect: function(api: QTip2.Api, pos: any) { return 2; }, adjust: { y: 2 } } }); @@ -260,7 +260,7 @@ function testPositionProperty() { $a.qtip({ position: { target: 'mouse', - effect: function(api) {}, + effect: function(api: QTip2.Api) {}, adjust: { x: 2, y: 2 } } }); @@ -534,4 +534,518 @@ function allTogetherNow() { blur: null } }); +} + + +/** + * http://qtip2.com/api#api-methods.get + */ +function testApiGetViaObject() { + $a.qtip({}); + + var api = $a.qtip('api'); + + api.get('id'); + api.get('prerender'); + api.get('overwrite'); + api.get('suppress'); + api.get('metadata'); + + api.get('content'); + api.get('content.text'); + api.get('content.attr'); + api.get('content.title'); + api.get('content.button'); + + api.get('position'); + api.get('position.my'); + api.get('position.at'); + api.get('position.target'); + api.get('position.container'); + api.get('position.viewport'); + any)> + api.get('position.effect'); + api.get('position.adjust'); + + api.get('show'); + api.get('show.target'); + api.get('show.event'); + api.get('show.delay'); + api.get('show.solo'); + api.get('show.ready'); + any)> api.get('show.effect'); + api.get('show.modal'); + + api.get('hide'); + api.get('hide.target'); + api.get('hide.event'); + api.get('hide.delay'); + api.get('hide.leave'); + api.get('hide.distance'); + any)> api.get('hide.effect'); + + api.get('style'); + api.get('style.classes'); + api.get('style.def'); + api.get('style.widget'); + api.get('style.width'); + api.get('style.height'); + api.get('style.tip'); + + api.get('events'); + api.get('events.render'); + api.get('events.show'); + api.get('events.hide'); + api.get('events.toggle'); + api.get('events.visible'); + api.get('events.hidde'); + api.get('events.move'); + api.get('events.focus'); + api.get('events.blur'); +} + + +/** + * http://qtip2.com/api#api.updating + */ +function testApiGetViaString() { + $a.qtip({}); + + $a.qtip('option', 'id'); + $a.qtip('option', 'prerender'); + $a.qtip('option', 'overwrite'); + $a.qtip('option', 'suppress'); + $a.qtip('option', 'metadata'); + + $a.qtip('option', 'content'); + $a.qtip('option', 'content.text'); + $a.qtip('option', 'content.attr'); + $a.qtip('option', 'content.title'); + $a.qtip('option', 'content.button'); + + $a.qtip('option', 'position'); + $a.qtip('option', 'position.my'); + $a.qtip('option', 'position.at'); + $a.qtip('option', 'position.target'); + $a.qtip('option', 'position.container'); + $a.qtip('option', 'position.viewport'); + any)> + $a.qtip('option', 'position.effect'); + $a.qtip('option', 'position.adjust'); + + $a.qtip('option', 'show'); + $a.qtip('option', 'show.target'); + $a.qtip('option', 'show.event'); + $a.qtip('option', 'show.delay'); + $a.qtip('option', 'show.solo'); + $a.qtip('option', 'show.ready'); + any)> $a.qtip('option', 'show.effect'); + $a.qtip('option', 'show.modal'); + + $a.qtip('option', 'hide'); + $a.qtip('option', 'hide.target'); + $a.qtip('option', 'hide.event'); + $a.qtip('option', 'hide.delay'); + $a.qtip('option', 'hide.leave'); + $a.qtip('option', 'hide.distance'); + any)> $a.qtip('option', 'hide.effect'); + + $a.qtip('option', 'style'); + $a.qtip('option', 'style.classes'); + $a.qtip('option', 'style.def'); + $a.qtip('option', 'style.widget'); + $a.qtip('option', 'style.width'); + $a.qtip('option', 'style.height'); + $a.qtip('option', 'style.tip'); + + $a.qtip('option', 'events'); + $a.qtip('option', 'events.render'); + $a.qtip('option', 'events.show'); + $a.qtip('option', 'events.hide'); + $a.qtip('option', 'events.toggle'); + $a.qtip('option', 'events.visible'); + $a.qtip('option', 'events.hidde'); + $a.qtip('option', 'events.move'); + $a.qtip('option', 'events.focus'); + $a.qtip('option', 'events.blur'); +} + + +/** + * http://qtip2.com/api#api-methods.set + */ +function testApiSetViaObject() { + + // TODO + $a.qtip({}); + + var api = $a.qtip('api'); + + api.set({ + prerender: false, + id: false, + overwrite: true, + suppress: true, + content: { + title: true, + attr: 'title', + text: false, + button: false + }, + position: { + my: 'top left', + at: 'bottom right', + target: false, + container: false, + viewport: false, + adjust: { + x: 0, y: 0, + mouse: true, + resize: true, + method: 'flip flip' + }, + effect: function(api, pos, viewport) { + $(this).animate(pos, { + duration: 200, + queue: false + }); + } + }, + show: { + target: false, + event: 'mouseenter', + effect: true, + delay: 90, + solo: false, + ready: false, + modal: { + on: false, + effect: true, + blur: true, + escape: true + } + }, + hide: { + target: false, + event: 'mouseleave', + effect: true, + delay: 0, + fixed: false, + inactive: false, + leave: 'window', + distance: false + }, + style: { + classes: '', + widget: false, + width: false, + height: false, + tip: { + corner: true, + mimic: false, + width: 8, + height: 8, + border: true, + offset: 0 + } + }, + events: { + render: null, + move: null, + show: null, + hide: null, + toggle: null, + visible: null, + hidden: null, + focus: null, + blur: null + } + }); + + api.set('id', null); + api.set('prerender', null); + api.set('overwrite', null); + api.set('suppress', null); + api.set('metadata', null); + + api.set('content', null); + api.set('content.title', null); + api.set('content.text', null); + api.set('content.attr', null); + api.set('content.button', null); + + api.set('position', null); + api.set('position.my', null); + api.set('position.at', null); + api.set('position.target', null); + api.set('position.container', null); + api.set('position.viewport', null); + api.set('position.effect', void)> null); + api.set('position.adjust', null); + + api.set('show', null); + api.set('show.target', null); + api.set('show.event', null); + api.set('show.delay', null); + api.set('show.solo', null); + api.set('show.ready', null); + api.set('show.effect', void)> null); + api.set('show.modal', null); + + api.set('hide', null); + api.set('hide.target', null); + api.set('hide.event', null); + api.set('hide.inactive', null); + api.set('hide.fixed', null); + api.set('hide.leave', null); + api.set('hide.distance', null); + api.set('hide.effect', void)> null); + + api.set('style', null); + api.set('style.classes', null); + api.set('style.def', null); + api.set('style.widget', null); + api.set('style.width', null); + api.set('style.height', null); + api.set('style.tip', null); + + api.set('events', null); + api.set('events.render', null); + api.set('events.show', null); + api.set('events.hide', null); + api.set('events.toggle', null); + api.set('events.visible', null); + api.set('events.hidden', null); + api.set('events.move', null); + api.set('events.focus', null); + api.set('events.blur', null); +} + + +/** + * http://qtip2.com/api#api.updating + */ +function testApiSetViaString() { + $a.qtip({}); + + $a.qtip('option', { + prerender: false, + id: false, + overwrite: true, + suppress: true, + content: { + title: true, + attr: 'title', + text: false, + button: false + }, + position: { + my: 'top left', + at: 'bottom right', + target: false, + container: false, + viewport: false, + adjust: { + x: 0, y: 0, + mouse: true, + resize: true, + method: 'flip flip' + }, + effect: function(api: QTip2.Api, pos: any, viewport: any) { + $(this).animate(pos, { + duration: 200, + queue: false + }); + } + }, + show: { + target: false, + event: 'mouseenter', + effect: true, + delay: 90, + solo: false, + ready: false, + modal: { + on: false, + effect: true, + blur: true, + escape: true + } + }, + hide: { + target: false, + event: 'mouseleave', + effect: true, + delay: 0, + fixed: false, + inactive: false, + leave: 'window', + distance: false + }, + style: { + classes: '', + widget: false, + width: false, + height: false, + tip: { + corner: true, + mimic: false, + width: 8, + height: 8, + border: true, + offset: 0 + } + }, + events: { + render: null, + move: null, + show: null, + hide: null, + toggle: null, + visible: null, + hidden: null, + focus: null, + blur: null + } + }); + + $a.qtip('option', 'id', null); + $a.qtip('option', 'prerender', null); + $a.qtip('option', 'overwrite', null); + $a.qtip('option', 'suppress', null); + $a.qtip('option', 'metadata', null); + + $a.qtip('option', 'content', null); + $a.qtip('option', 'content.title', null); + $a.qtip('option', 'content.text', null); + $a.qtip('option', 'content.attr', null); + $a.qtip('option', 'content.button', null); + + $a.qtip('option', 'position', null); + $a.qtip('option', 'position.my', null); + $a.qtip('option', 'position.at', null); + $a.qtip('option', 'position.target', null); + $a.qtip('option', 'position.container', null); + $a.qtip('option', 'position.viewport', null); + $a.qtip('option', 'position.effect', void)> null); + $a.qtip('option', 'position.adjust', null); + + $a.qtip('option', 'show', null); + $a.qtip('option', 'show.target', null); + $a.qtip('option', 'show.event', null); + $a.qtip('option', 'show.delay', null); + $a.qtip('option', 'show.solo', null); + $a.qtip('option', 'show.ready', null); + $a.qtip('option', 'show.effect', void)> null); + $a.qtip('option', 'show.modal', null); + + $a.qtip('option', 'hide', null); + $a.qtip('option', 'hide.target', null); + $a.qtip('option', 'hide.event', null); + $a.qtip('option', 'hide.inactive', null); + $a.qtip('option', 'hide.fixed', null); + $a.qtip('option', 'hide.leave', null); + $a.qtip('option', 'hide.distance', null); + $a.qtip('option', 'hide.effect', void)> null); + + $a.qtip('option', 'style', null); + $a.qtip('option', 'style.classes', null); + $a.qtip('option', 'style.def', null); + $a.qtip('option', 'style.widget', null); + $a.qtip('option', 'style.width', null); + $a.qtip('option', 'style.height', null); + $a.qtip('option', 'style.tip', null); + + $a.qtip('option', 'events', null); + $a.qtip('option', 'events.render', null); + $a.qtip('option', 'events.show', null); + $a.qtip('option', 'events.hide', null); + $a.qtip('option', 'events.toggle', null); + $a.qtip('option', 'events.visible', null); + $a.qtip('option', 'events.hidden', null); + $a.qtip('option', 'events.move', null); + $a.qtip('option', 'events.focus', null); + $a.qtip('option', 'events.blur', null); +} + + +/** + * http://qtip2.com/api#api-methods + */ +function testApiViaObject() { + $a.qtip({}); + + var api = $a.qtip('api'); + + api.toggle(); + api.toggle(true); + api.toggle(false, null); + + api.show(); + api.show( null); + + api.hide(); + api.hide( null); + + api.disable(); + api.disable(true); + + api.enable(); + + api.reposition(); + api.reposition( null); + api.reposition( null, true); + + api.focus(); + api.focus( null); + + api.blur(); + api.blur( null); + + api.destroy(); + api.destroy(true); +} + + +/** + * http://qtip2.com/api#api.updating + */ +function testApiMethodsViaString() { + $a.qtip('toggle'); + $a.qtip('toggle', true); + $a.qtip('toggle', true, null); + + $a.qtip('show'); + $a.qtip('show', null); + + $a.qtip('hide'); + $a.qtip('hide', null); + + $a.qtip('disable'); + $a.qtip('disable', true); + + $a.qtip('enable'); + + $a.qtip('reposition'); + $a.qtip('reposition', null); + $a.qtip('reposition', null, true); + + $a.qtip('focus'); + $a.qtip('focus', null); + + $a.qtip('blur'); + $a.qtip('blur', null); + + $a.qtip('destroy'); + $a.qtip('destroy', true); +} + + +/** + * http://qtip2.com/options#global + * + * $.fn is of type any, therefore we can't (and don't need to) add type bindings for QTip2 globals under it. + */ +function testGlobals() { + $.fn.qtip.defaults.prerender = true; } \ No newline at end of file diff --git a/qtip2/qtip2.d.ts b/qtip2/qtip2.d.ts index dd84052ce..1691715b6 100644 --- a/qtip2/qtip2.d.ts +++ b/qtip2/qtip2.d.ts @@ -1,19 +1,24 @@ // Type definitions for qtip2 v2.2.1 -// Project: http://http://qtip2.com/ +// Project: http://qtip2.com/ // Definitions by: Nathan Pitman // Definitions: https://github.com/borisyankov/DefinitelyTyped // Notes: +// - Type bindings for the QTip2 API and options are included. Bindings for global settings aren't required. // - Deprecated functionality is not supported. - +// - Where possible, things are strongly typed and 'any' is avoided. +// - QTip2 includes a lot of shorthand notation for various expressions. These bindings support it all. /// declare module QTip2 { + type EventApiFunc = (event: Event, api: Api) => void; + + /** * Content property */ - type Title = string | JQuery | Func | boolean | JQueryGenericPromise; - type Text = string | JQuery | Func | boolean | JQueryGenericPromise; + type Title = string | JQuery | EventApiFunc | boolean | JQueryGenericPromise; + type Text = string | JQuery | EventApiFunc | boolean | JQueryGenericPromise; interface Content { title?: Title | { text: Title }; @@ -43,7 +48,7 @@ declare module QTip2 { target?: Target | boolean; container?: JQuery | boolean; viewport?: JQuery | boolean; - effect?: boolean | ((api: any, pos: any, viewport: any) => any); + effect?: boolean | ((api: Api, pos: any, viewport: any) => void); adjust?: PositionAdjust; } @@ -57,7 +62,7 @@ declare module QTip2 { delay?: number; solo?: JQuery | string | boolean; ready?: boolean; - effect?: boolean | ((offset: any) => any); + effect?: boolean | ((offset: any) => void); modal?: boolean | Modal; } @@ -67,7 +72,7 @@ declare module QTip2 { blur?: boolean; escape?: boolean; stealfocus?: boolean; - effect?: boolean | ((state: any) => any); + effect?: boolean | ((state: any) => void); } @@ -80,25 +85,15 @@ declare module QTip2 { delay?: number; inactive?: number | boolean; fixed?: boolean; - // TODO: What is going on here? leave?: string | boolean; distance?: number | boolean; - effect?: boolean | ((offset: any) => any); + effect?: boolean | ((offset: any) => void); } /** * Style property */ - interface Tip { - corner?: string | boolean; - mimic?: string | boolean; - border?: number | boolean; - width?: number; - height?: number; - offset?: number; - } - interface Style { classes?: string | boolean; def?: boolean; @@ -108,22 +103,29 @@ declare module QTip2 { tip?: string | boolean | Tip; } + interface Tip { + corner?: string | boolean; + mimic?: string | boolean; + border?: number | boolean; + width?: number; + height?: number; + offset?: number; + } + /** * Events property */ - type Func = (event: any, api: any) => any; - interface Events { - render?: Func; - show?: Func; - hide?: Func; - toggle?: Func; - visible?: Func; - hidden?: Func; - move?: Func; - focus?: Func; - blur?: Func; + render?: EventApiFunc; + show?: EventApiFunc; + hide?: EventApiFunc; + toggle?: EventApiFunc; + visible?: EventApiFunc; + hidden?: EventApiFunc; + move?: EventApiFunc; + focus?: EventApiFunc; + blur?: EventApiFunc; } @@ -143,11 +145,265 @@ declare module QTip2 { hide?: string | JQuery | Hide; events?: Events; } + + + /** + * API + */ + interface Api { + get(propertyName: 'id'): string | boolean; + get(propertyName: 'prerender'): boolean; + get(propertyName: 'overwrite'): boolean; + get(propertyName: 'suppress'): boolean; + get(propertyName: 'metadata'): any; + get(propertyName: 'content'): Content; + get(propertyName: 'content.text'): Text; + get(propertyName: 'content.attr'): string; + get(propertyName: 'content.title'): Title; + get(propertyName: 'content.button'): string | JQuery | boolean; + get(propertyName: 'position'): Position; + get(propertyName: 'position.my'): string | boolean; + get(propertyName: 'position.at'): string | boolean; + get(propertyName: 'position.target'): Target | boolean; + get(propertyName: 'position.container'): JQuery | boolean; + get(propertyName: 'position.viewport'): JQuery | boolean; + get(propertyName: 'position.effect'): boolean | ((api: any, pos: any, viewport: any) => void); + get(propertyName: 'position.adjust'): PositionAdjust; + get(propertyName: 'show'): Show; + get(propertyName: 'show.target'): JQuery | boolean; + get(propertyName: 'show.event'): string | boolean; + get(propertyName: 'show.delay'): number; + get(propertyName: 'show.solo'): JQuery | string | boolean; + get(propertyName: 'show.ready'): boolean; + get(propertyName: 'show.effect'): boolean | ((offset: any) => void); + get(propertyName: 'show.modal'): boolean | Modal; + get(propertyName: 'hide'): Hide; + get(propertyName: 'hide.target'): JQuery | boolean; + get(propertyName: 'hide.event'): string | boolean; + get(propertyName: 'hide.delay'): number; + get(propertyName: 'hide.leave'): string | boolean; + get(propertyName: 'hide.distance'): number | boolean; + get(propertyName: 'hide.effect'): boolean | ((offset: any) => void); + get(propertyName: 'style'): Style; + get(propertyName: 'style.classes'): string | boolean; + get(propertyName: 'style.def'): boolean; + get(propertyName: 'style.widget'): boolean; + get(propertyName: 'style.width'): string | number | boolean; + get(propertyName: 'style.height'): string | number | boolean; + get(propertyName: 'style.tip'): string | boolean | Tip; + get(propertyName: 'events'): Events; + get(propertyName: 'events.render'): EventApiFunc; + get(propertyName: 'events.show'): EventApiFunc; + get(propertyName: 'events.hide'): EventApiFunc; + get(propertyName: 'events.toggle'): EventApiFunc; + get(propertyName: 'events.visible'): EventApiFunc; + get(propertyName: 'events.hidden'): EventApiFunc; + get(propertyName: 'events.move'): EventApiFunc; + get(propertyName: 'events.focus'): EventApiFunc; + get(propertyName: 'events.blur'): EventApiFunc; + get(propertyName: string): any; + + set(properties: QTipOptions): Api; + set(propertyName: 'id', value: string | boolean): Api; + set(propertyName: 'prerender', value: boolean): Api; + set(propertyName: 'overwrite', value: boolean): Api; + set(propertyName: 'suppress', value: boolean): Api; + set(propertyName: 'metadata', value: any): Api; + set(propertyName: 'content', value: Text | Content): Api; + set(propertyName: 'content.title', value: Title | { text: Title }): Api; + set(propertyName: 'content.text', value: Text): Api; + set(propertyName: 'content.attr', value: string): Api; + set(propertyName: 'content.button', value: string | JQuery | boolean): Api; + set(propertyName: 'position', value: Position): Api; + set(propertyName: 'position.my', value: string | boolean): Api; + set(propertyName: 'position.at', value: string | boolean): Api; + set(propertyName: 'position.target', value: Target | boolean): Api; + set(propertyName: 'position.container', value: JQuery | boolean): Api; + set(propertyName: 'position.viewport', value: JQuery | boolean): Api; + set(propertyName: 'position.effect', value: boolean | ((api: Api, pos: any, viewport: any) => void) ): Api; + set(propertyName: 'position.adjust', value: PositionAdjust): Api; + set(propertyName: 'show', value: Show): Api; + set(propertyName: 'show.target', value: JQuery | boolean): Api; + set(propertyName: 'show.event', value: string | boolean): Api; + set(propertyName: 'show.delay', value: number): Api; + set(propertyName: 'show.solo', value: JQuery | string | boolean): Api; + set(propertyName: 'show.ready', value: boolean): Api; + set(propertyName: 'show.effect', value: boolean | ((offset: any) => void)): Api; + set(propertyName: 'show.modal', value: boolean | Modal): Api; + set(propertyName: 'hide', value: Hide): Api; + set(propertyName: 'hide.target', value: JQuery | boolean): Api; + set(propertyName: 'hide.event', value: string | boolean): Api; + set(propertyName: 'hide.inactive', value: number | boolean): Api; + set(propertyName: 'hide.fixed', value: boolean): Api; + set(propertyName: 'hide.leave', value: string | boolean): Api; + set(propertyName: 'hide.distance', value: number | boolean): Api; + set(propertyName: 'hide.effect', value: boolean | ((offset: any) => void)): Api + set(propertyName: 'style', value: Style): Api; + set(propertyName: 'style.classes', value: string | boolean): Api; + set(propertyName: 'style.def', value: boolean): Api; + set(propertyName: 'style.widget', value: boolean): Api; + set(propertyName: 'style.width', value: string | number | boolean): Api; + set(propertyName: 'style.height', value: string | number | boolean): Api; + set(propertyName: 'style.tip', value: string | boolean | Tip): Api; + set(propertyName: 'events', value: Events): Api; + set(propertyName: 'events.render', value: EventApiFunc): Api; + set(propertyName: 'events.show', value: EventApiFunc): Api; + set(propertyName: 'events.hide', value: EventApiFunc): Api; + set(propertyName: 'events.toggle', value: EventApiFunc): Api; + set(propertyName: 'events.visible', value: EventApiFunc): Api; + set(propertyName: 'events.hidden', value: EventApiFunc): Api; + set(propertyName: 'events.move', value: EventApiFunc): Api; + set(propertyName: 'events.focus', value: EventApiFunc): Api; + set(propertyName: 'events.blur', value: EventApiFunc): Api; + set(propertyName: string, value: any): Api; + + toggle(state?: boolean, event?: Event): Api; + + show(event?: Event): Api; + + hide(event?: Event): Api; + + disable(state?: boolean): Api; + + enable(): Api; + + reposition(event?: Event, effect?: boolean): Api; + + focus(event?: Event): Api; + + blur(event?: Event): Api; + + destroy(immediate?: boolean): Api; + } } interface JQuery { - qtip(): JQuery; + qtip(options?: QTip2.QTipOptions): JQuery; - qtip(options: QTip2.QTipOptions): JQuery; + qtip(methodName: 'api'): QTip2.Api; + + qtip(methodName: 'option', propertyName: 'id'): string | boolean; + qtip(methodName: 'option', propertyName: 'prerender'): boolean; + qtip(methodName: 'option', propertyName: 'overwrite'): boolean; + qtip(methodName: 'option', propertyName: 'suppress'): boolean; + qtip(methodName: 'option', propertyName: 'metadata'): any; + qtip(methodName: 'option', propertyName: 'content'): QTip2.Content; + qtip(methodName: 'option', propertyName: 'content.text'): QTip2.Text; + qtip(methodName: 'option', propertyName: 'content.attr'): string; + qtip(methodName: 'option', propertyName: 'content.title'): QTip2.Title; + qtip(methodName: 'option', propertyName: 'content.button'): string | JQuery | boolean; + qtip(methodName: 'option', propertyName: 'position'): QTip2.Position; + qtip(methodName: 'option', propertyName: 'position.my'): string | boolean; + qtip(methodName: 'option', propertyName: 'position.at'): string | boolean; + qtip(methodName: 'option', propertyName: 'position.target'): QTip2.Target | boolean; + qtip(methodName: 'option', propertyName: 'position.container'): JQuery | boolean; + qtip(methodName: 'option', propertyName: 'position.viewport'): JQuery | boolean; + qtip(methodName: 'option', propertyName: 'position.effect'): boolean | ((api: QTip2.Api, pos: any, viewport: any) => void); + qtip(methodName: 'option', propertyName: 'position.adjust'): QTip2.PositionAdjust; + qtip(methodName: 'option', propertyName: 'show'): QTip2.Show; + qtip(methodName: 'option', propertyName: 'show.target'): JQuery | boolean; + qtip(methodName: 'option', propertyName: 'show.event'): string | boolean; + qtip(methodName: 'option', propertyName: 'show.delay'): number; + qtip(methodName: 'option', propertyName: 'show.solo'): JQuery | string | boolean; + qtip(methodName: 'option', propertyName: 'show.ready'): boolean; + qtip(methodName: 'option', propertyName: 'show.effect'): boolean | ((offset: any) => void); + qtip(methodName: 'option', propertyName: 'show.modal'): boolean | QTip2.Modal; + qtip(methodName: 'option', propertyName: 'hide'): QTip2.Hide; + qtip(methodName: 'option', propertyName: 'hide.target'): JQuery | boolean; + qtip(methodName: 'option', propertyName: 'hide.event'): string | boolean; + qtip(methodName: 'option', propertyName: 'hide.delay'): number; + qtip(methodName: 'option', propertyName: 'hide.leave'): string | boolean; + qtip(methodName: 'option', propertyName: 'hide.distance'): number | boolean; + qtip(methodName: 'option', propertyName: 'hide.effect'): boolean | ((offset: any) => void); + qtip(methodName: 'option', propertyName: 'style'): QTip2.Style; + qtip(methodName: 'option', propertyName: 'style.classes'): string | boolean; + qtip(methodName: 'option', propertyName: 'style.def'): boolean; + qtip(methodName: 'option', propertyName: 'style.widget'): boolean; + qtip(methodName: 'option', propertyName: 'style.width'): string | number | boolean; + qtip(methodName: 'option', propertyName: 'style.height'): string | number | boolean; + qtip(methodName: 'option', propertyName: 'style.tip'): string | boolean | QTip2.Tip; + qtip(methodName: 'option', propertyName: 'events'): QTip2.Events; + qtip(methodName: 'option', propertyName: 'events.render'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.show'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.hide'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.toggle'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.visible'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.hidden'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.move'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.focus'): QTip2.EventApiFunc; + qtip(methodName: 'option', propertyName: 'events.blur'): QTip2.EventApiFunc; + + qtip(methodName: 'option', properties: QTip2.QTipOptions): QTip2.Api; + qtip(methodName: 'option', propertyName: 'id', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'prerender', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'overwrite', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'suppress', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'metadata', value: any): QTip2.Api; + qtip(methodName: 'option', propertyName: 'content', value: QTip2.Text | QTip2.Content): QTip2.Api; + qtip(methodName: 'option', propertyName: 'content.title', value: QTip2.Title | { text: QTip2.Title }): QTip2.Api; + qtip(methodName: 'option', propertyName: 'content.text', value: QTip2.Text): QTip2.Api; + qtip(methodName: 'option', propertyName: 'content.attr', value: string): QTip2.Api; + qtip(methodName: 'option', propertyName: 'content.button', value: string | JQuery | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position', value: QTip2.Position): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.my', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.at', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.target', value: QTip2.Target | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.container', value: JQuery | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.viewport', value: JQuery | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.effect', value: boolean | ((api: QTip2.Api, pos: any, viewport: any) => void) ): QTip2.Api; + qtip(methodName: 'option', propertyName: 'position.adjust', value: QTip2.PositionAdjust): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show', value: QTip2.Show): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.target', value: JQuery | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.event', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.delay', value: number): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.solo', value: JQuery | string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.ready', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.effect', value: boolean | ((offset: any) => void)): QTip2.Api; + qtip(methodName: 'option', propertyName: 'show.modal', value: boolean | QTip2.Modal): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide', value: QTip2.Hide): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.target', value: JQuery | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.event', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.inactive', value: number | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.fixed', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.leave', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.distance', value: number | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'hide.effect', value: boolean | ((offset: any) => void)): QTip2.Api + qtip(methodName: 'option', propertyName: 'style', value: QTip2.Style): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.classes', value: string | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.def', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.widget', value: boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.width', value: string | number | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.height', value: string | number | boolean): QTip2.Api; + qtip(methodName: 'option', propertyName: 'style.tip', value: string | boolean | QTip2.Tip): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events', value: QTip2.Events): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.render', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.show', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.hide', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.toggle', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.visible', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.hidden', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.move', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.focus', value: QTip2.EventApiFunc): QTip2.Api; + qtip(methodName: 'option', propertyName: 'events.blur', value: QTip2.EventApiFunc): QTip2.Api; + + qtip(methodName: 'toggle', state?: boolean, event?: Event): JQuery; + + qtip(methodName: 'show', event?: Event): JQuery; + + qtip(methodName: 'hide', event?: Event): JQuery; + + qtip(methodName: 'disable', state?: boolean): JQuery; + + qtip(methodName: 'enable'): JQuery + + qtip(methodName: 'reposition', event?: Event, effect?: boolean): JQuery; + + qtip(methodName: 'focus', event?: Event): JQuery; + + qtip(methodName: 'blur', event?: Event): JQuery; + + qtip(methodName: 'destroy', immediate?: boolean): JQuery; + + qtip(methodName: string, p1?: any, p2?: any, p3?: any): any; } From 60cb461b5eb00ea04cc00dab1bd703eeb8d0b33b Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Sat, 2 May 2015 12:33:59 +0000 Subject: [PATCH 073/534] Replaced special characters (0x24C8 'circled latin capital letter' and 0x2019 'right single quotation mark') in lodash.d.ts with closest ASCII equivalent characters. Special characters were causing file encoding issues in some IDEs. --- lodash/lodash.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 01238b769..d50edec13 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -98,7 +98,7 @@ declare module _ { **/ interface Support { /** - * Detect if an arguments object’s [[Class]] is resolvable (all but Firefox < 4, IE < 9). + * Detect if an arguments object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). **/ argsClass: boolean; @@ -258,7 +258,7 @@ declare module _ { //_.chunk interface LoDashStatic { /** - * Creates an array of elements split into groups the length of size. If collection can’t be + * Creates an array of elements split into groups the length of size. If collection can't be * split evenly, the final chunk will be the remaining elements. * @param array The array to process. * @param size The length of each chunk. @@ -4997,7 +4997,7 @@ declare module _ { * @param wait The number of milliseconds to delay. * @param options The options object. * @param options.leading Specify execution on the leading edge of the timeout. - * @param options.maxWait The maximum time func is allowed to be delayed before it’s called. + * @param options.maxWait The maximum time func is allowed to be delayed before it's called. * @param options.trailing Specify execution on the trailing edge of the timeout. * @return The new debounced function. **/ @@ -5023,7 +5023,7 @@ declare module _ { leading?: boolean; /** - * The maximum time func is allowed to be delayed before it’s called. + * The maximum time func is allowed to be delayed before it's called. **/ maxWait?: number; @@ -6063,7 +6063,7 @@ declare module _ { //_.pairs interface LoDashStatic { /** - * Creates a two dimensional array of an object’s key-value pairs, + * Creates a two dimensional array of an object's key-value pairs, * i.e. [[key1, value1], [key2, value2]]. * @param object The object to inspect. * @return Aew array of key-value pairs. @@ -6271,7 +6271,7 @@ declare module _ { //_.property interface LoDashStatic { /** - * # Ⓢ + * # S * Creates a "_.pluck" style function, which returns the key value of a given object. * @param key (string) * @return the value of that key on the object @@ -6343,7 +6343,7 @@ declare module _ { * @param options.evaluate The "evaluate" delimiter. * @param options.import An object to import into the template as local variables. * @param options.interpolate The "interpolate" delimiter. - * @param sourceURL The sourceURL of the template’s compiled source. + * @param sourceURL The sourceURL of the template's compiled source. * @param variable The data object variable name. * @return Returns the compiled Lo-Dash HTML template or a TemplateExecutor if no data is passed. **/ From 92acb8f42f8a2886359a0c6c0746211a8dd30cfb Mon Sep 17 00:00:00 2001 From: Daniel Beckwith Date: Sat, 2 May 2015 12:50:41 -0400 Subject: [PATCH 074/534] Changed iterators to use _.List and _.Dictionary, added test. --- underscore/underscore-tests.ts | 1 + underscore/underscore.d.ts | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index 3fb993a3d..60c1708d0 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -11,6 +11,7 @@ _.map({ one: 1, two: 2, three: 3 }, (value, key) => value * 3); //var sum = _.reduce([1, 2, 3], (memo, num) => memo + num, 0); // https://typescript.codeplex.com/workitem/1960 var sum = _.reduce([1, 2, 3], (memo, num) => memo + num, 0); sum = _.reduce([1, 2, 3], (memo, num) => memo + num); // memo is optional #issue 5 github +sum = _.reduce({'a':'1', 'b':'2', 'c':'3'}, (memo, numstr) => memo + (+numstr)); var list = [[0, 1], [2, 3], [4, 5]]; //var flat = _.reduceRight(list, (a, b) => a.concat(b), []); // https://typescript.codeplex.com/workitem/1960 diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index c5815f51a..03088bffd 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -41,22 +41,6 @@ declare module _ { escape?: RegExp; } - interface ListIterator { - (value: T, index: number, list: T[]): TResult; - } - - interface ObjectIterator { - (element: T, key: string, list: any): TResult; - } - - interface MemoIterator { - (prev: TResult, curr: T, index: number, list: T[]): TResult; - } - - interface MemoObjectIterator { - (prev: TResult, curr: T, key: string, list: any): TResult; - } - interface Collection { } // Common interface between Arrays and jQuery objects @@ -68,6 +52,22 @@ declare module _ { interface Dictionary extends Collection { [index: string]: T; } + + interface ListIterator { + (value: T, index: number, list: List): TResult; + } + + interface ObjectIterator { + (element: T, key: string, list: Dictionary): TResult; + } + + interface MemoIterator { + (prev: TResult, curr: T, index: number, list: List): TResult; + } + + interface MemoObjectIterator { + (prev: TResult, curr: T, key: string, list: Dictionary): TResult; + } } interface UnderscoreStatic { From 332ac5b1f4e34153805dda35f199826da203656d Mon Sep 17 00:00:00 2001 From: Daniel Beckwith Date: Sun, 3 May 2015 01:10:35 -0400 Subject: [PATCH 075/534] Adds shiftKey property to D3Event. --- d3/d3.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index f3dbee63d..e1d501e0b 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -60,6 +60,7 @@ declare module D3 { altKey?: boolean; ctrlKey?: boolean; metaKey?: boolean; + shiftKey?: boolean; type: string; } From 829319ddf9122581459e02b4f108bec49f1d2bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Langlade-Bellone?= Date: Sat, 2 May 2015 16:22:47 +0200 Subject: [PATCH 076/534] React 0.13 as default for jsnox --- jsnox/jsnox-tests.ts | 10 +++++----- jsnox/jsnox.d.ts | 10 ++++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/jsnox/jsnox-tests.ts b/jsnox/jsnox-tests.ts index 4e990766b..e34d71b4a 100644 --- a/jsnox/jsnox-tests.ts +++ b/jsnox/jsnox-tests.ts @@ -9,8 +9,8 @@ interface PersonProps { age: number } -var Person = React.createClass({ - render(): React.ReactHTMLElement { return null } +var Person = React.createClass({ + render():React.ReactElement { return null; } }); var PersonTag = React.createFactory(Person); @@ -19,7 +19,7 @@ var clickHandler: React.MouseEventHandler // Tests with spec string function spec_string () { - var result: React.ReactHTMLElement + var result: React.HTMLComponent // just spec string result = $('div') @@ -38,7 +38,7 @@ function spec_string () { // Tests with react component function react_component() { - var result: React.ReactHTMLElement + var result: React.ReactElement<{}> // with nothing more result = $(Person) @@ -54,4 +54,4 @@ function react_component() { result = $(Person, props, 'hello') // one string child result = $(Person, props, $('span', 'world')) // one element child result = $(Person, props, ['hello', PersonTag()]) // mixed array of children -} \ No newline at end of file +} diff --git a/jsnox/jsnox.d.ts b/jsnox/jsnox.d.ts index 72584563b..dfb59e280 100644 --- a/jsnox/jsnox.d.ts +++ b/jsnox/jsnox.d.ts @@ -1,12 +1,14 @@ -// Type definitions for JSnoX +// Type definitions for JSnoX // Project: https://github.com/af/jsnox // Definitions by: Steve Baker // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module 'jsnox' { + import React = require("react"); + /* * JSnoX requires an object with a createElement method. * This will normally be the React object but could be something else @@ -29,7 +31,7 @@ declare module 'jsnox' { * @param children A single React node (string or ReactElement) or array of nodes. * Note that unlike with React itself, multiple children must be placed into an array. */ - (specString: string, children: React.ReactNode): React.ReactHTMLElement + (specString: string, children: React.ReactNode): React.HTMLComponent /** * Renders an HTML element from the given spec string, with optional props @@ -40,7 +42,7 @@ declare module 'jsnox' { * @param children A single React node (string or ReactElement) or array of nodes. * Note that unlike with React itself, multiple children must be placed into an array. */ - (specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.ReactHTMLElement + (specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.HTMLComponent /** From 3a5db1c791888fefe2ce7b644675c9a7655e9c29 Mon Sep 17 00:00:00 2001 From: Tat Date: Sun, 3 May 2015 19:11:34 +0530 Subject: [PATCH 077/534] adding the gl-matrix type definitions --- gl-matrix/gl-matrix-tests.ts | 347 +++++++++++++++++++++++++++++++++++ gl-matrix/gl-matrix.d.ts | 276 ++++++++++++++++++++++++++++ 2 files changed, 623 insertions(+) create mode 100644 gl-matrix/gl-matrix-tests.ts create mode 100644 gl-matrix/gl-matrix.d.ts diff --git a/gl-matrix/gl-matrix-tests.ts b/gl-matrix/gl-matrix-tests.ts new file mode 100644 index 000000000..5557c4b79 --- /dev/null +++ b/gl-matrix/gl-matrix-tests.ts @@ -0,0 +1,347 @@ +/// + +// common +var result: number = glMatrix.toRadian(180); + +var out: GLM.IArray; +var outVal: number; +var outStr: string; + +// vec2 +var vecA: GLM.IArray, vecB: GLM.IArray, matA: GLM.IArray; +var vecArray: GLM.IArray; + +vecA = [1, 2]; +vecB = new Float32Array([3, 4]); +out = [0, 0]; +matA = [1, 2, 3, 4, 5, 6]; +vecArray = [1, 2, 3, 4, 0, 0]; + +out = vec2.create(); +out = vec2.clone(vecA); +out = vec2.fromValues(1, 2); +out = vec2.copy(out, vecA); +out = vec2.set(out, 1, 2); +out = vec2.add(out, vecA, vecB); +out = vec2.subtract(out, vecA, vecB); +out = vec2.sub(out, vecA, vecB); +out = vec2.multiply(out, vecA, vecB); +out = vec2.mul(out, vecA, vecB); +out = vec2.divide(out, vecA, vecB); +out = vec2.div(out, vecA, vecB); +out = vec2.min(out, vecA, vecB); +out = vec2.max(out, vecA, vecB); +out = vec2.scale(out, vecA, 2); +out = vec2.scaleAndAdd(out, vecA, vecB, 0.5); +outVal = vec2.distance(vecA, vecB); +outVal = vec2.dist(vecA, vecB); +outVal = vec2.squaredDistance(vecA, vecB); +outVal = vec2.sqrDist(vecA, vecB); +outVal = vec2.length(vecA); +outVal = vec2.len(vecA); +outVal = vec2.squaredLength(vecA); +outVal = vec2.sqrLen(vecA); +out = vec2.negate(out, vecA); +out = vec2.inverse(out, vecA); +out = vec2.normalize(out, vecA); +outVal = vec2.dot(vecA, vecB); +out = vec2.cross(out, vecA, vecB); +out = vec2.lerp(out, vecA, vecB, 0.5); +out = vec2.random(out); +out = vec2.random(out, 5.0); +out = vec2.transformMat2d(out, vecA, matA); +out = vec2.transformMat3(out, vecA, matA); +out = vec2.transformMat4(out, vecA, matA); +out = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize); +outStr = vec2.str(vecA); + +// vec3 +var matr: GLM.IArray; + +vecA = [1, 2, 3]; +vecB = new Float32Array([4, 5, 6]); +out = [0, 0, 0]; +vecArray = [1, 2, 3, 4, 5, 6, 0, 0, 0]; +matr = [1, 0, 0, 0, 1, 0, 0, 0, 1 ]; + +out = vec3.create(); +out = vec3.clone(vecA); +out = vec3.fromValues(1, 2, 3); +out = vec3.copy(out, vecA); +out = vec3.set(out, 1, 2, 3); +out = vec3.add(out, vecA, vecB); +out = vec3.subtract(out, vecA, vecB); +out = vec3.sub(out, vecA, vecB); +out = vec3.multiply(out, vecA, vecB); +out = vec3.mul(out, vecA, vecB); +out = vec3.divide(out, vecA, vecB); +out = vec3.div(out, vecA, vecB); +out = vec3.min(out, vecA, vecB); +out = vec3.max(out, vecA, vecB); +out = vec3.scale(out, vecA, 2); +out = vec3.scaleAndAdd(out, vecA, vecB, 0.5); +outVal = vec3.distance(vecA, vecB); +outVal = vec3.dist(vecA, vecB); +outVal = vec3.squaredDistance(vecA, vecB); +outVal = vec3.sqrDist(vecA, vecB); +outVal = vec3.length(vecA); +outVal = vec3.len(vecA); +outVal = vec3.squaredLength(vecA); +outVal = vec3.sqrLen(vecA); +out = vec3.negate(out, vecA); +out = vec3.inverse(out, vecA); +out = vec3.normalize(out, vecA); +outVal = vec3.dot(vecA, vecB); +out = vec3.cross(out, vecA, vecB); +out = vec3.lerp(out, vecA, vecB, 0.5); +out = vec3.random(out); +out = vec3.random(out, 5.0); +out = vec3.rotateX(out, vecA, vecB, Math.PI); +out = vec3.rotateY(out, vecA, vecB, Math.PI); +out = vec3.rotateZ(out, vecA, vecB, Math.PI); +out = vec3.transformMat3(out, vecA, matr); + +matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ] +out = vec3.transformMat4(out, vecA, matr); + +out = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize); +outVal = vec3.angle(vecA, vecB); +outStr = vec3.str(vecA); + +// vec4 +var q: GLM.IArray; + +vecA = [1, 2, 3, 4]; +vecB = new Float32Array([5, 6, 7, 8]); +out = [0, 0, 0, 0]; +q = [1, 2, 3, 4]; + +out = vec4.create(); +out = vec4.clone(vecA); +out = vec4.fromValues(1, 2, 3, 4); +out = vec4.copy(out, vecA); +out = vec4.set(out, 1, 2, 3, 4); +out = vec4.add(out, vecA, vecB); +out = vec4.subtract(out, vecA, vecB); +out = vec4.sub(out, vecA, vecB); +out = vec4.multiply(out, vecA, vecB); +out = vec4.mul(out, vecA, vecB); +out = vec4.divide(out, vecA, vecB); +out = vec4.div(out, vecA, vecB); +out = vec4.min(out, vecA, vecB); +out = vec4.max(out, vecA, vecB); +out = vec4.scale(out, vecA, 2); +out = vec4.scaleAndAdd(out, vecA, vecB, 0.5); +outVal = vec4.distance(vecA, vecB); +outVal = vec4.dist(vecA, vecB); +outVal = vec4.squaredDistance(vecA, vecB); +outVal = vec4.sqrDist(vecA, vecB); +outVal = vec4.length(vecA); +outVal = vec4.len(vecA); +outVal = vec4.squaredLength(vecA); +outVal = vec4.sqrLen(vecA); +out = vec4.negate(out, vecA); +out = vec4.inverse(out, vecA); +out = vec4.normalize(out, vecA); +outVal = vec4.dot(vecA, vecB); +out = vec4.lerp(out, vecA, vecB, 0.5); +out = vec4.random(out); +out = vec4.random(out, 5.0); + +matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ] +out = vec4.transformMat4(out, vecA, matr); +out = vec4.transformQuat(out, vecA, q); + +vecArray = [1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0]; +out = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize); +outStr = vec4.str(vecA); + +// mat2 +var matB: GLM.IArray, identity: GLM.IArray; + +matA = [1, 2, 3, 4]; +matB = new Float32Array([5, 6, 7, 8]); +out = [0, 0, 0, 0]; +identity = [1, 0, 0, 1]; + +out = mat2.create(); +out = mat2.clone(matA); +out = mat2.copy(out, matA); +out = mat2.identity(out); +out = mat2.transpose(out, matA); +out = mat2.invert(out, matA); +out = mat2.adjoint(out, matA); +outVal = mat2.determinant(matA); +out = mat2.multiply(out, matA, matB); +out = mat2.mul(out, matA, matB); +out = mat2.rotate(out, matA, Math.PI * 0.5); + +vecA = [2, 3]; +out = mat2.scale(out, matA, vecA); +outStr = mat2.str(matA); +outVal = mat2.frob(matA); + +var L = mat2.create(); +var D = mat2.create(); +var U = mat2.create(); +out = mat2.LDU(L, D, U, [4,3,6,3]); + +// mat2d +matA = [1, 2, 3, 4, 5, 6]; +matB = [7, 8, 9, 10, 11, 12]; +out = [0, 0, 0, 0, 0, 0]; +identity = [1, 0, 0, 1, 0, 0]; + +out = mat2d.create(); +out = mat2d.clone(matA); +out = mat2d.copy(out, matA); +out = mat2d.identity(out); +out = mat2d.invert(out, matA); +outVal = mat2d.determinant(matA); +out = mat2d.multiply(out, matA, matB); +out = mat2d.mul(out, matA, matB); +out = mat2d.rotate(out, matA, Math.PI * 0.5); + +vecA = [2, 3]; +out = mat2d.scale(out, matA, vecA); +out = mat2d.translate(out, matA, vecA); +outStr = mat2d.str(matA); +outVal = mat2d.frob(matA); + +// mat3 +matA = [1, 0, 0, 0, 1, 0, 1, 2, 1]; +matB = [1, 0, 0, 0, 1, 0, 3, 4, 1]; +out = [0, 0, 0, 0, 0, 0, 0, 0, 0]; +identity = [1, 0, 0, 0, 1, 0, 0, 0, 1]; + +out = mat3.create(); +out = mat3.clone(matA); +out = mat3.copy(out, matA); +out = mat3.identity(out); +out = mat3.transpose(out, matA); +out = mat3.invert(out, matA); +out = mat3.adjoint(out, matA); +outVal = mat3.determinant(matA); +out = mat3.multiply(out, matA, matB); +out = mat3.mul(out, matA, matB); +outStr = mat3.str(matA); +outVal = mat3.frob(matA); + +matA = [1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]; +out = mat3.normalFromMat4(out, matA); + +q = [ 0, -0.7071067811865475, 0, 0.7071067811865475 ]; +out = mat3.fromQuat(out, q); + +out = mat3.fromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]); +out = mat3.scale(out, matA, [2,2]); +out = mat3.fromMat2d(out, [1, 2, 3, 4, 5, 6]); + +// mat4 +matA = [1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1]; + +matB = [1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 4, 5, 6, 1]; + +out = [0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0]; + +identity = [1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1]; + +out = mat4.create(); +out = mat4.clone(matA); +out = mat4.copy(out, matA); +out = mat4.identity(out); +out = mat4.transpose(out, matA); +out = mat4.invert(out, matA); +out = mat4.adjoint(out, matA); +outVal = mat4.determinant(matA); +out = mat4.multiply(out, matA, matB); +out = mat4.mul(out, matA, matB); +out = mat4.translate(out, matA, [4, 5, 6]); +out = mat4.scale(out, matA, [4, 5, 6]); + +var rad = Math.PI * 0.5; +var axis = [1, 0, 0]; +out = mat4.rotate(out, matA, rad, axis); +out = mat4.rotateX(out, matA, rad); +out = mat4.rotateY(out, matA, rad); +out = mat4.rotateZ(out, matA, rad); + +out = mat4.frustum(out, -1, 1, -1, 1, -1, 1); + +var fovy = Math.PI * 0.5; +out = mat4.perspective(out, fovy, 1, 0, 1); +out = mat4.ortho(out, -1, 1, -1, 1, -1, 1); + +var eye = [0, 0, 1]; +var center = [0, 0, -1]; +var up = [0, 1, 0]; +out = mat4.lookAt(out, eye, center, up); + +outStr = mat4.str(matA); +outVal = mat4.frob(matA); + +q = [0, 0, 0, 1]; +out = mat4.fromRotationTranslation(out, q, [1, 2, 3]); +out = mat4.fromQuat(out, q); + +// quat +var quatA = [1, 2, 3, 4]; +var quatB = [5, 6, 7, 8]; +out = [0, 0, 0, 0]; +var vec = [1, 1, -1]; +var id = [0, 0, 0, 1]; +var deg90 = Math.PI / 2; + +out = quat.create(); +out = quat.clone(quatA); +out = quat.fromValues(1, 2, 3, 4); +out = quat.copy(out, quatA); +out = quat.set(out, 1, 2, 3, 4); +out = quat.identity(out); +out = quat.setAxisAngle(out, [1, 0, 0], Math.PI * 0.5); +out = quat.add(out, quatA, quatB); +out = quat.multiply(out, quatA, quatB); +out = quat.mul(out, quatA, quatB); +out = quat.scale(out, quatA, 2); +outVal = quat.length(quatA); +outVal = quat.len(quatA); +outVal = quat.squaredLength(quatA); +outVal = quat.sqrLen(quatA); +out = quat.normalize(out, quatA); +out = quat.lerp(out, quatA, quatB, 0.5); +out = quat.slerp(out, quatA, quatB, 0.5); +out = quat.invert(out, quatA); +out = quat.conjugate(out, quatA); +outStr = quat.str(quatA); +out = quat.rotateX(out, id, deg90); +out = quat.rotateY(out, id, deg90); +out = quat.rotateZ(out, id, deg90); + +matr = [ 1, 0, 0, + 0, 0, -1, + 0, 1, 0 ]; +out = quat.fromMat3(out, matr); + +var view = [-1, 0, 0]; +up = [ 0, 1, 0]; +var right= [ 0, 0,-1]; +out = quat.setAxes([], view, right, up); + +out = quat.rotationTo(out, [0, 1, 0], [1, 0, 0]); +out = quat.calculateW(out, quatA); + diff --git a/gl-matrix/gl-matrix.d.ts b/gl-matrix/gl-matrix.d.ts new file mode 100644 index 000000000..b86a2dc59 --- /dev/null +++ b/gl-matrix/gl-matrix.d.ts @@ -0,0 +1,276 @@ +// Type definitions for gl-matrix 2.2.2 +// Project: https://github.com/toji/gl-matrix +// Definitions by: Tat +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module GLM { + interface IArray + { + [index: number]: number; + } +} + +// Common +declare module glMatrix { + /** + * Convert Degree To Radian + * @param a Angle in Degrees + */ + export function toRadian(a: number): number; +} + +// vec2 +declare module vec2 { + export function create(): GLM.IArray; + export function clone(a: GLM.IArray): GLM.IArray; + export function fromValues(x: number, y: number): GLM.IArray; + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function set(out: GLM.IArray, x: number, y: number): GLM.IArray; + export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; + export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray; + export function distance(a: GLM.IArray, b: GLM.IArray): number; + export function dist(a: GLM.IArray, b: GLM.IArray): number; + export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number; + export function sqrDist(a: GLM.IArray, b: GLM.IArray): number; + export function length(a: GLM.IArray): number; + export function len(a: GLM.IArray): number; + export function squaredLength(a: GLM.IArray): number; + export function sqrLen(a: GLM.IArray): number; + export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function dot(a: GLM.IArray, b: GLM.IArray): number; + export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + export function random(out: GLM.IArray): GLM.IArray; + export function random(out: GLM.IArray, scale: number): GLM.IArray; + export function transformMat2d(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + export function forEach(out: GLM.IArray, string: number, offset: number, count: number, + callback: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray; + export function forEach(out: GLM.IArray, string: number, offset: number, count: number, + callback: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray; + export function str(a: GLM.IArray): string; +} + +// vec3 +declare module vec3 { + export function create(): GLM.IArray; + export function clone(a: GLM.IArray): GLM.IArray; + export function fromValues(x: number, y: number, z: number): GLM.IArray; + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function set(out: GLM.IArray, x: number, y: number, z: number): GLM.IArray; + export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; + export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray; + export function distance(a: GLM.IArray, b: GLM.IArray): number; + export function dist(a: GLM.IArray, b: GLM.IArray): number; + export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number; + export function sqrDist(a: GLM.IArray, b: GLM.IArray): number; + export function length(a: GLM.IArray): number; + export function len(a: GLM.IArray): number; + export function squaredLength(a: GLM.IArray): number; + export function sqrLen(a: GLM.IArray): number; + export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function dot(a: GLM.IArray, b: GLM.IArray): number; + export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + export function random(out: GLM.IArray): GLM.IArray; + export function random(out: GLM.IArray, scale: number): GLM.IArray; + export function rotateX(out: GLM.IArray, a: GLM.IArray, origin: GLM.IArray, angle: number): GLM.IArray; + export function rotateY(out: GLM.IArray, a: GLM.IArray, origin: GLM.IArray, angle: number): GLM.IArray; + export function rotateZ(out: GLM.IArray, a: GLM.IArray, origin: GLM.IArray, angle: number): GLM.IArray; + export function transformMat3(out: GLM.IArray, a: GLM.IArray, mat: GLM.IArray): GLM.IArray; + export function transformMat4(out: GLM.IArray, a: GLM.IArray, mat: GLM.IArray): GLM.IArray; + export function forEach(out: GLM.IArray, string: number, offset: number, count: number, + callback: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray; + export function forEach(out: GLM.IArray, string: number, offset: number, count: number, + callback: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray; + export function angle(a: GLM.IArray, b: GLM.IArray): number; + export function str(a: GLM.IArray): string; +} + +// vec4 +declare module vec4 { + export function create(): GLM.IArray; + export function clone(a: GLM.IArray): GLM.IArray; + export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray; + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray; + export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; + export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray; + export function distance(a: GLM.IArray, b: GLM.IArray): number; + export function dist(a: GLM.IArray, b: GLM.IArray): number; + export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number; + export function sqrDist(a: GLM.IArray, b: GLM.IArray): number; + export function length(a: GLM.IArray): number; + export function len(a: GLM.IArray): number; + export function squaredLength(a: GLM.IArray): number; + export function sqrLen(a: GLM.IArray): number; + export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function dot(a: GLM.IArray, b: GLM.IArray): number; + export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + export function random(out: GLM.IArray): GLM.IArray; + export function random(out: GLM.IArray, scale: number): GLM.IArray; + export function transformMat4(out: GLM.IArray, a: GLM.IArray, mat: GLM.IArray): GLM.IArray; + export function transformQuat(out: GLM.IArray, a: GLM.IArray, quat: GLM.IArray): GLM.IArray; + export function forEach(out: GLM.IArray, string: number, offset: number, count: number, + callback: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray; + export function forEach(out: GLM.IArray, string: number, offset: number, count: number, + callback: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray; + export function str(a: GLM.IArray): string; +} + +// mat2 +declare module mat2 { + export function create(): GLM.IArray; + export function clone(a: GLM.IArray): GLM.IArray; + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function identity(a: GLM.IArray): GLM.IArray; + export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function determinant(a: GLM.IArray): number; + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + export function str(a: GLM.IArray): string; + export function frob(a: GLM.IArray): number; + export function LDU(L: GLM.IArray, D: GLM.IArray, U: GLM.IArray, a: GLM.IArray): GLM.IArray; +} + +// mat2d +declare module mat2d { + export function create(): GLM.IArray; + export function clone(a: GLM.IArray): GLM.IArray; + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function identity(a: GLM.IArray): GLM.IArray; + export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function determinant(a: GLM.IArray): number; + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + export function str(a: GLM.IArray): string; + export function frob(a: GLM.IArray): number; +} + +// mat3 +declare module mat3 { + export function create(): GLM.IArray; + export function clone(a: GLM.IArray): GLM.IArray; + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function identity(a: GLM.IArray): GLM.IArray; + export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function determinant(a: GLM.IArray): number; + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function str(a: GLM.IArray): string; + export function frob(a: GLM.IArray): number; + export function normalFromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray; + export function fromMat4(out: GLM.IArray, q: GLM.IArray): GLM.IArray; + export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + export function fromMat2d(out: GLM.IArray, q: GLM.IArray): GLM.IArray; +} + +// mat4 +declare module mat4 { + export function create(): GLM.IArray; + export function clone(a: GLM.IArray): GLM.IArray; + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function identity(a: GLM.IArray): GLM.IArray; + export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function determinant(a: GLM.IArray): number; + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number, axis: GLM.IArray): GLM.IArray; + export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + export function frustum(out: GLM.IArray, left: number, right: number, + bottom: number, top: number, near: number, far: number): GLM.IArray; + export function perspective(out: GLM.IArray, fov: number, aspect: number, + near: number, far: number): GLM.IArray; + export function ortho(out: GLM.IArray, left: number, right: number, + bottom: number, top: number, near: number, far: number): GLM.IArray; + export function lookAt(out: GLM.IArray, eye: GLM.IArray, + center: GLM.IArray, up: GLM.IArray): GLM.IArray; + export function str(a: GLM.IArray): string; + export function frob(a: GLM.IArray): number; + export function fromRotationTranslation(out: GLM.IArray, quat: GLM.IArray, + vec: GLM.IArray): GLM.IArray; + export function fromQuat(out: GLM.IArray, quat: GLM.IArray): GLM.IArray; +} + +// quat +declare module quat { + export function create(): GLM.IArray; + export function clone(a: GLM.IArray): GLM.IArray; + export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray; + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray; + export function identity(a: GLM.IArray): GLM.IArray; + export function setAxisAngle(out: GLM.IArray, axis: GLM.IArray, rad: number): GLM.IArray; + export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; + export function length(a: GLM.IArray): number; + export function len(a: GLM.IArray): number; + export function squaredLength(a: GLM.IArray): number; + export function sqrLen(a: GLM.IArray): number; + export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + export function slerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function conjugate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function str(a: GLM.IArray): string; + export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + export function fromMat3(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + export function setAxes(out: GLM.IArray, view: GLM.IArray, right: GLM.IArray, + up: GLM.IArray): GLM.IArray; + export function rotationTo(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function calculateW(out: GLM.IArray, a: GLM.IArray): GLM.IArray; +} \ No newline at end of file From 24967f4426710d746e1042f9d73f30a0671ac76a Mon Sep 17 00:00:00 2001 From: Arnaud Bosc Date: Sun, 3 May 2015 20:53:39 +0200 Subject: [PATCH 078/534] fix(firebase): update change user & email interfaces names --- firebase/firebase.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/firebase/firebase.d.ts b/firebase/firebase.d.ts index 4c9ac8659..f3c53b3ce 100644 --- a/firebase/firebase.d.ts +++ b/firebase/firebase.d.ts @@ -267,11 +267,11 @@ interface Firebase extends FirebaseQuery { /** * Updates the email associated with an email / password user account. */ - changeEmail(credentials: FirebaseNewUserCredentials, onComplete: (error: any) => void): void; + changeEmail(credentials: FirebaseChangeEmailCredentials, onComplete: (error: any) => void): void; /** * Change the password of an existing user using an email / password combination. */ - changePassword(credentials: FirebaseNewPasswordCredentials, onComplete: (error: any) => void): void; + changePassword(credentials: FirebaseChangePasswordCredentials, onComplete: (error: any) => void): void; /** * Removes an existing user account using an email / password combination. */ @@ -320,13 +320,13 @@ interface FirebaseCredentials { password: string; } -interface FirebaseNewPasswordCredentials { +interface FirebaseChangePasswordCredentials { email: string; oldPassword: string; newPassword: string; } -interface FirebaseNewUserCredentials { +interface FirebaseChangeEmailCredentials { oldEmail: string; newEmail: string; password: string; From 3be8e62d30b5abc3d89fff3bcebf414559172d39 Mon Sep 17 00:00:00 2001 From: Arnaud Bosc Date: Sun, 3 May 2015 21:05:08 +0200 Subject: [PATCH 079/534] fix(firebase): update change user & email interfaces names --- angularfire/angularfire.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index 195fde1a0..2db5040b4 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -86,7 +86,7 @@ interface AngularFireAuth { $requireAuth(): ng.IPromise; $createUser(credentials: FirebaseCredentials): ng.IPromise; $removeUser(credentials: FirebaseCredentials): ng.IPromise; - $changeEmail(credentials: FirebaseNewUserCredentials): ng.IPromise; - $changePassword(credentials: FirebaseNewPasswordCredentials): ng.IPromise; + $changeEmail(credentials: FirebaseChangeEmailCredentials): ng.IPromise; + $changePassword(credentials: FirebaseChangePasswordCredentials): ng.IPromise; $resetPassword(credentials: FirebaseResetPasswordCredentials): ng.IPromise; } From 4f78978afdf1dee1167f1bf942fc4fb8704e6bd6 Mon Sep 17 00:00:00 2001 From: Arnaud Bosc Date: Sun, 3 May 2015 22:35:33 +0200 Subject: [PATCH 080/534] fix(angularfire): add missing services primary calls definition --- angularfire/angularfire.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index 2db5040b4..46d95750c 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -39,6 +39,7 @@ interface AngularFireObject extends AngularFireSimpleObject { $destroy(): void; } interface AngularFireObjectService { + (firebase: Firebase): AngularFireObject; $extend(ChildClass: Object, methods?: Object): Object; } @@ -57,6 +58,7 @@ interface AngularFireArray extends Array { $destroy(): void; } interface AngularFireArrayService { + (firebase: Firebase): AngularFireArray; $extend(ChildClass: Object, methods?: Object): Object; } From aeedf997845a9677ea144474fefdb52389618b08 Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Sun, 3 May 2015 23:18:08 -0500 Subject: [PATCH 081/534] Add Argv#command(...) to yargs --- yargs/yargs.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yargs/yargs.d.ts b/yargs/yargs.d.ts index e77819e82..6a6adebe8 100644 --- a/yargs/yargs.d.ts +++ b/yargs/yargs.d.ts @@ -53,6 +53,8 @@ declare module "yargs" { usage(message: string, options?: { [key: string]: Options }): Argv; usage(options?: { [key: string]: Options }): Argv; + command(command: string, description: string): Argv; + example(command: string, description: string): Argv; check(func: (argv: { [key: string]: any }, aliases: { [alias: string]: string }) => boolean): Argv; From 4c6fe7e1dbed3b6bfc5a078c4f9820a001e0279b Mon Sep 17 00:00:00 2001 From: CDAlexanderW Date: Mon, 4 May 2015 00:59:08 -0700 Subject: [PATCH 082/534] Implicit any replaced by explicit any type. --- jquery.ui.layout/jquery.ui.layout.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jquery.ui.layout/jquery.ui.layout.d.ts b/jquery.ui.layout/jquery.ui.layout.d.ts index b15dd3386..dae9dc067 100644 --- a/jquery.ui.layout/jquery.ui.layout.d.ts +++ b/jquery.ui.layout/jquery.ui.layout.d.ts @@ -27,12 +27,12 @@ interface JQueryLayout { resizeContent(pane: any): any; resizeAll(): any; - addToggleBtn(selector: string, pane: any) - addCloseBtn(selector: string, pane: any) - addOpenBtn(selector: string, pane: any) - addPinBtn(selector: string, pane: any) - allowOverflow(elemOrPane: any) - resetOverflow(elemOrPane: any) + addToggleBtn(selector: string, pane: any): any; + addCloseBtn(selector: string, pane: any): any; + addOpenBtn(selector: string, pane: any): any; + addPinBtn(selector: string, pane: any): any; + allowOverflow(elemOrPane: any): any; + resetOverflow(elemOrPane: any): any; } interface JQuery { From 684c0d22b5e5f9bacfd6447a6a0f2ce4aa5c69b9 Mon Sep 17 00:00:00 2001 From: Tom Wambold Date: Mon, 4 May 2015 15:54:07 -0400 Subject: [PATCH 083/534] Add position() method to mdToastPreset. Resolves #3882. --- angular-material/angular-material.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 89cf14154..06c1ecf25 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -102,6 +102,7 @@ declare module angular.material { capsule(capsule: boolean): T; theme(theme: string): T; hideDelay(delay: number): T; + position(position: string): T; } interface MDSimpleToastPreset extends MDToastPreset { From 0018f1f6c62f7a899c229ce7522e40b47ca43d95 Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 4 May 2015 17:45:06 -0300 Subject: [PATCH 084/534] source-map-support: bump version and fix node dependency --- source-map-support/source-map-support.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source-map-support/source-map-support.d.ts b/source-map-support/source-map-support.d.ts index b0de346a7..31a642042 100644 --- a/source-map-support/source-map-support.d.ts +++ b/source-map-support/source-map-support.d.ts @@ -1,15 +1,17 @@ -// Type definitions for source-map-support 0.2.6 +// Type definitions for source-map-support 0.2.10 // Project: https://github.com/evanw/source-map-support // Definitions by: Bart van der Schoor // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module 'source-map-support' { /** * Output of retrieveSourceMap(). */ export interface UrlAndMap { url: string; - map: any; // string or Buffer + map: string|Buffer; } /** From 2c169b1f610893f65194f25ecafe3d173753b0d6 Mon Sep 17 00:00:00 2001 From: yamada28go Date: Tue, 5 May 2015 12:32:36 +0900 Subject: [PATCH 085/534] add x-date --- xdate/xdate.d.ts | 365 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 365 insertions(+) create mode 100644 xdate/xdate.d.ts diff --git a/xdate/xdate.d.ts b/xdate/xdate.d.ts new file mode 100644 index 000000000..bd1cd8e8e --- /dev/null +++ b/xdate/xdate.d.ts @@ -0,0 +1,365 @@ +// Type definitions for XDate 0.8 +// Project: http://arshaw.com/xdate/ +// Definitions by: <> +// Definitions: https://github.com/daptiv/DefinitelyTyped + + +interface formatters_info +{ + i?: string; + u?: string; + xxx? : string; + vvv?: (xdate : XDate , useutc : boolean ) => string; +} + + +declare class XDate { + + //------------ + //Constructors + //------------ + + public constructor(); + + public constructor( utcmode : boolean ); + + /** + * constructor + */ + public constructor(xdate : XDate , utcmode? : boolean ) ; + + /** + * constructor + * @param {Date} [nativeDate] - JavaScript native date + */ + public constructor(nativeDate : Date , utcmode? : boolean ) ; + + /** + * constructor + * @param {number} [milliseconds] - milliseconds + */ + public constructor(milliseconds: number , utcmode? : boolean ) ; + + /** + * constructor + * @param {number} [year] - year + * @param {number} [month] - month + * @param {number} [date] - date + * @param {number} [hours] - hours + * @param {number} [minutes] - minutes + * @param {number} [seconds] - seconds + * @param {number} [milliseconds] - milliseconds + */ + public constructor( year : number , month : number , date : number , + hours? : number , minutes? : number , seconds? : number , milliseconds? : number , utcmode? : boolean ); + + /** + * constructor + * @param {string} [dateString] - formatted date string + */ + public constructor( dateString : string , utcmode? : boolean ); + + //------------ + //Getters + //------------ + + /** + * Returns the 4-digit year (ex: 2012) + * @return {number} 4-digit year (ex: 2012) + */ + public getFullYear() : number ; + + /* + *Returns the month of the year. (0-11) + *Value is zero-index, meaning Jan=0, Feb=1, Mar=2, etc. + */ + public getMonth() : number; + + /* + *Returns the ISO week number of the year. (1-53) + */ + public getWeek(): number; + + /* + *Returns the date of the month. (1-31) + */ + public getDate() : number; + + /* + *Returns the day-of-week as a number. (0-6) + *Sun=0, Mon=1, Tue=2, etc. + */ + public getDay() : number; + + /* + *Returns the hour of the day. (0-23) + */ + public getHours() : number; + + /* + *Returns the minute of the hour. (0-59) + */ + public getMinutes() : number; + + /* + *Returns the second of the minute. (0-59) + */ + public getSeconds() : number; + + /* + *Returns the millisecond of the second. (0-999) + */ + public getMilliseconds() : number; + + /* + *Returns the number of milliseconds since the epoch. + */ + public getTime() : number; + + /* + *Returns the number of milliseconds since the epoch. Identical to getTime. + */ + public valueOf() : number; + + //------------ + //Setters + //------------ + + /* + *year is a 4-digit year + */ + public setFullYear(year : number , preventOverflow? : boolean) : XDate; + + /* + month is zero-indexed, meaning Jan=0, Feb=1, Mar=2, etc. + */ + public setMonth(month : number , preventOverflow? : boolean ) : XDate; + + /* + *Moves the xdate to the Monday of the given week with time 00:00:00. + *The week is represented by a given ISO week number and an optional year. If year is omitted, the xdate's year with be used. + */ + public setWeek(week : number , year? : number) : XDate; + + /* + *Sets the date of the month. (1-31) + */ + public setDate(date : number ) : XDate; + + /* + *Sets the hour of the day. (0-23) + */ + public setHours(hours: number ) :XDate; + + /* + *Sets the minute of the hour. (0-59) + */ + public setMinutes(minutes : number) : XDate; + + /* + *Sets the second of the minute. (0-59) + */ + public setSeconds(seconds : number) : XDate; + + /* + *Sets the millisecond of the second. (0-999) + */ + public setMilliseconds(milliseconds : number) : XDate; + + /* + *Sets the number of milliseconds since the epoch. + */ + public setTime(milliseconds : number ) : XDate; + + //------------ + //Adding + //------------ + public addYears(years : number, preventOverflow? : boolean) : XDate; + public addMonths(months : number , preventOverflow? : boolean) : XDate; + public addWeeks(weeks : number) : XDate; + public addDays(days : number) : XDate; + public addHours(hours : number) : XDate; + public addMinutes(minutes : number) : XDate; + public addSeconds(seconds : number) : XDate; + public addMilliseconds(milliseconds : number) :XDate; + + + //------------ + //Diffing + //------------ + public diffYears(otherDate : string) : number ; + public diffYears(otherDate : XDate) : number ; + public diffMonths(otherDate : string) : number ; + public diffMonths(otherDate : XDate) : number ; + public diffWeeks(otherDate : string) : number ; + public diffWeeks(otherDate : XDate) : number ; + public diffDays(otherDate : string) : number ; + public diffDays(otherDate : XDate) : number ; + public diffHours(otherDate : string) : number ; + public diffHours(otherDate : XDate) : number ; + public diffMinutes(otherDate : string) : number ; + public diffMinutes(otherDate : XDate) : number ; + public diffSeconds(otherDate : string) : number ; + public diffSeconds(otherDate : XDate) : number ; + public diffMilliseconds(otherDate : string) : number ; + public diffMilliseconds(otherDate : XDate) : number ; + + + //------------ + //Formatting + //------------ + + /* + *If formatString is not specified, a browser-produced IETF string will be returned. + * settings can be a name of an available locale or an object that overrides the default locale's settings. + */ + public toString(formatString? : string , settings? : Object) : string; + + /* + *Same as toString but gets its values from the UTC version of the date. + *As a result, "Z" will be displayed as the timezone. + */ + public toUTCString(formatString? : string , settings? : Object) : string; + public toGMTString(formatString? : string , settings? : Object) : string; + + /* + *Returns an ISO8601 string that has been normalized to UTC. Will have a "Z" timezone indicator. + *See the native Date's specs for toISOString. + */ + public toISOString() : string; + + /* + *Same as native Date's toDateString + */ + public toDateString() : string; + + /* + *Same as native Date's toTimeString + */ + public toTimeString() : string; + + /* + *Same as native Date's toLocaleString + */ + public toLocaleString() : string; + + /* + *Same as native Date's toLocaleDateString + */ + public toLocaleDateString() : string; + + /* + *Same as native Date's toLocaleTimeString + */ + public toLocaleTimeString() : string; + + + //------------ + //Formatting + //------------ + public getUTCFullYear() : number ; + public getUTCMonth() : number ; + public getUTCWeek() : number ; + public getUTCDate() : number ; + public getUTCDay() : number ; + public getUTCHours() : number ; + public getUTCMinutes() : number ; + public getUTCSeconds() : number ; + public getUTCMilliseconds() : number ; + public setUTCFullYear(year : number) : XDate; + public setUTCMonth(month : number) : XDate; + public setUTCWeek(week : number , year? : number ) : XDate; + public setUTCDate(date : number ) : XDate; + public setUTCHours(hours : number ) : XDate; + public setUTCMinutes(minutes : number ) : XDate; + public setUTCSeconds(seconds : number ) : XDate; + public setUTCMilliseconds(milliseconds : number) : XDate; + + //------------ + //UTC Mode + //------------ + + /* + *Returns true if the date is in UTC-mode and false otherwise + */ + public getUTCMode() : boolean; + + /* + *utcMode must be either true or false. If the optional doCoercion parameters is set to true, + *the underlying millisecond time of the date will be coerced in such a way that methods like + *getDate and getHours will have the same values before and after the conversion. + */ + public setUTCMode(utcMode : boolean , doCoercion? : boolean ) : XDate; + + /* + *Returns the number of minutes from UTC, just like the native Date's getTimezoneOffset. + *However, if the XDate is in UTC-mode, 0 will be returned. + */ + public getTimezoneOffset() : number; + + //------------ + //Utilities + //------------ + + /* + *returns a copy of the XDate + */ + public clone() : XDate; + + /* + *sets the hours, minutes, seconds, and milliseconds to zero + */ + public clearTime() : XDate ; + + /* + *return true if the XDate is a valid date, false otherwise + */ + public valid() : boolean ; + + /* + *Returns a conversion to a native Date + */ + public toDate() : Date; + + //------------ + //Static function + //------------ + + + /* + *Returns the number of days in the given month + */ + public static getDaysInMonth(year : number , month : number) : number; + + /* + *Parses a date-string and returns milliseconds since the epoch. You'll probably want to use new XDate(dateString) instead. + */ + public static parse(dateString : string ) : number; + + + /* + *Returns the current date, as milliseconds since the epoch. You'll probably want to use new XDate() instead. + */ + public static now() : number ; + + + /* + *Returns the current date with time cleared, as an XDate object + */ + public static today() : XDate ; + + /* + *Returns a milliseconds time since the epoch for the given UTC date + */ + public static UTC(year : number , month : number , date : number , hours : number, + minutes : number , seconds : number , milliseconds : number ) : XDate; + + public static locales : Object; + + public static defaultLocale : string; + public static formatters : formatters_info; + + public static getDaysInMonth(year : number, month : number) : number; + public static UTC(year : number, month : number, day : number , hours? : number , minutes? : number , seconds?:number,ms?:number): number; + +} From ac2af604de3d037139e061fbd3fa3638009094c7 Mon Sep 17 00:00:00 2001 From: yamada28go Date: Tue, 5 May 2015 12:41:39 +0900 Subject: [PATCH 086/534] add xdate tests --- xdate/xdate-test.ts | 1320 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1320 insertions(+) create mode 100644 xdate/xdate-test.ts diff --git a/xdate/xdate-test.ts b/xdate/xdate-test.ts new file mode 100644 index 000000000..9f86c0609 --- /dev/null +++ b/xdate/xdate-test.ts @@ -0,0 +1,1320 @@ +/// + +//Those classes were tested by compile time only! + +module XDate_Test +{ + + class test_base + { + public assert( ref : boolean ) + { + if( true == ref) + { + console.info("OK"); + } + else + { + console.warn("NG"); + } + } + } + + //based on xdate/test/adding.js + class adding extends test_base + { + + private addYears() : boolean + { + + var d1 = new XDate(2011, 2, 1); + d1.addYears(10); + var d2 = new XDate(2011, 2, 1); + d2.addYears(-2); + return d1.getFullYear() == 2021 && + d1.getMonth() == 2 && + d1.getDate() == 1 && + d2.getFullYear() == 2009 && + d2.getMonth() == 2 && + d2.getDate() == 1; + + } + + private addMonths() : boolean + { + + var d1 = new XDate(2012, 2, 6); + d1.addMonths(3); + var d2 = new XDate(2012, 2, 6); + d2.addMonths(-3); + return d1.getFullYear() == 2012 && + d1.getMonth() == 5 && + d1.getDate() == 6 && + d2.getFullYear() == 2011 && + d2.getMonth() == 11 && + d2.getDate() == 6; + } + + private addMonths_prevent_overflow() : boolean + { + + var d1 = new XDate(2010, 11, 30); // dec 30 + d1.addMonths(2, true); + var d2 = new XDate(2011, 5, 30); // jun 30 + d2.addMonths(-4, true); + return d1.getFullYear() == 2011 && + d1.getMonth() == 1 && + d1.getDate() == 28 && + d2.getFullYear() == 2011 && + d2.getMonth() == 1 && + d2.getDate() == 28; + + } + + private addMonths_prevent_overflow_backwards_january_bug() : boolean { + var d1 = new XDate(2013, 0, 28); // Jan 28 + var d2 = new XDate(2013, 0, 14); // Jan 14 + return d1.addMonths(-1, true).toString('yyyy-MM-dd') == '2012-12-28' && // Dec 28 + d2.addMonths(-1, true).toString('yyyy-MM-dd') == '2012-12-14'; // Dec 14 + } + + + private addDays() : boolean { + var d1 = new XDate(2009, 5, 8); + d1.addDays(30); + var d2 = new XDate(2009, 5, 8); + d2.addDays(-4); + return d1.getFullYear() == 2009 && + d1.getMonth() == 6 && + d1.getDate() == 8 && + d2.getFullYear() == 2009 && + d2.getMonth() == 5 && + d2.getDate() == 4; + } + + + private addHours_addMinutes_addSeconds_addMilliseconds() : boolean { + var d = new XDate(2010, 0, 1, 5, 30, 24, 500); + d.addHours(2); + d.addMinutes(15); + d.addSeconds(6); + d.addMilliseconds(50); + return d.getHours() == 7 && + d.getMinutes() == 45 && + d.getSeconds() == 30 && + d.getMilliseconds() == 550; + } + + + private addWeeks() : boolean { + return new XDate(2011, 7, 12).addWeeks(2).getDate() == 26 && + new XDate(2011, 7, 12).addWeeks(-2).getDate() == 29; + } + + public constructor() + { + super(); + super.assert( this.addYears() ); + super.assert( this.addMonths_prevent_overflow() ); + super.assert( this.addMonths_prevent_overflow_backwards_january_bug() ); + super.assert( this.addDays() ); + super.assert( this.addHours_addMinutes_addSeconds_addMilliseconds() ); + super.assert( this.addWeeks() ); + } + + } + + + class constructors extends test_base + { + + public no_args() : boolean { + var xdate = new XDate(); + var time = +new Date(); + return Math.abs(xdate.getTime() - time) < 1000 && !xdate.getUTCMode(); + } + + public only_utcMode_false(): boolean { + var xdate = new XDate(false); + var time = +new Date(); + return Math.abs(xdate.getTime() - time) < 1000 && !xdate.getUTCMode(); + } + + public only_utcMode_true() : boolean { + var xdate = new XDate(true); + var time = +new Date(); + return Math.abs(xdate.getTime() - time) < 1000 && xdate.getUTCMode(); + } + + public from_XDate_XDate() : boolean { + var xdate1 = new XDate(); + var xdate2 = new XDate(xdate1); + return xdate1.getTime() == xdate2.getTime() && + !xdate1.getUTCMode() && !xdate2.getUTCMode(); + } + + public from_XDate_XDate_with_utcMode_true() : boolean { + var xdate1 = new XDate().setUTCMode(true); + var xdate2 = new XDate(xdate1); + //return xdate1.getTime() == xdate2.getTime() && + //xdate1.getUTCMode() && xdate2.getUTCMode(); + return true; + } + + public from_XDate_XDate_override_with_utcMode_true() : boolean { + var xdate1 = new XDate(); + var xdate2 = new XDate(xdate1, true); + return xdate1.getTime() == xdate2.getTime() && + !xdate1.getUTCMode() && xdate2.getUTCMode(); + } + + public from_XDate_XDate_override_with_utcMode_false() : boolean { + var xdate1 = new XDate().setUTCMode(true); + var xdate2 = new XDate(xdate1, false); + return xdate1.getTime() == xdate2.getTime() && + xdate1.getUTCMode() && !xdate2.getUTCMode(); + } + + public from_native_Date_utcMode_false() : boolean { + var date = new Date(); + var xdate1 = new XDate(date); + var xdate2 = new XDate(date, false); + return date.getTime() == xdate1.getTime() && + date.getTime() == xdate2.getTime() && + !xdate1.getUTCMode() && !xdate2.getUTCMode(); + } + + public from_native_Date_utcMode_true(): boolean { + var date = new Date(); + var xdate = new XDate(date, true); + return date.getTime() == xdate.getTime() && + xdate.getUTCMode(); + } + + public from_milliseconds_time_utcMode_false() : boolean { + var MS = 933490800000; + var xdate1 = new XDate(MS); + var xdate2 = new XDate(MS, false); + return !xdate1.getUTCMode() && + !xdate2.getUTCMode() && + xdate1.getTime() == MS && + xdate2.getTime() == MS; + } + + public from_milliseconds_time_utcMode_true() : boolean { + var MS = 933490800000; + var xdate = new XDate(MS, true); + return xdate.getUTCMode() && xdate.getTime() == MS; + } + + public year_month_date_utcMode_false() : boolean { + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var xdate1 = new XDate(YEAR, MONTH, DATE); + //var xdate2 = new XDate(YEAR, MONTH, DATE, false); + var xdate2 = new XDate(YEAR, MONTH, DATE); + xdate2.setUTCMode(false); + return !xdate1.getUTCMode() && !xdate2.getUTCMode() && + xdate1.getTime() == xdate2.getTime() && + xdate1.getFullYear() == YEAR && + xdate1.getMonth() == MONTH && + xdate1.getDate() == DATE && + !xdate1.getHours() && + !xdate1.getMinutes() && + !xdate1.getSeconds() && + !xdate1.getMilliseconds(); + } + + public toString_utcMode_undefined_true() : boolean { + var xdate1 = new XDate('2012-09-21'); + var xdate2 = new XDate('2012-09-21', true); + return xdate1.toString('yyyy-MM-dd HH-mm-ss') == '2012-09-21 00-00-00' && + xdate2.toString('yyyy-MM-dd HH-mm-ss') == '2012-09-21 00-00-00'; + } + + public year_month_date_minutes_seconds_milliseconds_utcMode_false() : boolean { + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + var xdate1 = new XDate(YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS); + var xdate2 = new XDate(YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS, false); + return !xdate1.getUTCMode() && !xdate2.getUTCMode() && + xdate1.getTime() == xdate2.getTime() && + xdate1.getFullYear() == YEAR && + xdate1.getMonth() == MONTH && + xdate1.getDate() == DATE && + xdate1.getHours() == HOURS && + xdate1.getMinutes() == MINUTES && + xdate1.getSeconds() == SECONDS && + xdate1.getMilliseconds() == MILLISECONDS; + } + + public year_month_date_utcMode_true() : boolean { + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + //var xdate = new XDate(YEAR, MONTH, DATE, true); + var xdate = new XDate(YEAR, MONTH, DATE); + xdate.setUTCMode(true); + return xdate.getUTCMode() + xdate.getFullYear() == YEAR && + xdate.getMonth() == MONTH && + xdate.getDate() == DATE && + !xdate.getHours() && + !xdate.getMinutes() && + !xdate.getSeconds() && + !xdate.getMilliseconds(); + } + + public year_month_date_minutes_seconds_milliseconds_utcMode_true() : boolean { + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + var xdate = new XDate(YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS, true); + return xdate.getUTCMode() && + xdate.getFullYear() == YEAR && + xdate.getMonth() == MONTH && + xdate.getDate() == DATE && + xdate.getHours() == HOURS && + xdate.getMinutes() == MINUTES && + xdate.getSeconds() == SECONDS && + xdate.getMilliseconds() == MILLISECONDS; + } + + /* + public without_new_operator() : boolean { + return XDate("Sun Aug 14 2011 00:28:53 GMT-0700 (PDT)") && + !XDate("asdf").valid(); + } + */ + + + public constructor() + { + super(); + super.assert( this.no_args() ); + super.assert( this.only_utcMode_false() ); + super.assert( this.only_utcMode_true() ); + super.assert( this.from_XDate_XDate() ); + + super.assert(this.from_XDate_XDate_with_utcMode_true()); + super.assert(this.from_XDate_XDate_override_with_utcMode_true()); + super.assert(this.from_XDate_XDate_override_with_utcMode_false()); + super.assert(this.from_native_Date_utcMode_false()); + super.assert(this.from_native_Date_utcMode_true()); + super.assert(this.from_milliseconds_time_utcMode_false()); + super.assert(this.from_milliseconds_time_utcMode_true()); + super.assert(this.year_month_date_utcMode_false()); + super.assert(this.toString_utcMode_undefined_true()); + super.assert(this.year_month_date_minutes_seconds_milliseconds_utcMode_false()); + super.assert(this.year_month_date_utcMode_true()); + super.assert(this.year_month_date_minutes_seconds_milliseconds_utcMode_true()); + } + } + + + // based on xdate/test/diffing.js + class diffing extends test_base + { + + + public diffWeeks() : boolean{ + return Math.floor(new XDate(2011, 4, 18).diffWeeks(new XDate(2011, 4, 26))) == 1 && + //Math.abs(new XDate(2011, 4, 18).diffWeeks(new XDate(2011, 4, 26), true) - (1+1/7)) < .001 && + Math.floor(new XDate(2011, 4, 18).diffWeeks(new XDate(2011, 4, 24))) == 0 && + //Math.abs(new XDate(2011, 4, 18).diffWeeks(new XDate(2011, 4, 24), true) - (1-1/7)) < .001 && + Math.floor(new XDate(2011, 4, 18).diffWeeks(new XDate('2011-05-26'))) == 1; + } + + + public diffYears() :boolean { + return new XDate('2011-04-10').diffYears('2013-04-10') == 2 && + new XDate('2011-01-01T06:06:06').diffYears('2013-07-01T06:06:06') == 2.5; + } + + + public diffMonths() :boolean { + return new XDate('2011-06-05').diffMonths('2012-07-05') == 13 && + new XDate('2012-07-05').diffMonths('2011-06-05') == -13; + } + + + public diffDays() :boolean { + return new XDate('2012-12-25').diffDays('2012-12-30') == 5; + } + + + public diffHours() :boolean { + return new XDate('2012-05-05T06:30:00').diffHours('2012-05-05T04:00:00') == -2.5; + } + + + public diffMinutes() :boolean { + return new XDate('2012-05-01T05:50').diffMinutes('2012-05-01T06:10:30') == 20.5; + } + + + public diffSeconds() :boolean { + return new XDate('2012-03-01T00:00:45').diffSeconds('2012-03-01T00:01:15') == 30; + } + + + public diffMilliseconds() :boolean { + return new XDate('2011-06-06T05:05:05').diffMilliseconds('2011-06-06T05:05:08.100') == 3100; + } + + + + public constructor() + { + super(); + super.assert( this.diffWeeks() ); + super.assert( this.diffYears() ); + super.assert( this.diffMonths() ); + super.assert( this.diffDays() ); + super.assert( this.diffHours() ); + super.assert( this.diffMinutes() ); + super.assert( this.diffSeconds() ); + super.assert( this.diffMilliseconds() ); + } + + } + + // based on xdate/test/formatting.js + class formatting extends test_base + { + + public numbers_am() : boolean { + return new XDate(1986, 5, 8, 4, 3, 2) + .toString('MM/dd/yyyy hh:mm:ss tt') == "06/08/1986 04:03:02 am"; + } + + + public numbers_am_uppercase() : boolean { + return new XDate(1986, 5, 8, 4, 3, 2) + .toString('MM/dd/yyyy hh:mm:ss TT') == "06/08/1986 04:03:02 AM"; + } + + + public numbers_am_mini() : boolean { + return new XDate(1986, 5, 8, 4, 3, 2) + .toString('M/d/yy h:m:s t') == "6/8/86 4:3:2 a"; + } + + + public numbers_pm() : boolean { + return new XDate(1986, 5, 8, 14, 3, 2) + .toString('MM/dd/yyyy hh:mm:ss tt') == "06/08/1986 02:03:02 pm"; + } + + + public numbers_pm_uppercase() : boolean { + return new XDate(1986, 5, 8, 14, 3, 2) + .toString('MM/dd/yyyy hh:mm:ss TT') == "06/08/1986 02:03:02 PM"; + } + + + public numbers_pm_mini() : boolean { + return new XDate(1986, 5, 8, 14, 3, 2) + .toString('M/d/yy h:m:s t') == "6/8/86 2:3:2 p"; + } + + + public no_am_pm_confusion() : boolean { + return new XDate(2012, 5, 8).toString('tt') == 'am' && + new XDate(2012, 5, 8, 12).toString('tt') == 'pm'; + } + + + public numbers_24_hour_clock() : boolean { + return new XDate(1986, 5, 8, 14, 3, 2) + .toString('dd/MM/yyyy HH:mm:ss') == "08/06/1986 14:03:02"; + } + + + public short_names() : boolean { + return new XDate(2011, 10, 5) + .toString('ddd, MMM dd, yyyy') == "Sat, Nov 05, 2011"; + } + + + public long_namesu() : boolean { + return new XDate(2011, 10, 5) + .toString('dddd, MMMM dd, yyyy') == "Saturday, November 05, 2011"; + } + + + public ordinals() : boolean { + return new XDate(2011, 1, 1).toString('dS') == "1st" && + new XDate(2011, 1, 2).toString('dS') == "2nd" && + new XDate(2011, 1, 3).toString('dS') == "3rd" && + new XDate(2011, 1, 4).toString('dS') == "4th" && + new XDate(2011, 1, 23).toString('dS') == "23rd" && + new XDate(2011, 1, 11).toString('dS') == "11th"; + } + + + public fff_milliseconds() : boolean { + var d = new XDate(); + var s = d.toString('fff'); + return d.getMilliseconds() === parseInt(s, 10) && s.length==3; + } + + + public timezone() : boolean { + var d1 = new XDate(); + d1.getTimezoneOffset = function() { return 7 * 60 + 15 }; + var d2 = new XDate(); + d2.getTimezoneOffset = function() { return -(7 * 60 + 15) }; + return d1.toString('z') == '-7' && + d1.toString('zz') == '-07' && + d1.toString('zzz') == '-07:15' && + d2.toString('z') == '+7' && + d2.toString('zz') == '+07' && + d2.toString('zzz') == '+07:15'; + } + + + public toString_i() : boolean { + var d = new XDate(2011, 5, 8, 14, 35, 21); + return d.toString('i') == '2011-06-08T14:35:21'; + } + + public toString_i_utcMode_true() : boolean { + var d = new XDate(2011, 5, 8, 14, 35, 21); + d.setUTCMode(true); + return d.toString('i') == '2011-06-08T14:35:21'; + } + + public toString_u() : boolean { + var d = new XDate(2011, 5, 8, 14, 35, 21); + return d.toString('u').indexOf('2011-06-08T14:35:21') == 0; + } + + public toString_u_utcMode_true() : boolean { + var d = new XDate(2011, 5, 8, 14, 35, 21); + d.setUTCMode(true); + return d.toString('u') == '2011-06-08T14:35:21Z'; + } + + public toUTCString_i() : boolean { + var d = new XDate(Date.UTC(2011, 5, 8, 14, 35, 21)); + return d.toUTCString('i') == '2011-06-08T14:35:21'; + } + + public toUTCString_i_utcMode_true() : boolean { + var d = new XDate(Date.UTC(2011, 5, 8, 14, 35, 21), true); + return d.toUTCString('i') == '2011-06-08T14:35:21'; + } + + public toUTCString_u() : boolean { + var d = new XDate(Date.UTC(2011, 5, 8, 14, 35, 21)); + return d.toUTCString('u') == '2011-06-08T14:35:21Z'; + } + + public toUTCString_u_utcMode_true() : boolean { + var d = new XDate(Date.UTC(2011, 5, 8, 14, 35, 21), true); + return d.toUTCString('u') == '2011-06-08T14:35:21Z'; + } + + + public non_zero_parenthesis() : boolean { + var d1 = new XDate(2010, 5, 8, 1); + var d2 = new XDate(2010, 5, 8, 14, 30); + return d1.toString('M/d/yyyy h(:mm)tt') == "6/8/2010 1am" && + d2.toString('M/d/yyyy h(:mm)tt') == "6/8/2010 2:30pm"; + } + + public non_zero_parenthesis_nested() : boolean { + return new XDate(2011, 5, 8).toString("(h(:mm)tt)") == "12am" && + new XDate(2011, 5, 8, 6).toString("(h(:mm)tt)") == "6am" && + new XDate(2011, 5, 8, 6, 30).toString("(h(:mm)tt)") == "6:30am"; + } + + + public non_zero_parenthesis_crazy_quotes() : boolean { + return new XDate(2010, 5, 8, 14, 30) + .toString("M/d/yyyy h(:mm')')tt") == "6/8/2010 2:30)pm"; + } + + + public string_literal() : boolean { + var d = new XDate(2011, 5, 8); + return d.toString("MMM dS 'yyyy!mm'") == "Jun 8th yyyy!mm"; + } + + + public escaped_single_quote() : boolean { + var d = new XDate(2011, 5, 8); + return d.toString("''MMM dS yyyy''") == "'Jun 8th 2011'"; + } + + + public toString_toUTCString_settings_param() : boolean { + var settings = { + dayNames: ['Sunday', 'Benduday', 'Zhellday', 'Taungsday', 'Centaxday', 'Primeday', 'Saturday'] + }; + return new XDate(2011, 3, 29).toString('dddd yyyy', settings) == 'Primeday 2011' && + new XDate(2011, 3, 4, 12).toUTCString('dddd yyyy', settings) == 'Benduday 2011'; + } + + + public iso_week_correct_digits() : boolean { + return new XDate(2011, 2, 1).toString('w') == '9' && + new XDate(2011, 2, 1).toUTCString('w') == '9' && + new XDate(2011, 2, 1).toString('ww') == '09' && + new XDate(2011, 2, 1).toUTCString('ww') == '09'; + } + + + public toString_toUTCString_different_locale() : boolean { + XDate.locales['starwars'] = { + dayNames: ['Sunday', 'Benduday', 'Zhellday', 'Taungsday', 'Centaxday', 'Primeday', 'Saturday'] + }; + return new XDate(2011, 3, 29).toString('dddd yyyy', 'starwars') == 'Primeday 2011' && + new XDate(2011, 3, 4, 12).toUTCString('dddd yyyy', 'starwars') == 'Benduday 2011'; + } + + + public toString_toUTCString_new_default_locale() : boolean { + XDate.locales['starwars'] = { + dayNames: ['Sunday', 'Benduday', 'Zhellday', 'Taungsday', 'Centaxday', 'Primeday', 'Saturday'] + }; + XDate.defaultLocale = 'starwars'; + var good = + new XDate(2011, 3, 29).toString('dddd yyyy') == 'Primeday 2011' && + new XDate(2011, 3, 4, 12).toUTCString('dddd yyyy') == 'Benduday 2011'; + XDate.defaultLocale = ''; + return good; + } + + + public custom_formatter_string() : boolean { + XDate.formatters.xxx = 'yyyyMMdd'; + var d = new XDate('2012-11-01'); + return d.toString('xxx') == '20121101'; + } + + + public custom_formatter_function() : boolean { + XDate.formatters.vvv = function(xdate, useUTC) { + return "cool/" + useUTC + "/" + xdate.getDate(); + }; + var d = new XDate('2012-10-05'); + return d.toString('vvv') == "cool/false/5" && + d.toUTCString('vvv') == "cool/true/5"; + } + + + public toString_methods_hasLocalTimezone_yes() : boolean { + var realDate = new Date(2011, 3, 20, 12, 30); + var xdate = new XDate(2011, 3, 20, 12, 30); + return realDate.toString() == xdate.toString() && + realDate.toDateString() == xdate.toDateString() && + realDate.toTimeString() == xdate.toTimeString() && + realDate.toLocaleString() == xdate.toLocaleString() && + realDate.toLocaleDateString() == xdate.toLocaleDateString() && + realDate.toLocaleTimeString() == xdate.toLocaleTimeString() && + realDate.toUTCString() == xdate.toUTCString(); + //toGMTString() was abolition + //&& + //realDate.toGMTString() == xdate.toGMTString(); + } + + public toString_methods_hasLocalTimezone_no() : boolean { + var realDate = new Date(2011, 3, 20, 12, 30); + var xdate = new XDate(2011, 3, 20, 12, 30); + xdate.setUTCMode(false); + return realDate.toString().indexOf(xdate.toString()) == 0 && + realDate.toTimeString().indexOf(xdate.toTimeString()) == 0 && + realDate.toLocaleString().indexOf(xdate.toLocaleString()) == 0 && + realDate.toLocaleDateString().indexOf(xdate.toLocaleDateString()) == 0 && + realDate.toLocaleTimeString().indexOf(xdate.toLocaleTimeString()) == 0; + } + + public toGMTString() : boolean { + var xdate = new XDate(); + return xdate.toUTCString() == xdate.toGMTString(); + } + + } + + //based on xdate/test/getters.js + class getters extends test_base + { + + public getTime_valueOf() : boolean { + var MS = 933490800000; + var xdate1 = new XDate(MS); + var xdate2 = new XDate(MS, false); + // return xdate1.getTime() == MS && xdate1.valueOf() == MS && +xdate1 == MS && + // xdate2.getTime() == MS && xdate2.valueOf() == MS && xdate2 == MS; + + return xdate1.getTime() == MS && xdate1.valueOf() == MS && + xdate2.getTime() == MS && xdate2.valueOf() == MS; + + } + + public getUTC() : boolean { + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + var xdate = new XDate(Date.UTC(YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS)); + return xdate.getUTCFullYear() == YEAR && + xdate.getUTCMonth() == MONTH && + xdate.getUTCDate() == DATE && + xdate.getUTCHours() == HOURS && + xdate.getUTCMinutes() == MINUTES && + xdate.getUTCSeconds() == SECONDS && + xdate.getUTCMilliseconds() == MILLISECONDS; + } + + //Deprecated + // public getYear() : boolean { + // var xdate = new XDate(1999, 0, 1); + // return xdate.getYear() == 99; + // } + + public getWeek() : boolean { + return new XDate(2011, 2, 1).getWeek() == 9; + } + + public getUTCWeek() : boolean { + return new XDate(2011, 2, 1, 12, 30).getUTCWeek() == 9; + } + + //Non-standard + /* + public getWeek_getUTCWeek_mega_test() : boolean { + if (!Date.prototype.toLocaleFormat) { + return "need Mozilla toLocaleFormat"; + } + var realDate = new Date(2011, 0, 1, 12, 0); + var xdate = new XDate(2011, 0, 1, 12, 0); + while (xdate.getFullYear() != 2014) { + var w1 = parseInt(realDate.toLocaleFormat('%V'), 10); + var w2 = xdate.getWeek(); + if (w1 != w2) { + return [ + false, + realDate.toString() + '=' + w1 + ' ' + xdate.toString() + '=' + w2 + ]; + } + var realDateUTC = XDate(realDate).setUTCMode(true, true).toDate(); + w1 = parseInt(realDateUTC.toLocaleFormat('%V'), 10); + w2 = xdate.getUTCWeek(); + if (w1 != w2) { + return [ + false, + realDateUTC.toUTCString() + '=' + w1 + ' ' + xdate.toUTCString() + '=' + w2 + ' (UTC!)' + ]; + } + realDate.setDate(realDate.getDate() + 1); + xdate.setDate(xdate.getDate() + 1); + } + return true; + } + */ + + } + + // based on xdate/test/parsing.js + class parsing extends test_base + { + + public IETF() : boolean { + var s = "Sat Apr 23 2011 13:44:12 GMT"; + var d = new XDate(s); + return d.getUTCFullYear() == 2011 && + d.getUTCMonth() == 3 && + d.getUTCDate() == 23 && + d.getUTCHours() == 13 && + d.getUTCMinutes() == 44 && + d.getUTCSeconds() == 12 && + !d.getUTCMode() && + +d == +new Date(s); + } + + + public ISO_no_time() : boolean + { + var s = "2010-06-08"; + var d = new XDate(s); + return d.getFullYear() == 2010 && + d.getMonth() == 5 && + d.getDate() == 8 && + !d.getHours() && + !d.getMinutes() && + !d.getSeconds() && + !d.getMilliseconds() && + !d.getUTCMode(); + } + + + public ISO_T() : boolean { + var s = "2010-06-08T14:45:30"; + var d = new XDate(s); + return d.getFullYear() == 2010 && + d.getMonth() == 5 && + d.getDate() == 8 && + d.getHours() == 14 && + d.getMinutes() == 45 && + d.getSeconds() == 30 && + !d.getMilliseconds() && + !d.getUTCMode(); + } + + + public ISO_space() : boolean { + var s = "2010-06-08 14:45:30"; + var d = new XDate(s); + return d.getFullYear() == 2010 && + d.getMonth() == 5 && + d.getDate() == 8 && + d.getHours() == 14 && + d.getMinutes() == 45 && + d.getSeconds() == 30 && + !d.getMilliseconds() && + !d.getUTCMode(); + } + + + public ISO_no_seconds() : boolean { + var s = "2010-06-08T14:45"; + var d = new XDate(s); + return d.getFullYear() == 2010 && + d.getMonth() == 5 && + d.getDate() == 8 && + d.getHours() == 14 && + d.getMinutes() == 45 && + !d.getSeconds() && + !d.getMilliseconds() && + !d.getUTCMode(); + } + + + public ISO_milliseconds() : boolean { + var s = "2010-06-08T14:45:30.500"; + var d = new XDate(s); + return d.getFullYear() == 2010 && + d.getMonth() == 5 && + d.getDate() == 8 && + d.getHours() == 14 && + d.getMinutes() == 45 && + d.getSeconds() == 30 && + d.getMilliseconds() == 500 && + !d.getUTCMode(); + } + + + public ISO_timezone_colon() : boolean { + var s = "2010-06-08T14:00:28-02:30"; + var d = new XDate(s); + return d.getUTCHours() == 16 && + d.getUTCMinutes() == 30 && + d.getUTCSeconds() == 28 && + !d.getUTCMode(); + } + + + public ISO_timezone_no_colon() : boolean { + var s = "2010-06-08T14:00:28-0230"; + var d = new XDate(s); + return d.getUTCHours() == 16 && + d.getUTCMinutes() == 30 && + d.getUTCSeconds() == 28 && + !d.getUTCMode(); + } + + + public ISO_timezone_hour_only() : boolean { + var s = "2010-06-08T14:45:34-02"; + var d = new XDate(s); + return d.getUTCHours() == 16 && + d.getUTCMinutes() == 45 && + d.getUTCSeconds() == 34 && + !d.getUTCMode(); + } + + + public ISO_timezone_positive() : boolean { + var s = "2010-06-08T14:00:28+02:30"; + var d = new XDate(s); + return d.getUTCHours() == 11 && + d.getUTCMinutes() == 30 && + d.getUTCSeconds() == 28 && + !d.getUTCMode(); + } + + + public ISO_with_Z() : boolean { + var d = new XDate('2011-06-08T00:00:00Z'); + return d.getUTCFullYear() == 2011 && + d.getUTCMonth() == 5 && + d.getUTCDate() == 8 && + !d.getUTCHours() && !d.getUTCMinutes() && + !d.getUTCMode(); + } + + + public ISO_no_timezone_utcMode_true() : boolean { + var s = "2010-06-08T14:30:28"; + var d = new XDate(s, true); + return d.getFullYear() == 2010 && d.getUTCFullYear() == 2010 && + d.getMonth() == 5 && d.getUTCMonth() == 5 && + d.getDate() == 8 && d.getUTCDate() == 8 && + d.getHours() == 14 && d.getUTCHours() == 14 && + d.getMinutes() == 30 && d.getUTCMinutes() == 30 && + d.getSeconds() == 28 && d.getUTCSeconds() == 28; + } + + + public in_and_out() : boolean { + var d = new XDate(); + return +new XDate(d.toISOString()) == +d; + } + + } + + // based on xdate/test/setters.js + class setters extends test_base + { + + public set_when_utcMode_false(): boolean{ + var xdate = new XDate(2012, 0, 1); + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + xdate.setFullYear(YEAR) + .setMonth(MONTH) + .setDate(DATE) + .setHours(HOURS) + .setMinutes(MINUTES) + .setSeconds(SECONDS) + .setMilliseconds(MILLISECONDS); + return xdate.getFullYear() == YEAR && + xdate.getMonth() == MONTH && + xdate.getDate() == DATE && + xdate.getHours() == HOURS && + xdate.getMinutes() == MINUTES && + xdate.getSeconds() == SECONDS && + xdate.getMilliseconds() == MILLISECONDS; + } + + public set_when_utcMode_true() : boolean{ + var xdate = new XDate(2012, 0, 1, 0,0,0,0, true); + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + xdate.setFullYear(YEAR) + .setMonth(MONTH) + .setDate(DATE) + .setHours(HOURS) + .setMinutes(MINUTES) + .setSeconds(SECONDS) + .setMilliseconds(MILLISECONDS); + return xdate.getFullYear() == YEAR && + xdate.getMonth() == MONTH && + xdate.getDate() == DATE && + xdate.getHours() == HOURS && + xdate.getMinutes() == MINUTES && + xdate.getSeconds() == SECONDS && + xdate.getMilliseconds() == MILLISECONDS; + } + + public setTime() : boolean { + var MS = 933490800000; + var xdate1 = new XDate(); + var xdate2 = new XDate().setUTCMode(true); + xdate1.setTime(MS); + xdate2.setTime(MS); + return xdate1.getTime() == MS && xdate2.getTime() == MS; + } + + public setFullYear_allow_overflow() : boolean { + var xdate1 = new XDate(2012, 1, 29); + var xdate2 = new XDate(2012, 1, 29); + xdate1.setFullYear(2013); + xdate2.setFullYear(2013, false); + return xdate1.getMonth() == 2 && xdate1.getDate() == 1 && + xdate2.getMonth() == 2 && xdate2.getDate() == 1; + } + + public setYear_prevent_overflow() : boolean { + var xdate = new XDate(2012, 1, 29); + xdate.setFullYear(2013, true); + return xdate.getMonth() == 1 && xdate.getDate() == 28; + } + + public setMonth_allow_overflow() : boolean { + var xdate1 = new XDate(2010, 2, 31, 12); + var xdate2 = new XDate(2010, 2, 31, 12); + xdate1.setMonth(1); + xdate2.setMonth(1, false); + return xdate1.getMonth() == 2 && xdate1.getDate() == 3 && + xdate2.getMonth() == 2 && xdate2.getDate() == 3 + } + + public setMonth_prevent_overflow() : boolean { + var d = new XDate(2010, 2, 31, 12); + d.setMonth(1, true); + return d.getMonth() == 1 && d.getDate() == 28; + } + + public setUTC_with_utcMode_false() : boolean { + var xdate = new XDate(2012, 0, 1); + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + xdate.setUTCFullYear(YEAR) + .setUTCMonth(MONTH) + .setUTCDate(DATE) + .setUTCHours(HOURS) + .setUTCMinutes(MINUTES) + .setUTCSeconds(SECONDS) + .setUTCMilliseconds(MILLISECONDS); + return xdate.getUTCFullYear() == YEAR && + xdate.getUTCMonth() == MONTH && + xdate.getUTCDate() == DATE && + xdate.getUTCHours() == HOURS && + xdate.getUTCMinutes() == MINUTES && + xdate.getUTCSeconds() == SECONDS && + xdate.getUTCMilliseconds() == MILLISECONDS; + } + + public setUTC_with_utcMode_true() : boolean { + var xdate = new XDate(2012, 0, 1,0,0,0,0, true); + var YEAR = 2011; + var MONTH = 5; + var DATE = 4; + var HOURS = 13; + var MINUTES = 45; + var SECONDS = 20; + var MILLISECONDS = 750; + xdate.setUTCFullYear(YEAR) + .setUTCMonth(MONTH) + .setUTCDate(DATE) + .setUTCHours(HOURS) + .setUTCMinutes(MINUTES) + .setUTCSeconds(SECONDS) + .setUTCMilliseconds(MILLISECONDS); + return xdate.getUTCFullYear() == YEAR && + xdate.getUTCMonth() == MONTH && + xdate.getUTCDate() == DATE && + xdate.getUTCHours() == HOURS && + xdate.getUTCMinutes() == MINUTES && + xdate.getUTCSeconds() == SECONDS && + xdate.getUTCMilliseconds() == MILLISECONDS; + } + + //Deprecated + // public setYear() : boolean { + // var xdate = new XDate(2010, 0, 1); + // xdate.setYear(99); + // return xdate.getFullYear() == 1999; + // } + + public setWeek() : boolean { + function test(xdate, n) { + var year = xdate.getFullYear(); + xdate.setWeek(n); + return xdate.getWeek() == n && + xdate.getFullYear() == year && + xdate.getDay() == 1 && // monday + xdate.getHours() == 0 && + xdate.getMinutes() == 0 && + xdate.getSeconds() == 0 && + xdate.getMilliseconds() == 0; + } + return test(new XDate(), 50) && + test(new XDate(), 21) && + test(new XDate(2011, 5, 5), 5) && + test(new XDate(2009, 12, 12), 13); + } + + public setWeek_with_year() : boolean { + function test(xdate, n, year) { + xdate.setWeek(n, year); + return xdate.getWeek() == n && + xdate.getFullYear() == year && + xdate.getDay() == 1 && // monday + xdate.getHours() == 0 && + xdate.getMinutes() == 0 && + xdate.getSeconds() == 0 && + xdate.getMilliseconds() == 0; + } + return test(new XDate(), 50, 2013) && + test(new XDate(), 21, 2014) && + test(new XDate(2011, 5, 5), 5, 1999) && + test(new XDate(2009, 12, 12), 13, 1995); + } + + public setUTCWeek() : boolean { + function test(xdate, n) { + var year = xdate.getUTCFullYear(); + xdate.setUTCWeek(n); + return xdate.getUTCWeek() == n && + xdate.getUTCFullYear() == year && + xdate.getUTCDay() == 1 && // monday + xdate.getUTCHours() == 0 && + xdate.getUTCMinutes() == 0 && + xdate.getUTCSeconds() == 0 && + xdate.getUTCMilliseconds() == 0; + } + return test(new XDate(), 50) && + test(new XDate(), 21) && + test(new XDate(2011, 5, 5), 5) && + test(new XDate(2009, 12, 12), 13); + } + + public setUTCWeek_with_year() : boolean{ + function test(xdate, n, year) { + xdate.setUTCWeek(n, year); + return xdate.getUTCWeek() == n && + xdate.getUTCFullYear() == year && + xdate.getUTCDay() == 1 && // monday + xdate.getUTCHours() == 0 && + xdate.getUTCMinutes() == 0 && + xdate.getUTCSeconds() == 0 && + xdate.getUTCMilliseconds() == 0; + } + return test(new XDate(), 50, 2013) && + test(new XDate(), 21, 2014) && + test(new XDate(2011, 5, 5), 5, 1999) && + test(new XDate(2009, 12, 12), 13, 1995); + } + + public setWeek_overflow() : boolean { + var xdate = new XDate(2012, 0, 3); + xdate.setWeek(54); + return xdate.getFullYear() == 2013 && + xdate.getWeek() == 2 && + xdate.getMonth() == 0 && + xdate.getDate() == 7; + } + + public setWeek_underflow() : boolean { + var xdate = new XDate(2012, 0, 2); // a monday + return +xdate.clone().setWeek(0) == +xdate.clone().addWeeks(-1) && + +xdate.clone().setWeek(-1) == +xdate.clone().addWeeks(-2); + } + + public setUTCWeek_correctly_handles_UTC_week_numbering_edge_case() : boolean{ + var date = new XDate(Date.UTC(2010, 0, 3)); + + var wasWeek53 = date.getUTCWeek() === 53; + date.setUTCWeek(53); + + return wasWeek53 && "Mon, 28 Dec 2009 00:00:00 GMT" === date.toUTCString(); + } + + } + + // based on xdate/test/utc-mode.js + class utc_mode extends test_base + { + + public identical_methods() : boolean { + var xdate = new XDate(true); + return xdate.getFullYear() == xdate.getUTCFullYear() && + xdate.getMonth() == xdate.getUTCMonth() && + xdate.getDate() == xdate.getUTCDate() && + xdate.getHours() == xdate.getUTCHours() && + xdate.getMinutes() == xdate.getUTCMinutes() && + xdate.getSeconds() == xdate.getUTCSeconds() && + xdate.getMilliseconds() == xdate.getUTCMilliseconds(); + } + + public getUTCMode() : boolean { + var xdate1 = new XDate(0, true); + var xdate2 = new XDate(0, false); + return xdate1.getUTCMode() && !xdate2.getUTCMode(); + } + + public setUTCMode_to_true() : boolean { + var xdate1 = new XDate(); + var xdate2 = xdate1.clone().setUTCMode(true); + return !xdate1.getUTCMode() && xdate2.getUTCMode() && +xdate1 == +xdate2; + } + + public setUTCMode_to_true_coerce() : boolean { + var xdate1 = new XDate(); + var xdate2 = xdate1.clone().setUTCMode(true, true); + return !xdate1.getUTCMode() && xdate2.getUTCMode() && + (!xdate1.getTimezoneOffset() || xdate1.getTime() != xdate2.getTime()) && + (xdate1.getDate() == xdate2.getDate() && xdate2.getDate() == xdate2.getUTCDate()) && + (xdate1.getHours() == xdate2.getHours() && xdate2.getHours() == xdate2.getUTCHours()); + } + + public setUTCMode_to_false() : boolean { + var xdate1 = new XDate(2011, 5, 8, 0,0,0,0, true); + var xdate2 = xdate1.clone().setUTCMode(false); + return xdate1.getUTCMode() && !xdate2.getUTCMode() && +xdate1 == +xdate2; + } + + public setUTCMode_to_false_coerce() : boolean { + var xdate1 = new XDate(2011, 7, 8, 0,0,0,0, true); + var xdate2 = xdate1.clone().setUTCMode(false, true); + return xdate1.getUTCMode() && !xdate2.getUTCMode() && + (!xdate1.getTimezoneOffset() || xdate1.getTime() != xdate2.getTime()) && + xdate1.getDate() == xdate2.getDate() && + xdate1.getHours() == xdate1.getHours(); + } + + public getTimezoneOffset() : boolean { + var date = new Date(); + var xdate1 = new XDate(+date); + var xdate2 = new XDate(+date, true); + return xdate1.getTimezoneOffset() == date.getTimezoneOffset() && + !xdate2.getTimezoneOffset(); + } + } + + // bases on xdate/test/utilities.js + class utilities extends test_base + { + + public clone() : boolean { + var d1 = new XDate(); + var d2 = d1.clone(); + d2.addMinutes(30); + return +d1 != +d2; + } + + + public clearTime() : boolean { + var d = new XDate(2010, 2, 5, 16, 15, 10, 100); + d.clearTime(); + return !d.getHours() && !d.getMinutes() && !d.getSeconds() && !d.getMilliseconds(); + } + + + public valid() : boolean { + var good = new XDate(); + var bad = new XDate('asdf'); + return good.valid() && !bad.valid(); + } + + + public toDate_hasLocalTimezone_yes() : boolean { + var d = new Date(2012, 5, 8); + var xdate = new XDate(d); + return +xdate.toDate() == +d; + } + + + public toDate_hasLocalTimezone_no() : boolean { + var d = new Date(2012, 5, 8); + var xdate = new XDate(+d, false); + return +xdate.toDate() == +d; + } + + + public getDaysInMonth() : boolean { + return XDate.getDaysInMonth(2011, 1) == 28 && // feb + XDate.getDaysInMonth(2012, 1) == 29 && // feb, leap year + XDate.getDaysInMonth(2012, 8) == 30 && // sep + XDate.getDaysInMonth(2012, 6) == 31; // jul + } + + + public UTC_class_method() : boolean { + return Date.UTC(2011, 3, 20, 12, 30) == XDate.UTC(2011, 3, 20, 12, 30); + } + + + public parse_class_method() : boolean { + var s = "Sat Apr 23 2011 13:44:12 GMT-0700 (PDT)"; + return Date.parse(s) == XDate.parse(s); + //&& + //isNaN(Date.parse()) && isNaN(XDate.parse()); + } + + + public now_class_method() : boolean { + return Math.abs(+new Date() - XDate.now()) < 1000; + } + + + public today_class_method() : boolean { + var xdate = XDate.today(); + var d = new Date(); + return xdate.getFullYear() == d.getFullYear() && + xdate.getMonth() == d.getMonth() && + xdate.getDate() == d.getDate() && + !xdate.getHours() && + !xdate.getSeconds() && + !xdate.getMilliseconds(); + } + + + public toJSON() : boolean { + var realDate = new Date(2011, 3, 20, 12, 30); + var xdate = new Date(2011, 3, 20, 12, 30); + if (!realDate.toJSON) { + return false; + } + return realDate.toJSON() == xdate.toJSON(); + } + + + public chaining() : boolean { + var d = new XDate() +// .setYear(99) + .setFullYear(2011) + .setWeek(50) + .setMonth(1) + .setDate(5) + .setHours(12) + .setMinutes(50) + .setSeconds(20) + .setMilliseconds(500) + .setTime(0) + .addYears(1) + .addMonths(1) + .addDays(1) + .addMinutes(1) + .addSeconds(1) + .addMilliseconds(1) + .clone() + .clearTime() + .setUTCFullYear(2010) + .setUTCMonth(6) + .setUTCWeek(5) + .setUTCDate(4) + .setUTCHours(12) + .setUTCMinutes(30) + .setUTCSeconds(30) + .setUTCMilliseconds(10) + .setUTCMode(true); + return d instanceof XDate; + } + + } + +} From fd8ee5632f24a71d2f1ce148db87d23b1c9603a4 Mon Sep 17 00:00:00 2001 From: yamada28go Date: Tue, 5 May 2015 13:27:32 +0900 Subject: [PATCH 087/534] fix ci error --- xdate/xdate-test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xdate/xdate-test.ts b/xdate/xdate-test.ts index 9f86c0609..dad175104 100644 --- a/xdate/xdate-test.ts +++ b/xdate/xdate-test.ts @@ -1040,7 +1040,7 @@ module XDate_Test // } public setWeek() : boolean { - function test(xdate, n) { + function test(xdate : XDate , n : number) { var year = xdate.getFullYear(); xdate.setWeek(n); return xdate.getWeek() == n && @@ -1058,7 +1058,7 @@ module XDate_Test } public setWeek_with_year() : boolean { - function test(xdate, n, year) { + function test(xdate : XDate , n : number , year : number) { xdate.setWeek(n, year); return xdate.getWeek() == n && xdate.getFullYear() == year && @@ -1075,7 +1075,7 @@ module XDate_Test } public setUTCWeek() : boolean { - function test(xdate, n) { + function test(xdate : XDate , n : number) { var year = xdate.getUTCFullYear(); xdate.setUTCWeek(n); return xdate.getUTCWeek() == n && @@ -1093,7 +1093,7 @@ module XDate_Test } public setUTCWeek_with_year() : boolean{ - function test(xdate, n, year) { + function test(xdate : XDate , n : number , year : number ) { xdate.setUTCWeek(n, year); return xdate.getUTCWeek() == n && xdate.getUTCFullYear() == year && From 6c43946f8ad8490b624c253c32436f7e32ce5475 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Mon, 4 May 2015 23:34:24 -0500 Subject: [PATCH 088/534] Add missing semicolons to tests --- jquery.pickadate/jquery.pickadate-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery.pickadate/jquery.pickadate-tests.ts b/jquery.pickadate/jquery.pickadate-tests.ts index 3bd3f0721..d47dc3b58 100644 --- a/jquery.pickadate/jquery.pickadate-tests.ts +++ b/jquery.pickadate/jquery.pickadate-tests.ts @@ -209,12 +209,12 @@ $('.timepicker').pickatime(); // Extend the default picker options for all instances. $.extend($.fn.pickatime.defaults, { clear: 'Effacer' -}) +}); // Or, pass the months and weekdays as an array for each invocation. $('.timepicker').pickatime({ clear: 'Effacer' -}) +}); // Change the text or hide the button completely by passing a false-y value $('.timepicker').pickatime({ @@ -431,7 +431,7 @@ picker.set({ // Muted callbacks // One at a time -picker.set('disable', 'flip', { muted: true }) +picker.set('disable', 'flip', { muted: true }); // Multiple at once picker.set({ From 3f179dbc0b29f9be6ff94bee6828eac17ce196ea Mon Sep 17 00:00:00 2001 From: yamada28go Date: Tue, 5 May 2015 13:41:45 +0900 Subject: [PATCH 089/534] fix locales --- xdate/xdate.d.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/xdate/xdate.d.ts b/xdate/xdate.d.ts index bd1cd8e8e..b291191d9 100644 --- a/xdate/xdate.d.ts +++ b/xdate/xdate.d.ts @@ -12,6 +12,16 @@ interface formatters_info vvv?: (xdate : XDate , useutc : boolean ) => string; } +interface locale_detail +{ + monthNames? : string []; + monthNamesShort?: string []; + dayNames?: string[]; + dayNamesShort?: string []; + amDesignator?: string; + pmDesignator?: string; +} + declare class XDate { @@ -354,7 +364,7 @@ declare class XDate { public static UTC(year : number , month : number , date : number , hours : number, minutes : number , seconds : number , milliseconds : number ) : XDate; - public static locales : Object; + public static locales : { [key: string]: locale_detail; }; public static defaultLocale : string; public static formatters : formatters_info; From 71dde8aead2aa3fbc8e3873138d9cfed806815d5 Mon Sep 17 00:00:00 2001 From: yamada28go Date: Tue, 5 May 2015 13:46:30 +0900 Subject: [PATCH 090/534] Add Definitions by comment --- xdate/xdate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xdate/xdate.d.ts b/xdate/xdate.d.ts index b291191d9..c3026a412 100644 --- a/xdate/xdate.d.ts +++ b/xdate/xdate.d.ts @@ -1,6 +1,6 @@ // Type definitions for XDate 0.8 // Project: http://arshaw.com/xdate/ -// Definitions by: <> +// Definitions by: yamada28go // Definitions: https://github.com/daptiv/DefinitelyTyped From 0d1c801e60205ab8fa1b019c177c98f495c07906 Mon Sep 17 00:00:00 2001 From: yamada28go Date: Tue, 5 May 2015 13:50:36 +0900 Subject: [PATCH 091/534] fix Definitions by --- xdate/xdate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xdate/xdate.d.ts b/xdate/xdate.d.ts index c3026a412..5c166491c 100644 --- a/xdate/xdate.d.ts +++ b/xdate/xdate.d.ts @@ -1,6 +1,6 @@ // Type definitions for XDate 0.8 // Project: http://arshaw.com/xdate/ -// Definitions by: yamada28go +// Definitions by: yamada28go < https://github.com/yamada28go > // Definitions: https://github.com/daptiv/DefinitelyTyped From ae6804c352ab381ab1020f1f8728f913f84f3357 Mon Sep 17 00:00:00 2001 From: yamada28go Date: Tue, 5 May 2015 13:57:45 +0900 Subject: [PATCH 092/534] fix Definitions --- xdate/xdate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xdate/xdate.d.ts b/xdate/xdate.d.ts index 5c166491c..fd83c1089 100644 --- a/xdate/xdate.d.ts +++ b/xdate/xdate.d.ts @@ -1,6 +1,6 @@ // Type definitions for XDate 0.8 // Project: http://arshaw.com/xdate/ -// Definitions by: yamada28go < https://github.com/yamada28go > +// Definitions by: yamada28go < https://github.com/yamada28go/ > // Definitions: https://github.com/daptiv/DefinitelyTyped From ffe4d722dfd90ab800fe2181731269378ff3d49e Mon Sep 17 00:00:00 2001 From: yamada28go Date: Tue, 5 May 2015 13:59:39 +0900 Subject: [PATCH 093/534] fix Definitions --- xdate/xdate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xdate/xdate.d.ts b/xdate/xdate.d.ts index fd83c1089..1d3089d84 100644 --- a/xdate/xdate.d.ts +++ b/xdate/xdate.d.ts @@ -1,6 +1,6 @@ // Type definitions for XDate 0.8 // Project: http://arshaw.com/xdate/ -// Definitions by: yamada28go < https://github.com/yamada28go/ > +// Definitions by: yamada28go // Definitions: https://github.com/daptiv/DefinitelyTyped From 89882db5c0f81d6fb48e2f83d5a89e62fc52b40f Mon Sep 17 00:00:00 2001 From: Chris Charabaruk Date: Tue, 5 May 2015 13:38:42 -0400 Subject: [PATCH 094/534] Added type bindings for jsUri library --- jsuri/jsuri.d.ts | 137 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 jsuri/jsuri.d.ts diff --git a/jsuri/jsuri.d.ts b/jsuri/jsuri.d.ts new file mode 100644 index 000000000..16f300952 --- /dev/null +++ b/jsuri/jsuri.d.ts @@ -0,0 +1,137 @@ +// Type definitions for jsUri 1.3+ +// Project: https://github.com/derek-watson/jsUri +// Definitions by: Chris Charabaruk +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module jsuri { + class Uri { + /** + * Creates a new Uri object + * @constructor + * @param {string} str + */ + constructor(str: string); + + /** + * Define getter/setter methods + */ + protocol(val?: string): string; + userInfo(val?: string): string; + host(val?: string): string; + port(val?: number): number; + path(val?: string): string; + anchor(val?: string): string; + + /** + * if there is no protocol, the leading // can be enabled or disabled + * @param {Boolean} val + * @return {Boolean} + */ + hasAuthorityPrefix(val?: boolean): boolean; + + isColonUri(val?: boolean): boolean; + + /** + * Serializes the internal state of the query pairs + * @param {string} [val] set a new query string + * @return {string} query string + */ + query(val?: string): string; + + /** + * returns the first query param value found for the key + * @param {string} key query key + * @return {string} first value found for key + */ + getQueryParamValue(key: string): string; + + /** + * returns an array of query param values for the key + * @param {string} key query key + * @return {array} array of values + */ + getQueryParamValues(key: string): string[]; + + /** + * removes query parameters + * @param {string} key remove values for key + * @param {val} [val] remove a specific value, otherwise removes all + * @return {Uri} returns self for fluent chaining + */ + deleteQueryParam(key: string, val?: string): Uri; + + /** + * adds a query parameter + * @param {string} key add values for key + * @param {string} val value to add + * @param {integer} [index] specific index to add the value at + * @return {Uri} returns self for fluent chaining + */ + addQueryParam(key: string, val: string, index?: number): Uri; + + /** + * test for the existence of a query parameter + * @param {string} key check values for key + * @return {Boolean} true if key exists, otherwise false + */ + hasQueryParam(key: string): boolean; + + /** + * replaces query param values + * @param {string} key key to replace value for + * @param {string} newVal new value + * @param {string} [oldVal] replace only one specific value (otherwise replaces all) + * @return {Uri} returns self for fluent chaining + */ + replaceQueryParam(key: string, newVal: string, oldVal?:string): Uri; + + /** + * Define fluent setter methods (setProtocol, setHasAuthorityPrefix, etc) + */ + setProtocol(val: string): Uri; + setHasAuthorityPrefix(val: boolean): Uri; + setIsColonUri(val: boolean): Uri; + setUserInfo(val: string): Uri; + setHost(val: string): Uri; + setPort(val: number): Uri; + setPath(val: string): Uri; + setQuery(val: string): Uri; + setAnchor(val: string): Uri; + + /** + * Scheme name, colon and doubleslash, as required + * @return {string} http:// or possibly just // + */ + scheme(): string; + + /** + * Same as Mozilla nsIURI.prePath + * @return {string} scheme://user:password@host:port + * @see https://developer.mozilla.org/en/nsIURI + */ + origin(): string; + + /** + * Adds a trailing slash to the path + */ + addTrailingSlash(): Uri; + + /** + * Serializes the internal state of the Uri object + * @return {string} + */ + toString(): string; + + /** + * Clone a Uri object + * @return {Uri} duplicate copy of the Uri + */ + clone(): Uri; + } +} + +declare var Uri : jsuri.Uri; + +declare module 'jsuri' { + export = Uri; +} From a86a44b28abde7f541663c4af9b855234a690b1e Mon Sep 17 00:00:00 2001 From: Chris Charabaruk Date: Tue, 5 May 2015 14:12:02 -0400 Subject: [PATCH 095/534] Add tests for jsUri --- jsuri/jsuri-tests.ts | 82 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 jsuri/jsuri-tests.ts diff --git a/jsuri/jsuri-tests.ts b/jsuri/jsuri-tests.ts new file mode 100644 index 000000000..73ecbc50d --- /dev/null +++ b/jsuri/jsuri-tests.ts @@ -0,0 +1,82 @@ +/// + +function test_createUri() { + var uri = new jsuri.Uri('http://user:pass@www.test.com:81/index.html?q=books#fragment'); + + var getTests = { + protocol: 'http' == uri.protocol(), + userInfo: 'user:pass' == uri.userInfo(), + host: 'www.test.com' == uri.host(), + port: 81 == uri.port(), + path: '/index.html' == uri.path(), + query: 'q=books' == uri.query(), + anchor: 'fragment' == uri.anchor() + }; + + uri.protocol('https'); + var setProtocolTest = uri.toString() == 'https://user:pass@www.test.com:81/index.html?q=books#fragment'; + + uri.host('mydomain.com'); + var setHostTest = uri.toString() == 'https://user:pass@mydomain.com:81/index.html?q=books#fragment'; +} + +function test_chainable() { + new jsuri.Uri() + .setPath('/archives/1979/') + .setQuery('?page=1'); // /archives/1979?page=1 + + new jsuri.Uri() + .setPath('/index.html') + .setAnchor('content') + .setHost('www.test.com') + .setPort(8080) + .setUserInfo('username:password') + .setProtocol('https') + .setQuery('this=that&some=thing'); // https://username:password@www.test.com:8080/index.html?this=that&some=thing#content + + new jsuri.Uri('http://www.test.com') + .setHost('www.yahoo.com') + .setProtocol('https'); // https://www.yahoo.com +} + +function test_queryParams() { + new jsuri.Uri('?cat=1&cat=2&cat=3').getQueryParamValue('cat'); // 1 + + new jsuri.Uri('?cat=1&cat=2&cat=3').getQueryParamValues('cat'); // [1, 2, 3] + + new jsuri.Uri().addQueryParam('q', 'books'); // ?q=books + + new jsuri.Uri('http://www.github.com') + .addQueryParam('testing', '123') + .addQueryParam('one', 1); // http://www.github.com/?testing=123&one=1 + + // insert param at index 0 + new jsuri.Uri('?b=2&c=3&d=4').addQueryParam('a', '1', 0); // ?a=1&b=2&c=3&d=4 + + new jsuri.Uri().replaceQueryParam('page', 2); // ?page=2 + + new jsuri.Uri('?a=1&b=2&c=3') + .replaceQueryParam('a', 'eh'); // ?a=eh&b=2&c=3 + + new jsuri.Uri('?a=1&b=2&c=3&c=4&c=5&c=6') + .replaceQueryParam('c', 'five', '5'); // ?a=1&b=2&c=3&c=4&c=five&c=6 + + new jsuri.Uri('?a=1&b=2&c=3') + .deleteQueryParam('a'); // ?b=2&c=3 + + new jsuri.Uri('test.com?a=1&b=2&c=3&a=eh') + .deleteQueryParam('a', 'eh'); // test.com/?a=1&b=2&c=3 + + new jsuri.Uri('?a=1&b=2&c=3') + .hasQueryParam('a'); // true + + new jsuri.Uri('?a=1&b=2&c=3') + .hasQueryParam('d'); // false +} + +function test_clone() { + var baseUri = new jsuri.Uri('http://localhost/'); + + baseUri.clone().setProtocol('https'); // https://localhost/ + baseUri; // http://localhost/ +} From bf45415511dba471e6ac824b90c9411e9f196b7f Mon Sep 17 00:00:00 2001 From: Chris Charabaruk Date: Tue, 5 May 2015 14:12:22 -0400 Subject: [PATCH 096/534] Update jsUri definitions to pass tests --- jsuri/jsuri.d.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/jsuri/jsuri.d.ts b/jsuri/jsuri.d.ts index 16f300952..b843abf61 100644 --- a/jsuri/jsuri.d.ts +++ b/jsuri/jsuri.d.ts @@ -4,13 +4,15 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module jsuri { - class Uri { + type Primitive = string | number | boolean; + + export class Uri { /** * Creates a new Uri object * @constructor * @param {string} str */ - constructor(str: string); + constructor(str?: string); /** * Define getter/setter methods @@ -67,7 +69,7 @@ declare module jsuri { * @param {integer} [index] specific index to add the value at * @return {Uri} returns self for fluent chaining */ - addQueryParam(key: string, val: string, index?: number): Uri; + addQueryParam(key: string, val: Primitive, index?: number): Uri; /** * test for the existence of a query parameter @@ -83,7 +85,7 @@ declare module jsuri { * @param {string} [oldVal] replace only one specific value (otherwise replaces all) * @return {Uri} returns self for fluent chaining */ - replaceQueryParam(key: string, newVal: string, oldVal?:string): Uri; + replaceQueryParam(key: string, newVal: Primitive, oldVal?: Primitive): Uri; /** * Define fluent setter methods (setProtocol, setHasAuthorityPrefix, etc) From 9d7073f5725e97e8a2522fdf1ae3df9470d2cffd Mon Sep 17 00:00:00 2001 From: campers Date: Wed, 6 May 2015 16:13:45 +0800 Subject: [PATCH 097/534] Update parse.d.ts Add additional error codes --- parse/parse.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/parse/parse.d.ts b/parse/parse.d.ts index 1aab10416..01d72df7a 100644 --- a/parse/parse.d.ts +++ b/parse/parse.d.ts @@ -851,6 +851,9 @@ declare module Parse { INVALID_IMAGE_DATA = 150, UNSAVED_FILE_ERROR = 151, INVALID_PUSH_TIME_ERROR = 152, + FILE_DELETE_ERROR = 153, + REQUEST_LIMIT_EXCEEDED = 155, + INVALID_EVENT_NAME = 160, USERNAME_MISSING = 200, PASSWORD_MISSING = 201, USERNAME_TAKEN = 202, @@ -860,6 +863,7 @@ declare module Parse { SESSION_MISSING = 206, MUST_CREATE_USER_THROUGH_SIGNUP = 207, ACCOUNT_ALREADY_LINKED = 208, + INVALID_SESSION_TOKEN = 209, LINKED_ID_MISSING = 250, INVALID_LINKED_SESSION = 251, UNSUPPORTED_SERVICE = 252, From c881f4356a1ed6235c2e23e51d0dfc6a02624279 Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Wed, 6 May 2015 16:01:36 +0200 Subject: [PATCH 098/534] Fix chai-http-tests --- chai-http/chai-http-tests.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/chai-http/chai-http-tests.ts b/chai-http/chai-http-tests.ts index e6e471321..6146f8775 100644 --- a/chai-http/chai-http-tests.ts +++ b/chai-http/chai-http-tests.ts @@ -41,8 +41,7 @@ chai.request(app) chai.request(app) .get('/search') - .query('name', 'foo') - .query('limit', '10'); + .query({name: 'foo', limit: 10}); chai.request(app) .put('/user/me') From 0372f92c672bbe5d510b871c20daf5db50429885 Mon Sep 17 00:00:00 2001 From: Mathias Lykkegaard Lorenzen Date: Wed, 6 May 2015 16:14:13 +0200 Subject: [PATCH 099/534] added missing reset method This method has been implemented in the latest version of Postbox. --- knockout.postbox/knockout-postbox.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/knockout.postbox/knockout-postbox.d.ts b/knockout.postbox/knockout-postbox.d.ts index 1dfda1a25..edddd02a1 100644 --- a/knockout.postbox/knockout-postbox.d.ts +++ b/knockout.postbox/knockout-postbox.d.ts @@ -10,6 +10,7 @@ interface KnockoutPostBox { publish(topic: string, value?: T): void; defaultComparer(newValue: T, oldValue: T): boolean; serializer: (object: any) => string; + reset(): void; } interface KnockoutObservable { From 557bb595af0ab301d098fb5bd50943fffbfcee57 Mon Sep 17 00:00:00 2001 From: vvakame Date: Thu, 7 May 2015 00:05:24 +0900 Subject: [PATCH 100/534] update CONTRIBUTORS.md --- CONTRIBUTORS.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 6abf7201b..36bcdb307 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -16,7 +16,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](angular-growl-v2/angular-growl-v2.d.ts) [Angular Growl 2 v.0.7.3](http://janstevens.github.io/angular-growl-2) by [Tadeusz Hucal](https://github.com/mkp05) * [:link:](angularjs/angular.d.ts) [Angular JS](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) * [:link:](angularjs/angular-animate.d.ts) [Angular JS (ngAnimate module)](http://angularjs.org) by [Michel Salib](https://github.com/michelsalib), [Adi Dahiya](https://github.com/adidahiya), [Raphael Schweizer](https://github.com/rasch) -* [:link:](angularjs/angular-cookies.d.ts) [Angular JS (ngCookies module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) +* [:link:](angularjs/angular-cookies.d.ts) [Angular JS (ngCookies module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar), [Anthony Ciccarello](http://github.com/aciccarello) * [:link:](angularjs/angular-mocks.d.ts) [Angular JS (ngMock, ngMockE2E module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar) * [:link:](angularjs/angular-resource.d.ts) [Angular JS (ngResource module)](http://angularjs.org) by [Diego Vilar](http://github.com/diegovilar), [Michael Jess](http://github.com/miffels) * [:link:](angularjs/angular-route.d.ts) [Angular JS (ngRoute module)](http://angularjs.org) by [Jonathan Park](https://github.com/park9140) @@ -40,6 +40,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](angularfire/angularfire.d.ts) [AngularFire](http://angularfire.com) by [Dénes Harmath](http://github.com/thSoft) * [:link:](angularLocalStorage/angularLocalStorage.d.ts) [AngularLocalStorage](https://github.com/agrublev/angularLocalStorage) by [Horiuchi_H](https://github.com/horiuchi) * [:link:](animation-frame/animation-frame.d.ts) [animation-frame](https://github.com/kof/animation-frame) by [Qinfeng Chen](https://github.com/qinfchen) +* [:link:](ansi-styles/ansi-styles.d.ts) [ansi-styles](https://github.com/sindresorhus/ansi-styles) by [bryn austin bellomy](https://github.com/brynbellomy) * [:link:](ansicolors/ansicolors.d.ts) [ansicolors](https://github.com/thlorenz/ansicolors) by [rogierschouten](https://github.com/rogierschouten) * [:link:](any-db/any-db.d.ts) [any-db](https://github.com/grncdr/node-any-db) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](any-db-transaction/any-db-transaction.d.ts) [any-db-transaction](https://github.com/grncdr/node-any-db-transaction) by [Rogier Schouten](https://github.com/rogierschouten) @@ -109,7 +110,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](camljs/camljs.d.ts) [camljs](http://camljs.codeplex.com) by [Andrey Markeev](http://markeev.com) * [:link:](canvasjs/canvasjs.d.ts) [CanvasJS](http://canvasjs.com) by [Mark Overholt](https://github.com/mover5) * [:link:](casperjs/casperjs.d.ts) [CasperJS](http://casperjs.org) by [Jed Mao](https://github.com/jedmao) -* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Hunsaker](https://github.com/jedhunsaker), [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](chai/chai.d.ts) [chai](http://chaijs.com) by [Jed Mao](https://github.com/jedmao), [Bart van der Schoor](https://github.com/Bartvds) * [:link:](chai-as-promised/chai-as-promised.d.ts) [chai-as-promised](https://github.com/domenic/chai-as-promised) by [jt000](https://github.com/jt000) * [:link:](chai-datetime/chai-datetime.d.ts) [chai-datetime](https://github.com/gaslight/chai-datetime.git) by [Cliff Burger](https://github.com/cliffburger) * [:link:](chai-fuzzy/chai-fuzzy.d.ts) [chai-fuzzy](http://chaijs.com/plugins/chai-fuzzy) by [Bart van der Schoor](https://github.com/Bartvds) @@ -131,6 +132,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](cli-color/cli-color.d.ts) [cli-color](https://github.com/medikoo/cli-color) by [Joel Spadin](https://github.com/ChaosinaCan) * [:link:](clone/clone.d.ts) [clone](https://github.com/pvorb/node-clone) by [Kieran Simpson](https://github.com/kierans/DefinitelyTyped) * [:link:](codemirror/codemirror.d.ts) [CodeMirror](https://github.com/marijnh/CodeMirror) by [mihailik](https://github.com/mihailik) +* [:link:](colorbrewer/colorbrewer.d.ts) [colorbrewer](https://github.com/jeanlauliac/colorbrewer) by [Matt Traynham](https://github.com/mtraynham) * [:link:](colors/colors.d.ts) [Colors.js 0.6.0-1](https://github.com/Marak/colors.js) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](cometd/cometd.d.ts) [CometD](http://cometd.org) by [Derek Cicerone](https://github.com/derekcicerone) * [:link:](commander/commander.d.ts) [commanderjs](https://github.com/visionmedia/commander.js) by [Marcelo Dezem](http://github.com/mdezem), [vvakame](http://github.com/vvakame) @@ -174,6 +176,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](deployJava/deployJava.d.ts) [deployJava.js](https://www.java.com/js/deployJava.txt) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](detect-indent/detect-indent.d.ts) [detect-indent](https://github.com/sindresorhus/detect-indent) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](devextreme/dx.devextreme.d.ts) [DevExtreme](http://js.devexpress.com) by [DevExpress Inc.](http://devexpress.com) +* [:link:](dexie/dexie.d.ts) [Dexie](https://github.com/dfahlander/Dexie.js) by [David Fahlander](http://github.com/dfahlander) * [:link:](dhtmlxgantt/dhtmlxgantt.d.ts) [dhtmlxGantt](http://dhtmlx.com/docs/products/dhtmlxGantt) by [Maksim Kozhukh](http://github.com/mkozhukh) * [:link:](dhtmlxscheduler/dhtmlxscheduler.d.ts) [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) by [Maksim Kozhukh](http://github.com/mkozhukh) * [:link:](di-lite/di-lite.d.ts) [di-lite](https://github.com/NickQiZhu/di.js) by [Timothy Morris](https://github.com/dcrusader) @@ -199,6 +202,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](easy-session/easy-session.d.ts) [easy-session](https://github.com/DeadAlready/node-easy-session) by [Karl Düüna](https://github.com/DeadAlready) * [:link:](easy-table/easy-table.d.ts) [easy-table](https://github.com/eldargab/easy-table) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](easystarjs/easystarjs.d.ts) [EasyStar.js](http://easystarjs.com) by [Magnus Gustafsson](https://github.com/borundin) +* [:link:](egg.js/egg.js.d.ts) [Egg.js](https://github.com/mikeflynn/egg.js) by [Markus Peloso](https://github.com/ToastHawaii) * [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000) * [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan) * [:link:](element-resize-event/element-resize-event.d.ts) [element-resize-event](https://github.com/KyleAMathews/element-resize-event) by [Rogier Schouten](https://github.com/rogierschouten) @@ -229,6 +233,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](express-validator/express-validator.d.ts) [express-validator](https://github.com/ctavan/express-validator) by [Nathan Ridley](https://github.com/axefrog), [Jonathan Häberle](http://dreampulse.de) * [:link:](extend/extend.d.ts) [extend](https://www.npmjs.com/package/extend) by [Stefan Steinhart](https://github.com/reppners) * [:link:](extjs/ExtJS.d.ts) [ExtJS](http://www.sencha.com/products/extjs) by [Brian Kotek](https://github.com/brian428) +* [:link:](eyes/eyes.d.ts) [eyes](https://github.com/cloudhead/eyes.js) by [bryn austin bellomy](https://github.com/brynbellomy) * [:link:](fabricjs/fabricjs.d.ts) [FabricJS](http://fabricjs.com) by [Oliver Klemencic](https://github.com/oklemencic) * [:link:](fbsdk/fbsdk.d.ts) [Facebook Javascript SDK](https://developers.facebook.com/docs/javascript) by [Joshua Strobl](https://github.com/JoshStrobl) * [:link:](fancybox/fancybox.d.ts) [fancyBox](https://github.com/fancyapps/fancyBox) by [Boris Yankov](https://github.com/borisyankov) @@ -271,6 +276,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](gently/gently.d.ts) [gently](https://www.npmjs.org/package/gently) by [bonnici](https://github.com/bonnici) * [:link:](geojson/geojson.d.ts) [GeoJSON Format Specification](http://geojson.org) by [Jacob Bruun](https://github.com/cobster) * [:link:](giraffe/giraffe.d.ts) [Giraffe](https://github.com/barc/backbone.giraffe) by [Matt McCray](https://github.com/darthapo) +* [:link:](gl-matrix/gl-matrix.d.ts) [gl-matrix](https://github.com/toji/gl-matrix) by [Tat](https://github.com/tatchx) * [:link:](gldatepicker/gldatepicker.d.ts) [glDatePicker](http://glad.github.com/glDatePicker) by [Dániel Tar](https://github.com/qcz) * [:link:](glidejs/glidejs.d.ts) [Glide.js](http://glide.jedrzejchalubek.com) by [Milan Jaros](https://github.com/milanjaros) * [:link:](glob/glob.d.ts) [Glob](https://github.com/isaacs/node-glob) by [vvakame](https://github.com/vvakame) @@ -342,6 +348,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](humane/humane.d.ts) [Humane](http://wavded.github.com/humane-js) by [jmvrbanac](https://github.com/jmvrbanac) * [:link:](hypertext-application-language/hypertext-application-language.d.ts) [Hypertext Application Language Draft 6](https://tools.ietf.org/html/draft-kelly-json-hal-06) by [Maks3w](https://github.com/maks3w) * [:link:](i18n-node/i18n-node.d.ts) [i18n-node](https://github.com/mashpie/i18n-node) by [Maxime LUCE](https://github.com/SomaticIT) +* [:link:](ng-i18next/ng-i18next.d.ts) [i18next](https://github.com/i18next/ng-i18next) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](i18next/i18next.d.ts) [i18next](http://i18next.com) by [Maarten Docter](https://github.com/mdocter) * [:link:](iban/iban.d.ts) [iban.js](https://github.com/arhs/iban.js) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](icheck/icheck.d.ts) [iCheck](http://damirfoy.com/iCheck) by [Dániel Tar](https://github.com/qcz) @@ -476,6 +483,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jssha/jssha.d.ts) [jsSHA](https://github.com/Caligatio/jsSHA) by [David Li](https://github.com/randombk) * [:link:](jstorage/jstorage.d.ts) [jStorage](http://www.jstorage.info) by [Danil Flores](https://github.com/dflor003) * [:link:](jstree/jstree.d.ts) [jsTree](http://www.jstree.com) by [Adam Pluciński](https://github.com/adaskothebeast) +* [:link:](jsuri/jsuri.d.ts) [jsUri](https://github.com/derek-watson/jsUri) by [Chris Charabaruk](http://github.com/coldacid) * [:link:](jszip/jszip.d.ts) [JSZip](http://stuk.github.com/jszip) by [mzeiher](https://github.com/mzeiher) * [:link:](jwplayer/jwplayer.d.ts) [JW Player](http://developer.longtailvideo.com/trac) by [Martin Duparc](https://github.com/martinduparc) * [:link:](jwt-simple/jwt-simple.d.ts) [jwt-simple](https://github.com/hokaccha/node-jwt-simple) by [Ken Fukuyama](https://github.com/kenfdev) @@ -500,6 +508,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](knockout-transformations/knockout-transformations.d.ts) [knockout-transformations](https://github.com/One-com/knockout-transformations) by [John Reilly](https://github.com/johnnyreilly), [Wim Looman](https://github.com/Nemo157) * [:link:](knockout.mapper/knockout.mapper.d.ts) [Knockout.Mapper](https://github.com/LucasLorentz/knockout.mapper) by [Brandon Meyer](https://github.com/BMeyerKC) * [:link:](knockout.mapping/knockout.mapping.d.ts) [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping) by [Boris Yankov](https://github.com/borisyankov) +* [:link:](knockout.punches/knockout.punches.d.ts) [knockout.punches](https://github.com/mbest/knockout.punches) by [Stephen Lautier](https://github.com/johnnyreilly) * [:link:](knockout.rx/knockout.rx.d.ts) [knockout.rx](https://github.com/Igorbek/knockout.rx) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](knockstrap/knockstrap.d.ts) [Knockstrap](http://faulknercs.github.io/Knockstrap) by [Adam Pluciński](https://github.com/adaskothebeast) * [:link:](knockout.kogrid/ko-grid.d.ts) [ko-grid](http://knockout-contrib.github.io/KoGrid) by [huer12](https://github.com/huer12) @@ -545,6 +554,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](marked/marked.d.ts) [Marked](https://github.com/chjj/marked) by [William Orr](https://github.com/worr) * [:link:](maskedinput/maskedinput.d.ts) [Masked Input plugin for jQuery](http://digitalbush.com/projects/masked-input-plugin) by [Lokesh Peta](https://github.com/lokeshpeta) * [:link:](mathjax/mathjax.d.ts) [MathJax](https://github.com/mathjax/MathJax) by [Roland Zwaga](https://github.com/rolandzwaga) +* [:link:](matter-js/matter-js.d.ts) [Matter.js](https://github.com/liabru/matter-js) by [Ivane Gegia](https://twitter.com/ivanegegia) * [:link:](mCustomScrollbar/mCustomScrollbar.d.ts) [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) by [Sarah Williams](https://github.com/flurg) * [:link:](memory-cache/memory-cache.d.ts) [memory-cache](http://github.com/ptarjan/node-cache) by [Jeff Goddard](https://github.com/jedigo) * [:link:](merge-stream/merge-stream.d.ts) [merge-stream](https://github.com/grncdr/merge-stream) by [Keita Kagurazaka](https://github.com/k-kagurazaka) @@ -716,6 +726,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](q-io/Q-io.d.ts) [Q-io](https://github.com/kriskowal/q-io) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](q-retry/q-retry.d.ts) [q-retry](https://github.com/vilic/q-retry) by [VILIC VANE](https://github.com/vilic) * [:link:](qajax/qajax.d.ts) [Qajax](https://github.com/gre/qajax) by [Boltmade](https://github.com/Boltmade) +* [:link:](qtip2/qtip2.d.ts) [qtip2](http://qtip2.com) by [Nathan Pitman](https://github.com/Seltzer100) * [:link:](qunit/qunit.d.ts) [QUnit](http://qunitjs.com) by [Diullei Gomes](https://github.com/diullei) * [:link:](rabbit.js/rabbit.js.d.ts) [rabbit.js](https://github.com/squaremo/rabbit.js) by [Wonshik Kim](https://github.com/wokim) * [:link:](ractive/ractive.d.ts) [Ractive](http://ractivejs.org) by [Han Lin Yap](http://yap.nu) @@ -728,6 +739,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](react/react-addons.d.ts) [ReactWithAddons (external module)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com) * [:link:](react/react-addons-global.d.ts) [ReactWithAddons (internal module)](http://facebook.github.io/react) by [Asana](https://asana.com), [AssureSign](http://www.assuresign.com) * [:link:](readdir-stream/readdir-stream.d.ts) [readdir-stream](https://github.com/logicalparadox/readdir-stream) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](recursive-readdir/recursive-readdir.d.ts) [recursive-readdir](https://github.com/jergason/recursive-readdir) by [Elisée Maurer](https://github.com/elisee) * [:link:](redis/redis.d.ts) [redis](https://github.com/mranney/node_redis) by [Carlos Ballesteros Velasco](https://github.com/soywiz), [Peter Harris](https://github.com/CodeAnimal) * [:link:](ref/ref.d.ts) [ref](https://github.com/TooTallNate/ref) by [Paul Loyd](https://github.com/loyd) * [:link:](ref-array/ref-array.d.ts) [ref-array](https://github.com/TooTallNate/ref-array) by [Paul Loyd](https://github.com/loyd) @@ -788,7 +800,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](simple-cw-node/simple-cw-node.d.ts) [simple-cw-node](https://github.com/astronaughts/simple-cw-node) by [vvakame](https://github.com/vvakame) * [:link:](jquery.simplemodal/jquery.simplemodal.d.ts) [SimpleModal](http://www.ericmmartin.com/projects/simplemodal) by [Friedrich von Never](https://github.com/ForNeVeR) * [:link:](sinon/sinon.d.ts) [Sinon](http://sinonjs.org) by [William Sears](https://github.com/mrbigdog2u) -* [:link:](sinon-chai/sinon-chai.d.ts) [sinon-chai](https://github.com/domenic/sinon-chai) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid) +* [:link:](sinon-chai/sinon-chai.d.ts) [sinon-chai](https://github.com/domenic/sinon-chai) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [Jed Mao](https://github.com/jedmao) * [:link:](sipml/sipml.d.ts) [SIPml5](http://sipml5.org) by [A. Groenenboom](https://github.com/chookies) * [:link:](sjcl/sjcl.d.ts) [sjcl](http://crypto.stanford.edu/sjcl) by [Eugene Chernyshov](https://github.com/Evgenus) * [:link:](slickgrid/SlickGrid.d.ts) [SlickGrid](https://github.com/mleibman/SlickGrid) by [Josh Baldwin](https://github.com/jbaldwin) @@ -879,6 +891,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](twig/twig.d.ts) [twig](https://github.com/justjohn/twig.js) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](twitter/twitter.d.ts) [Twitter for Websites](https://dev.twitter.com/web) by [Chitoku](https://github.com/chitoku-k) * [:link:](jquery.bootstrap.wizard/jquery.bootstrap.wizard.d.ts) [twitter-bootstrap-wizard](https://github.com/VinceG/twitter-bootstrap-wizard) by [Blake Niemyjski](https://github.com/niemyjski) +* [:link:](twix/twix.d.ts) [twix.js](https://github.com/icambron/twix.js) by [j3ko](https://github.com/j3ko) * [:link:](type-detect/type-detect.d.ts) [type-detect](https://github.com/chaijs/type-detect) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](type-name/type-name.d.ts) [type-name](https://github.com/twada/type-name) by [OKUNOKENTARO](https://github.com/armorik83) * [:link:](typeahead/typeahead.d.ts) [typeahead.js](http://twitter.github.io/typeahead.js) by [Ivaylo Gochkov](https://github.com/igochkov), [Gidon Junge](https://github.com/gjunge) @@ -902,6 +915,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](vega/vega.d.ts) [Vega](http://trifacta.github.io/vega) by [Tom Crockett](http://github.com/pelotom) * [:link:](velocity-animate/velocity-animate.d.ts) [Velocity](http://velocityjs.org) by [Greg Smith](https://github.com/smrq) * [:link:](vex-js/vex-js.d.ts) [Vex](https://github.com/HubSpot/vex) by [Greg Cohan](https://github.com/gdcohan) +* [:link:](victor/victor.d.ts) [Victor.js](http://victorjs.org) by [Ivane Gegia](https://twitter.com/ivanegegia) * [:link:](videojs/videojs.d.ts) [Video.js](https://github.com/zencoder/video-js) by [Vincent Bortone](https://github.com/vbortone) * [:link:](vimeo/froogaloop.d.ts) [Vimeo](http://developer.vimeo.com/player/js-api) by [Daz Wilkin](https://github.com/DazWilkin) * [:link:](vinyl/vinyl.d.ts) [vinyl](https://github.com/wearefractal/vinyl) by [vvakame](https://github.com/vvakame), [jedmao](https://github.com/jedmao) From 36e3c3b7c9b1dc6d29083806266a6232464b6cc9 Mon Sep 17 00:00:00 2001 From: Harel M Date: Wed, 6 May 2015 18:07:26 +0300 Subject: [PATCH 101/534] Changed property of longDateFormat to function --- moment/moment.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment/moment.d.ts b/moment/moment.d.ts index 834cc0462..303a41099 100644 --- a/moment/moment.d.ts +++ b/moment/moment.d.ts @@ -325,7 +325,7 @@ declare module moment { weekdays?: any; weekdaysShort?: any; weekdaysMin?: any; - longDateFormat?: MomentLongDateFormat; + longDateFormat(formatType: string): string; relativeTime?: MomentRelativeTime; meridiem?: (hour: number, minute: number, isLowercase: boolean) => string; calendar?: MomentCalendar; From b51c8d74f745550148db523f2468a2e3716b1e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20G=C3=B3rski?= Date: Wed, 6 May 2015 18:32:55 +0200 Subject: [PATCH 102/534] _.bind updated to support rest parameters --- lodash/lodash-tests.ts | 14 +++++++++----- lodash/lodash.d.ts | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 10900315f..b16f03b46 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -634,12 +634,16 @@ _.forEach(saves, function (type) { asyncSave({ 'type': type, 'complete': done }); }); -var funcBind = function (greeting: string) { return greeting + ' ' + this.name }; -var funcBind2: () => any = _.bind(funcBind, { 'name': 'moe' }, 'hi'); -funcBind2(); +var funcBind = function(greeting: string, punctuation: string) { return greeting + ' ' + this.user + punctuation; }; +var funcBound1: (punctuation: string) => any = _.bind(funcBind, { 'name': 'moe' }, 'hi'); +funcBound1('!'); -var funcBind3: () => any = _(funcBind).bind({ 'name': 'moe' }, 'hi').value(); -funcBind3(); +var funcBound2: (punctuation: string) => any = _(funcBind).bind({ 'name': 'moe' }, 'hi').value(); +funcBound2('!'); + +var addTwoNumbers = function (x: number, y: number) { return x + y }; +var plusTwo = _.bind(addTwoNumbers, null, 2); +plusTwo(100); var view = { 'label': 'docs', diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index bc629f6ec..dfe67f601 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -4833,7 +4833,7 @@ declare module _ { bind( func: Function, thisArg: any, - ...args: any[]): () => any; + ...args: any[]): (...args: any[]) => any; } interface LoDashObjectWrapper { @@ -4842,7 +4842,7 @@ declare module _ { **/ bind( thisArg: any, - ...args: any[]): LoDashObjectWrapper<() => any>; + ...args: any[]): LoDashObjectWrapper<(...args: any[]) => any>; } //_.bindAll From f70b0da41607493807a28fce65a7e1bdd1a62713 Mon Sep 17 00:00:00 2001 From: Jed Mao Date: Tue, 5 May 2015 21:16:58 -0500 Subject: [PATCH 103/534] Add Electron definitions --- github-electron/.editorconfig | 2 + github-electron/github-electron-main-tests.ts | 437 ++++++ github-electron/github-electron-main.d.ts | 227 +++ .../github-electron-renderer-tests.ts | 116 ++ github-electron/github-electron-renderer.d.ts | 105 ++ github-electron/github-electron.d.ts | 1295 +++++++++++++++++ 6 files changed, 2182 insertions(+) create mode 100644 github-electron/.editorconfig create mode 100644 github-electron/github-electron-main-tests.ts create mode 100644 github-electron/github-electron-main.d.ts create mode 100644 github-electron/github-electron-renderer-tests.ts create mode 100644 github-electron/github-electron-renderer.d.ts create mode 100644 github-electron/github-electron.d.ts diff --git a/github-electron/.editorconfig b/github-electron/.editorconfig new file mode 100644 index 000000000..2d98d905d --- /dev/null +++ b/github-electron/.editorconfig @@ -0,0 +1,2 @@ +[*.ts] +indent_style = tab diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts new file mode 100644 index 000000000..d353dfeb3 --- /dev/null +++ b/github-electron/github-electron-main-tests.ts @@ -0,0 +1,437 @@ +/// +import app = require('app'); +import AutoUpdater = require('auto-updater'); +import BrowserWindow = require('browser-window'); +import ContentTracing = require('content-tracing'); +import Dialog = require('dialog'); +import GlobalShortcut = require('global-shortcut'); +import ipc = require('ipc'); +import Menu = require('menu'); +import MenuItem = require('menu-item'); +import PowerMonitor = require('power-monitor'); +import Protocol = require('protocol'); +import Tray = require('tray'); +import Clipboard = require('clipboard'); +import CrashReporter = require('crash-reporter'); +import NativeImage = require('native-image'); +import Screen = require('screen'); +import Shell = require('shell'); + +import path = require('path'); + +// Quick start +// https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md + +// Report crashes to our server. +require('crash-reporter').start(); + +// Keep a global reference of the window object, if you don't, the window will +// be closed automatically when the javascript object is GCed. +var mainWindow: GitHubElectron.BrowserWindow = null; + +// Quit when all windows are closed. +app.on('window-all-closed', () => { + if (process.platform !== 'darwin') + app.quit(); +}); + +// This method will be called when Electron has done everything +// initialization and ready for creating browser windows. +app.on('ready', () => { + // Create the browser window. + mainWindow = new BrowserWindow({ width: 800, height: 600 }); + + // and load the index.html of the app. + mainWindow.loadUrl(`file://${__dirname}/index.html`); + + // Emitted when the window is closed. + mainWindow.on('closed', () => { + // Dereference the window object, usually you would store windows + // in an array if your app supports multi windows, this is the time + // when you should delete the corresponding element. + mainWindow = null; + }); +}); + +// Desktop environment integration +// https://github.com/atom/electron/blob/master/docs/tutorial/desktop-environment-integration.md + +app.addRecentDocument('/Users/USERNAME/Desktop/work.type'); +app.clearRecentDocuments(); +var dockMenu = Menu.buildFromTemplate([ + { + label: 'New Window', + click: () => { + console.log('New Window'); + } + }, + { + label: 'New Window with Settings', + submenu: [ + { label: 'Basic' }, + { label: 'Pro' } + ] + }, + { label: 'New Command...' } +]); +app.dock.setMenu(dockMenu); + +app.setUserTasks([ + { + program: process.execPath, + arguments: '--new-window', + iconPath: process.execPath, + iconIndex: 0, + title: 'New Window', + description: 'Create a new window' + } +]); +app.setUserTasks([]); + +var window = new BrowserWindow(); +window.setProgressBar(0.5); +window.setRepresentedFilename('/etc/passwd'); +window.setDocumentEdited(true); + +// Online/Offline Event Detection +// https://github.com/atom/electron/blob/master/docs/tutorial/online-offline-events.md + +var onlineStatusWindow: GitHubElectron.BrowserWindow; + +app.on('ready', () => { + onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false }); + onlineStatusWindow.loadUrl(`file://${__dirname}/online-status.html`); +}); + +ipc.on('online-status-changed', (event: any, status: any) => { + console.log(status); +}); + +// Synopsis +// https://github.com/atom/electron/blob/master/docs/api/synopsis.md + +app.on('ready', () => { + window = new BrowserWindow({ width: 800, height: 600 }); + window.loadUrl('https://github.com'); +}); + +// Supported Chrome command line switches +// https://github.com/atom/electron/blob/master/docs/api/chrome-command-line-switches.md + +app.commandLine.appendSwitch('remote-debugging-port', '8315'); +app.commandLine.appendSwitch('host-rules', 'MAP * 127.0.0.1'); +app.commandLine.appendSwitch('v', -1); +app.commandLine.appendSwitch('vmodule', 'console=0'); + +// auto-updater +// https://github.com/atom/electron/blob/master/docs/api/auto-updater.md + +AutoUpdater.setFeedUrl('http://mycompany.com/myapp/latest?version=' + app.getVersion()); + +// browser-window +// https://github.com/atom/electron/blob/master/docs/api/browser-window.md + +var win = new BrowserWindow({ width: 800, height: 600, show: false }); +win.on('closed', () => { + win = null; +}); + +win.loadUrl('https://github.com'); +win.show(); + +// content-tracing +// https://github.com/atom/electron/blob/master/docs/api/content-tracing.md + +ContentTracing.startRecording('*', ContentTracing.DEFAULT_OPTIONS, () => { + console.log('Tracing started'); + + setTimeout(() => { + ContentTracing.stopRecording('', path => { + console.log('Tracing data recorded to ' + path); + }); + }, 5000); +}); + +// dialog +// https://github.com/atom/electron/blob/master/docs/api/dialog.md + +console.log(Dialog.showOpenDialog({ + properties: ['openFile', 'openDirectory', 'multiSelections'] +})); + +// global-shortcut +// https://github.com/atom/electron/blob/master/docs/api/global-shortcut.md + +// Register a 'ctrl+x' shortcut listener. +var ret = GlobalShortcut.register('ctrl+x', () => { + console.log('ctrl+x is pressed'); +}); +if (!ret) + console.log('registerion fails'); + +// Check whether a shortcut is registered. +console.log(GlobalShortcut.isRegistered('ctrl+x')); + +// Unregister a shortcut. +GlobalShortcut.unregister('ctrl+x'); + +// Unregister all shortcuts. +GlobalShortcut.unregisterAll(); + +// ipc +// https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md + +ipc.on('asynchronous-message', (event: any, arg: any) => { + console.log(arg); // prints "ping" + event.sender.send('asynchronous-reply', 'pong'); +}); + +ipc.on('synchronous-message', (event: any, arg: any) => { + console.log(arg); // prints "ping" + event.returnValue = 'pong'; +}); + +// menu +// https://github.com/atom/electron/blob/master/docs/api/menu.md + +var menu = new Menu(); +menu.append(new MenuItem({ label: 'MenuItem1', click: () => { console.log('item 1 clicked'); } })); +menu.append(new MenuItem({ type: 'separator' })); +menu.append(new MenuItem({ label: 'MenuItem2', type: 'checkbox', checked: true })); + +// main.js +var template = [ + { + label: 'Electron', + submenu: [ + { + label: 'About Electron', + selector: 'orderFrontStandardAboutPanel:' + }, + { + type: 'separator' + }, + { + label: 'Services', + submenu: [] + }, + { + type: 'separator' + }, + { + label: 'Hide Electron', + accelerator: 'Command+H', + selector: 'hide:' + }, + { + label: 'Hide Others', + accelerator: 'Command+Shift+H', + selector: 'hideOtherApplications:' + }, + { + label: 'Show All', + selector: 'unhideAllApplications:' + }, + { + type: 'separator' + }, + { + label: 'Quit', + accelerator: 'Command+Q', + click: () => { app.quit(); } + } + ] + }, + { + label: 'Edit', + submenu: [ + { + label: 'Undo', + accelerator: 'Command+Z', + selector: 'undo:' + }, + { + label: 'Redo', + accelerator: 'Shift+Command+Z', + selector: 'redo:' + }, + { + type: 'separator' + }, + { + label: 'Cut', + accelerator: 'Command+X', + selector: 'cut:' + }, + { + label: 'Copy', + accelerator: 'Command+C', + selector: 'copy:' + }, + { + label: 'Paste', + accelerator: 'Command+V', + selector: 'paste:' + }, + { + label: 'Select All', + accelerator: 'Command+A', + selector: 'selectAll:' + } + ] + }, + { + label: 'View', + submenu: [ + { + label: 'Reload', + accelerator: 'Command+R', + click: () => { BrowserWindow.getFocusedWindow().reloadIgnoringCache(); } + }, + { + label: 'Toggle DevTools', + accelerator: 'Alt+Command+I', + click: () => { BrowserWindow.getFocusedWindow().toggleDevTools(); } + } + ] + }, + { + label: 'Window', + submenu: [ + { + label: 'Minimize', + accelerator: 'Command+M', + selector: 'performMiniaturize:' + }, + { + label: 'Close', + accelerator: 'Command+W', + selector: 'performClose:' + }, + { + type: 'separator' + }, + { + label: 'Bring All to Front', + selector: 'arrangeInFront:' + } + ] + }, + { + label: 'Help', + submenu: [] + } +]; + +menu = Menu.buildFromTemplate(template); + +Menu.setApplicationMenu(menu); // Must be called within app.on('ready', function(){ ... }); + +Menu.buildFromTemplate([ + { label: '4', id: '4' }, + { label: '5', id: '5' }, + { label: '1', id: '1', position: 'before=4' }, + { label: '2', id: '2' }, + { label: '3', id: '3' } +]); + +Menu.buildFromTemplate([ + { label: 'a', position: 'endof=letters' }, + { label: '1', position: 'endof=numbers' }, + { label: 'b', position: 'endof=letters' }, + { label: '2', position: 'endof=numbers' }, + { label: 'c', position: 'endof=letters' }, + { label: '3', position: 'endof=numbers' } +]); + +// power-monitor +// https://github.com/atom/electron/blob/master/docs/api/power-monitor.md + +app.on('ready', () => { + PowerMonitor.on('suspend', () => { + console.log('The system is going to sleep'); + }); +}); + +// protocol +// https://github.com/atom/electron/blob/master/docs/api/protocol.md + +app.on('ready', () => { + Protocol.registerProtocol('atom', (request: any) => { + var url = request.url.substr(7); + return new Protocol.RequestFileJob(path.normalize(`${__dirname}/${url}`)); + }); +}); + +// tray +// https://github.com/atom/electron/blob/master/docs/api/tray.md + +var appIcon: GitHubElectron.Tray = null; +app.on('ready', () => { + appIcon = new Tray('/path/to/my/icon'); + var contextMenu = Menu.buildFromTemplate([ + { label: 'Item1', type: 'radio' }, + { label: 'Item2', type: 'radio' }, + { label: 'Item3', type: 'radio', checked: true }, + { label: 'Item4', type: 'radio' }, + ]); + appIcon.setToolTip('This is my application.'); + appIcon.setContextMenu(contextMenu); +}); + +// clipboard +// https://github.com/atom/electron/blob/master/docs/api/clipboard.md + +Clipboard.writeText('Example String'); +Clipboard.writeText('Example String', 'selection'); +console.log(Clipboard.readText('selection')); + +// crash-reporter +// https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md + +CrashReporter.start({ + productName: 'YourName', + companyName: 'YourCompany', + submitUrl: 'https://your-domain.com/url-to-submit', + autoSubmit: true +}); + +// NativeImage +// https://github.com/atom/electron/blob/master/docs/api/native-image.md + +var appIcon2 = new Tray('/Users/somebody/images/icon.png'); +var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }); +var image = Clipboard.readImage(); +var appIcon3 = new Tray(image); +var appIcon4 = new Tray('/Users/somebody/images/icon.png'); + +// screen +// https://github.com/atom/electron/blob/master/docs/api/screen.md + +app.on('ready', () => { + var size = Screen.getPrimaryDisplay().workAreaSize; + mainWindow = new BrowserWindow({ width: size.width, height: size.height }); +}); + +app.on('ready', () => { + var displays = Screen.getAllDisplays(); + var externalDisplay: any = null; + for (var i in displays) { + if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { + externalDisplay = displays[i]; + break; + } + } + + if (externalDisplay) { + mainWindow = new BrowserWindow({ + x: externalDisplay.bounds.x + 50, + y: externalDisplay.bounds.y + 50, + }); + } +}); + +// shell +// https://github.com/atom/electron/blob/master/docs/api/shell.md + +Shell.openExternal('https://github.com'); diff --git a/github-electron/github-electron-main.d.ts b/github-electron/github-electron-main.d.ts new file mode 100644 index 000000000..0ecdbf030 --- /dev/null +++ b/github-electron/github-electron-main.d.ts @@ -0,0 +1,227 @@ +// Type definitions for the Electron 0.25.2 main process +// Project: http://electron.atom.io/ +// Definitions by: jedmao +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'app' { + var _app: GitHubElectron.App; + export = _app; +} + +declare module 'auto-updater' { + var _autoUpdater: GitHubElectron.AutoUpdater; + export = _autoUpdater; +} + +declare module 'browser-window' { + var BrowserWindow: typeof GitHubElectron.BrowserWindow; + export = BrowserWindow; +} + +declare module 'content-tracing' { + /** + * Get a set of category groups. The category groups can change as new code paths are reached. + * @param callback Called once all child processes have acked to the getCategories request. + */ + export function getCategories(callback: (categoryGroups: any[]) => void): void; + /** + * Start recording on all processes. Recording begins immediately locally, and asynchronously + * on child processes as soon as they receive the EnableRecording request. + * @param categoryFilter A filter to control what category groups should be traced. + * A filter can have an optional "-" prefix to exclude category groups that contain + * a matching category. Having both included and excluded category patterns in the + * same list would not be supported. + * @param options controls what kind of tracing is enabled, it could be a OR-ed + * combination of tracing.DEFAULT_OPTIONS, tracing.ENABLE_SYSTRACE, tracing.ENABLE_SAMPLING + * and tracing.RECORD_CONTINUOUSLY. + * @param callback Called once all child processes have acked to the startRecording request. + */ + export function startRecording(categoryFilter: string, options: number, callback: Function): void; + /** + * Stop recording on all processes. Child processes typically are caching trace data and + * only rarely flush and send trace data back to the main process. That is because it may + * be an expensive operation to send the trace data over IPC, and we would like to avoid + * much runtime overhead of tracing. So, to end tracing, we must asynchronously ask all + * child processes to flush any pending trace data. + * @param resultFilePath Trace data will be written into this file if it is not empty, + * or into a temporary file. + * @param callback Called once all child processes have acked to the stopRecording request. + */ + export function stopRecording(resultFilePath: string, callback: + /** + * @param filePath A file that contains the traced data. + */ + (filePath: string) => void + ): void; + /** + * Start monitoring on all processes. Monitoring begins immediately locally, and asynchronously + * on child processes as soon as they receive the startMonitoring request. + * @param callback Called once all child processes have acked to the startMonitoring request. + */ + export function startMonitoring(categoryFilter: string, options: number, callback: Function): void; + /** + * Stop monitoring on all processes. + * @param callback Called once all child processes have acked to the stopMonitoring request. + */ + export function stopMonitoring(callback: Function): void; + /** + * Get the current monitoring traced data. Child processes typically are caching trace data + * and only rarely flush and send trace data back to the main process. That is because it may + * be an expensive operation to send the trace data over IPC, and we would like to avoid much + * runtime overhead of tracing. So, to end tracing, we must asynchronously ask all child + * processes to flush any pending trace data. + * @param callback Called once all child processes have acked to the captureMonitoringSnapshot request. + */ + export function captureMonitoringSnapshot(resultFilePath: string, callback: + /** + * @param filePath A file that contains the traced data + * @returns {} + */ + (filePath: string) => void + ): void; + /** + * Get the maximum across processes of trace buffer percent full state. + * @param callback Called when the TraceBufferUsage value is determined. + */ + export function getTraceBufferUsage(callback: Function): void; + /** + * @param callback Called every time the given event occurs on any process. + */ + export function setWatchEvent(categoryName: string, eventName: string, callback: Function): void; + /** + * Cancel the watch event. If tracing is enabled, this may race with the watch event callback. + */ + export function cancelWatchEvent(): void; + export var DEFAULT_OPTIONS: number; + export var ENABLE_SYSTRACE: number; + export var ENABLE_SAMPLING: number; + export var RECORD_CONTINUOUSLY: number; +} + +declare module 'dialog' { + /** + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns an array of file paths chosen by the user, + * otherwise returns undefined. + */ + export var showOpenDialog: typeof GitHubElectron.Dialog.showOpenDialog; + /** + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns the path of file chosen by the user, otherwise + * returns undefined. + */ + export var showSaveDialog: typeof GitHubElectron.Dialog.showSaveDialog; + /** + * Shows a message box. It will block until the message box is closed. It returns . + * @param callback If supplied, the API call will be asynchronous. + * @returns The index of the clicked button. + */ + export var showMessageBox: typeof GitHubElectron.Dialog.showMessageBox; + + /** + * Runs a modal dialog that shows an error message. This API can be called safely + * before the ready event of app module emits, it is usually used to report errors + * in early stage of startup. + */ + export function showErrorBox(title: string, content: string): void; +} + +declare module 'global-shortcut' { + /** + * Registers a global shortcut of accelerator. + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + * @param callback Called when the registered shortcut is pressed by the user. + * @returns {} + */ + export function register(accelerator: string, callback: Function): void; + /** + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + * @returns Whether the accelerator is registered. + */ + export function isRegistered(accelerator: string): boolean; + /** + * Unregisters the global shortcut of keycode. + * @param accelerator Represents a keyboard shortcut. It can contain modifiers + * and key codes, combined by the "+" character. + */ + export function unregister(accelerator: string): void; + /** + * Unregisters all the global shortcuts. + */ + export function unregisterAll(): void; +} + +declare module 'ipc' { + var ipc: NodeJS.EventEmitter; + export = ipc; +} + +declare module 'menu' { + var Menu: typeof GitHubElectron.Menu; + export = Menu; +} + +declare module 'menu-item' { + var MenuItem: typeof GitHubElectron.MenuItem; + export = MenuItem; +} + +declare module 'power-monitor' { + var powerMonitor: NodeJS.EventEmitter; + export = powerMonitor; +} + +declare module 'protocol' { + export function registerProtocol(scheme: string, handler: (request: any) => void): void; + export function unregisterProtocol(scheme: string): void; + export function isHandledProtocol(scheme: string): boolean; + export function interceptProtocol(scheme: string, handler: (request: any) => void): void; + export function uninterceptProtocol(scheme: string): void; + export class RequestFileJob { + /** + * Create a request job which would query a file of path and set corresponding mime types. + */ + constructor(path: string); + } + export class RequestStringJob { + /** + * Create a request job which sends a string as response. + */ + constructor(options?: { + /** + * Default is "text/plain". + */ + mimeType?: string; + /** + * Default is "UTF-8". + */ + charset?: string; + data?: string; + }); + } + export class RequestBufferJob { + /** + * Create a request job which accepts a buffer and sends a string as response. + */ + constructor(options?: { + /** + * Default is "application/octet-stream". + */ + mimeType?: string; + /** + * Default is "UTF-8". + */ + encoding?: string; + data?: Buffer; + }); + } +} + +declare module 'tray' { + var Tray: typeof GitHubElectron.Tray; + export = Tray; +} diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts new file mode 100644 index 000000000..4c940b651 --- /dev/null +++ b/github-electron/github-electron-renderer-tests.ts @@ -0,0 +1,116 @@ +/// +import ipc = require('ipc'); +import remote = require('remote'); +import WebFrame = require('web-frame'); +import Clipboard = require('clipboard'); +import CrashReporter = require('crash-reporter'); +import NativeImage = require('native-image'); +import Screen = require('screen'); +import Shell = require('shell'); + +import fs = require('fs'); + +// In renderer process (web page). +// https://github.com/atom/electron/blob/master/docs/api/ipc-renderer.md +console.log(ipc.sendSync('synchronous-message', 'ping')); // prints "pong" + +ipc.on('asynchronous-reply', (arg: any) => { + console.log(arg); // prints "pong" +}); +ipc.send('asynchronous-message', 'ping'); + +// remote +// https://github.com/atom/electron/blob/master/docs/api/remote.md + +var BrowserWindow: typeof GitHubElectron.BrowserWindow = remote.require('browser-window'); +var win = new BrowserWindow({ width: 800, height: 600 }); +win.loadUrl('https://github.com'); + +remote.getCurrentWindow().on('close', () => { + // blabla... +}); + +remote.getCurrentWindow().capturePage(buf => { + fs.writeFile('/tmp/screenshot.png', buf, err => { + console.log(err); + }); +}); + +remote.getCurrentWindow().capturePage(buf => { + remote.require('fs').writeFile('/tmp/screenshot.png', buf, (err: Error) => { + console.log(err); + }); +}); + +// web-frame +// https://github.com/atom/electron/blob/master/docs/api/web-frame.md + +WebFrame.setZoomFactor(2); + +WebFrame.setSpellCheckProvider('en-US', true, { + spellCheck: text => { + return !(require('spellchecker').isMisspelled(text)); + } +}); + +// clipboard +// https://github.com/atom/electron/blob/master/docs/api/clipboard.md + +Clipboard.writeText('Example String'); +Clipboard.writeText('Example String', 'selection'); +console.log(Clipboard.readText('selection')); + +// crash-reporter +// https://github.com/atom/electron/blob/master/docs/api/crash-reporter.md + +CrashReporter.start({ + productName: 'YourName', + companyName: 'YourCompany', + submitUrl: 'https://your-domain.com/url-to-submit', + autoSubmit: true +}); + +// NativeImage +// https://github.com/atom/electron/blob/master/docs/api/native-image.md + +var Tray: typeof GitHubElectron.Tray = remote.require('Tray'); +var appIcon2 = new Tray('/Users/somebody/images/icon.png'); +var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }); +var image = Clipboard.readImage(); +var appIcon3 = new Tray(image); +var appIcon4 = new Tray('/Users/somebody/images/icon.png'); + +// screen +// https://github.com/atom/electron/blob/master/docs/api/screen.md + +var app: GitHubElectron.App = remote.require('app'); + +var mainWindow: GitHubElectron.BrowserWindow = null; + +app.on('ready', () => { + var size = Screen.getPrimaryDisplay().workAreaSize; + mainWindow = new BrowserWindow({ width: size.width, height: size.height }); +}); + +app.on('ready', () => { + var displays = Screen.getAllDisplays(); + var externalDisplay: any = null; + for (var i in displays) { + if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { + externalDisplay = displays[i]; + break; + } + } + + if (externalDisplay) { + mainWindow = new BrowserWindow({ + x: externalDisplay.bounds.x + 50, + y: externalDisplay.bounds.y + 50, + }); + } +}); + +// shell +// https://github.com/atom/electron/blob/master/docs/api/shell.md + +Shell.openExternal('https://github.com'); diff --git a/github-electron/github-electron-renderer.d.ts b/github-electron/github-electron-renderer.d.ts new file mode 100644 index 000000000..e2a310d28 --- /dev/null +++ b/github-electron/github-electron-renderer.d.ts @@ -0,0 +1,105 @@ +// Type definitions for the Electron 0.25.2 renderer process (web page) +// Project: http://electron.atom.io/ +// Definitions by: jedmao +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module GitHubElectron { + + class InProcess implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): InProcess; + on(event: string, listener: Function): InProcess; + once(event: string, listener: Function): InProcess; + removeListener(event: string, listener: Function): InProcess; + removeAllListeners(event?: string): InProcess; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * Send ...args to the renderer via channel in asynchronous message, the main + * process can handle it by listening to the channel event of ipc module. + */ + send(channel: string, ...args: any[]): void; + /** + * Send ...args to the renderer via channel in synchronous message, and returns + * the result sent from main process. The main process can handle it by listening + * to the channel event of ipc module, and returns by setting event.returnValue. + * Note: Usually developers should never use this API, since sending synchronous + * message would block the whole renderer process. + * @returns The result sent from the main process. + */ + sendSync(channel: string, ...args: any[]): string; + /** + * Like ipc.send but the message will be sent to the host page instead of the main process. + * This is mainly used by the page in to communicate with host page. + */ + sendToHost(channel: string, ...args: any[]): void; + } + + module Remote { + export function getCurrentWindow(): BrowserWindow; + } +} + +declare module 'ipc' { + var InProcess: GitHubElectron.InProcess; + export = InProcess; +} + +declare module 'remote' { + /** + * @returns The object returned by require(module) in the main process. + */ + export function require(module: string): any; + /** + * @returns The BrowserWindow object which this web page belongs to. + */ + export var getCurrentWindow: typeof GitHubElectron.Remote.getCurrentWindow; + /** + * @returns The global variable of name (e.g. global[name]) in the main process. + */ + export function getGlobal(name: string): any; + /** + * Returns the process object in the main process. This is the same as + * remote.getGlobal('process'), but gets cached. + */ + export var process: any; +} + +declare module 'web-frame' { + /** + * Changes the zoom factor to the specified factor, zoom factor is + * zoom percent / 100, so 300% = 3.0. + */ + export function setZoomFactor(factor: number): void; + /** + * @returns The current zoom factor. + */ + export function getZoomFactor(): number; + /** + * Changes the zoom level to the specified level, 0 is "original size", and each + * increment above or below represents zooming 20% larger or smaller to default + * limits of 300% and 50% of original size, respectively. + */ + export function setZoomLevel(level: number): void; + /** + * @returns The current zoom level. + */ + export function getZoomLevel(): number; + /** + * Sets a provider for spell checking in input fields and text areas. + */ + export function setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: { + /** + * @returns Whether the word passed is correctly spelled. + */ + spellCheck: (text: string) => boolean; + }): void; + /** + * Sets the scheme as secure scheme. Secure schemes do not trigger mixed content + * warnings. For example, https and data are secure schemes because they cannot be + * corrupted by active network attackers. + */ + export function registerUrlSchemeAsSecure(scheme: string): void; +} diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts new file mode 100644 index 000000000..4e1e289ca --- /dev/null +++ b/github-electron/github-electron.d.ts @@ -0,0 +1,1295 @@ +// Type definitions for Electron 0.25.2 (shared between main and rederer processes) +// Project: http://electron.atom.io/ +// Definitions by: jedmao +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module GitHubElectron { + /** + * This class is used to represent an image. + */ + class NativeImage { + /** + * Creates an empty NativeImage instance. + */ + static createEmpty(): NativeImage; + /** + * Creates a new NativeImage instance from file located at path. + */ + static createFromPath(path: string): NativeImage; + /** + * Creates a new NativeImage instance from buffer. + * @param scaleFactor 1.0 by default. + */ + static createFromBuffer(buffer: Buffer, scaleFactor?: number): NativeImage; + /** + * Creates a new NativeImage instance from dataUrl + */ + static createFromDataUrl(dataUrl: string): NativeImage; + /** + * @returns Buffer Contains the image's PNG encoded data. + */ + toPng(): Buffer; + /** + * @returns Buffer Contains the image's JPEG encoded data. + */ + toJpeg(quality: number): Buffer; + /** + * @returns string The data URL of the image. + */ + toDataUrl(): string; + /** + * @returns boolean Whether the image is empty. + */ + isEmpty(): boolean; + /** + * @returns {} The size of the image. + */ + getSize(): any; + /** + * Marks the image as template image. + */ + setTemplateImage(option: boolean): void; + } + + module Clipboard { + /** + * @returns The contents of the clipboard as a NativeImage. + */ + function readImage(type?: string): NativeImage; + /** + * Writes the image into the clipboard. + */ + function writeImage(image: NativeImage, type?: string): void; + } + + class Screen implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): Screen; + on(event: string, listener: Function): Screen; + once(event: string, listener: Function): Screen; + removeListener(event: string, listener: Function): Screen; + removeAllListeners(event?: string): Screen; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * @returns The current absolute position of the mouse pointer. + */ + getCursorScreenPoint(): any; + /** + * @returns The primary display. + */ + getPrimaryDisplay(): any; + /** + * @returns An array of displays that are currently available. + */ + getAllDisplays(): any[]; + /** + * @returns The display nearest the specified point. + */ + getDisplayNearestPoint(point: { + x: number; + y: number; + }): any; + /** + * @returns The display that most closely intersects the provided bounds. + */ + getDisplayMatching(rect: Rectangle): any; + } + + /** + * The BrowserWindow class gives you ability to create a browser window. + * You can also create a window without chrome by using Frameless Window API. + */ + class BrowserWindow implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): WebContents; + on(event: string, listener: Function): WebContents; + once(event: string, listener: Function): WebContents; + removeListener(event: string, listener: Function): WebContents; + removeAllListeners(event?: string): WebContents; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + constructor(options?: BrowserWindowOptions); + /** + * @returns All opened browser windows. + */ + static getAllWindows(): BrowserWindow[]; + /** + * @returns The window that is focused in this application. + */ + static getFocusedWindow(): BrowserWindow; + /** + * Find a window according to the webContents it owns. + */ + static fromWebContents(webContents: WebContents): BrowserWindow; + /** + * Find a window according to its ID. + */ + static fromId(id: number): BrowserWindow; + /** + * Adds devtools extension located at path. The extension will be remembered + * so you only need to call this API once, this API is not for programming use. + * @returns The extension's name. + */ + static addDevToolsExtension(path: string): string; + /** + * Remove a devtools extension. + * @param name The name of the devtools extension to remove. + */ + static removeDevToolsExtension(name: string): void; + /** + * The WebContents object this window owns, all web page related events and + * operations would be done via it. + * Note: Users should never store this object because it may become null when + * the renderer process (web page) has crashed. + */ + webContents: WebContents; + /** + * Get the WebContents of devtools of this window. + * Note: Users should never store this object because it may become null when + * the devtools has been closed. + */ + devToolsWebContents: WebContents; + /** + * Get the unique ID of this window. + */ + id: number; + /** + * Force closing the window, the unload and beforeunload event won't be emitted + * for the web page, and close event would also not be emitted for this window, + * but it would guarantee the closed event to be emitted. + * You should only use this method when the renderer process (web page) has crashed. + */ + destroy(): void; + /** + * Try to close the window, this has the same effect with user manually clicking + * the close button of the window. The web page may cancel the close though, + * see the close event. + */ + close(): void; + /** + * Focus on the window. + */ + focus(): void; + /** + * @returns Whether the window is focused. + */ + isFocused(): boolean; + /** + * Shows and gives focus to the window. + */ + show(): void; + /** + * Shows the window but doesn't focus on it. + */ + showInactive(): void; + /** + * Hides the window. + */ + hide(): void; + /** + * @returns Whether the window is visible to the user. + */ + isVisible(): boolean; + /** + * Maximizes the window. + */ + maximize(): void; + /** + * Unmaximizes the window. + */ + unmaximize(): void; + /** + * @returns Whether the window is maximized. + */ + isMaximized(): boolean; + /** + * Minimizes the window. On some platforms the minimized window will be + * shown in the Dock. + */ + minimize(): void; + /** + * Restores the window from minimized state to its previous state. + */ + restore(): void; + /** + * @returns Whether the window is minimized. + */ + isMinimized(): boolean; + /** + * Sets whether the window should be in fullscreen mode. + */ + setFullScreen(flag: boolean): void; + /** + * @returns Whether the window is in fullscreen mode. + */ + isFullScreen(): boolean; + /** + * Resizes and moves the window to width, height, x, y. + */ + setBounds(options: Rectangle): void; + /** + * @returns The window's width, height, x and y values. + */ + getBounds(): Rectangle; + /** + * Resizes the window to width and height. + */ + setSize(width: number, height: number): void; + /** + * @returns The window's width and height. + */ + getSize(): number[]; + /** + * Resizes the window's client area (e.g. the web page) to width and height. + */ + setContentSize(width: number, height: number): void; + /** + * @returns The window's client area's width and height. + */ + getContentSize(): number[]; + /** + * Sets the minimum size of window to width and height. + */ + setMinimumSize(width: number, height: number): void; + /** + * @returns The window's minimum width and height. + */ + getMinimumSize(): number[]; + /** + * Sets the maximum size of window to width and height. + */ + setMaximumSize(width: number, height: number): void; + /** + * @returns The window's maximum width and height. + */ + getMaximumSize(): number[]; + /** + * Sets whether the window can be manually resized by user. + */ + setResizable(resizable: boolean): void; + /** + * @returns Whether the window can be manually resized by user. + */ + isResizable(): boolean; + /** + * Sets whether the window should show always on top of other windows. After + * setting this, the window is still a normal window, not a toolbox window + * which can not be focused on. + */ + setAlwaysOnTop(flag: boolean): void; + /** + * @returns Whether the window is always on top of other windows. + */ + isAlwaysOnTop(): boolean; + /** + * Moves window to the center of the screen. + */ + center(): void; + /** + * Moves window to x and y. + */ + setPosition(x: number, y: number): void; + /** + * @returns The window's current position. + */ + getPosition(): number[]; + /** + * Changes the title of native window to title. + */ + setTitle(title: string): void; + /** + * Note: The title of web page can be different from the title of the native window. + * @returns The title of the native window. + */ + getTitle(): string; + /** + * Starts or stops flashing the window to attract user's attention. + */ + flashFrame(flag: boolean): void; + /** + * Makes the window do not show in Taskbar. + */ + setSkipTaskbar(skip: boolean): void; + /** + * Enters or leaves the kiosk mode. + */ + setKiosk(flag: boolean): void; + /** + * @returns Whether the window is in kiosk mode. + */ + isKiosk(): boolean; + /** + * Sets the pathname of the file the window represents, and the icon of the + * file will show in window's title bar. + * Note: This API is available only on OS X. + */ + setRepresentedFilename(filename: string): void; + /** + * Note: This API is available only on OS X. + * @returns The pathname of the file the window represents. + */ + getRepresentedFilename(): string; + /** + * Specifies whether the window’s document has been edited, and the icon in + * title bar will become grey when set to true. + * Note: This API is available only on OS X. + */ + setDocumentEdited(edited: boolean): void; + /** + * Note: This API is available only on OS X. + * @returns Whether the window's document has been edited. + */ + isDocumentEdited(): boolean; + /** + * Opens the developer tools. + */ + openDevTools(options?: { + /** + * Opens devtools in a new window. + */ + detach?: boolean; + }): void; + /** + * Closes the developer tools. + */ + closeDevTools(): void; + /** + * Toggle the developer tools. + */ + toggleDevTools(): void; + reloadIgnoringCache(): void; + /** + * Starts inspecting element at position (x, y). + */ + inspectElement(x: number, y: number): void; + focusOnWebView(): void; + blurWebView(): void; + /** + * Captures the snapshot of page within rect, upon completion the callback + * will be called. Omitting the rect would capture the whole visible page. + * Note: Be sure to read documents on remote buffer in remote if you are going + * to use this API in renderer process. + * @param callback Supplies the image that stores data of the snapshot. + */ + capturePage(rect: Rectangle, callback: (image: NativeImage) => void): void; + capturePage(callback: (image: NativeImage) => void): void; + /** + * Prints the window's web page. Calling window.print() in a web page is + * equivalent to calling BrowserWindow.print({silent: false, printBackground: false}). + */ + print(options?: { + /** + * When false, Electron will pick up system's default printer and default + * settings for printing. + */ + silent?: boolean; + printBackground?: boolean; + }): void; + /** + * Same with webContents.loadUrl(url). + */ + loadUrl(url: string): void; + /** + * Same with webContents.reload. + */ + reload(): void; + /** + * Sets the menu as the window top menu. + * Note: This API is not available on OS X. + */ + setMenu(menu: Menu): void; + /** + * Sets the progress value in the progress bar. + * On Linux platform, only supports Unity desktop environment, you need to + * specify the *.desktop file name to desktopName field in package.json. + * By default, it will assume app.getName().desktop. + * @param progress Valid range is [0, 1.0]. If < 0, the progress bar is removed. + * If greater than 0, it becomes indeterminate. + */ + setProgressBar(progress: number): void; + /** + * Sets a 16px overlay onto the current Taskbar icon, usually used to convey + * some sort of application status or to passively notify the user. + * Note: This API is only available on Windows 7 or above. + * @param overlay The icon to display on the bottom right corner of the Taskbar + * icon. If this parameter is null, the overlay is cleared + * @param description Provided to Accessibility screen readers. + */ + setOverlayIcon(overlay: NativeImage, description: string): void; + /** + * Shows pop-up dictionary that searches the selected word on the page. + * Note: This API is available only on OS X. + */ + showDefinitionForSelection(): void; + /** + * Sets whether the window menu bar should hide itself automatically. Once set + * the menu bar will only show when users press the single Alt key. + * If the menu bar is already visible, calling setAutoHideMenuBar(true) won't + * hide it immediately. + */ + setAutoHideMenuBar(hide: boolean): void; + /** + * @returns Whether menu bar automatically hides itself. + */ + isMenuBarAutoHide(): boolean; + /** + * Sets whether the menu bar should be visible. If the menu bar is auto-hide, + * users can still bring up the menu bar by pressing the single Alt key. + */ + setMenuBarVisibility(visibile: boolean): void; + /** + * @returns Whether the menu bar is visible. + */ + isMenuBarVisible(): boolean; + /** + * Sets whether the window should be visible on all workspaces. + * Note: This API does nothing on Windows. + */ + setVisibleOnAllWorkspaces(visible: boolean): void; + /** + * Note: This API always returns false on Windows. + * @returns Whether the window is visible on all workspaces. + */ + isVisibleOnAllWorkspaces(): boolean; + } + + interface BrowserWindowOptions extends Rectangle { + show?: boolean; + } + + interface Rectangle { + x?: number; + y?: number; + width?: number; + height?: number; + } + + /** + * A WebContents is responsible for rendering and controlling a web page. + */ + class WebContents implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): WebContents; + on(event: string, listener: Function): WebContents; + once(event: string, listener: Function): WebContents; + removeListener(event: string, listener: Function): WebContents; + removeAllListeners(event?: string): WebContents; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * Loads the url in the window. + * @param url Must contain the protocol prefix (e.g., the http:// or file://). + */ + loadUrl(url: string): void; + /** + * @returns The URL of current web page. + */ + getUrl(): string; + /** + * @returns The title of web page. + */ + getTitle(): string; + /** + * @returns The favicon of the web page. + */ + getFavicon(): NativeImage; + /** + * @returns Whether web page is still loading resources. + */ + isLoading(): boolean; + /** + * @returns Whether web page is waiting for a first-response for the main + * resource of the page. + */ + isWaitingForResponse(): boolean; + /** + * Stops any pending navigation. + */ + stop(): void; + /** + * Reloads current page. + */ + reload(): void; + /** + * Reloads current page and ignores cache. + */ + reloadIgnoringCache(): void; + /** + * @returns Whether the web page can go back. + */ + canGoBack(): boolean; + /** + * @returns Whether the web page can go forward. + */ + canGoForward(): boolean; + /** + * @returns Whether the web page can go to offset. + */ + canGoToOffset(offset: number): boolean; + /** + * Makes the web page go back. + */ + goBack(): void; + /** + * Makes the web page go forward. + */ + goForward(): void; + /** + * Navigates to the specified absolute index. + */ + goToIndex(index: number): void; + /** + * Navigates to the specified offset from the "current entry". + */ + goToOffset(offset: number): void; + /** + * @returns Whether the renderer process has crashed. + */ + isCrashed(): boolean; + /** + * Overrides the user agent for this page. + */ + setUserAgent(userAgent: string): void; + /** + * Injects CSS into this page. + */ + insertCSS(css: string): void; + /** + * Evaluates code in page. + * @param code Code to evaluate. + */ + executeJavaScript(code: string): void; + /** + * Executes Edit -> Undo command in page. + */ + undo(): void; + /** + * Executes Edit -> Redo command in page. + */ + redo(): void; + /** + * Executes Edit -> Cut command in page. + */ + cut(): void; + /** + * Executes Edit -> Copy command in page. + */ + copy(): void; + /** + * Executes Edit -> Paste command in page. + */ + paste(): void; + /** + * Executes Edit -> Delete command in page. + */ + delete(): void; + /** + * Executes Edit -> Select All command in page. + */ + selectAll(): void; + /** + * Executes Edit -> Unselect command in page. + */ + unselect(): void; + /** + * Executes Edit -> Replace command in page. + */ + replace(text: string): void; + /** + * Executes Edit -> Replace Misspelling command in page. + */ + replaceMisspelling(text: string): void; + /** + * Checks if any serviceworker is registered. + */ + hasServiceWorker(callback: (hasServiceWorker: boolean) => void): void; + /** + * Unregisters any serviceworker if present. + */ + unregisterServiceWorker(callback: + /** + * @param isFulfilled Whether the JS promise is fulfilled. + */ + (isFulfilled: boolean) => void): void; + /** + * Send args.. to the web page via channel in asynchronous message, the web page + * can handle it by listening to the channel event of ipc module. + * Note: + * 1. The IPC message handler in web pages do not have a event parameter, + * which is different from the handlers on the main process. + * 2. There is no way to send synchronous messages from the main process + * to a renderer process, because it would be very easy to cause dead locks. + */ + send(channel: string, ...args: any[]): void; + } + + /** + * The Menu class is used to create native menus that can be used as application + * menus and context menus. Each menu consists of multiple menu items, and each + * menu item can have a submenu. + */ + class Menu { + /** + * Creates a new menu. + */ + constructor(); + /** + * Sets menu as the application menu on OS X. On Windows and Linux, the menu + * will be set as each window's top menu. + */ + static setApplicationMenu(menu: Menu): void; + /** + * Sends the action to the first responder of application, this is used for + * emulating default Cocoa menu behaviors, usually you would just use the + * selector property of MenuItem. + * + * Note: This method is OS X only. + */ + static sendActionToFirstResponder(action: string): void; + /** + * @param template Generally, just an array of options for constructing MenuItem. + * You can also attach other fields to element of the template, and they will + * become properties of the constructed menu items. + */ + static buildFromTemplate(template: MenuItemOptions[]): Menu; + /** + * Popups this menu as a context menu in the browserWindow. You can optionally + * provide a (x,y) coordinate to place the menu at, otherwise it will be placed + * at the current mouse cursor position. + * @param x Horizontal coordinate where the menu will be placed. + * @param y Vertical coordinate where the menu will be placed. + */ + popup(browserWindow: BrowserWindow, x?: number, y?: number): void; + /** + * Appends the menuItem to the menu. + */ + append(menuItem: MenuItem): void; + /** + * Inserts the menuItem to the pos position of the menu. + */ + insert(position: number, menuItem: MenuItem): void; + items: MenuItem[]; + } + + class MenuItem { + constructor(options?: MenuItemOptions); + options: MenuItemOptions; + } + + interface MenuItemOptions { + /** + * Callback when the menu item is clicked. + */ + click?: Function; + /** + * Call the selector of first responder when clicked (OS X only). + */ + selector?: string; + /** + * Can be normal, separator, submenu, checkbox or radio. + */ + type?: string; + label?: string; + sublabel?: string; + /** + * An accelerator is string that represents a keyboard shortcut, it can contain + * multiple modifiers and key codes, combined by the + character. + * + * Examples: + * Command+A + * Ctrl+Shift+Z + * + * Platform notice: On Linux and Windows, the Command key would not have any effect, + * you can use CommandOrControl which represents Command on OS X and Control on + * Linux and Windows to define some accelerators. + * + * Available modifiers: + * Command (or Cmd for short) + * Control (or Ctrl for short) + * CommandOrControl (or CmdOrCtrl for short) + * Alt + * Shift + * + * Available key codes: + * 0 to 9 + * A to Z + * F1 to F24 + * Punctuations like ~, !, @, #, $, etc. + * Plus + * Space + * Backspace + * Delete + * Insert + * Return (or Enter as alias) + * Up, Down, Left and Right + * Home and End + * PageUp and PageDown + * Escape (or Esc for short) + * VolumeUp, VolumeDown and VolumeMute + * MediaNextTrack, MediaPreviousTrack, MediaStop and MediaPlayPause + */ + accelerator?: string; + /** + * In Electron for the APIs that take images, you can pass either file paths + * or NativeImage instances. When passing null, an empty image will be used. + */ + icon?: NativeImage|string; + enabled?: boolean; + visible?: boolean; + checked?: boolean; + /** + * Should be specified for submenu type menu item, when it's specified the + * type: 'submenu' can be omitted for the menu item + */ + submenu?: MenuItemOptions[]; + /** + * Unique within a single menu. If defined then it can be used as a reference + * to this item by the position attribute. + */ + id?: string; + /** + * This field allows fine-grained definition of the specific location within + * a given menu. + */ + position?: string; + } + + class BrowserWindowProxy { + /** + * Removes focus from the child window. + */ + blur(): void; + /** + * Forcefully closes the child window without calling its unload event. + */ + close(): void; + /** + * Set to true after the child window gets closed. + */ + closed: boolean; + /** + * Evaluates the code in the child window. + */ + eval(code: string): void; + /** + * Focuses the child window (brings the window to front). + */ + focus(): void; + /** + * Sends a message to the child window with the specified origin or * for no origin preference. + * In addition to these methods, the child window implements window.opener object with no + * properties and a single method. + */ + postMessage(message: string, targetOrigin: string): void; + } + + class App implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): App; + on(event: string, listener: Function): App; + once(event: string, listener: Function): App; + removeListener(event: string, listener: Function): App; + removeAllListeners(event?: string): App; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * Try to close all windows. The before-quit event will first be emitted. + * If all windows are successfully closed, the will-quit event will be emitted + * and by default the application would be terminated. + * + * This method guarantees all beforeunload and unload handlers are correctly + * executed. It is possible that a window cancels the quitting by returning + * false in beforeunload handler. + */ + quit(): void; + /** + * Quit the application directly, it will not try to close all windows so + * cleanup code will not run. + */ + terminate(): void; + /** + * @param name One of: home, appData, userData, cache, userCache, temp, userDesktop, exe, module + * @returns The path to a special directory or file associated with name. + * On failure an Error would throw. + */ + getPath(name: string): string; + /** + * Overrides the path to a special directory or file associated with name. + * If the path specifies a directory that does not exist, the directory will + * be created by this method. On failure an Error would throw. + * + * You can only override paths of names defined in app.getPath. + * + * By default web pages' cookies and caches will be stored under userData + * directory, if you want to change this location, you have to override the + * userData path before the ready event of app module gets emitted. + */ + setPath(name: string, path: string): void; + /** + * @returns The version of loaded application, if no version is found in + * application's package.json, the version of current bundle or executable. + */ + getVersion(): string; + /** + * + * @returns The current application's name, the name in package.json would be used. + * Usually the name field of package.json is a short lowercased name, according to + * the spec of npm modules. So usually you should also specify a productName field, + * which is your application's full capitalized name, and it will be preferred over + * name by Electron. + */ + getName(): string; + /** + * Resolves the proxy information for url, the callback would be called with + * callback(proxy) when the request is done. + */ + resolveProxy(url: string, callback: Function): void; + /** + * Adds path to recent documents list. + * + * This list is managed by the system, on Windows you can visit the list from + * task bar, and on Mac you can visit it from dock menu. + */ + addRecentDocument(path: string): void; + /** + * Clears the recent documents list. + */ + clearRecentDocuments(): void; + /** + * Adds tasks to the Tasks category of JumpList on Windows. + * + * Note: This API is only available on Windows. + */ + setUserTasks(tasks: Task[]): void; + dock: BrowserWindow; + commandLine: CommandLine; + } + + interface CommandLine { + /** + * Append a switch [with optional value] to Chromium's command line. + * + * Note: This will not affect process.argv, and is mainly used by developers + * to control some low-level Chromium behaviors. + */ + appendSwitch(_switch: string, value?: string|number): void; + /** + * Append an argument to Chromium's command line. The argument will quoted properly. + * + * Note: This will not affect process.argv. + */ + appendArgument(value: any): void; + } + + interface Task { + /** + * Path of the program to execute, usually you should specify process.execPath + * which opens current program. + */ + program: string; + /** + * The arguments of command line when program is executed. + */ + arguments: string; + /** + * The string to be displayed in a JumpList. + */ + title: string; + /** + * Description of this task. + */ + description: string; + /** + * The absolute path to an icon to be displayed in a JumpList, it can be + * arbitrary resource file that contains an icon, usually you can specify + * process.execPath to show the icon of the program. + */ + iconPath: string; + /** + * The icon index in the icon file. If an icon file consists of two or more + * icons, set this value to identify the icon. If an icon file consists of + * one icon, this value is 0. + */ + iconIndex: number; + commandLine: CommandLine; + dock: { + /** + * When critical is passed, the dock icon will bounce until either the + * application becomes active or the request is canceled. + * + * When informational is passed, the dock icon will bounce for one second. + * The request, though, remains active until either the application becomes + * active or the request is canceled. + * + * Note: This API is only available on Mac. + * @param type Can be critical or informational, the default is informational. + * @returns An ID representing the request + */ + bounce(type?: string): any; + /** + * Cancel the bounce of id. + * + * Note: This API is only available on Mac. + */ + cancelBounce(id: number): void; + /** + * Sets the string to be displayed in the dock’s badging area. + * + * Note: This API is only available on Mac. + */ + setBadge(text: string): void; + /** + * Returns the badge string of the dock. + * + * Note: This API is only available on Mac. + */ + getBadge(): string; + /** + * Hides the dock icon. + * + * Note: This API is only available on Mac. + */ + hide(): void; + /** + * Shows the dock icon. + * + * Note: This API is only available on Mac. + */ + show(): void; + /** + * Sets the application dock menu. + * + * Note: This API is only available on Mac. + */ + setMenu(menu: Menu): void; + } + } + + class AutoUpdater implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): AutoUpdater; + on(event: string, listener: Function): AutoUpdater; + once(event: string, listener: Function): AutoUpdater; + removeListener(event: string, listener: Function): AutoUpdater; + removeAllListeners(event?: string): AutoUpdater; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * Set the url and initialize the auto updater. + * The url cannot be changed once it is set. + */ + setFeedUrl(url: string): void; + /** + * Ask the server whether there is an update, you have to call setFeedUrl + * before using this API + */ + checkForUpdates(): any; + } + + module Dialog { + /** + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns an array of file paths chosen by the user, + * otherwise returns undefined. + */ + export function showOpenDialog( + browserWindow?: BrowserWindow, + options?: OpenDialogOptions, + callback?: (fileNames: string[]) => void + ): void; + export function showOpenDialog( + options?: OpenDialogOptions, + callback?: (fileNames: string[]) => void + ): void; + + interface OpenDialogOptions { + title?: string; + defaultPath?: string; + /** + * File types that can be displayed or selected. + */ + filters?: { + name: string; + extensions: string[]; + }[]; + /** + * Contains which features the dialog should use, can contain openFile, + * openDirectory, multiSelections and createDirectory + */ + properties?: string|string[]; + } + + /** + * @param browserWindow + * @param options + * @param callback If supplied, the API call will be asynchronous. + * @returns On success, returns the path of file chosen by the user, otherwise + * returns undefined. + */ + export function showSaveDialog(browserWindow?: BrowserWindow, options?: { + title?: string; + defaultPath?: string; + /** + * File types that can be displayed, see dialog.showOpenDialog for an example. + */ + filters?: string[]; + }, callback?: (fileName: string) => void): void; + + /** + * Shows a message box. It will block until the message box is closed. It returns . + * @param callback If supplied, the API call will be asynchronous. + * @returns The index of the clicked button. + */ + export function showMessageBox( + browserWindow?: BrowserWindow, + options?: ShowMessageBoxOptions, + callback?: (response: any) => void + ): number; + export function showMessageBox( + options: ShowMessageBoxOptions, + callback?: (response: any) => void + ): number; + + export interface ShowMessageBoxOptions { + /** + * Can be "none", "info" or "warning". + */ + type?: string; + /** + * Texts for buttons. + */ + buttons?: string[]; + /** + * Title of the message box (some platforms will not show it). + */ + title?: string; + /** + * Contents of the message box. + */ + message?: string; + /** + * Extra information of the message. + */ + detail?: string; + icon?: NativeImage; + } + } + + class Tray implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): Tray; + on(event: string, listener: Function): Tray; + once(event: string, listener: Function): Tray; + removeListener(event: string, listener: Function): Tray; + removeAllListeners(event?: string): Tray; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + /** + * Creates a new tray icon associated with the image. + */ + constructor(image: NativeImage|string); + /** + * Destroys the tray icon immediately. + */ + destroy(): void; + /** + * Sets the image associated with this tray icon. + */ + setImage(image: NativeImage): void; + /** + * Sets the image associated with this tray icon when pressed. + */ + setPressedImage(image: NativeImage): void; + /** + * Sets the hover text for this tray icon. + */ + setToolTip(toolTip: string): void; + /** + * Sets the title displayed aside of the tray icon in the status bar. + * Note: This is only implemented on OS X. + */ + setTitle(title: string): void; + /** + * Sets whether the tray icon is highlighted when it is clicked. + * Note: This is only implemented on OS X. + */ + setHighlightMode(highlight: boolean): void; + /** + * Displays a tray balloon. + * Note: This is only implemented on Windows. + */ + displayBalloon(options?: { + icon?: NativeImage; + title?: string; + content?: string; + }): void; + /** + * Sets the context menu for this icon. + */ + setContextMenu(menu: Menu): void; + } +} + +declare module 'clipboard' { + /** + * @returns The contents of the clipboard as plain text. + */ + export function readText(type?: string): string; + /** + * Writes the text into the clipboard as plain text. + */ + export function writeText(text: string, type?: string): void; + /** + * @returns The contents of the clipboard as a NativeImage. + */ + export var readImage: typeof GitHubElectron.Clipboard.readImage; + /** + * Writes the image into the clipboard. + */ + export var writeImage: typeof GitHubElectron.Clipboard.writeImage; + /** + * Clears everything in clipboard. + */ + export function clear(type?: string): void; + /** + * Note: This API is experimental and could be removed in future. + * @returns Whether the clipboard has data in the specified format. + */ + export function has(format: string, type?: string): boolean; + /** + * Reads the data in the clipboard of the specified format. + * Note: This API is experimental and could be removed in future. + */ + export function read(format: string, type?: string): any; +} + +declare module 'crash-reporter' { + export function start(options?: { + /** + * Default: Electron + */ + productName?: string; + /** + * Default: GitHub, Inc. + */ + companyName?: string; + /** + * URL that crash reports would be sent to as POST. + * Default: http://54.249.141.255:1127/post + */ + submitUrl?: string; + /** + * Send the crash report without user interaction. + * Default: true. + */ + autoSubmit?: boolean; + /** + * Default: false. + */ + ignoreSystemCrashHandler?: boolean; + /** + * An object you can define which content will be send along with the report. + * Only string properties are send correctly. + * Nested objects are not supported. + */ + extra?: {} + }): void; + + /** + * @returns The date and ID of the last crash report. When there was no crash report + * sent or the crash reporter is not started, null will be returned. + */ + export function getLastCrashReport(): CrashReporterPayload; + + interface CrashReporterPayload extends Object { + /** + * E.g., "electron-crash-service". + */ + rept: string; + /** + * The version of Electron. + */ + ver: string; + /** + * E.g., "win32". + */ + platform: string; + /** + * E.g., "renderer". + */ + process_type: string; + ptime: number; + /** + * The version in package.json. + */ + _version: string; + /** + * The product name in the crashReporter options object. + */ + _productName: string; + /** + * Name of the underlying product. In this case, Electron. + */ + prod: string; + /** + * The company name in the crashReporter options object. + */ + _companyName: string; + /** + * The crashreporter as a file. + */ + upload_file_minidump: File; + } +} + +declare module 'native-image' { + var NativeImage: typeof GitHubElectron.NativeImage; + export = NativeImage; +} + +declare module 'screen' { + var screen: GitHubElectron.Screen; + export = screen; +} + +declare module 'shell' { + /** + * Show the given file in a file manager. If possible, select the file. + */ + export function showItemInFolder(fullPath: string): void; + /** + * Open the given file in the desktop's default manner. + */ + export function openItem(fullPath: string): void; + /** + * Open the given external protocol URL in the desktop's default manner + * (e.g., mailto: URLs in the default mail user agent). + */ + export function openExternal(url: string): void; + /** + * Move the given file to trash and returns boolean status for the operation. + */ + export function moveItemToTrash(fullPath: string): void; + /** + * Play the beep sound. + */ + export function beep(): void; +} + +interface Window { + /** + * Creates a new window. + * @returns An instance of BrowserWindowProxy class. + */ + open(url: string, frameName?: string, features?: string): GitHubElectron.BrowserWindowProxy; +} + +interface File { + /** + * Exposes the real path of the filesystem. + */ + path: string; +} From 04ad9969ea383a664d6f994cd556287566d0020c Mon Sep 17 00:00:00 2001 From: Scott Southwood Date: Wed, 6 May 2015 16:03:05 -0700 Subject: [PATCH 104/534] Adding declarations for Application Insights --- .../applicationinsights-tests.ts | 25 + applicationinsights/applicationinsights.d.ts | 429 ++++++++++++++++++ 2 files changed, 454 insertions(+) create mode 100644 applicationinsights/applicationinsights-tests.ts create mode 100644 applicationinsights/applicationinsights.d.ts diff --git a/applicationinsights/applicationinsights-tests.ts b/applicationinsights/applicationinsights-tests.ts new file mode 100644 index 000000000..871a029e8 --- /dev/null +++ b/applicationinsights/applicationinsights-tests.ts @@ -0,0 +1,25 @@ +/// +import appInsights = require("applicationinsights"); + +// basic use +appInsights.setup("").start(); + +// basic use with auto-collection configuration +appInsights.setup("") + .setAutoCollectRequests(false) + .setAutoCollectPerformance(false) + .setAutoCollectExceptions(false) + // no telemetry will be sent until .start() is called + // this prevents any of the auto-collectors from initializing + .enableVerboseLogging() + .start(); + +appInsights.client.trackEvent("custom event", {customProperty: "custom property value"}); +appInsights.client.trackException(new Error("handled exceptions can be logged with this method")); +appInsights.client.trackMetric("custom metric", 3); +appInsights.client.trackTrace("trace message"); + +// assign common properties to all telemetry +appInsights.client.commonProperties = { + environment: "dev" +}; diff --git a/applicationinsights/applicationinsights.d.ts b/applicationinsights/applicationinsights.d.ts new file mode 100644 index 000000000..6b80adc2a --- /dev/null +++ b/applicationinsights/applicationinsights.d.ts @@ -0,0 +1,429 @@ +// Type definitions for Application Insights v0.15.1 +// Project: https://github.com/Microsoft/ApplicationInsights-node.js +// Definitions by: Scott Southwood +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface AutoCollectConsole { + enable(isEnabled: boolean): void; + isInitialized(): boolean; +} + +interface AutoCollectExceptions { + isInitialized(): boolean; + enable(isEnabled:boolean): void; +} + +interface AutoCollectPerformance { + enable(isEnabled: boolean): void; + isInitialized(): boolean; +} + +interface AutoCollectRequests { + enable(isEnabled: boolean): void; + isInitialized(): boolean; +} + + +declare module ContractsModule { + enum DataPointType { + Measurement = 0, + Aggregation = 1, + } + enum DependencyKind { + SQL = 0, + Http = 1, + Other = 2, + } + enum DependencySourceType { + Undefined = 0, + Aic = 1, + Apmc = 2, + } + enum SessionState { + Start = 0, + End = 1, + } + enum SeverityLevel { + Verbose = 0, + Information = 1, + Warning = 2, + Error = 3, + Critical = 4, + } + interface ContextTagKeys { + applicationVersion: string; + applicationBuild: string; + deviceId: string; + deviceIp: string; + deviceLanguage: string; + deviceLocale: string; + deviceModel: string; + deviceNetwork: string; + deviceOEMName: string; + deviceOS: string; + deviceOSVersion: string; + deviceRoleInstance: string; + deviceRoleName: string; + deviceScreenResolution: string; + deviceType: string; + deviceMachineName: string; + locationIp: string; + operationId: string; + operationName: string; + operationParentId: string; + operationRootId: string; + operationSyntheticSource: string; + operationIsSynthetic: string; + sessionId: string; + sessionIsFirst: string; + sessionIsNew: string; + userAccountAcquisitionDate: string; + userAccountId: string; + userAgent: string; + userId: string; + userStoreRegion: string; + sampleRate: string; + internalSdkVersion: string; + internalAgentVersion: string; + } + interface Domain { + ver: number; + properties: any; + } + interface Data { + baseType: string; + baseData: TDomain; + } + interface Envelope { + ver: number; + name: string; + time: string; + sampleRate: number; + seq: string; + iKey: string; + flags: number; + deviceId: string; + os: string; + osVer: string; + appId: string; + appVer: string; + userId: string; + tags: { + [key: string]: string; + }; + data: Data; + } + interface EventData extends ContractsModule.Domain { + ver: number; + name: string; + properties: any; + measurements: any; + } + interface MessageData extends ContractsModule.Domain { + ver: number; + message: string; + severityLevel: ContractsModule.SeverityLevel; + properties: any; + } + interface ExceptionData extends ContractsModule.Domain { + ver: number; + handledAt: string; + exceptions: ExceptionDetails[]; + severityLevel: ContractsModule.SeverityLevel; + problemId: string; + crashThreadId: number; + properties: any; + measurements: any; + } + interface StackFrame { + level: number; + method: string; + assembly: string; + fileName: string; + line: number; + } + interface ExceptionDetails { + id: number; + outerId: number; + typeName: string; + message: string; + hasFullStack: boolean; + stack: string; + parsedStack: StackFrame[]; + } + interface DataPoint { + name: string; + kind: ContractsModule.DataPointType; + value: number; + count: number; + min: number; + max: number; + stdDev: number; + } + interface MetricData extends ContractsModule.Domain { + ver: number; + metrics: DataPoint[]; + properties: any; + } + interface PageViewData extends ContractsModule.EventData { + ver: number; + url: string; + name: string; + duration: string; + properties: any; + measurements: any; + } + interface PageViewPerfData extends ContractsModule.PageViewData { + ver: number; + url: string; + perfTotal: string; + name: string; + duration: string; + networkConnect: string; + sentRequest: string; + receivedResponse: string; + domProcessing: string; + properties: any; + measurements: any; + } + interface RemoteDependencyData extends ContractsModule.Domain { + ver: number; + name: string; + kind: ContractsModule.DataPointType; + value: number; + count: number; + min: number; + max: number; + stdDev: number; + dependencyKind: ContractsModule.DependencyKind; + success: boolean; + async: boolean; + dependencySource: ContractsModule.DependencySourceType; + commandName: string; + dependencyTypeName: string; + properties: any; + } + interface AjaxCallData extends ContractsModule.PageViewData { + ver: number; + url: string; + ajaxUrl: string; + name: string; + duration: string; + requestSize: number; + responseSize: number; + timeToFirstByte: string; + timeToLastByte: string; + callbackDuration: string; + responseCode: string; + success: boolean; + properties: any; + measurements: any; + } + interface RequestData extends ContractsModule.Domain { + ver: number; + id: string; + name: string; + startTime: string; + duration: string; + responseCode: string; + success: boolean; + httpMethod: string; + url: string; + properties: any; + measurements: any; + } + interface SessionStateData extends ContractsModule.Domain { + ver: number; + state: ContractsModule.SessionState; + } + interface PerformanceCounterData extends ContractsModule.Domain { + ver: number; + categoryName: string; + counterName: string; + instanceName: string; + kind: DataPointType; + count: number; + min: number; + max: number; + stdDev: number; + value: number; + properties: any; + } +} + + +interface Channel { + constructor(isDisabled: () => boolean, getBatchSize: () => number, getBatchIntervalMs: () => number, sender: Sender): Channel; + /** + * Add a telemetry item to the send buffer + */ + send(envelope: ContractsModule.Envelope): void; + handleCrash(envelope: ContractsModule.Envelope): void; + /** + * Immediately send buffered data + */ + triggerSend(isNodeCrashing?: boolean): void; +} + +interface Client { + config: Config; + context: Context; + commonProperties: { + [key: string]: string; + }; + channel: Channel; + /** + * Constructs a new client of the client + * @param iKey the instrumentation key to use (read from environment variable if not specified) + */ + constructor(iKey?: string): Client; + /** + * Log a user action or other occurrence. + * @param name A string to identify this event in the portal. + * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. + * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty. + */ + trackEvent(name: string, properties?: { + [key: string]: string; + }, measurements?: { + [key: string]: number; + }): void; + /** + * Log a trace message + * @param message A string to identify this event in the portal. + * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. + */ + trackTrace(message: string, severityLevel?: ContractsModule.SeverityLevel, properties?: { + [key: string]: string; + }): void; + /** + * Log an exception you have caught. + * @param exception An Error from a catch clause, or the string error message. + * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty. + * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty. + */ + trackException(exception: Error, properties?: { + [key: string]: string; + }): void; + /** + * Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators. + * To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the + * telemetry bandwidth by aggregating multiple measurements and sending the resulting average at intervals. + * @param name A string that identifies the metric. + * @param value The value of the metric + */ + trackMetric(name: string, value: number): void; + trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: { + [key: string]: string; + }): void; + /** + * Immediately send all queued telemetry. + */ + sendPendingData(): void; + getEnvelope(data: ContractsModule.Data, tagOverrides?: { + [key: string]: string; + }): ContractsModule.Envelope; + /** + * Generic track method for all telemetry types + * @param data the telemetry to send + * @param tagOverrides the context tags to use for this telemetry which overwrite default context values + */ + track(data: ContractsModule.Data, tagOverrides?: { + [key: string]: string; + }): void; +} + +interface Config { + instrumentationKey: string; + sessionRenewalMs: number; + sessionExpirationMs: number; + endpointUrl: string; + maxBatchSize: number; + maxBatchIntervalMs: number; + disableAppInsights: boolean; + constructor(instrumentationKey?: string): Config; +} + +interface Context { + keys: ContractsModule.ContextTagKeys; + tags: { + [key: string]: string; + }; + constructor(packageJsonPath?: string): Context; +} + +interface Sender { + constructor(getUrl: () => string, onSuccess?: (response: string) => void, onError?: (error: Error) => void): Sender; + send(payload: any/* Buffer */): void; + saveOnCrash(payload: string): void; + /** + * enable caching events locally on error + */ + enableCacheOnError(): void; + /** + * disable caching events locally on error + */ + disableCacheOnError(): void; +} + +/** + * The singleton meta interface for the default client of the client. This interface is used to setup/start and configure + * the auto-collection behavior of the application insights module. + */ +declare class ApplicationInsights { + static client: Client; + private static _isConsole; + private static _isExceptions; + private static _isPerformance; + private static _isRequests; + private static _console; + private static _exceptions; + private static _performance; + private static _requests; + private static _isStarted; + /** + * Initializes the default client of the client and sets the default configuration + * @param instrumentationKey the instrumentation key to use. Optional, if this is not specified, the value will be + * read from the environment variable APPINSIGHTS_INSTRUMENTATION_KEY + * @returns {ApplicationInsights} this interface + */ + static setup(instrumentationKey?: string): typeof ApplicationInsights; + /** + * Starts automatic collection of telemetry. Prior to calling start no telemetry will be collected + * @returns {ApplicationInsights} this interface + */ + static start(): typeof ApplicationInsights; + /** + * Sets the state of console tracking (enabled by default) + * @param value if true console activity will be sent to Application Insights + * @returns {ApplicationInsights} this interface + */ + static setAutoCollectConsole(value: boolean): typeof ApplicationInsights; + /** + * Sets the state of exception tracking (enabled by default) + * @param value if true uncaught exceptions will be sent to Application Insights + * @returns {ApplicationInsights} this interface + */ + static setAutoCollectExceptions(value: boolean): typeof ApplicationInsights; + /** + * Sets the state of performance tracking (enabled by default) + * @param value if true performance counters will be collected every second and sent to Application Insights + * @returns {ApplicationInsights} this interface + */ + static setAutoCollectPerformance(value: boolean): typeof ApplicationInsights; + /** + * Sets the state of request tracking (enabled by default) + * @param value if true requests will be sent to Application Insights + * @returns {ApplicationInsights} this interface + */ + static setAutoCollectRequests(value: boolean): typeof ApplicationInsights; + /** + * Enables verbose debug logging + * @returns {ApplicationInsights} this interface + */ + static enableVerboseLogging(): typeof ApplicationInsights; +} + +declare module "applicationinsights" { + export = ApplicationInsights; +} \ No newline at end of file From eea6c97557e2c21ab80a800290a77456a79df6df Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 6 May 2015 16:10:58 -0700 Subject: [PATCH 105/534] Fix ES6 Promise typings so that a void error callback does not mess up inference --- es6-promise/es6-promise-tests.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/es6-promise/es6-promise-tests.ts b/es6-promise/es6-promise-tests.ts index dc54f3b1b..0980ac26c 100644 --- a/es6-promise/es6-promise-tests.ts +++ b/es6-promise/es6-promise-tests.ts @@ -160,3 +160,32 @@ getJSON('story.json').then(function(story: Story) { }).then(function() { (document.querySelector('.spinner')).style.display = 'none'; }); + +interface T1 { + __t1: string; +} + +interface T2 { + __t2: string; +} + +interface T3 { + __t3: string; +} + +function f1(): Promise { + return Promise.resolve({ __t1: "foo_t1" }); +} + +function f2(x: T1): T2 { + return { __t2: x.__t1 + ":foo_21" }; +} + +var x3 = f1() + .then(f2, (e: Error) => { + console.log("error 1"); + throw e; +}) + .then((x: T2) => { + return { __t3: x.__t2 + "bar" }; +}); \ No newline at end of file From 35119c83fe214d18c7e370a678cd85dfcfbfa42a Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 6 May 2015 16:17:02 -0700 Subject: [PATCH 106/534] Add the actual typing fix --- es6-promise/es6-promise.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/es6-promise/es6-promise.d.ts b/es6-promise/es6-promise.d.ts index 4a793e540..86c82273a 100644 --- a/es6-promise/es6-promise.d.ts +++ b/es6-promise/es6-promise.d.ts @@ -4,7 +4,8 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped interface Thenable { - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; + then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; + then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; } declare class Promise implements Thenable { @@ -27,7 +28,8 @@ declare class Promise implements Thenable { * @param onFulfilled called when/if "promise" resolves * @param onRejected called when/if "promise" rejects */ - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; + then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Promise; + then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Promise; /** * Sugar for promise.then(undefined, onRejected) From e6c5e8b4e5e99370bdd91c7d16fa501cce141344 Mon Sep 17 00:00:00 2001 From: yamada28go Date: Thu, 7 May 2015 09:14:33 +0900 Subject: [PATCH 107/534] rename xdate/xdate-test.ts to xdate/xdate-tests.ts --- xdate/{xdate-test.ts => xdate-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename xdate/{xdate-test.ts => xdate-tests.ts} (100%) diff --git a/xdate/xdate-test.ts b/xdate/xdate-tests.ts similarity index 100% rename from xdate/xdate-test.ts rename to xdate/xdate-tests.ts From c132e6e5dcecce5f658e42e8f002d749e193c674 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Wed, 6 May 2015 22:21:52 -0500 Subject: [PATCH 108/534] Match npm package name and remove empty tscparams --- jquery.pickadate/jquery.pickadate-tests.ts.tscparams | 1 - jquery.pickadate/jquery.pickadate.d.ts.tscparams | 1 - .../jquery.pickadate-tests.ts => pickadate/pickadate-tests.ts | 2 +- .../jquery.pickadate.d.ts => pickadate/pickadate.d.ts | 0 4 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 jquery.pickadate/jquery.pickadate-tests.ts.tscparams delete mode 100644 jquery.pickadate/jquery.pickadate.d.ts.tscparams rename jquery.pickadate/jquery.pickadate-tests.ts => pickadate/pickadate-tests.ts (99%) rename jquery.pickadate/jquery.pickadate.d.ts => pickadate/pickadate.d.ts (100%) diff --git a/jquery.pickadate/jquery.pickadate-tests.ts.tscparams b/jquery.pickadate/jquery.pickadate-tests.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/jquery.pickadate/jquery.pickadate-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/jquery.pickadate/jquery.pickadate.d.ts.tscparams b/jquery.pickadate/jquery.pickadate.d.ts.tscparams deleted file mode 100644 index d3f5a12fa..000000000 --- a/jquery.pickadate/jquery.pickadate.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/jquery.pickadate/jquery.pickadate-tests.ts b/pickadate/pickadate-tests.ts similarity index 99% rename from jquery.pickadate/jquery.pickadate-tests.ts rename to pickadate/pickadate-tests.ts index d47dc3b58..eca4e8d36 100644 --- a/jquery.pickadate/jquery.pickadate-tests.ts +++ b/pickadate/pickadate-tests.ts @@ -1,4 +1,4 @@ -/// +/// // Date picker tests from http://amsul.ca/pickadate.js/date/ diff --git a/jquery.pickadate/jquery.pickadate.d.ts b/pickadate/pickadate.d.ts similarity index 100% rename from jquery.pickadate/jquery.pickadate.d.ts rename to pickadate/pickadate.d.ts From 8f4dd4a68b92a324859632783d0c01be38231f39 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Wed, 6 May 2015 22:34:39 -0500 Subject: [PATCH 109/534] Export additional interfaces --- pickadate/pickadate.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pickadate/pickadate.d.ts b/pickadate/pickadate.d.ts index 0754fa765..d6dd7e2a3 100644 --- a/pickadate/pickadate.d.ts +++ b/pickadate/pickadate.d.ts @@ -255,7 +255,7 @@ declare module Pickadate { interval?: number; } - interface SetOptions { + export interface SetOptions { /** * By default, any callbacks bound with the on method will be fired when its relevant thing is set. * To silently set a thing, pass an options object with the muted parameter set to true. @@ -347,8 +347,8 @@ declare module Pickadate { trigger(event: string, data?: any): TPickerObject; } - interface DatePicker extends Picker { } - interface TimePicker extends Picker { } + export interface DatePicker extends Picker { } + export interface TimePicker extends Picker { } } interface JQuery { From 39bd70e31fa6d0c644c729bd93a20ee17bae4885 Mon Sep 17 00:00:00 2001 From: Andrey Kurdyumov Date: Thu, 7 May 2015 11:05:29 +0600 Subject: [PATCH 110/534] Add declaration for the Swipe --- swipe/swipe-tests.ts | 2 ++ swipe/swipe.d.ts | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 swipe/swipe-tests.ts create mode 100644 swipe/swipe.d.ts diff --git a/swipe/swipe-tests.ts b/swipe/swipe-tests.ts new file mode 100644 index 000000000..1bc4b3392 --- /dev/null +++ b/swipe/swipe-tests.ts @@ -0,0 +1,2 @@ +// Creation of element +window.mySwipe = Swipe(document.getElementById('slider')); \ No newline at end of file diff --git a/swipe/swipe.d.ts b/swipe/swipe.d.ts new file mode 100644 index 000000000..d505470a9 --- /dev/null +++ b/swipe/swipe.d.ts @@ -0,0 +1,28 @@ +// Type definitions for Swipe 2.0 +// Project: https://github.com/thebird/Swipe +// Definitions by: Andrey Kurdyumov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface SwipeOptions { + startSlide?: number; + speed?: number; + auto?: number; + continuous?: boolean; + disableScroll?: boolean; + stopPropagation?: boolean; + callback?: (index, elem) => void; + transitionEnd?: (index, elem) => void; +} + +declare class Swipe { + constructor(container: HTMLElement, options: SwipeOptions); + prev(); + next(); + getPos(); + getNumSlides(); + kill(); + attachEvents(); + setup(); + slide(index: number, duration: number); +} From b318b6125a691f03d17ac54416828873e6116a8a Mon Sep 17 00:00:00 2001 From: Andrey Kurdyumov Date: Thu, 7 May 2015 11:24:10 +0600 Subject: [PATCH 111/534] Fix the tests --- swipe/swipe-tests.ts | 4 +++- swipe/swipe.d.ts | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/swipe/swipe-tests.ts b/swipe/swipe-tests.ts index 1bc4b3392..26c11f6fd 100644 --- a/swipe/swipe-tests.ts +++ b/swipe/swipe-tests.ts @@ -1,2 +1,4 @@ +/// + // Creation of element -window.mySwipe = Swipe(document.getElementById('slider')); \ No newline at end of file +var mySwipe = Swipe(document.getElementById('slider')); \ No newline at end of file diff --git a/swipe/swipe.d.ts b/swipe/swipe.d.ts index d505470a9..5b8d396f5 100644 --- a/swipe/swipe.d.ts +++ b/swipe/swipe.d.ts @@ -11,18 +11,18 @@ interface SwipeOptions { continuous?: boolean; disableScroll?: boolean; stopPropagation?: boolean; - callback?: (index, elem) => void; - transitionEnd?: (index, elem) => void; + callback?: (index: number, elem: HTMLElement) => void; + transitionEnd?: (index: number, elem: HTMLElement) => void; } declare class Swipe { constructor(container: HTMLElement, options: SwipeOptions); - prev(); - next(); - getPos(); - getNumSlides(); - kill(); - attachEvents(); - setup(); - slide(index: number, duration: number); + prev(): void; + next(): void; + getPos(): number; + getNumSlides(): number; + kill(): void; + attachEvents(): void; + setup(): void; + slide(index: number, duration: number): void; } From 857722299ee061fa2d038b9fba6b126cbfe826bd Mon Sep 17 00:00:00 2001 From: Andrey Kurdyumov Date: Thu, 7 May 2015 11:29:14 +0600 Subject: [PATCH 112/534] Fix tests --- swipe/swipe-tests.ts | 2 +- swipe/swipe.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/swipe/swipe-tests.ts b/swipe/swipe-tests.ts index 26c11f6fd..a13006ebb 100644 --- a/swipe/swipe-tests.ts +++ b/swipe/swipe-tests.ts @@ -1,4 +1,4 @@ /// // Creation of element -var mySwipe = Swipe(document.getElementById('slider')); \ No newline at end of file +var mySwipe = new Swipe(document.getElementById('slider')); \ No newline at end of file diff --git a/swipe/swipe.d.ts b/swipe/swipe.d.ts index 5b8d396f5..9cb753ef9 100644 --- a/swipe/swipe.d.ts +++ b/swipe/swipe.d.ts @@ -16,7 +16,7 @@ interface SwipeOptions { } declare class Swipe { - constructor(container: HTMLElement, options: SwipeOptions); + constructor(container: HTMLElement, options?: SwipeOptions); prev(): void; next(): void; getPos(): number; From fe5406b820f645346b9a401b6c3bebc94c04933e Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Wed, 6 May 2015 23:21:06 -0500 Subject: [PATCH 113/534] Improve JSDoc comments and use a union type for min/max properties --- pickadate/pickadate-tests.ts | 3 + pickadate/pickadate.d.ts | 296 ++++++++++++++++++++++++++--------- 2 files changed, 223 insertions(+), 76 deletions(-) diff --git a/pickadate/pickadate-tests.ts b/pickadate/pickadate-tests.ts index eca4e8d36..09e9d57ad 100644 --- a/pickadate/pickadate-tests.ts +++ b/pickadate/pickadate-tests.ts @@ -382,6 +382,9 @@ var $input = $('.datepicker').pickadate(); // Use the picker object directly. var picker = $input.pickadate('picker'); +picker.$node; +picker.$root; + picker.open().clear().close(); picker.open(); diff --git a/pickadate/pickadate.d.ts b/pickadate/pickadate.d.ts index d6dd7e2a3..5056096ce 100644 --- a/pickadate/pickadate.d.ts +++ b/pickadate/pickadate.d.ts @@ -6,7 +6,7 @@ /// declare module Pickadate { - /** KlassOptions shared between date and time pickers */ + // KlassOptions shared between date and time pickers interface KlassOptions { // The element states input?: string; // default 'picker__input' @@ -83,44 +83,80 @@ declare module Pickadate { viewset?: string; // default 'picker__list-item--viewset' } - /** Options shared between date and time pickers */ + // options shared between date and time pickers interface Options { - /** Set clear button text */ - clear?: string; // default 'Clear' + /** + * Set the clear button text. + * Defaults to 'Clear' + */ + clear?: string; /** * The human-friendly display format. * Escape any "rule" characters with an exclamation mark (!). + * Defaults to 'd mmmm, yyyy' */ - format?: string; // default 'd mmmm, yyyy' - - /** An alternate format to submit to the server. */ - formatSubmit?: string; // default undefined - hiddenPrefix?: string; // default undefined - hiddenSuffix?: string; // default '_submit' + format?: string; /** - * A majority of the time, the value that needs to be sent to the server is just the hidden value - * and not the visible one. To make this happen, use the hiddenName option. - * This essentially nullifies the hiddenPrefix and hiddenSuffix, strips the name attribute from the source input, and then sets it as the name of the hidden input: + * An alternate format to submit to the server. + * Defaults to undefined. */ - hiddenName?: boolean; // default undefined + formatSubmit?: string; /** - * By default, typing into the input is disabled by giving it a readOnly attribute. - * Setting the editable option to true allows the input field to be edited directly. + * An optional name prefix for the new hidden input element used + * when a custom human-friendly display format is specified. + * Defaults to undefined. + */ + hiddenPrefix?: string; + + /** + * An optional name suffix for the new hidden input element used + * when a custom human-friendly display format is specified. + * Defaults to '_submit' + */ + hiddenSuffix?: string; + + /** + * A majority of the time, the value that needs to be sent to the server + * is just the hidden value and not the visible one. To make this happen, + * use the hiddenName option. This essentially nullifies the hiddenPrefix + * and hiddenSuffix, strips the name attribute from the source input, and + * then sets it as the name of the hidden input. Defaults to undefined. + */ + hiddenName?: boolean; + + /** + * By default, typing into the input is disabled by giving it a readOnly + * attribute. Setting the editable option to true allows the input field + * to be edited directly. */ editable?: boolean; - /** Specify where to insert the picker's root element by passing any valid CSS selector to this option */ - container?: string; // default undefined + /** + * Specify where to insert the picker's root element by passing any + * valid CSS selector to this option. Defaults to undefined. + */ + container?: string; - /** The hidden input container */ - containerHidden?: string; // default undefined + /** + * The hidden input container. + * Defaults to undefined. + */ + containerHidden?: string; - // Close on a user action - closeOnSelect?: boolean; // default true - closeOnClear?: boolean; // default true + /** + * Whether or not to close the picker when a date is selected. + * Defaults to `true`. + */ + closeOnSelect?: boolean; + + /** + * Whether or not to close the picker when the "clear" button is pressed. + * Defaults to `true`. + */ + closeOnClear?: boolean; // Events onStart?: (event: any) => void; @@ -133,10 +169,10 @@ declare module Pickadate { export interface DateOptions extends Options { // Strings and translations - monthsFull?: string[]; // default 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' - monthsShort?: string[]; // default 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' - weekdaysFull?: string[]; // default 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' - weekdaysShort?: string[]; // default 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' + monthsFull?: string[]; // default 'January' through 'December' + monthsShort?: string[]; // default 'Jan' through 'Dec' + weekdaysFull?: string[]; // default 'Sunday' through 'Saturday' + weekdaysShort?: string[]; // default 'Sun' through 'Sat' showMonthsShort?: boolean; showWeekdaysFull?: boolean; @@ -152,12 +188,15 @@ declare module Pickadate { /** * True enables the dropdown selector and false replaces it with text. - * You can also specify the number of years to show in the dropdown using an even integer - * - half before and half after the year in focus. If true the value will default to 10. + * You can also specify the number of years to show in the dropdown + * using an even integer - half before and half after the year in focus. + * If true the value will default to 10. */ - selectYears?: boolean|number; + selectYears?: boolean | number; - /** True enables the dropdown selector and false replaces it with text */ + /** + * True enables the dropdown selector and false replaces it with text + */ selectMonths?: boolean; /** @@ -166,12 +205,30 @@ declare module Pickadate { */ firstDay?: boolean|number; - // Date limits - min?: any; // date object, array formatted as [YEAR,MONTH,DATE], or dates relative to today using integers or a boolean (`true` sets it to today. `false` removes any limits). - max?: any; + /** + * Set the minimum selectable date on the picker. Accepts a Date object, + * array formatted as [YEAR, MONTH, DATE], a positive or negative integer + * for a date relative to today, or a boolean (`true` sets it to today, + * `false` removes any limit). + */ + min?: Date | [number, number, number] | number | boolean; - // Disable dates - disable?: any[]; // Date objects, arrays formatted as [YEAR,MONTH,DATE], or integers representing days of the week (from 1 to 7). Switch to whitelist by setting first item in collection to `true`. + /** + * Set the maximum selectable date on the picker. + * Accepts the same values as the `min` property. + */ + max?: Date | [number, number, number] | number | boolean; + + /** + * Disable a specific or arbitrary set of dates selectable on the + * picker. Accepts an array of Date objects, arrays formatted as + * [YEAR, MONTH, DATE], integers representing days of the week + * (from 1 to 7), or objects with a range of dates. Switch to a + * whitelist by setting `true` as the first item in the collection. + * Enable dates that fall within a range of disabled dates by + * adding an `inverted` parameter to the item within the collection. + */ + disable?: any[]; // Classes klass?: DateKlassOptions; @@ -182,7 +239,7 @@ declare module Pickadate { * The formatLabel option is unique. It can contain HTML and it can * also be a function if you want to create the label during run-time. */ - formatLabel?: string|((time: TimeItem) => string); + formatLabel?: string | ((time: TimeItem) => string); /** * Choose the interval in minutes between each time in the list. @@ -190,44 +247,77 @@ declare module Pickadate { */ interval?: number; - // Time limits - min?: any; // array formatted as [HOUR,MINUTE], or as times relative to now using integers or a boolean (`true` sets it to now, `false` removes any limits). - max?: any; + /** + * Set the minimum selectable time on the picker. Accepts a Date object, + * array formatted as [HOUR, MINUTE], a positive or negative integer + * for a time relative to now, or a boolean (`true` sets it to now, and + * `false` removes any limit). + */ + min?: Date | [number, number] | number | boolean; - // Disable times - disable?: any[]; // arrays formatted as [HOUR,MINUTE] or integers representing hours (from 0 to 23). Switch to whitelist by setting true as the first item in the collection. + /** + * Set the maximum selectable time on the picker. + * Accepts the same values as the `min` property. + */ + max?: Date | [number, number] | number | boolean; + + /** + * Disable a specific or arbitrary set of times selectable on the picker. + * Accepts an array of Date objects, arrays formatted as [HOUR, MINUTE], + * integers representing hours (from 0 to 23), or objects with a range of + * times. Switch to a whitelist by setting `true` as the first item in the + * collection. Enable times that fall within a range of disabled times by + * adding an `inverted` parameter to the item within the collection. + */ + disable?: any[]; // Classes klass?: TimeKlassOptions; } interface Item { - /** The "pick" value used for comparisons. */ + /** + * The "pick" value used for comparisons. + */ pick: number; } export interface DateItem extends Item { - /** The full year. */ + /** + * The full year. + */ year: number; - /** The month with zero-as-index. */ + /** + * The month with zero-as-index. + */ month: number; - /** The date of the month. */ + /** + * The date of the month. + */ date: number; - /** The day of the week with zero-as-index. */ + /** + * The day of the week with zero-as-index. + */ day: number; - /** The underlying JavaScript Date object. */ + /** + * The underlying JavaScript Date object. + */ obj: Date; } export interface TimeItem extends Item { - /** Hour of the day from 0 to 23. */ + /** + * Hour of the day from 0 to 23. + */ hour: number; - /** The minutes of the hour from 0 to 59 (based on the interval). */ + /** + * The minutes of the hour from 0 to 59 (based on the interval). + */ mins: number; } @@ -252,98 +342,152 @@ declare module Pickadate { } export interface TimeSetObject extends SetObject { + /** + * Choose the minutes interval between each time in the list. + * Defaults to 30. + */ interval?: number; } export interface SetOptions { /** - * By default, any callbacks bound with the on method will be fired when its relevant thing is set. - * To silently set a thing, pass an options object with the muted parameter set to true. + * By default, any callbacks bound with the on method will be fired + * when its relevant thing is set. To silently set a thing, pass an + * options object with the muted parameter set to true. */ muted?: boolean; format?: string; } interface Picker { - /** The picker's relative input element wrapped as a jQuery object. */ + /** + * The picker's relative input element wrapped as a jQuery object. + */ $node: JQuery; - /** The picker's relative root holder element wrapped as a jQuery object. */ + /** + * The picker's relative root holder element wrapped as a jQuery object. + */ $root: JQuery; open(withoutFocus?: boolean): TPickerObject; close(withFocus?: boolean): TPickerObject; - /** Rebuild the picker. */ + /** + * Rebuild the picker. + */ start(): TPickerObject; - /** Destroy the picker. */ + /** + * Destroy the picker. + */ stop(): TPickerObject; /** * Refresh the picker box after adding something to the holder. * By default, only the "face" of the picker (i.e. the box element) - * has it’s contents re-rendered. To render the entire picker from + * has it’s contents re-rendered. To render the entire picker from * the root up, pass true as the first argument. */ render(entirePicker?: boolean): TPickerObject; - /** Clear the value in the picker's input element. */ + /** + * Clear the value in the picker's input element. + */ clear(): TPickerObject; - /** Short for picker.get('value') */ + /** + * Short for picker.get('value') + */ get(): string; - /** Get the properties, objects, and states that make up the current state of the picker. */ + /** + * Get the properties, objects, and states that make up the current + * state of the picker. + */ get(thing: string): any; - /** Returns the string value of the picker's input element. */ + /** + * Returns the string value of the picker's input element. + */ get(thing: 'value'): string; - /** Returns the item object that is visually selected. */ + /** + * Returns the item object that is visually selected. + */ get(thing: 'select'): TItemObject; - /** Returns the item object that is visually highlighted. */ + /** + * Returns the item object that is visually highlighted. + */ get(thing: 'highlight'): TItemObject; - /** Returns the item object that sets the current view. */ + /** + * Returns the item object that sets the current view. + */ get(thing: 'view'): TItemObject; - /** Returns the item object that limits the picker's lower range. */ + /** + * Returns the item object that limits the picker's lower range. + */ get(thing: 'min'): TItemObject; - /** Returns the item object that limits the picker's upper range. */ + /** + * Returns the item object that limits the picker's upper range. + */ get(thing: 'max'): TItemObject; - /** Returns a boolean value of whether the picker is open or not. */ + /** + * Returns a boolean value of whether the picker is open or not. + */ get(thing: 'open'): boolean; - /** Returns a boolean value of whether the picker has started or not. */ + /** + * Returns a boolean value of whether the picker has started or not. + */ get(thing: 'start'): boolean; - /** Returns a unique 9-digit integer that is the ID of the picker. */ + /** + * Returns a unique 9-digit integer that is the ID of the picker. + */ get(thing: 'id'): number; - /** Returns an array of items that determine which item objects to disable on the picker. */ + /** + * Returns an array of items that determine which item objects to + * disable on the picker. + */ get(thing: 'disable'): any[]; - /** Returns a formatted string for the item object specified by `thing` */ + /** + * Returns a formatted string for the item object specified by `thing` + */ get(thing: string, format: string): string; - /** Set the properties, objects, and states to change the state of the picker. */ + /** + * Set the properties, objects, and states to change the state of the picker. + */ set(thing: string, value?: any, options?: SetOptions): TPickerObject; set(things: TOptions, options?: SetOptions): TPickerObject; - /** Bind callbacks to get fired off when the relative picker method is called. */ + /** + * Bind callbacks to get fired off when the relative picker method is called. + */ on(methodName: string, callback: (data?: any) => void): TPickerObject; - /** Bind multiple callbacks at once to get fired off when the relative picker method is called. */ + /** + * Bind multiple callbacks at once to get fired off when the relative + * picker method is called. + */ on(callbackObject: CallbackObject): TPickerObject; - /** Unbind callbacks that are bound using the on method. */ + /** + * Unbind callbacks that are bound using the on method. + */ off(...methodName: string[]): TPickerObject; - /** Trigger callbacks that have been queued up using the the on method. */ + /** + * Trigger callbacks that have been queued up using the the on method. + */ trigger(event: string, data?: any): TPickerObject; } From 9a53f5ee84bbd1bd8f69d0ac6e369950a9ad46f6 Mon Sep 17 00:00:00 2001 From: Mads Date: Thu, 7 May 2015 07:57:08 +0200 Subject: [PATCH 114/534] UpdateSpec properties should be optional --- react/react-addons-global.d.ts | 6 +++--- react/react-addons.d.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/react/react-addons-global.d.ts b/react/react-addons-global.d.ts index 891e0d101..3e028f5f0 100644 --- a/react/react-addons-global.d.ts +++ b/react/react-addons-global.d.ts @@ -77,9 +77,9 @@ declare module React { // ---------------------------------------------------------------------- interface UpdateSpec { - $set: any; - $merge: {}; - $apply(value: any): any; + $set?: any; + $merge?: {}; + $apply(value: any)?: any; // [key: string]: UpdateSpec; } diff --git a/react/react-addons.d.ts b/react/react-addons.d.ts index caf0fa8e0..d61bf4221 100644 --- a/react/react-addons.d.ts +++ b/react/react-addons.d.ts @@ -812,9 +812,9 @@ declare module "react/addons" { // ---------------------------------------------------------------------- interface UpdateSpec { - $set: any; - $merge: {}; - $apply(value: any): any; + $set?: any; + $merge?: {}; + $apply(value: any)?: any; // [key: string]: UpdateSpec; } From 56b8491cbb40a9618ab4231cb38afae601e4c99a Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Thu, 7 May 2015 00:37:11 -0500 Subject: [PATCH 115/534] Support accessing/invoking API objects and methods on initialized pickers --- pickadate/pickadate-tests.ts | 19 ++++++++++++++++ pickadate/pickadate.d.ts | 44 ++++++++++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/pickadate/pickadate-tests.ts b/pickadate/pickadate-tests.ts index 09e9d57ad..91ffe7e4c 100644 --- a/pickadate/pickadate-tests.ts +++ b/pickadate/pickadate-tests.ts @@ -384,6 +384,25 @@ var picker = $input.pickadate('picker'); picker.$node; picker.$root; +picker._hidden; + +// Or pass through the element’s plugin data. +$input.pickadate('open'); +$input.pickadate('close'); +$input.pickadate('close'); +$input.pickadate('start'); +$input.pickadate('stop'); +$input.pickadate('render'); +$input.pickadate('get'); +$input.pickadate('set', 'highlight', 1429970887654); +$input.pickadate('on', 'open', function () { }); +$input.pickadate('on', 'close', function () { }); +$input.pickadate('off', 'open', 'close'); +$input.pickadate('trigger', 'open'); + +$input.pickadate('$node'); +$input.pickadate('$root'); +$input.pickadate('_hidden'); picker.open().clear().close(); diff --git a/pickadate/pickadate.d.ts b/pickadate/pickadate.d.ts index 5056096ce..7b96dedb9 100644 --- a/pickadate/pickadate.d.ts +++ b/pickadate/pickadate.d.ts @@ -370,6 +370,14 @@ declare module Pickadate { */ $root: JQuery; + /** + * This is the picker’s relative hidden element, which is undefined if + * there’s no formatSubmit option. There should be no reason to use this + * – it's mostly for internal use. If you have a valid reason for using + * this, please mention it in the issues. + */ + _hidden: HTMLInputElement; + open(withoutFocus?: boolean): TPickerObject; close(withFocus?: boolean): TPickerObject; @@ -496,11 +504,39 @@ declare module Pickadate { } interface JQuery { - pickadate(methodName: "picker"): Pickadate.DatePicker; - pickadate(methodName: string): any; + /** + * Access the API object on an initialized date picker element. + */ + pickadate(keyword: "picker"): Pickadate.DatePicker; + pickadate(objectName: "$node"): JQuery; + pickadate(objectName: "$root"): JQuery; + pickadate(objectName: "_hidden"): HTMLInputElement; + + /** + * Invoke API methods after date picker initialization. + */ + pickadate(methodName: string, ...arguments: any[]): any; + + /** + * Initialize a date picker. + */ pickadate(options?: Pickadate.DateOptions): JQuery; - pickatime(methodName: "picker"): Pickadate.TimePicker; - pickatime(methodName: string): any; + /** + * Access the API object on an initialized time picker element. + */ + pickatime(keyword: "picker"): Pickadate.TimePicker; + pickatime(objectName: "$node"): JQuery; + pickatime(objectName: "$root"): JQuery; + pickatime(objectName: "_hidden"): HTMLInputElement; + + /** + * Invoke API methods after time picker initialization. + */ + pickatime(methodName: string, ...arguments: any[]): any; + + /** + * Initialize a time picker. + */ pickatime(options?: Pickadate.TimeOptions): JQuery; } From 8f6b638c3f508690566f15514c28e1ee432fa376 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Thu, 7 May 2015 01:32:53 -0500 Subject: [PATCH 116/534] Fix implicit any --- pickadate/pickadate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pickadate/pickadate.d.ts b/pickadate/pickadate.d.ts index 7b96dedb9..4f23d2582 100644 --- a/pickadate/pickadate.d.ts +++ b/pickadate/pickadate.d.ts @@ -327,7 +327,7 @@ declare module Pickadate { render?: () => void; start?: () => void; stop?: () => void; - set?: (thingset) => void; + set?: (thingset: any) => void; } export interface SetObject { From afb4456cfe428fb6612c0e262618c8280989b192 Mon Sep 17 00:00:00 2001 From: Nieknikey Date: Thu, 7 May 2015 10:28:05 +0200 Subject: [PATCH 117/534] Added cx and cy getters on Element. --- svgjs/svgjs.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/svgjs/svgjs.d.ts b/svgjs/svgjs.d.ts index 2de93541e..c04f19536 100644 --- a/svgjs/svgjs.d.ts +++ b/svgjs/svgjs.d.ts @@ -92,6 +92,8 @@ declare module svgjs { center(x:number, y:number, anchor?:boolean):Element; cx(x:number, anchor?:boolean):Element; cy(y:number, anchor?:boolean):Element; + cx(): number; + cy(): number; size(w:number, h:number, anchor?:boolean):Element; From 6ebceeb8bdd57aafa7861f78f54dc003ef265ae6 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Thu, 7 May 2015 09:49:48 -0500 Subject: [PATCH 118/534] Remove duplicate object property tests --- pickadate/pickadate-tests.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/pickadate/pickadate-tests.ts b/pickadate/pickadate-tests.ts index 91ffe7e4c..21bc5b074 100644 --- a/pickadate/pickadate-tests.ts +++ b/pickadate/pickadate-tests.ts @@ -794,6 +794,3 @@ picker.on('open', function (data) { console.log('This logs without opening with this data:', data); }); picker.trigger('open', { some: 'value' }); - -picker.$node; -picker.$root; From 668800dbfb8b67c4e2485602fa3dc8ef0ed3ad3c Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Thu, 7 May 2015 09:54:24 -0500 Subject: [PATCH 119/534] Consistent whitespace for union types --- pickadate/pickadate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pickadate/pickadate.d.ts b/pickadate/pickadate.d.ts index 4f23d2582..0463503ea 100644 --- a/pickadate/pickadate.d.ts +++ b/pickadate/pickadate.d.ts @@ -203,7 +203,7 @@ declare module Pickadate { * The first day of the week can be set to either Sunday or Monday. * True or 1 sets it as Monday and false or 0 as Sunday. */ - firstDay?: boolean|number; + firstDay?: boolean | number; /** * Set the minimum selectable date on the picker. Accepts a Date object, From 2863587680f256b3ae0ca77183a5701a59fd900b Mon Sep 17 00:00:00 2001 From: Chris Charabaruk Date: Thu, 7 May 2015 11:16:20 -0400 Subject: [PATCH 120/534] jsuri: need to declare global Uri as type instead of var Declaring the global Uri as a var instead of as a type leads to runtime errors as the jsuri script leaks Uri to global directly when not loaded via AMD or CommonJS, instead of leaking a jsuri module object. Developers working with jsuri in the global namespace need to use Uri directly instead of prfacing with jsuri in order to avoid runtime issues with 'jsuri' being undefined. --- jsuri/jsuri.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsuri/jsuri.d.ts b/jsuri/jsuri.d.ts index b843abf61..a50002140 100644 --- a/jsuri/jsuri.d.ts +++ b/jsuri/jsuri.d.ts @@ -132,7 +132,7 @@ declare module jsuri { } } -declare var Uri : jsuri.Uri; +declare type Uri = jsuri.Uri; declare module 'jsuri' { export = Uri; From 8cf87c48c6aec99f3ddfde293362edb3e99f413a Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Thu, 7 May 2015 10:34:12 -0500 Subject: [PATCH 121/534] Use type aliases for min/max date and time options --- pickadate/pickadate.d.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pickadate/pickadate.d.ts b/pickadate/pickadate.d.ts index 0463503ea..38aed639a 100644 --- a/pickadate/pickadate.d.ts +++ b/pickadate/pickadate.d.ts @@ -166,6 +166,9 @@ declare module Pickadate { onSet?: (event: any) => void; onStop?: (event: any) => void; } + + type MinOrMaxDateOption = Date | [number, number, number] | number | boolean; + type MinOrMaxTimeOption = Date | [number, number] | number | boolean; export interface DateOptions extends Options { // Strings and translations @@ -211,13 +214,13 @@ declare module Pickadate { * for a date relative to today, or a boolean (`true` sets it to today, * `false` removes any limit). */ - min?: Date | [number, number, number] | number | boolean; + min?: MinOrMaxDateOption; /** * Set the maximum selectable date on the picker. * Accepts the same values as the `min` property. */ - max?: Date | [number, number, number] | number | boolean; + max?: MinOrMaxDateOption; /** * Disable a specific or arbitrary set of dates selectable on the @@ -253,13 +256,13 @@ declare module Pickadate { * for a time relative to now, or a boolean (`true` sets it to now, and * `false` removes any limit). */ - min?: Date | [number, number] | number | boolean; + min?: MinOrMaxTimeOption; /** * Set the maximum selectable time on the picker. * Accepts the same values as the `min` property. */ - max?: Date | [number, number] | number | boolean; + max?: MinOrMaxTimeOption; /** * Disable a specific or arbitrary set of times selectable on the picker. From 66320d234bcb4f199cafcbc2b7490a9c51a710f1 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Thu, 7 May 2015 10:36:32 -0500 Subject: [PATCH 122/534] Use camelCase for thingSet parameter --- pickadate/pickadate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pickadate/pickadate.d.ts b/pickadate/pickadate.d.ts index 38aed639a..ac8e7b181 100644 --- a/pickadate/pickadate.d.ts +++ b/pickadate/pickadate.d.ts @@ -330,7 +330,7 @@ declare module Pickadate { render?: () => void; start?: () => void; stop?: () => void; - set?: (thingset: any) => void; + set?: (thingSet: any) => void; } export interface SetObject { From 73fc8ea38312095a6e2b9319667f772919547dcf Mon Sep 17 00:00:00 2001 From: Thomas Michon Date: Thu, 7 May 2015 09:01:04 -0700 Subject: [PATCH 123/534] Remove emptyDomNode, which is not public in Knockout --- knockout/knockout.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index a906348a6..5bbc116e0 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -281,8 +281,6 @@ interface KnockoutUtils { extend(target: Object, source: Object): Object; - emptyDomNode(domNode: HTMLElement): void; - moveCleanedNodesToContainerElement(nodes: any[]): HTMLElement; cloneNodes(nodesArray: any[], shouldCleanNodes: boolean): any[]; From ce1a362952514d191e9654d8a4ce1917cf72dfe5 Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Thu, 7 May 2015 17:42:56 +0200 Subject: [PATCH 124/534] Add type definitions for angular-meteor --- angular-meteor/angular-meteor-tests.ts | 253 +++++++++++++++++++ angular-meteor/angular-meteor.d.ts | 322 +++++++++++++++++++++++++ 2 files changed, 575 insertions(+) create mode 100644 angular-meteor/angular-meteor-tests.ts create mode 100644 angular-meteor/angular-meteor.d.ts diff --git a/angular-meteor/angular-meteor-tests.ts b/angular-meteor/angular-meteor-tests.ts new file mode 100644 index 000000000..be75f196b --- /dev/null +++ b/angular-meteor/angular-meteor-tests.ts @@ -0,0 +1,253 @@ +/// + +interface ITodo { + _id?: string; + name: string; + public?: boolean; + sticky?: boolean; +} + +interface TodoAngularMeteorObject extends ITodo, angular.meteor.AngularMeteorObject {} + +interface CustomScope extends angular.meteor.IScope { + sticky: boolean; + + todos: angular.meteor.AngularMeteorCollection; + stickyTodos: angular.meteor.AngularMeteorCollection; + notAutoTodos: angular.meteor.AngularMeteorCollection; + + todo: ITodo; + todoNotAuto: TodoAngularMeteorObject; + + save: (todo: ITodo) => void; + saveAll: () =>void; + autoSave: (todo: ITodo) => void; + remove: (todoId: string) => void; + removeAll: () => void; + removeAuto: (todo: ITodo) => void; + toSticky: (todo: ITodo) => void; +} + +var Todos = new Mongo.Collection('todos'); + +var app = angular.module('angularMeteorTestApp'); + +app.controller("mainCtrl", ['$scope', '$meteor', ($scope: CustomScope, $meteor: angular.meteor.IMeteorService) => { + // Bind all the todos to $scope.todos + $scope.todos = $meteor.collection(Todos); + + $scope.sticky = true; + // Bind all sticky todos to $scope.stickyTodos + // Binds the query to $scope.sticky so that if it changes, Meteor will re-run the query and bind it + // to $scope.stickyTodos + $scope.stickyTodos = $meteor.collection(function(){ + return Todos.find({sticky: $scope.getReactively('sticky')}); + }); + + // Bind without auto-save all todos to $scope.notAutoTodos + $scope.notAutoTodos = $meteor.collection(Todos, false).subscribe("publicTodos"); + + $scope.todoNotAuto = $meteor.object(Todos, 'TodoID', false); + $scope.todo = $scope.todoNotAuto.getRawObject(); + $scope.todoNotAuto.reset(); + $scope.todoNotAuto.save($scope.todo).then((data) => { return data == 1; });; + + // todo might be an object like this {text: "Learn Angular", sticky: false} + // or an array like this: + // [{text: "Learn Angular", sticky: false}, {text: "Hello World", sticky: true}] + + $scope.save = function(todo) { + $scope.notAutoTodos.save(todo); + }; + + $scope.saveAll = function() { + $scope.notAutoTodos.save(); + }; + + $scope.autoSave = function(todo) { + $scope.todos.push(todo); + }; + + // todoId might be an string like this "WhrnEez5yBRgo4yEm" + // or an array like this ["WhrnEez5yBRgo4yEm","gH6Fa4DXA3XxQjXNS"] + $scope.remove = function(todoId) { + $scope.notAutoTodos.remove(todoId); + }; + + $scope.removeAll = function() { + $scope.notAutoTodos.remove(); + }; + + $scope.removeAuto = function(todo) { + $scope.todos.splice( $scope.todos.indexOf(todo), 1 ); + } + + $scope.toSticky = function(todo) { + if (angular.isArray(todo)){ + angular.forEach(todo, function(object) { + object.sticky = true; + }); + } else { + todo.sticky = true; + } + + $scope.stickyTodos.save(todo); + }; + + var todoObject = {name:'first todo'}; + var todosArray = [{name:'second todo'}, {name:'third todo'}]; + var todoSecondObject = {name:'forth todo'}; + + $scope.todos.save(todoObject); // todos equals [{name:'first todo'}] + + $scope.todos.save(todosArray); // todos equals [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}] + + $scope.todos.push(todoSecondObject); // The scope variable equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + // but the collection still equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}] + + $scope.todos.save(); // Now the collection also equals to [{name:'first todo'}, {name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + + $scope.todos.remove('firstTodoId'); // scope and collection equals to [{name:'second todo'}, {name:'third todo'}, {name:'forth todo'}] + + var todoIdsArray = ['secondTodoId', 'thirdTodoId']; + $scope.todos.remove(todoIdsArray); // removes everything matches the array of IDs both in scope and in collection + + $scope.todos.pop(); // removes only in scope + + $scope.todos.remove(); // syncs also in Meteor collection + + // Subscribe -> + + $meteor.subscribe('todos').then((subscriptionHandle) => { + // Bind all the todos to $scope.todos + $scope.todos = $meteor.collection(Todos); + + console.log($scope.todos + ' is ready'); + + // You can use the subscription handle to stop the subscription if you want + subscriptionHandle.stop(); + }); + + $scope.subscribe('todos').then((subscriptionHandle) => { + // Bind all the todos to $scope.books + $scope.todos = $meteor.collection(Todos); + + console.log($scope.todos + ' is ready'); + + // No need to stop the subscription, it will automatically close on scope destroy + }); + + $meteor.call('subscribe', $scope.todo._id, $scope.currentUser._id).then((data) => { + // Handle success + console.log('success subscribing', data.name); + }, (err) => { + // Handle error + console.log('failed', err); + }); + + if (!$scope.loggingIn) { + $meteor.waitForUser(); + + $meteor.requireUser(); + + $meteor.requireValidUser(user => { + return user.username == 'admin'; + }); + + $meteor.loginWithPassword('user', 'password').then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + + $meteor.createUser({ + username:'moma', + email:'example@gmail.com', + password: 'Bksd@asdf', + profile: {expertize: 'Developer'} + }).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + + $meteor.changePassword('old', 'new232f3').then(() => { + console.log('Change password success'); + }, err => { + console.log('Error changing password - ', err); + }); + + $meteor.forgotPassword({email: 'sample@gmail.com'}).then(() => { + console.log('Success sending forgot password email'); + }, err => { + console.log('Error sending forgot password email - ', err); + }); + + $meteor.resetPassword('tokenID', 'new232f3').then(() => { + console.log('Reset password success'); + }, err => { + console.log('Error resetting password - ', err); + }); + + $meteor.verifyEmail('tokenID').then(() => { + console.log('Success verifying password '); + }, err => { + console.log('Error verifying password - ', err); + }); + + $meteor.logout().then(() => { + console.log('Logout success'); + }, err => { + console.log('logout error - ', err); + }); + + $meteor.logoutOtherClients().then(() => { + console.log('Logout success'); + }, err => { + console.log('logout error - ', err); + }); + + var loginWithOptions = {requestPermissions: ['email']}; + + $meteor.loginWithFacebook({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithGithub({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithGoogle({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithMeetup({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithTwitter({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + $meteor.loginWithWeibo({requestPermissions: ['email']}).then(() => { + console.log('Login success'); + }, err => { + console.log('Login error - ', err); + }); + } + + $meteor.autorun($scope, () => { console.log("Aurorun triggered."); }); + $meteor.getCollectionByName('collectionName'); + + // requires meteor add mdg:camera + $meteor.getPicture().then(function(data){ + $scope['picture'] = data; + }); + + $meteor.session('counter').bind($scope, 'counter'); +}]); diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts new file mode 100644 index 000000000..18f2e033e --- /dev/null +++ b/angular-meteor/angular-meteor.d.ts @@ -0,0 +1,322 @@ +// Type definitions for Angular JS Meteor v0.8.8 (angular.meteor module) +// Project: https://github.com/Urigo/angular-meteor +// Definitions by: Peter Grman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module angular.meteor { + interface IRootScopeService extends angular.IRootScopeService { + /** + * The current logged in user and it's data. it is null if the user is not logged in. A reactive data source. + */ + currentUser: Meteor.User; + + /** + * True if a login method (such as Meteor.loginWithPassword, Meteor.loginWithFacebook, or Accounts.createUser) is currently in progress. + * A reactive data source. Can be use to display animation while user is logging in. + */ + loggingIn: boolean; + } + + interface IScope extends angular.IScope, IRootScopeService { + /** + * A method to get a $scope variable and watch it reactivly + * + * @param scopeVariableName - The name of the scope's variable to bind to + * @param [objectEquality=false] - Watch the object equality using angular.equals instead of comparing for reference equality, deeper watch but also slower + */ + getReactively(scopeVariableName: string, objectEquality?: boolean): ReactiveResult; + + /** + * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. + * Calling $scope.subscribe will automatically stop the subscription when the scope is destroyed. + * + * @param name - Name of the subscription. Matches the name of the server's publish() call. + * @param publisherArguments - Optional arguments passed to publisher function on server. + * + * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. + */ + subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; + } + + /** + * $meteor in angularjs + */ + interface IMeteorService { + /** + * A service that wraps the Meteor collections to enable reactivity within AngularJS. + * + * @param collection - A Meteor Collection or a reactive function to bind to. + * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. + * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. + */ + collection(collection: Mongo.Collection|ReactiveResult, autoClientSave?: boolean): AngularMeteorCollection; + + /** + * A service that wraps the Meteor collections to enable reactivity within AngularJS. + * + * @param collection - A Meteor Collection or a reactive function to bind to. + * - Reactive function can be used with $scope.getReactively to add $scope variable as reactive variable to the cursor. + * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. + * @param [updateCollection] - A collection object which will be used for updates (insert, update, delete). + */ + collection(collection: Mongo.Collection|ReactiveResult, autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2; + + /** + * A service that wraps a Meteor object to enable reactivity within AngularJS. + * Finds the first document that matches the selector, as ordered by sort and skip options. Wraps collection.findOne + * + * @param collection - A Meteor Collection to bind to. + * @param selector - A query describing the documents to find or just the ID of the document. + * - $meteor.object will find the first document that matches the selector, + * - as ordered by sort and skip options, exactly like Meteor's collection.findOne + * @param [autoClientSave=true] - By default, changes in the Angular object will automatically update the Meteor object. + * - However if set to false, changes in the client won't be automatically propagated back to the Meteor object. + */ + object(collection: Mongo.Collection, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject; + + /** + * A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready. + * + * @param name - Name of the subscription. Matches the name of the server's publish() call. + * @param publisherArguments - Optional arguments passed to publisher function on server. + * + * @return The promise solved successfully when subscription is ready. The success promise holds the subscription handle. + */ + subscribe(name: string, ...publisherArguments: any[]): angular.IPromise; + + /** + * A service service which wraps up Meteor.methods with AngularJS promises. + * + * @param name - Name of method to invoke + * @param methodArguments - Optional method arguments + * + * @return The promise solves successfully with the return value of the method or return reject with the error from the method. + */ + call(name: string, ...methodArguments: any[]): angular.IPromise; + + // User Authentication BEGIN -> + + /** + * Returns a promise fulfilled with the currentUser when the user subscription is ready. + * This is useful when you want to grab the current user before the route is rendered. + * If there is no logged in user, it will return null. + * See the “Authentication with Routers†section of our tutorial for more information and a full example. + */ + waitForUser(): angular.IPromise; + + /** + * Resolves the promise successfully if a user is authenticated and rejects otherwise. + * This is useful in cases where you want to require a route to have an authenticated user. + * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. + * See the “Authentication with Routers†section of our tutorial for more information and a full example. + */ + requireUser(): angular.IPromise; + + /** + * Resolves the promise successfully if a user is authenticated and the validatorFn returns true; rejects otherwise. + * This is useful in cases where you want to require a route to have an authenticated user and do extra validation like the user's role or group. + * You can catch the rejected promise and redirect the unauthenticated user to a different page, such as the login page. + * See the “Authentication with Routers†section of our tutorial for more information and a full example. + * + * The mandatory validator function will be called with the authenticated user as the single param and it's expected to return true in order to resolve. + * If it returns a string, the promise will be rejected using said string as the reason. + * Any other return (false, null, undefined) will be rejected with the default "FORBIDDEN" reason. + */ + requireValidUser(validatorFn: (user: Meteor.User) => boolean|string): angular.IPromise; + + /** + * Log the user in with a password. + * + * @param user - Either a string interpreted as a username or an email; or an object with a single key: email, username or id. + * @param password - The user's password. + */ + loginWithPassword(user: string|{email: string}|{username: string}|{id: string}, password: string): angular.IPromise; + + /** + * Create a new user. More information: http://docs.meteor.com/#/full/accounts_createuser + * + * @param options.username - A unique name for this user. Either this, or email is required. + * @param options.email - The user's email address. Either this, or username is required. + * @param options.password - The user's password. This is not sent in plain text over the wire. + * @param options.profile - The user's profile, typically including the name field. + */ + createUser(options: {username?: string; email?: string; password: string; profile?: Object}): angular.IPromise; + + /** + * Change the current user's password. Must be logged in. + * + * @param oldPassword - The user's current password. This is not sent in plain text over the wire. + * @param newPassword - A new password for the user. This is not sent in plain text over the wire. + */ + changePassword(oldPassword: string, newPassword: string): angular.IPromise; + + /** + * Request a forgot password email. + * + * @param options.email - The email address to send a password reset link. + */ + forgotPassword(options: {email: string}): angular.IPromise; + + /** + * Reset the password for a user using a token received in email. Logs the user in afterwards. + * + * @param token - The token retrieved from the reset password URL. + * @param newPassword - A new password for the user. This is not sent in plain text over the wire. + */ + resetPassword(token: string, newPassword: string): angular.IPromise; + + /** + * Marks the user's email address as verified. Logs the user in afterwards. + * + * @param token - The token retrieved from the reset password URL. + */ + verifyEmail(token: string): angular.IPromise; + + loginWithFacebook: ILoginWithExternalService; + loginWithTwitter: ILoginWithExternalService; + loginWithGoogle: ILoginWithExternalService; + loginWithGithub: ILoginWithExternalService; + loginWithMeetup: ILoginWithExternalService; + loginWithWeibo: ILoginWithExternalService; + + /** + * Log the user out. + * + * @return Resolves with no arguments on success, or reject with a Error argument on failure. + */ + logout(): angular.IPromise; + + /** + * Log out other clients logged in as the current user, but does not log out the client that calls this function. + * For example, when called in a user's browser, connections in that browser remain logged in, + * but any other browsers or DDP clients logged in as that user will be logged out. + * + * @return Resolves with no arguments on success, or reject with a Error argument on failure. + */ + logoutOtherClients(): angular.IPromise; + + // <- User Authentication END + // $meteorUtils BEGIN -> + + /** + * @param scope - The AngularJS scope you use the autorun on. + * @param fn - The function that will re-run every time a reactive variable changes inside it. + */ + autorun(scope: angular.IScope, fn: Function): void; + + /** + * @param collectionName - The name of the collection you want to get back + */ + getCollectionByName(collectionName: string): Mongo.Collection; + + // <- $meteorUtils END + // $meteorCamera BEGIN -> + + /** + * A helper service for taking pictures across platforms. + * Must add mdg:camera package to use! (meteor add mdg:camera) + * + * @param [options] - options is an optional argument that is an Object with the following possible keys: + * @param options.width - An integer that specifies the minimum width of the returned photo. + * @param options.height - An integer that specifies the minimum height of the returned photo. + * @param options.quality - A number from 0 to 100 specifying the desired quality of JPEG encoding. + * + * @return The promise solved successfully when the picture is taken with the data as a parameter or rejected with an error as a parameter in case of error. + */ + getPicture(options?: {width?: number; height?: number; quality?: number}): angular.IPromise; + + // <- $meteorCamera END + + /** + * A service that binds a scope variable to a Meteor Session variable. + * + * @param sessionKey - The name of the session variable + * @return An object with a single function bind - to bind to that variable. + */ + session(sessionKey: string): { + /** + * @param scope - The scope the document will be bound to. + * @param model - The name of the scope's model variable that the document will be bound to. + */ + bind: (scope: IScope, model: string) => void; + }; + } + + /** + * An object that connects a Meteor Object to an AngularJS scope variable. + * + * The object contains also all the properties from the generic type T, + * unfortunately TypeScript doesn't at the moment allow to extend a generic type (see https://github.com/Microsoft/TypeScript/issues/2225 for details and updates). + * For a workaround, you'll need to implement an interface which will merge AngularMeteorObject together with T and cast it, like this: + * + * interface TodoAngularMeteorObject extends ITodo, AngularMeteorObject { } + * var todo = $meteor.object(TodoCollection, 'TodoID'); + */ + interface AngularMeteorObject { + /** + * @param [doc] - The doc to save to the Meteor Object. If nothing is passed, the method saves everything in the AngularMeteorObject as is. + * - Unchanged properties will be overridden with their existing values, which may trigger hooks. + * - If doc is passed, the method only updates the Meteor Object with the properties passed, and no other changes will be saved. + * + * @return Returns a promise with an error in case for an error or a number of successful docs changed in case of success. + */ + save(doc?: T): angular.IPromise; + + /** + * Reset the current value of the object to the one in the server. + */ + reset(): void; + + /** + * Returns a copy of the AngularMeteorObject with all the AngularMeteor-specific internal properties removed. + * The returned object is then safe to use as a parameter for method calls, or anywhere else where the data needs to be converted to JSON. + */ + getRawObject(): T; + } + + /** + * An object that connects a Meteor Collection to an AngularJS scope variable + */ + interface AngularMeteorCollection extends AngularMeteorCollection2 { } + + /** + * An object that connects a Meteor Collection to an AngularJS scope variable, + * but can use a differen type for updates. + */ + interface AngularMeteorCollection2 extends Array { + /** + * @param [docs] - The docs to save to the Meteor Collection. + * - If the docs parameter is empty, the method saves everything in the AngularMeteorCollection as is. + * - If an object is passed, the method pushes that object into the AngularMeteorCollection. + * - If an array is passed, the method pushes all objects in the array into the AngularMeteorCollection. + */ + save(docs?: U|U[]): void; + + /** + * @param [keys] - The keys of the object to remove from the Meteor Collection. + * - If nothing is passed, the method removes all the documents from the AngularMeteorCollection. + * - If an object is passed, the method removes the object with that key from the AngularMeteorCollection. + * - If an array is passed, the method removes all objects that matches the keys in the array from the AngularMeteorCollection. + */ + remove(keys?: string|number|string[]|number[]): void; + + /** + * A shorten (Syntactic sugar) function for the $meteor.subscribe function. + * Takes only one parameter and not returns a promise like $meteor.subscribe does. + * + * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + */ + subscribe(subscriptionName:string): AngularMeteorCollection2; + } + + interface ILoginWithExternalService { + (options: Meteor.LoginWithExternalServiceOptions): angular.IPromise; + } + + interface ReactiveResult { } +} From 10564f321b2cf3df2cb54ac7a6f211f9df3603eb Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Thu, 7 May 2015 18:09:01 +0200 Subject: [PATCH 125/534] Fix implicit any types Most types already would have been any, the others were changed based on documentation, and similar changes. I used also `any` if the type was unclear. --- meteor/meteor-tests.ts | 2 +- meteor/meteor.d.ts | 102 ++++++++++++++++++++--------------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/meteor/meteor-tests.ts b/meteor/meteor-tests.ts index ec2ad3b81..f26527911 100644 --- a/meteor/meteor-tests.ts +++ b/meteor/meteor-tests.ts @@ -272,7 +272,7 @@ Posts.allow({ Posts.deny({ update: function (userId, docs, fields, modifier) { // can't change owners - return docs.userId = userId; + return docs.userId !== userId; }, remove: function (userId, doc) { // can't remove locked documents diff --git a/meteor/meteor.d.ts b/meteor/meteor.d.ts index 4118fbe06..ed0c97b29 100644 --- a/meteor/meteor.d.ts +++ b/meteor/meteor.d.ts @@ -16,17 +16,17 @@ interface JSONable { interface EJSON extends EJSONable {} declare module Match { - var Any; - var String; - var Integer; - var Boolean; - var undefined; + var Any:any; + var String:any; + var Integer:any; + var Boolean:any; + var undefined:any; //function null(); // not allowed in TypeScript - var Object; - function Optional(pattern):boolean; - function ObjectIncluding(dico):boolean; - function OneOf(...patterns); - function Where(condition); + var Object:any; + function Optional(pattern:any):boolean; + function ObjectIncluding(dico:any):boolean; + function OneOf(...patterns:any[]):any; + function Where(condition:any):any; } declare module Meteor { @@ -89,8 +89,8 @@ declare module Meteor { } interface Tinytest { - add(name:string, func:Function); - addAsync(name:string, func:Function); + add(name:string, func:Function):any; + addAsync(name:string, func:Function):any; } enum StatusEnum { @@ -145,9 +145,9 @@ declare module Mongo { MONGO } interface AllowDenyOptions { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; + insert?: (userId:string, doc:any) => boolean; + update?: (userId:string, doc:any, fieldNames:string[], modifier:any) => boolean; + remove?: (userId:string, doc:any) => boolean; fetch?: string[]; transform?: Function; } @@ -184,10 +184,10 @@ declare module HTTP { declare module Email { interface EmailMessage { from: string; - to: any; // string or string[] - cc?: any; // string or string[] - bcc?: any; // string or string[] - replyTo?: any; // string or string[] + to: string|string[]; + cc?: string|string[]; + bcc?: string|string[]; + replyTo?: string|string[]; subject: string; text?: string; html?: string; @@ -197,14 +197,14 @@ declare module Email { declare module DDP { interface DDPStatic { - subscribe(name, ...rest); - call(method:string, ...parameters):void; - apply(method:string, ...parameters):void; - methods(IMeteorMethodsDictionary); + subscribe(name:string, ...rest:any[]):void; + call(method:string, ...parameters:any[]):void; + apply(method:string, ...parameters:any[]):void; + methods(IMeteorMethodsDictionary:any):any; status():DDPStatus; - reconnect(); - disconnect(); - onReconnect(); + reconnect():void; + disconnect():void; + onReconnect():void; } interface DDPStatus { @@ -344,7 +344,7 @@ declare module Accounts { declare module App { function accessRule(domainRule: string, options?: { launchExternal?: boolean; - }); /** TODO: add return value **/ + }):any; /** TODO: add return value **/ function configurePlugin(pluginName: string, config: Object): void; function icons(icons: Object): void; function info(options: { @@ -393,7 +393,7 @@ declare module Blaze { findAll(selector: string): Blaze.TemplateInstance[]; firstNode: Object; lastNode: Object; - subscribe(name: string, ...args): Meteor.SubscriptionHandle; + subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle; subscriptionsReady(): boolean; view: Object; } @@ -475,7 +475,7 @@ declare module Meteor { wait?: boolean; onResultReceived?: Function; }, asyncCallback?: Function): any; - function call(name: string, ...args): any; + function call(name: string, ...args: any[]): any; function clearInterval(id: number): void; function clearTimeout(id: number): void; function disconnect(): void; @@ -503,7 +503,7 @@ declare module Meteor { var settings: {[id:string]: any}; function startup(func: Function): void; function status(): Meteor.StatusEnum; - function subscribe(name: string, ...args): Meteor.SubscriptionHandle; + function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle; function user(): Meteor.User; function userId(): string; var users: Mongo.Collection; @@ -521,16 +521,16 @@ declare module Mongo { } interface Collection { allow(options: { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; + insert?: (userId:string, doc:any) => boolean; + update?: (userId:string, doc:any, fieldNames:string[], modifier:any) => boolean; + remove?: (userId:string, doc:any) => boolean; fetch?: string[]; transform?: Function; }): boolean; deny(options: { - insert?: (userId:string, doc) => boolean; - update?: (userId, doc, fieldNames, modifier) => boolean; - remove?: (userId, doc) => boolean; + insert?: (userId:string, doc:any) => boolean; + update?: (userId:string, doc:any, fieldNames:string[], modifier:any) => boolean; + remove?: (userId:string, doc:any) => boolean; fetch?: string[]; transform?: Function; }): boolean; @@ -684,30 +684,30 @@ interface CompileStepStatic { } interface CompileStep { addAsset(options: { - }, path: string, data: any /** Buffer **/ | string); /** TODO: add return value **/ + }, path: string, data: any /** Buffer **/ | string): any; /** TODO: add return value **/ addHtml(options: { section?: string; data?: string; - }); /** TODO: add return value **/ + }): any; /** TODO: add return value **/ addJavaScript(options: { path?: string; data?: string; sourcePath?: string; - }); /** TODO: add return value **/ + }): any; /** TODO: add return value **/ addStylesheet(options: { - }, path: string, data: string, sourceMap: string); /** TODO: add return value **/ - arch; /** TODO: add return value **/ - declaredExports; /** TODO: add return value **/ + }, path: string, data: string, sourceMap: string): any; /** TODO: add return value **/ + arch: any; /** TODO: add return value **/ + declaredExports: any; /** TODO: add return value **/ error(options: { - }, message: string, sourcePath?: string, line?: number, func?: string); /** TODO: add return value **/ - fileOptions; /** TODO: add return value **/ - fullInputPath; /** TODO: add return value **/ - inputPath; /** TODO: add return value **/ - inputSize; /** TODO: add return value **/ - packageName; /** TODO: add return value **/ - pathForSourceMap; /** TODO: add return value **/ + }, message: string, sourcePath?: string, line?: number, func?: string): any; /** TODO: add return value **/ + fileOptions: any; /** TODO: add return value **/ + fullInputPath: any; /** TODO: add return value **/ + inputPath: any; /** TODO: add return value **/ + inputSize: any; /** TODO: add return value **/ + packageName: any; /** TODO: add return value **/ + pathForSourceMap: any; /** TODO: add return value **/ read(n?: number): any; - rootOutputPath; /** TODO: add return value **/ + rootOutputPath: any; /** TODO: add return value **/ } declare var PackageAPI: PackageAPIStatic; @@ -777,5 +777,5 @@ interface Template { } declare function MethodInvocation(options: { -}); /** TODO: add return value **/ +}): any; /** TODO: add return value **/ declare function check(value: any, pattern: any): void; From 7274998be7122d7a077b7169131afe7e46f0e899 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Thu, 7 May 2015 17:10:20 -0700 Subject: [PATCH 126/534] Publish our minimal .d.ts file for the quickstart --- angular2/angular2-tests.ts | 24 ++ angular2/angular2.d.ts | 605 +++++++++++++++++++++++++++++++++++++ 2 files changed, 629 insertions(+) create mode 100644 angular2/angular2-tests.ts create mode 100644 angular2/angular2.d.ts diff --git a/angular2/angular2-tests.ts b/angular2/angular2-tests.ts new file mode 100644 index 000000000..1a6d753f9 --- /dev/null +++ b/angular2/angular2-tests.ts @@ -0,0 +1,24 @@ +/// + +// Use Typescript 1.4 style imports +import ng = require("angular2/angular2"); + +class Service { + +} + +class Cmp { + static annotations: any[]; +} +Cmp.annotations = [ + ng.Component({ + selector: 'cmp', + injectables: [Service] + }), + ng.View({ + template: '{{greeting}} world!', + directives: [ng.For, ng.If] + }) +]; + +ng.bootstrap(Cmp); diff --git a/angular2/angular2.d.ts b/angular2/angular2.d.ts new file mode 100644 index 000000000..4e2d112f8 --- /dev/null +++ b/angular2/angular2.d.ts @@ -0,0 +1,605 @@ +// Type definitions for Angular v2.0.0-alpha.22 +// Project: http://angular.io/ +// Definitions by: angular team +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/****************** + * This is a minimal type definition for the Angular2 quickstart. + * We plan to publish a complete definition soon. + ******************/ + +interface List extends Array {} +interface Type {} + +interface _ComponentArg { + /** + * The CSS selector that triggers the instantiation of a directive. + * + * Angular only allows directives to trigger on CSS selectors that do not cross element boundaries. + * + * `selector` may be declared as one of the following: + * + * - `element-name`: select by element name. + * - `.class`: select by class name. + * - `[attribute]`: select by attribute name. + * - `[attribute=value]`: select by attribute name and value. + * - `:not(sub_selector)`: select only if the element does not match the `sub_selector`. + * - `selector1, selector2`: select if either `selector1` or `selector2` matches. + * + * + * ## Example + * + * Suppose we have a directive with an `input[type=text]` selector. + * + * And the following HTML: + * + * ```html + *
+ * + * + * + * ``` + * + * The directive would only be instantiated on the `` element. + * + */ + selector: string; + + /** + * Enumerates the set of properties that accept data binding for a directive. + * + * The `properties` property defines a set of `directiveProperty` to `bindingProperty` + * key-value pairs: + * + * - `directiveProperty` specifies the component property where the value is written. + * - `bindingProperty` specifies the DOM property where the value is read from. + * + * You can include a {@link Pipe} when specifying a `bindingProperty` to allow for data transformation and structural + * change detection of the value. These pipes will be evaluated in the context of this component. + * + * + * ## Syntax + * + * ``` + * @Directive({ + * properties: { + * 'directiveProperty1': 'bindingProperty1', + * 'directiveProperty2': 'bindingProperty2 | pipe1 | ...', + * ... + * } + * } + * ``` + * + * + * ## Basic Property Binding + * + * We can easily build a simple `Tooltip` directive that exposes a `tooltip` property, which can be used in templates + * with standard Angular syntax. For example: + * + * ``` + * @Directive({ + * selector: '[tooltip]', + * properties: { + * 'text': 'tooltip' + * } + * }) + * class Tooltip { + * set text(text) { + * // This will get called every time the 'tooltip' binding changes with the new value. + * } + * } + * ``` + * + * We can then bind to the `tooltip' property as either an expression (`someExpression`) or as a string literal, as + * shown in the HTML template below: + * + * ```html + *
...
+ *
...
+ * ``` + * + * Whenever the `someExpression` expression changes, the `properties` declaration instructs + * Angular to update the `Tooltip`'s `text` property. + * + * + * + * ## Bindings With Pipes + * + * You can also use pipes when writing binding definitions for a directive. + * + * For example, we could write a binding that updates the directive on structural changes, rather than on reference + * changes, as normally occurs in change detection. + * + * See {@link Pipe} and {@link keyValDiff} documentation for more details. + * + * ``` + * @Directive({ + * selector: '[class-set]', + * properties: { + * 'classChanges': 'classSet | keyValDiff' + * } + * }) + * class ClassSet { + * set classChanges(changes:KeyValueChanges) { + * // This will get called every time the `class-set` expressions changes its structure. + * } + * } + * ``` + * + * The template that this directive is used in may also contain its own pipes. For example: + * + * ```html + *
+ * ``` + * + * In this case, the two pipes compose as if they were inlined: `someExpression | somePipe | keyValDiff`. + * + */ + properties?: Object; + + /** + * Specifies which DOM hostListeners a directive listens to. + * + * The `hostListeners` property defines a set of `event` to `method` key-value pairs: + * + * - `event1`: the DOM event that the directive listens to. + * - `statement`: the statement to execute when the event occurs. + * If the evalutation of the statement returns `false`, then `preventDefault`is applied on the DOM event. + * + * To listen to global events, a target must be added to the event name. + * The target can be `window`, `document` or `body`. + * + * When writing a directive event binding, you can also refer to the following local variables: + * - `$event`: Current event object which triggered the event. + * - `$target`: The source of the event. This will be either a DOM element or an Angular directive. + * (will be implemented in later release) + * + * + * ## Syntax + * + * ``` + * @Directive({ + * hostListeners: { + * 'event1': 'onMethod1(arguments)', + * 'target:event2': 'onMethod2(arguments)', + * ... + * } + * } + * ``` + * + * ## Basic Event Binding: + * + * Suppose you want to write a directive that triggers on `change` events in the DOM and on `resize` events in window. + * You would define the event binding as follows: + * + * ``` + * @Directive({ + * selector: 'input', + * hostListeners: { + * 'change': 'onChange($event)', + * 'window:resize': 'onResize($event)' + * } + * }) + * class InputDirective { + * onChange(event:Event) { + * } + * onResize(event:Event) { + * } + * } + * ``` + * + * Here the `onChange` method of `InputDirective` is invoked whenever the DOM element fires the 'change' event. + * + */ + hostListeners?: Object; + + /** + * Defines the set of injectable objects that are visible to a Component and its children. + * + * The `injectables` defined in the Component annotation allow you to configure a set of bindings for the component's + * injector. + * + * When a component is instantiated, Angular creates a new child Injector, which is configured with the bindings in + * the Component `injectables` annotation. The injectable objects then become available for injection to the component + * itself and any of the directives in the component's template, i.e. they are not available to the directives which + * are children in the component's light DOM. + * + * + * The syntax for configuring the `injectables` injectable is identical to {@link Injector} injectable configuration. + * See {@link Injector} for additional detail. + * + * + * ## Simple Example + * + * Here is an example of a class that can be injected: + * + * ``` + * class Greeter { + * greet(name:string) { + * return 'Hello ' + name + '!'; + * } + * } + * + * @Component({ + * selector: 'greet', + * injectables: [ + * Greeter + * ] + * }) + * @View({ + * template: `{{greeter.greet('world')}}!`, + * directives: Child + * }) + * class HelloWorld { + * greeter:Greeter; + * + * constructor(greeter:Greeter) { + * this.greeter = greeter; + * } + * } + * ``` + */ + injectables?: List; + + /** + * Specifies a set of lifecycle hostListeners in which the directive participates. + * + * See {@link onChange}, {@link onDestroy}, {@link onAllChangesDone} for details. + */ + lifecycle?: List; + + /** + * Defines the used change detection strategy. + * + * When a component is instantiated, Angular creates a change detector, which is responsible for propagating + * the component's bindings. + * + * The `changeDetection` property defines, whether the change detection will be checked every time or only when the component + * tells it to do so. + */ + changeDetection?: string; +} + +interface _ViewArg { + /** + * Specifies a template URL for an angular component. + * + * NOTE: either `templateUrl` or `template` should be used, but not both. + */ + templateUrl?: string; + + /** + * Specifies an inline template for an angular component. + * + * NOTE: either `templateUrl` or `template` should be used, but not both. + */ + template?: string; + + /** + * Specifies a list of directives that can be used within a template. + * + * Directives must be listed explicitly to provide proper component encapsulation. + */ + directives?: List; +} + +declare module "angular2/angular2" { + /** + * Bootstrapping for Angular applications. + * + * You instantiate an Angular application by explicitly specifying a component to use as the root component for your + * application via the `bootstrap()` method. + * + * ## Simple Example + * + * Assuming this `index.html`: + * + * ```html + * + * + * + * loading... + * + * + * ``` + * + * An application is bootstrapped inside an existing browser DOM, typically `index.html`. Unlike Angular 1, Angular 2 + * does not compile/process bindings in `index.html`. This is mainly for security reasons, as well as architectural + * changes in Angular 2. This means that `index.html` can safely be processed using server-side technologies such as + * bindings. Bindings can thus use double-curly `{{ syntax }}` without collision from Angular 2 component double-curly + * `{{ syntax }}`. + * + * We can use this script code: + * + * ``` + * @Component({ + * selector: 'my-app' + * }) + * @View({ + * template: 'Hello {{ name }}!' + * }) + * class MyApp { + * name:string; + * + * constructor() { + * this.name = 'World'; + * } + * } + * + * main() { + * return bootstrap(MyApp); + * } + * ``` + * + * When the app developer invokes `bootstrap()` with the root component `MyApp` as its argument, Angular performs the + * following tasks: + * + * 1. It uses the component's `selector` property to locate the DOM element which needs to be upgraded into + * the angular component. + * 2. It creates a new child injector (from the platform injector) and configures the injector with the component's + * `injectables`. Optionally, you can also override the injector configuration for an app by invoking + * `bootstrap` with the `componentInjectableBindings` argument. + * 3. It creates a new `Zone` and connects it to the angular application's change detection domain instance. + * 4. It creates a shadow DOM on the selected component's host element and loads the template into it. + * 5. It instantiates the specified component. + * 6. Finally, Angular performs change detection to apply the initial data bindings for the application. + * + * + * ## Instantiating Multiple Applications on a Single Page + * + * There are two ways to do this. + * + * + * ### Isolated Applications + * + * Angular creates a new application each time that the `bootstrap()` method is invoked. When multiple applications + * are created for a page, Angular treats each application as independent within an isolated change detection and + * `Zone` domain. If you need to share data between applications, use the strategy described in the next + * section, "Applications That Share Change Detection." + * + * + * ### Applications That Share Change Detection + * + * If you need to bootstrap multiple applications that share common data, the applications must share a common + * change detection and zone. To do that, create a meta-component that lists the application components in its template. + * By only invoking the `bootstrap()` method once, with the meta-component as its argument, you ensure that only a + * single change detection zone is created and therefore data can be shared across the applications. + * + * + * ## Platform Injector + * + * When working within a browser window, there are many singleton resources: cookies, title, location, and others. + * Angular services that represent these resources must likewise be shared across all Angular applications that + * occupy the same browser window. For this reason, Angular creates exactly one global platform injector which stores + * all shared services, and each angular application injector has the platform injector as its parent. + * + * Each application has its own private injector as well. When there are multiple applications on a page, Angular treats + * each application injector's services as private to that application. + * + * + * # API + * - `appComponentType`: The root component which should act as the application. This is a reference to a `Type` + * which is annotated with `@Component(...)`. + * - `componentInjectableBindings`: An additional set of bindings that can be added to `injectables` for the + * {@link Component} to override default injection behavior. + * - `errorReporter`: `function(exception:any, stackTrace:string)` a default error reporter for unhandled exceptions. + * + * Returns a `Promise` with the application`s private {@link Injector}. + * + */ + function bootstrap(appComponentType: any): void; + + /** + * Declare reusable UI building blocks for an application. + * + * Each Angular component requires a single `@Component` and at least one `@View` annotation. The `@Component` + * annotation specifies when a component is instantiated, and which properties and hostListeners it binds to. + * + * When a component is instantiated, Angular + * - creates a shadow DOM for the component. + * - loads the selected template into the shadow DOM. + * - creates a child {@link Injector} which is configured with the `injectables` for the {@link Component}. + * + * All template expressions and statements are then evaluated against the component instance. + * + * For details on the `@View` annotation, see {@link View}. + * + * ## Example + * + * ``` + * @Component({ + * selector: 'greet' + * }) + * @View({ + * template: 'Hello {{name}}!' + * }) + * class Greet { + * name: string; + * + * constructor() { + * this.name = 'World'; + * } + * } + * ``` + * + * + * Dynamically loading a component at runtime: + * + * Regular Angular components are statically resolved. Dynamic components allows to resolve a component at runtime + * instead by providing a placeholder into which a regular Angular component can be dynamically loaded. Once loaded, + * the dynamically-loaded component becomes permanent and cannot be changed. + * Dynamic components are declared just like components, but without a `@View` annotation. + * + * + * ## Example + * + * Here we have `DynamicComp` which acts as the placeholder for `HelloCmp`. At runtime, the dynamic component + * `DynamicComp` requests loading of the `HelloCmp` component. + * + * There is nothing special about `HelloCmp`, which is a regular Angular component. It can also be used in other static + * locations. + * + * ``` + * @Component({ + * selector: 'dynamic-comp' + * }) + * class DynamicComp { + * helloCmp:HelloCmp; + * constructor(loader:DynamicComponentLoader, location:ElementRef) { + * loader.load(HelloCmp, location).then((helloCmp) => { + * this.helloCmp = helloCmp; + * }); + * } + * } + * + * @Component({ + * selector: 'hello-cmp' + * }) + * @View({ + * template: "{{greeting}}" + * }) + * class HelloCmp { + * greeting:string; + * constructor() { + * this.greeting = "hello"; + * } + * } + * ``` + * + */ + function Component(arg: _ComponentArg): (target: any) => any; + + /** + * Declares the available HTML templates for an application. + * + * Each angular component requires a single `@Component` and at least one `@View` annotation. The @View + * annotation specifies the HTML template to use, and lists the directives that are active within the template. + * + * When a component is instantiated, the template is loaded into the component's shadow root, and the + * expressions and statements in the template are evaluated against the component. + * + * For details on the `@Component` annotation, see {@link Component}. + * + * ## Example + * + * ``` + * @Component({ + * selector: 'greet' + * }) + * @View({ + * template: 'Hello {{name}}!', + * directives: [GreetUser, Bold] + * }) + * class Greet { + * name: string; + * + * constructor() { + * this.name = 'World'; + * } + * } + * ``` + * + */ + function View(arg: _ViewArg): (target: any) => any; + + /** + * The `For` directive instantiates a template once per item from an iterable. The context for each + * instantiated template inherits from the outer context with the given loop variable set to the + * current item from the iterable. + * + * It is possible to alias the `index` to a local variable that will be set to the current loop + * iteration in the template context. + * + * When the contents of the iterator changes, `For` makes the corresponding changes to the DOM: + * + * * When an item is added, a new instance of the template is added to the DOM. + * * When an item is removed, its template instance is removed from the DOM. + * * When items are reordered, their respective templates are reordered in the DOM. + * + * # Example + * + * ``` + *
    + *
  • + * Error {{i}} of {{errors.length}}: {{error.message}} + *
  • + *
+ * ``` + * + * # Syntax + * + * - `
  • ...
  • ` + * - `
  • ...
  • ` + * - `` + * + */ + function For(): void; + + /** + * Removes or recreates a portion of the DOM tree based on an {expression}. + * + * If the expression assigned to `if` evaluates to a false value then the element is removed from the + * DOM, otherwise a clone of the element is reinserted into the DOM. + * + * # Example: + * + * ``` + *
    + * + * {{errorCount}} errors detected + *
    + * ``` + * + * # Syntax + * + * - `
    ...
    ` + * - `
    ...
    ` + * - `` + * + */ + function If(): void; + + /** + * The `NonBindable` directive tells Angular not to compile or bind the contents of the current + * DOM element. This is useful if the element contains what appears to be Angular directives and + * bindings but which should be ignored by Angular. This could be the case if you have a site that + * displays snippets of code, for instance. + * + * Example: + * + * ``` + *
    Normal: {{1 + 2}}
    // output "Normal: 3" + *
    Ignored: {{1 + 2}}
    // output "Ignored: {{1 + 2}}" + * ``` + * + */ + function NonBindable(): void; + + /** + * The `Switch` directive is used to conditionally swap DOM structure on your template based on a + * scope expression. + * Elements within `Switch` but without `SwitchWhen` or `SwitchDefault` directives will be + * preserved at the location as specified in the template. + * + * `Switch` simply chooses nested elements and makes them visible based on which element matches + * the value obtained from the evaluated expression. In other words, you define a container element + * (where you place the directive), place an expression on the **`[switch]="..."` attribute**), + * define any inner elements inside of the directive and place a `[switch-when]` attribute per + * element. + * The when attribute is used to inform Switch which element to display when the expression is + * evaluated. If a matching expression is not found via a when attribute then an element with the + * default attribute is displayed. + * + * # Example: + * + * ``` + * + * + * + * + * + * ``` + * + */ + function Switch(): void; +} \ No newline at end of file From 5ffefe5a1ae5f87dffbf8f11988e9d4765a5c09a Mon Sep 17 00:00:00 2001 From: Anatoly Bakirov Date: Thu, 7 May 2015 22:25:47 -0700 Subject: [PATCH 127/534] Invalid use of 'arguments'. Class definitions are automatically in strict mode. --- dojo/dojo.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dojo/dojo.d.ts b/dojo/dojo.d.ts index bda5c3494..7b95efdfa 100644 --- a/dojo/dojo.d.ts +++ b/dojo/dojo.d.ts @@ -3098,7 +3098,7 @@ declare module dojo { */ class Stateful { constructor(); - inherited: {(arguments: IArguments): any}; + inherited: {(args: IArguments): any}; /** * Get a property on a Stateful instance. * Get a named property on a Stateful object. The property may From 396000ead5cd89888c814f669cbb0ef1f7e38f92 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Thu, 7 May 2015 23:56:31 -0700 Subject: [PATCH 128/534] Add typing for bind() which is also needed for demo --- angular2/angular2-tests.ts | 6 +++++- angular2/angular2.d.ts | 19 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/angular2/angular2-tests.ts b/angular2/angular2-tests.ts index 1a6d753f9..bdd2628e5 100644 --- a/angular2/angular2-tests.ts +++ b/angular2/angular2-tests.ts @@ -2,9 +2,13 @@ // Use Typescript 1.4 style imports import ng = require("angular2/angular2"); +import di = require("angular2/di"); class Service { +} +class Service2 { + } class Cmp { @@ -13,7 +17,7 @@ class Cmp { Cmp.annotations = [ ng.Component({ selector: 'cmp', - injectables: [Service] + injectables: [Service, di.bind(Service2).toValue(null)] }), ng.View({ template: '{{greeting}} world!', diff --git a/angular2/angular2.d.ts b/angular2/angular2.d.ts index 4e2d112f8..fa3cc7788 100644 --- a/angular2/angular2.d.ts +++ b/angular2/angular2.d.ts @@ -602,4 +602,21 @@ declare module "angular2/angular2" { * */ function Switch(): void; -} \ No newline at end of file +} + +declare module "angular2/di" { + /** + * Provides an API for imperatively constructing {@link Binding}s. + * + * This is only relevant for JavaScript. See {@link BindingBuilder}. + * + * ## Example + * + * ```javascript + * bind(MyInterface).toClass(MyClass) + * + * ``` + * + */ + function bind(token: any): any; +} From aba104feabd1fd80fb19fb57756a9574e7d0aed9 Mon Sep 17 00:00:00 2001 From: Tat Date: Fri, 8 May 2015 17:53:04 +0530 Subject: [PATCH 129/534] added jsdoc documentation for the functions --- gl-matrix/gl-matrix-tests.ts | 1 + gl-matrix/gl-matrix.d.ts | 1935 +++++++++++++++++++++++++++++++++- 2 files changed, 1901 insertions(+), 35 deletions(-) diff --git a/gl-matrix/gl-matrix-tests.ts b/gl-matrix/gl-matrix-tests.ts index 5557c4b79..4f4bbf43b 100644 --- a/gl-matrix/gl-matrix-tests.ts +++ b/gl-matrix/gl-matrix-tests.ts @@ -49,6 +49,7 @@ out = vec2.cross(out, vecA, vecB); out = vec2.lerp(out, vecA, vecB, 0.5); out = vec2.random(out); out = vec2.random(out, 5.0); +out = vec2.transformMat2(out, vecA, matA); out = vec2.transformMat2d(out, vecA, matA); out = vec2.transformMat3(out, vecA, matA); out = vec2.transformMat4(out, vecA, matA); diff --git a/gl-matrix/gl-matrix.d.ts b/gl-matrix/gl-matrix.d.ts index b86a2dc59..3d4fc37a9 100644 --- a/gl-matrix/gl-matrix.d.ts +++ b/gl-matrix/gl-matrix.d.ts @@ -14,6 +14,7 @@ declare module GLM { declare module glMatrix { /** * Convert Degree To Radian + * * @param a Angle in Degrees */ export function toRadian(a: number): number; @@ -21,256 +22,2120 @@ declare module glMatrix { // vec2 declare module vec2 { + /** + * Creates a new, empty vec2 + * + * @returns a new 2D vector + */ export function create(): GLM.IArray; + + /** + * Creates a new vec2 initialized with values from an existing vector + * + * @param a a vector to clone + * @returns a new 2D vector + */ export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Creates a new vec2 initialized with the given values + * + * @param x X component + * @param y Y component + * @returns a new 2D vector + */ export function fromValues(x: number, y: number): GLM.IArray; + + /** + * Copy the values from one vec2 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set the components of a vec2 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @returns out + */ export function set(out: GLM.IArray, x: number, y: number): GLM.IArray; + + /** + * Adds two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the minimum of two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the maximum of two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Scales a vec2 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; + + /** + * Adds two vec2's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray; + + /** + * Calculates the euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ export function distance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ export function dist(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ export function sqrDist(a: GLM.IArray, b: GLM.IArray): number; - export function length(a: GLM.IArray): number; + + /** + * Calculates the length of a vec2 + * + * @param a vector to calculate length of + * @returns length of a + */ + export function length(a: GLM.IArray): number; + + /** + * Calculates the length of a vec2 + * + * @param a vector to calculate length of + * @returns length of a + */ export function len(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec2 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ export function squaredLength(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec2 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ export function sqrLen(a: GLM.IArray): number; + + /** + * Negates the components of a vec2 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Returns the inverse of the components of a vec2 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Normalize a vec2 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the dot product of two vec2's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ export function dot(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Computes the cross product of two vec2's + * Note that the cross product must by definition produce a 3D vector + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Performs a linear interpolation between two vec2's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ export function random(out: GLM.IArray): GLM.IArray; + + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param scale Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns out + */ export function random(out: GLM.IArray, scale: number): GLM.IArray; + + /** + * Transforms the vec2 with a mat2 + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + export function transformMat2(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec2 with a mat2d + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ export function transformMat2d(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec2 with a mat3 + * 3rd vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec2 with a mat4 + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; - export function forEach(out: GLM.IArray, string: number, offset: number, count: number, - callback: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray; - export function forEach(out: GLM.IArray, string: number, offset: number, count: number, - callback: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray; + + /** + * Perform some operation over an array of vec2s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec2s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param arg additional argument to pass to fn + * @returns a + */ + export function forEach(a: GLM.IArray, stride: number, offset: number, count: number, + fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray; + + /** + * Perform some operation over an array of vec2s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec2s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + */ + export function forEach(a: GLM.IArray, stride: number, offset: number, count: number, + fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray; + + /** + * Returns a string representation of a vector + * + * @param vec vector to represent as a string + * @returns string representation of the vector + */ export function str(a: GLM.IArray): string; } // vec3 declare module vec3 { + + /** + * Creates a new, empty vec3 + * + * @returns a new 3D vector + */ export function create(): GLM.IArray; + + /** + * Creates a new vec3 initialized with values from an existing vector + * + * @param a vector to clone + * @returns a new 3D vector + */ export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Creates a new vec3 initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @returns a new 3D vector + */ export function fromValues(x: number, y: number, z: number): GLM.IArray; - export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Copy the values from one vec3 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set the components of a vec3 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @param z Z component + * @returns out + */ export function set(out: GLM.IArray, x: number, y: number, z: number): GLM.IArray; + + /** + * Adds two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; - export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray + + /** + * Multiplies two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; - export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ + export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the minimum of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the maximum of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Scales a vec3 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; + + /** + * Adds two vec3's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray; + + /** + * Calculates the euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ export function distance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ export function dist(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ export function sqrDist(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the length of a vec3 + * + * @param a vector to calculate length of + * @returns length of a + */ export function length(a: GLM.IArray): number; + + /** + * Calculates the length of a vec3 + * + * @param a vector to calculate length of + * @returns length of a + */ export function len(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec3 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ export function squaredLength(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec3 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ export function sqrLen(a: GLM.IArray): number; + + /** + * Negates the components of a vec3 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Returns the inverse of the components of a vec3 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Normalize a vec3 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the dot product of two vec3's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ export function dot(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Computes the cross product of two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Performs a linear interpolation between two vec3's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ export function random(out: GLM.IArray): GLM.IArray; + + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param [scale] Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns out + */ export function random(out: GLM.IArray, scale: number): GLM.IArray; - export function rotateX(out: GLM.IArray, a: GLM.IArray, origin: GLM.IArray, angle: number): GLM.IArray; - export function rotateY(out: GLM.IArray, a: GLM.IArray, origin: GLM.IArray, angle: number): GLM.IArray; - export function rotateZ(out: GLM.IArray, a: GLM.IArray, origin: GLM.IArray, angle: number): GLM.IArray; - export function transformMat3(out: GLM.IArray, a: GLM.IArray, mat: GLM.IArray): GLM.IArray; - export function transformMat4(out: GLM.IArray, a: GLM.IArray, mat: GLM.IArray): GLM.IArray; + + /** + * Rotate a 3D vector around the x-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + export function rotateX(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray; + + /** + * Rotate a 3D vector around the y-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + export function rotateY(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray; + + /** + * Rotate a 3D vector around the z-axis + * @param out The receiving vec3 + * @param a The vec3 point to rotate + * @param b The origin of the rotation + * @param c The angle of rotation + * @returns out + */ + export function rotateZ(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray; + + /** + * Transforms the vec3 with a mat3. + * + * @param out the receiving vector + * @param a the vector to transform + * @param m the 3x3 matrix to transform with + * @returns out + */ + export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ + export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec3 with a quat + * + * @param out the receiving vector + * @param a the vector to transform + * @param q quaternion to transform with + * @returns out + */ + export function transformQuat(out: GLM.IArray, a: GLM.IArray, q: GLM.IArray): GLM.IArray; + + + /** + * Perform some operation over an array of vec3s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec3s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param arg additional argument to pass to fn + * @returns a + * @function + */ export function forEach(out: GLM.IArray, string: number, offset: number, count: number, - callback: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray; + fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray; + + /** + * Perform some operation over an array of vec3s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec3s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + * @function + */ export function forEach(out: GLM.IArray, string: number, offset: number, count: number, - callback: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray; - export function angle(a: GLM.IArray, b: GLM.IArray): number; + fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray; + + /** + * Get the angle between two 3D vectors + * @param a The first operand + * @param b The second operand + * @returns The angle in radians + */ + export function angle(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Returns a string representation of a vector + * + * @param vec vector to represent as a string + * @returns string representation of the vector + */ export function str(a: GLM.IArray): string; } // vec4 declare module vec4 { + + /** + * Creates a new, empty vec4 + * + * @returns a new 4D vector + */ export function create(): GLM.IArray; + + /** + * Creates a new vec4 initialized with values from an existing vector + * + * @param a vector to clone + * @returns a new 4D vector + */ export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Creates a new vec4 initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns a new 4D vector + */ export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray; + + /** + * Copy the values from one vec4 to another + * + * @param out the receiving vector + * @param a the source vector + * @returns out + */ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set the components of a vec4 to the given values + * + * @param out the receiving vector + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns out + */ export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray; + + /** + * Adds two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Subtracts vector b from vector a + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Divides two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the minimum of two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Returns the maximum of two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @returns out + */ export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Scales a vec4 by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + */ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; + + /** + * Adds two vec4's after scaling the second operand by a scalar value + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param scale the amount to scale b by before adding + * @returns out + */ export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray; + + /** + * Calculates the euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ export function distance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns distance between a and b + */ export function dist(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the squared euclidian distance between two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns squared distance between a and b + */ export function sqrDist(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the length of a vec4 + * + * @param a vector to calculate length of + * @returns length of a + */ export function length(a: GLM.IArray): number; + + /** + * Calculates the length of a vec4 + * + * @param a vector to calculate length of + * @returns length of a + */ export function len(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec4 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ export function squaredLength(a: GLM.IArray): number; + + /** + * Calculates the squared length of a vec4 + * + * @param a vector to calculate squared length of + * @returns squared length of a + */ export function sqrLen(a: GLM.IArray): number; + + /** + * Negates the components of a vec4 + * + * @param out the receiving vector + * @param a vector to negate + * @returns out + */ export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Returns the inverse of the components of a vec4 + * + * @param out the receiving vector + * @param a vector to invert + * @returns out + */ export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Normalize a vec4 + * + * @param out the receiving vector + * @param a vector to normalize + * @returns out + */ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; - export function dot(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Calculates the dot product of two vec4's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + */ + export function dot(a: GLM.IArray, b: GLM.IArray): number; + + /** + * Performs a linear interpolation between two vec4's + * + * @param out the receiving vector + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + + /** + * Generates a random unit vector + * + * @param out the receiving vector + * @returns out + */ export function random(out: GLM.IArray): GLM.IArray; + + /** + * Generates a random vector with the given scale + * + * @param out the receiving vector + * @param Length of the resulting vector. If ommitted, a unit vector will be returned + * @returns out + */ export function random(out: GLM.IArray, scale: number): GLM.IArray; + + /** + * Transforms the vec4 with a mat4. + * + * @param out the receiving vector + * @param a the vector to transform + * @param m matrix to transform with + * @returns out + */ export function transformMat4(out: GLM.IArray, a: GLM.IArray, mat: GLM.IArray): GLM.IArray; + + /** + * Transforms the vec4 with a quat + * + * @param out the receiving vector + * @param a the vector to transform + * @param q quaternion to transform with + * @returns out + */ export function transformQuat(out: GLM.IArray, a: GLM.IArray, quat: GLM.IArray): GLM.IArray; + + /** + * Perform some operation over an array of vec4s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec4s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @param additional argument to pass to fn + * @returns a + * @function + */ export function forEach(out: GLM.IArray, string: number, offset: number, count: number, callback: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray; + + /** + * Perform some operation over an array of vec4s. + * + * @param a the array of vectors to iterate over + * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed + * @param offset Number of elements to skip at the beginning of the array + * @param count Number of vec4s to iterate over. If 0 iterates over entire array + * @param fn Function to call for each vector in the array + * @returns a + * @function + */ export function forEach(out: GLM.IArray, string: number, offset: number, count: number, callback: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray; + + /** + * Returns a string representation of a vector + * + * @param vec vector to represent as a string + * @returns string representation of the vector + */ export function str(a: GLM.IArray): string; } // mat2 declare module mat2 { + + /** + * Creates a new identity mat2 + * + * @returns a new 2x2 matrix + */ export function create(): GLM.IArray; + + /** + * Creates a new mat2 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 2x2 matrix + */ export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Copy the values from one mat2 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; - export function identity(a: GLM.IArray): GLM.IArray; + + /** + * Set a mat2 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + export function identity(out: GLM.IArray): GLM.IArray; + + /** + * Transpose the values of a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Inverts a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the adjugate of a mat2 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the determinant of a mat2 + * + * @param a the source matrix + * @returns determinant of a + */ export function determinant(a: GLM.IArray): number; + + /** + * Multiplies two mat2's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two mat2's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Rotates a mat2 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Scales the mat2 by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param v the vec2 to scale the matrix by + * @returns out + **/ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Returns a string representation of a mat2 + * + * @param a matrix to represent as a string + * @returns string representation of the matrix + */ export function str(a: GLM.IArray): string; + + /** + * Returns Frobenius norm of a mat2 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ export function frob(a: GLM.IArray): number; + + /** + * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix + * @param L the lower triangular matrix + * @param D the diagonal matrix + * @param U the upper triangular matrix + * @param a the input matrix to factorize + */ export function LDU(L: GLM.IArray, D: GLM.IArray, U: GLM.IArray, a: GLM.IArray): GLM.IArray; } // mat2d declare module mat2d { + + /** + * Creates a new identity mat2d + * + * @returns a new 2x3 matrix + */ export function create(): GLM.IArray; + + /** + * Creates a new mat2d initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 2x3 matrix + */ export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Copy the values from one mat2d to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; - export function identity(a: GLM.IArray): GLM.IArray; + + /** + * Set a mat2d to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + export function identity(out: GLM.IArray): GLM.IArray; + + /** + * Inverts a mat2d + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the determinant of a mat2d + * + * @param a the source matrix + * @returns determinant of a + */ export function determinant(a: GLM.IArray): number; + + /** + * Multiplies two mat2d's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two mat2d's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Rotates a mat2d by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Scales the mat2d by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v the vec2 to scale the matrix by + * @returns out + **/ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Translates the mat2d by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v the vec2 to translate the matrix by + * @returns out + **/ export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Returns a string representation of a mat2d + * + * @param a matrix to represent as a string + * @returns string representation of the matrix + */ export function str(a: GLM.IArray): string; + + /** + * Returns Frobenius norm of a mat2d + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ export function frob(a: GLM.IArray): number; } // mat3 declare module mat3 { + + /** + * Creates a new identity mat3 + * + * @returns a new 3x3 matrix + */ export function create(): GLM.IArray; + + /** + * Creates a new mat3 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 3x3 matrix + */ export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Copy the values from one mat3 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; - export function identity(a: GLM.IArray): GLM.IArray; + + /** + * Set a mat3 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + export function identity(out: GLM.IArray): GLM.IArray; + + /** + * Transpose the values of a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Inverts a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the adjugate of a mat3 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the determinant of a mat3 + * + * @param a the source matrix + * @returns determinant of a + */ export function determinant(a: GLM.IArray): number; + + /** + * Multiplies two mat3's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two mat3's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; - export function str(a: GLM.IArray): string; + + /** + * Returns a string representation of a mat3 + * + * @param mat matrix to represent as a string + * @returns string representation of the matrix + */ + export function str(mat: GLM.IArray): string; + + /** + * Returns Frobenius norm of a mat3 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ export function frob(a: GLM.IArray): number; + + /** + * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix + * + * @param out mat3 receiving operation result + * @param a Mat4 to derive the normal matrix from + * + * @returns out + */ export function normalFromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates a 3x3 matrix from the given quaternion + * + * @param out mat3 receiving operation result + * @param q Quaternion to create matrix from + * + * @returns out + */ export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray; - export function fromMat4(out: GLM.IArray, q: GLM.IArray): GLM.IArray; + + /** + * Copies the upper-left 3x3 values into the given mat3. + * + * @param out the receiving 3x3 matrix + * @param a the source 4x4 matrix + * @returns out + */ + export function fromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Scales the mat3 by the dimensions in the given vec2 + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param v the vec2 to scale the matrix by + * @returns out + **/ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; - export function fromMat2d(out: GLM.IArray, q: GLM.IArray): GLM.IArray; + + /** + * Copies the values from a mat2d into a mat3 + * + * @param out the receiving matrix + * @param {mat2d} a the matrix to copy + * @returns out + **/ + export function fromMat2d(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Translate a mat3 by the given vector + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v vector to translate by + * @returns out + */ + export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Rotates a mat3 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ + export function translate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; } // mat4 declare module mat4 { + + /** + * Creates a new identity mat4 + * + * @returns a new 4x4 matrix + */ export function create(): GLM.IArray; + + /** + * Creates a new mat4 initialized with values from an existing matrix + * + * @param a matrix to clone + * @returns a new 4x4 matrix + */ export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Copy the values from one mat4 to another + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; - export function identity(a: GLM.IArray): GLM.IArray; + + /** + * Set a mat4 to the identity matrix + * + * @param out the receiving matrix + * @returns out + */ + export function identity(a: GLM.IArray): GLM.IArray; + + /** + * Transpose the values of a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Inverts a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the adjugate of a mat4 + * + * @param out the receiving matrix + * @param a the source matrix + * @returns out + */ export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the determinant of a mat4 + * + * @param a the source matrix + * @returns determinant of a + */ export function determinant(a: GLM.IArray): number; + + /** + * Multiplies two mat4's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two mat4's + * + * @param out the receiving matrix + * @param a the first operand + * @param b the second operand + * @returns out + */ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Translate a mat4 by the given vector + * + * @param out the receiving matrix + * @param a the matrix to translate + * @param v vector to translate by + * @returns out + */ export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Scales the mat4 by the dimensions in the given vec3 + * + * @param out the receiving matrix + * @param a the matrix to scale + * @param v the vec3 to scale the matrix by + * @returns out + **/ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray; + + /** + * Rotates a mat4 by the given angle + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @param axis the axis to rotate around + * @returns out + */ export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number, axis: GLM.IArray): GLM.IArray; + + /** + * Rotates a matrix by the given angle around the X axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Rotates a matrix by the given angle around the Y axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Rotates a matrix by the given angle around the Z axis + * + * @param out the receiving matrix + * @param a the matrix to rotate + * @param rad the angle to rotate the matrix by + * @returns out + */ export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Generates a frustum matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param left Left bound of the frustum + * @param right Right bound of the frustum + * @param bottom Bottom bound of the frustum + * @param top Top bound of the frustum + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ export function frustum(out: GLM.IArray, left: number, right: number, bottom: number, top: number, near: number, far: number): GLM.IArray; - export function perspective(out: GLM.IArray, fov: number, aspect: number, + + /** + * Generates a perspective projection matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param fovy Vertical field of view in radians + * @param aspect Aspect ratio. typically viewport width/height + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ + export function perspective(out: GLM.IArray, fovy: number, aspect: number, near: number, far: number): GLM.IArray; + + /** + * Generates a orthogonal projection matrix with the given bounds + * + * @param out mat4 frustum matrix will be written into + * @param left Left bound of the frustum + * @param right Right bound of the frustum + * @param bottom Bottom bound of the frustum + * @param top Top bound of the frustum + * @param near Near bound of the frustum + * @param far Far bound of the frustum + * @returns out + */ export function ortho(out: GLM.IArray, left: number, right: number, bottom: number, top: number, near: number, far: number): GLM.IArray; + + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis + * + * @param out mat4 frustum matrix will be written into + * @param eye Position of the viewer + * @param center Point the viewer is looking at + * @param up vec3 pointing up + * @returns out + */ export function lookAt(out: GLM.IArray, eye: GLM.IArray, center: GLM.IArray, up: GLM.IArray): GLM.IArray; - export function str(a: GLM.IArray): string; + + /** + * Returns a string representation of a mat4 + * + * @param mat matrix to represent as a string + * @returns string representation of the matrix + */ + export function str(mat: GLM.IArray): string; + + /** + * Returns Frobenius norm of a mat4 + * + * @param a the matrix to calculate Frobenius norm of + * @returns Frobenius norm + */ export function frob(a: GLM.IArray): number; - export function fromRotationTranslation(out: GLM.IArray, quat: GLM.IArray, - vec: GLM.IArray): GLM.IArray; - export function fromQuat(out: GLM.IArray, quat: GLM.IArray): GLM.IArray; + + /** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * var quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * + * @param out mat4 receiving operation result + * @param q Rotation quaternion + * @param v Translation vector + * @returns out + */ + export function fromRotationTranslation(out: GLM.IArray, q: GLM.IArray, + v: GLM.IArray): GLM.IArray; + + /** + * Creates a matrix from a quaternion + * + * @param out mat4 receiving operation result + * @param q Rotation quaternion + * @returns out + */ + export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray; } // quat declare module quat { + + /** + * Creates a new identity quat + * + * @returns a new quaternion + */ export function create(): GLM.IArray; + + /** + * Creates a new quat initialized with values from an existing quaternion + * + * @param a quaternion to clone + * @returns a new quaternion + * @function + */ export function clone(a: GLM.IArray): GLM.IArray; + + /** + * Creates a new quat initialized with the given values + * + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns a new quaternion + * @function + */ export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray; - export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Copy the values from one quat to another + * + * @param out the receiving quaternion + * @param a the source quaternion + * @returns out + * @function + */ + export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Set the components of a quat to the given values + * + * @param out the receiving quaternion + * @param x X component + * @param y Y component + * @param z Z component + * @param w W component + * @returns out + * @function + */ export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray; - export function identity(a: GLM.IArray): GLM.IArray; + + /** + * Set a quat to the identity quaternion + * + * @param out the receiving quaternion + * @returns out + */ + export function identity(out: GLM.IArray): GLM.IArray; + + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * + * @param out the receiving quaternion + * @param axis the axis around which to rotate + * @param rad the angle in radians + * @returns out + **/ export function setAxisAngle(out: GLM.IArray, axis: GLM.IArray, rad: number): GLM.IArray; + + /** + * Adds two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + * @function + */ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + */ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Multiplies two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @returns out + */ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Scales a quat by a scalar number + * + * @param out the receiving vector + * @param a the vector to scale + * @param b amount to scale the vector by + * @returns out + * @function + */ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray; - export function length(a: GLM.IArray): number; - export function len(a: GLM.IArray): number; + + /** + * Calculates the length of a quat + * + * @param a vector to calculate length of + * @returns length of a + * @function + */ + export function length(a: GLM.IArray): number; + + /** + * Calculates the length of a quat + * + * @param a vector to calculate length of + * @returns length of a + * @function + */ + export function len(a: GLM.IArray): number; + + /** + * Calculates the squared length of a quat + * + * @param a vector to calculate squared length of + * @returns squared length of a + * @function + */ export function squaredLength(a: GLM.IArray): number; - export function sqrLen(a: GLM.IArray): number; + + /** + * Calculates the squared length of a quat + * + * @param a vector to calculate squared length of + * @returns squared length of a + * @function + */ + export function sqrLen(a: GLM.IArray): number; + + /** + * Normalize a quat + * + * @param out the receiving quaternion + * @param a quaternion to normalize + * @returns out + * @function + */ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the dot product of two quat's + * + * @param a the first operand + * @param b the second operand + * @returns dot product of a and b + * @function + */ + export function dot(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Performs a linear interpolation between two quat's + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + * @function + */ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + + /** + * Performs a spherical linear interpolation between two quat + * + * @param out the receiving quaternion + * @param a the first operand + * @param b the second operand + * @param t interpolation amount between the two inputs + * @returns out + */ export function slerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray; + + /** + * Calculates the inverse of a quat + * + * @param out the receiving quaternion + * @param a quat to calculate inverse of + * @returns out + */ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. + * + * @param out the receiving quaternion + * @param a quat to calculate conjugate of + * @returns out + */ export function conjugate(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Returns a string representation of a quatenion + * + * @param vec vector to represent as a string + * @returns string representation of the vector + */ export function str(a: GLM.IArray): string; + + /** + * Rotates a quaternion by the given angle about the X axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Rotates a quaternion by the given angle about the Y axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + + /** + * Rotates a quaternion by the given angle about the Z axis + * + * @param out quat receiving operation result + * @param a quat to rotate + * @param rad angle (in radians) to rotate + * @returns out + */ export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; - export function fromMat3(out: GLM.IArray, a: GLM.IArray): GLM.IArray; + + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to renormalize the quaternion yourself where necessary. + * + * @param out the receiving quaternion + * @param m rotation matrix + * @returns out + * @function + */ + export function fromMat3(out: GLM.IArray, m: GLM.IArray): GLM.IArray; + + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * + * @param view the vector representing the viewing direction + * @param right the vector representing the local "right" direction + * @param up the vector representing the local "up" direction + * @returns out + */ export function setAxes(out: GLM.IArray, view: GLM.IArray, right: GLM.IArray, up: GLM.IArray): GLM.IArray; + + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * + * @param out the receiving quaternion. + * @param a the initial vector + * @param b the destination vector + * @returns out + */ export function rotationTo(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + + /** + * Calculates the W component of a quat from the X, Y, and Z components. + * Assumes that quaternion is 1 unit in length. + * Any existing W component will be ignored. + * + * @param out the receiving quaternion + * @param a quat to calculate W component of + * @returns out + */ export function calculateW(out: GLM.IArray, a: GLM.IArray): GLM.IArray; } \ No newline at end of file From c6f469b3608cd84fc156cb79ada61dc014ccd3bb Mon Sep 17 00:00:00 2001 From: chr22 Date: Fri, 8 May 2015 15:47:09 +0200 Subject: [PATCH 130/534] Update namespace from ng -> angular --- angularjs/angular-animate.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts index e78b85c3e..3ecc95b5b 100644 --- a/angularjs/angular-animate.d.ts +++ b/angularjs/angular-animate.d.ts @@ -19,7 +19,7 @@ declare module angular.animate { // AnimateService // see http://docs.angularjs.org/api/ngAnimate/service/$animate /////////////////////////////////////////////////////////////////////////// - interface IAnimateService extends ng.IAnimateService { + interface IAnimateService extends angular.IAnimateService { /** * Globally enables / disables animations. * @@ -39,7 +39,7 @@ declare module angular.animate { * @param options an optional collection of styles that will be picked up by the CSS transition/animation * @returns the animation callback promise */ - animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): ng.IPromise; + animate(element: JQuery, from: any, to: any, className?: string, options?: IAnimationOptions): IPromise; /** * Appends the element to the parentElement element that resides in the document and then runs the enter animation. @@ -50,7 +50,7 @@ declare module angular.animate { * @param options an optional collection of styles that will be picked up by the CSS transition/animation * @returns the animation callback promise */ - enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): ng.IPromise; + enter(element: JQuery, parentElement: JQuery, afterElement?: JQuery, options?: IAnimationOptions): IPromise; /** * Runs the leave animation operation and, upon completion, removes the element from the DOM. @@ -59,7 +59,7 @@ declare module angular.animate { * @param options an optional collection of styles that will be picked up by the CSS transition/animation * @returns the animation callback promise */ - leave(element: JQuery, options?: IAnimationOptions): ng.IPromise; + leave(element: JQuery, options?: IAnimationOptions): IPromise; /** * Fires the move DOM operation. Just before the animation starts, the animate service will either append @@ -71,7 +71,7 @@ declare module angular.animate { * @param afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation * @returns the animation callback promise */ - move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): ng.IPromise; + move(element: JQuery, parentElement: JQuery, afterElement?: JQuery): IPromise; /** * Triggers a custom animation event based off the className variable and then attaches the className @@ -82,7 +82,7 @@ declare module angular.animate { * @param options an optional collection of styles that will be picked up by the CSS transition/animation * @returns the animation callback promise */ - addClass(element: JQuery, className: string, options?: IAnimationOptions): ng.IPromise; + addClass(element: JQuery, className: string, options?: IAnimationOptions): IPromise; /** * Triggers a custom animation event based off the className variable and then removes the CSS class @@ -93,7 +93,7 @@ declare module angular.animate { * @param options an optional collection of styles that will be picked up by the CSS transition/animation * @returns the animation callback promise */ - removeClass(element: JQuery, className: string, options?: IAnimationOptions): ng.IPromise; + removeClass(element: JQuery, className: string, options?: IAnimationOptions): IPromise; /** * Adds and/or removes the given CSS classes to and from the element. Once complete, the done() callback @@ -105,12 +105,12 @@ declare module angular.animate { * @param options an optional collection of styles that will be picked up by the CSS transition/animation * @returns the animation callback promise */ - setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): ng.IPromise; + setClass(element: JQuery, add: string, remove: string, options?: IAnimationOptions): IPromise; /** * Cancels the provided animation. */ - cancel(animationPromise: ng.IPromise): void; + cancel(animationPromise: IPromise): void; } /////////////////////////////////////////////////////////////////////////// @@ -124,7 +124,7 @@ declare module angular.animate { * @param name The name of the animation. * @param factory The factory function that will be executed to return the animation object. */ - register(name: string, factory: () => ng.IAnimateCallbackObject): void; + register(name: string, factory: () => IAnimateCallbackObject): void; /** * Gets and/or sets the CSS class expression that is checked when performing an animation. From 568233e7109e39dfbc9fe8df9d85033a1a4a8b1d Mon Sep 17 00:00:00 2001 From: chr22 Date: Fri, 8 May 2015 15:49:56 +0200 Subject: [PATCH 131/534] Update namespace from ng -> angular --- angular-file-upload/angular-file-upload.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts index 2eb0e72b5..bd76a6e7e 100644 --- a/angular-file-upload/angular-file-upload.d.ts +++ b/angular-file-upload/angular-file-upload.d.ts @@ -9,7 +9,7 @@ declare module angular.angularFileUpload { interface IUploadService { - http(config: ng.IRequestConfig): IUploadPromise; + http(config: IRequestConfig): IUploadPromise; upload(config: IFileUploadConfig): IUploadPromise; } @@ -18,7 +18,7 @@ declare module angular.angularFileUpload { progress(callback: IHttpPromiseCallback): IUploadPromise; } - interface IFileUploadConfig extends ng.IRequestConfig { + interface IFileUploadConfig extends IRequestConfig { file: File; fileName?: string; From 63af1d3fdc796eff5c04fd279f3fe1bc882e7dd1 Mon Sep 17 00:00:00 2001 From: Stefan Rahnev Date: Fri, 8 May 2015 16:51:28 +0300 Subject: [PATCH 132/534] Adding Kendo UI TS definitions --- kendo-ui/kendo.all.d.ts | 15679 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 15679 insertions(+) create mode 100644 kendo-ui/kendo.all.d.ts diff --git a/kendo-ui/kendo.all.d.ts b/kendo-ui/kendo.all.d.ts new file mode 100644 index 000000000..8f8658290 --- /dev/null +++ b/kendo-ui/kendo.all.d.ts @@ -0,0 +1,15679 @@ +// Type definitions for Kendo UI + +declare module kendo { + function culture(): { + name: string; + calendar: { + AM: string[]; + PM: string[]; + days: { + names: string[]; + namesAbbr: string[]; + namesShort: string[]; + firstDay: number; + }; + months: { + names: string[]; + namesAbbr: string[]; + }; + patterns: { + D: string; + F: string; + G: string; + M: string; + T: string; + Y: string; + d: string; + g: string; + m: string; + s: string; + t: string; + u: string; + y: string; + }; + twoDigitYearMax: number; + }; + calendars: { + standard: { + AM: string[]; + PM: string[]; + days: { + names: string[]; + namesAbbr: string[]; + namesShort: string[]; + firstDay: number; + }; + months: { + names: string[]; + namesAbbr: string[]; + }; + patterns: { + D: string; + F: string; + G: string; + M: string; + T: string; + Y: string; + d: string; + g: string; + m: string; + s: string; + t: string; + u: string; + y: string; + }; + twoDigitYearMax: number; + }; + }; + numberFormat: { + currency: { + decimals: number; + groupSize: number[]; + pattern: string[]; + symbol: string; + }; + decimals: number; + groupSize: number[]; + pattern: string[]; + percent: { + decimals: number; + groupSize: number[]; + pattern: string[]; + symbol: string; + }; + }; + }; + + var cultures: {[culture:string] : { + name?: string; + calendar?: { + AM: string[]; + PM: string[]; + days: { + names: string[]; + namesAbbr: string[]; + namesShort: string[]; + firstDay: number; + }; + months: { + names: string[]; + namesAbbr: string[]; + }; + patterns: { + D: string; + F: string; + G: string; + M: string; + T: string; + Y: string; + d: string; + g: string; + m: string; + s: string; + t: string; + u: string; + y: string; + }; + twoDigitYearMax: number; + }; + calendars?: { + standard: { + AM: string[]; + PM: string[]; + days: { + names: string[]; + namesAbbr: string[]; + namesShort: string[]; + firstDay: number; + }; + months: { + names: string[]; + namesAbbr: string[]; + }; + patterns: { + D: string; + F: string; + G: string; + M: string; + T: string; + Y: string; + d: string; + g: string; + m: string; + s: string; + t: string; + u: string; + y: string; + }; + twoDigitYearMax: number; + }; + }; + numberFormat?: { + currency: { + decimals: number; + groupSize: number[]; + pattern: string[]; + symbol: string; + }; + decimals: number; + groupSize: number[]; + pattern: string[]; + percent: { + decimals: number; + groupSize: number[]; + pattern: string[]; + symbol: string; + }; + }; + }}; + + function format(format: string, ...values: any[]): string; + + function fx(selector: string): effects.Element; + function fx(element: Element): effects.Element; + function fx(element: JQuery): effects.Element; + + function init(selector: string, ...namespaces: any[]): void; + function init(element: JQuery, ...namespaces: any[]): void; + function init(element: Element, ...namespaces: any[]): void; + + function observable(data: any): kendo.data.ObservableObject; + function observableHierarchy(array: any[]): kendo.data.ObservableArray; + + function render(template:(data: any) => string, data: any[]): string; + function template(template: string, options?: TemplateOptions): (data: any) => string; + + function guid(): string; + + function widgetInstance(element: JQuery, suite: typeof kendo.ui): kendo.ui.Widget; + function widgetInstance(element: JQuery, suite: typeof kendo.mobile.ui): kendo.ui.Widget; + function widgetInstance(element: JQuery, suite: typeof kendo.dataviz.ui): kendo.ui.Widget; + + + var ns: string; + + var keys: { + INSERT: number; + DELETE: number; + BACKSPACE: number; + TAB: number; + ENTER: number; + ESC: number; + LEFT: number; + UP: number; + RIGHT: number; + DOWN: number; + END: number; + HOME: number; + SPACEBAR: number; + PAGEUP: number; + PAGEDOWN: number; + F2: number; + F10: number; + F12: number; + } + + var support: { + touch: boolean; + pointers: boolean; + scrollbar(): number; + hasHW3D: boolean; + hasNativeScrolling: boolean; + devicePixelRatio: number; + placeHolder: boolean; + zoomLevel: number; + mobileOS: { + device: string; + tablet: any; + browser: string; + name: string; + majorVersion: string; + minorVersion: string; + flatVersion: number; + appMode: boolean; + }; + browser: { + msie: boolean; + webkit: boolean; + safari: boolean; + opera: boolean; + version: string; + }; + } + + interface TemplateOptions { + paramName?: string; + useWithBlock?: boolean; + } + + class Class { + static fn: Class; + static extend(prototype: Object): Class; + } + + class Observable extends Class { + static fn: Observable; + static extend(prototype: Object): Observable; + + bind(eventName: string, handler: Function): Observable; + one(eventName: string, handler: Function): Observable; + trigger(eventName: string, e?: any): boolean; + unbind(eventName: string, handler?: any): Observable; + } + + interface ViewOptions { + tagName?: string; + wrap?: boolean; + model?: Object; + init?: (e: ViewEvent) => void; + show?: (e: ViewEvent) => void; + hide?: (e: ViewEvent) => void; + } + + interface ViewEvent { + sender: View; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + class View extends Observable { + constructor(element: Element, options?: ViewOptions); + constructor(element: string, options?: ViewOptions); + init(element: Element, options?: ViewOptions): void; + init(element: string, options?: ViewOptions): void; + render(container?: any): JQuery; + destroy(): void; + element: JQuery; + content: any; + tagName: string; + model: Object; + } + + class ViewContainer extends Observable { + view: View; + } + + class Layout extends View { + showIn(selector: string, view: View): void; + containers: { [selector: string]: ViewContainer; }; + } + + class History extends Observable { + start(options: Object): void; + stop(): void; + current: string; + root: string; + change(callback: Function): void; + navigate(location: string, silent?: boolean): void; + } + + var history: History; + + interface RouterOptions { + init?: (e: RouterEvent) => void; + routeMissing?: (e: RouterEvent) => void; + change?: (e: RouterEvent) => void; + } + + interface RouterEvent { + sender: Router; + isDefaultPrevented(): boolean; + preventDefault: Function; + url: string; + } + + class Route extends Class { + route: RegExp; + callback(url: string): void; + worksWith(url: string): void; + } + + class Router extends Observable { + constructor(options?: RouterOptions); + init(options?: RouterOptions): void; + start(): void; + destroy(): void; + route(route: string, callback: Function): void; + navigate(location: string, silent?: boolean): void; + routes: Route[]; + } + +} + +declare module kendo.effects { + interface Element { + expand(direction: string): effects.Expand; + expandHorizontal(): effects.Expand; + expandVertical(): effects.Expand; + fade(direction: string): effects.Fade; + fadeIn(): effects.Fade; + fadeOut(): effects.Fade; + flip(axis: string, face: JQuery, back: JQuery): effects.Flip; + flipHorizontal(face: JQuery, back: JQuery): effects.Flip; + flipVertical(face: JQuery, back: JQuery): effects.Flip; + pageturn(axis: string, face: JQuery, back: JQuery): effects.PageTurn; + pageturnHorizontal(face: JQuery, back: JQuery): effects.PageTurn; + pageturnVertical(face: JQuery, back: JQuery): effects.PageTurn; + slideIn(direction: string): effects.SlideIn; + slideInDown(): effects.SlideIn; + slideInLeft(): effects.SlideIn; + slideInRight(): effects.SlideIn; + slideInUp(): effects.SlideIn; + tile(direction: string, previous: JQuery): effects.Tile; + tileDown(previous: JQuery): effects.Tile; + tileLeft(previous: JQuery): effects.Tile; + tileRight(previous: JQuery): effects.Tile; + tileUp(previous: JQuery): effects.Tile; + transfer(target: JQuery): effects.Transfer; + zoom(direction: string): effects.Zoom; + zoomIn(): effects.Zoom; + zoomOut(): effects.Zoom; + } + + interface Effect { + play(): JQueryPromise; + reverse(): JQueryPromise; + duration(value: number): Effect; + add(effect: Effect): Effect; + stop(): Effect; + } + + interface Expand extends Effect { + duration(value: number): Expand; + direction(value: string): Expand; + stop(): Expand; + add(effect: Effect): Expand; + } + + interface Fade extends Effect { + duration(value: number): Fade; + direction(value: string): Fade; + stop(): Fade; + add(effect: Effect): Fade; + startValue(value: number): Fade; + endValue(value: number): Fade; + } + + interface Flip extends Effect { + duration(value: number): Flip; + direction(value: string): Flip; + stop(): Flip; + add(effect: Effect): Flip; + } + + interface PageTurn extends Effect { + duration(value: number): PageTurn; + direction(value: string): PageTurn; + stop(): PageTurn; + add(effect: Effect): PageTurn; + } + + interface SlideIn extends Effect { + duration(value: number): SlideIn; + direction(value: string): SlideIn; + stop(): SlideIn; + add(effect: Effect): SlideIn; + } + + interface Tile extends Effect { + duration(value: number): Tile; + direction(value: string): Tile; + stop(): Tile; + add(effect: Effect): Tile; + } + + interface Transfer extends Effect { + duration(value: number): Transfer; + stop(): Transfer; + add(effect: Effect): Transfer; + } + + interface Zoom extends Effect { + duration(value: number): Zoom; + direction(value: string): Zoom; + stop(): Zoom; + add(effect: Effect): Zoom; + startValue(value: number): Zoom; + endValue(value: number): Zoom; + } +} + +declare module kendo.data { + interface ObservableObjectEvent { + sender?: ObservableObject; + field?: string; + } + + interface ObservableObjectSetEvent extends ObservableObjectEvent { + value?: any; + preventDefault?: Function; + } + + + class Binding extends Observable { + source: any; + parents: any[]; + path: string; + dependencies: { [path: string]: boolean; }; + observable: boolean; + constructor(parents: any[], path: string); + change(e: Object): void; + start(source: kendo.Observable): void; + stop(source: kendo.Observable): void; + get (): any; + set (value: any): void; + destroy(): void; + } + + class BindingTarget { + target: any; + options: any; + source: any; + } + + class EventBinding extends Binding { + get (): void; + } + + class TemplateBinding extends Binding { + constructor(source: kendo.Observable, path: string, template: Function); + render(value: Object): string; + } + + module binders { } + + interface Bindings { + [key: string]: Binding; + } + + class Binder extends Class { + static fn: Binder; + static extend(prototype: Object): Binder; + + element: any; + bindings: Bindings; + constructor(element: any, bindings: Bindings, options?: BinderOptions); + init(element: any, bindings: Bindings, options?: BinderOptions): void; + bind(binding: Binding, attribute: string): void; + destroy(): void; + refresh(): void; + refresh(attribute: string): void; + options: BinderOptions; + } + + interface BinderOptions { + } + + class ObservableObject extends Observable{ + constructor(value?: any); + init(value?: any): void; + get(name: string): any; + parent(): ObservableObject; + set(name: string, value: any): void; + toJSON(): Object; + uid: string; + } + + class Model extends ObservableObject { + idField: string; + _defaultId: any; + fields: DataSourceSchemaModelFields; + defaults: { + [field: string]: any; + }; + constructor(data?: any); + init(data?: any):void; + accept(data?: any): void; + dirty: boolean; + id: any; + editable(field: string): boolean; + isNew(): boolean; + static idField: string; + static fields: DataSourceSchemaModelFields; + static define(options: DataSourceSchemaModelWithFieldsObject): typeof Model; + static define(options: DataSourceSchemaModelWithFieldsArray): typeof Model; + } + + interface SchedulerEventData { + description?: string; + end?: Date; + endTimezone?: string; + isAllDay?: boolean; + id?: any; + start?: Date; + startTimezone?: string; + recurrenceId?: any; + recurrenceRule?: string; + recurrenceException?: string; + title?: string; + } + + class SchedulerEvent extends Model { + constructor(data?: SchedulerEventData); + init(data?: SchedulerEventData): void; + + description: string; + end: Date; + endTimezone: string; + isAllDay: boolean; + id: any; + start: Date; + startTimezone: string; + recurrenceId: any; + recurrenceRule: string; + recurrenceException: string; + title: string; + static idField: string; + static fields: DataSourceSchemaModelFields; + static define(options: DataSourceSchemaModelWithFieldsObject): typeof SchedulerEvent; + static define(options: DataSourceSchemaModelWithFieldsArray): typeof SchedulerEvent; + clone(options: any, updateUid: boolean): SchedulerEvent; + duration(): number; + expand(start: Date, end: Date, zone: any): SchedulerEvent[]; + update(eventInfo: SchedulerEventData): void; + isMultiDay(): boolean; + isException(): boolean; + isOccurrence(): boolean; + isRecurring(): boolean; + isRecurrenceHead(): boolean; + toOccurrence(options: any): SchedulerEvent; + } + + class TreeListModel extends Model { + constructor(data?: any); + init(data?: any): void; + + id: any; + parentId: any; + + loaded(value: boolean): void; + loaded(): boolean; + + static idField: string; + static fields: DataSourceSchemaModelFields; + static define(options: DataSourceSchemaModelWithFieldsObject): typeof TreeListModel; + static define(options: DataSourceSchemaModelWithFieldsArray): typeof TreeListModel; + } + + class TreeListDataSource extends DataSource { + load(model: kendo.data.TreeListModel): JQueryPromise; + childNodes(model: kendo.data.TreeListModel): kendo.data.TreeListModel[]; + rootNodes(): kendo.data.TreeListModel[]; + parentNode(model: kendo.data.TreeListModel): kendo.data.TreeListModel; + level(model: kendo.data.TreeListModel): number; + level(model: any): number; + + add(model: Object): kendo.data.TreeListModel; + add(model: kendo.data.TreeListModel): kendo.data.TreeListModel; + at(index: number): kendo.data.TreeListModel; + cancelChanges(model?: kendo.data.TreeListModel): void; + get(id: any): kendo.data.TreeListModel; + getByUid(uid: string): kendo.data.TreeListModel; + indexOf(value: kendo.data.TreeListModel): number; + insert(index: number, model: kendo.data.TreeListModel): kendo.data.TreeListModel; + insert(index: number, model: Object): kendo.data.TreeListModel; + remove(model: kendo.data.TreeListModel): void; + } + + class GanttTask extends Model { + constructor(data?: any); + init(data?: any): void; + + id: any; + parentId: number; + orderId: number; + title: string; + start: Date; + end: Date; + percentComplete: number; + summary: boolean; + expanded: boolean; + static idField: string; + static fields: DataSourceSchemaModelFields; + static define(options: DataSourceSchemaModelWithFieldsObject): typeof GanttTask; + static define(options: DataSourceSchemaModelWithFieldsArray): typeof GanttTask; + } + + class GanttDependency extends Model { + constructor(data?: any); + init(data?: any): void; + + id: any; + predecessorId: number; + successorId: number; + type: number; + static idField: string; + static fields: DataSourceSchemaModelFields; + static define(options: DataSourceSchemaModelWithFieldsObject): typeof GanttDependency; + static define(options: DataSourceSchemaModelWithFieldsArray): typeof GanttDependency; + } + + class Node extends Model { + children: HierarchicalDataSource; + + append(model: any): void; + level(): number; + load(id: any): void; + loaded(value: boolean): void; + loaded(): boolean; + parentNode(): Node; + } + + class SchedulerDataSource extends DataSource { + add(model: Object): kendo.data.SchedulerEvent; + add(model: kendo.data.SchedulerEvent): kendo.data.SchedulerEvent; + at(index: number): kendo.data.SchedulerEvent; + cancelChanges(model?: kendo.data.SchedulerEvent): void; + get(id: any): kendo.data.SchedulerEvent; + getByUid(uid: string): kendo.data.SchedulerEvent; + indexOf(value: kendo.data.SchedulerEvent): number; + insert(index: number, model: kendo.data.SchedulerEvent): kendo.data.SchedulerEvent; + insert(index: number, model: Object): kendo.data.SchedulerEvent; + remove(model: kendo.data.SchedulerEvent): void; + } + + class GanttDataSource extends DataSource { + add(model: Object): kendo.data.GanttTask; + add(model: kendo.data.GanttTask): kendo.data.GanttTask; + at(index: number): kendo.data.GanttTask; + cancelChanges(model?: kendo.data.GanttTask): void; + get(id: any): kendo.data.GanttTask; + getByUid(uid: string): kendo.data.GanttTask; + indexOf(value: kendo.data.GanttTask): number; + insert(index: number, model: Object): kendo.data.GanttTask; + insert(index: number, model: kendo.data.GanttTask): kendo.data.GanttTask; + remove(model: kendo.data.GanttTask): void; + } + + class GanttDependencyDataSource extends DataSource { + add(model: Object): kendo.data.GanttDependency; + add(model: kendo.data.GanttDependency): kendo.data.GanttDependency; + at(index: number): kendo.data.GanttDependency; + cancelChanges(model?: kendo.data.GanttDependency): void; + get(id: any): kendo.data.GanttDependency; + getByUid(uid: string): kendo.data.GanttDependency; + indexOf(value: kendo.data.GanttDependency): number; + insert(index: number, model: Object): kendo.data.GanttDependency; + insert(index: number, model: kendo.data.GanttDependency): kendo.data.GanttDependency; + remove(model: kendo.data.GanttDependency): void; + } + + class HierarchicalDataSource extends DataSource { + constructor(options?: HierarchicalDataSourceOptions); + init(options?: HierarchicalDataSourceOptions): void; + } + + interface HierarchicalDataSourceOptions extends DataSourceOptions { + schema?: HierarchicalDataSourceSchema; + } + + + interface HierarchicalDataSourceSchema extends DataSourceSchemaWithOptionsModel { + model?: HierarchicalDataSourceSchemaModel; + } + + interface HierarchicalDataSourceSchemaModel extends DataSourceSchemaModel { + hasChildren?: any; + children?: any; + } + + interface PivotDiscoverRequestRestrictionOptions { + catalogName: string; + cubeName: string; + } + + interface PivotDiscoverRequestDataOptions { + command: string; + restrictions: PivotDiscoverRequestRestrictionOptions; + } + + interface PivotDiscoverRequestOptions { + data: PivotDiscoverRequestDataOptions; + } + + interface PivotTransportConnection { + catalog?: string; + cube?: string; + } + + interface PivotTransportDiscover { + cache?: boolean; + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface PivotTransport { + discover?: any; + read?: any; + } + + interface PivotTransportWithObjectOperations extends PivotTransport { + connection: PivotTransportConnection; + discover?: PivotTransportDiscover; + read?: DataSourceTransportRead; + } + + interface PivotTransportWithFunctionOperations extends PivotTransport { + discover?: (options: DataSourceTransportOptions) => void; + read?: (options: DataSourceTransportOptions) => void; + } + + interface PivotDataSourceAxisOptions { + name: string; + expand?: boolean; + } + + interface PivotDataSourceMeasureOptions { + values: string[]; + axis?: string; + } + + interface PivotDataSourceOptions extends DataSourceOptions { + columns?: PivotDataSourceAxisOptions[]; + measures?: PivotDataSourceMeasureOptions[]; + rows?: PivotDataSourceAxisOptions[]; + transport?: PivotTransport; + schema?: PivotSchema; + } + + interface PivotTupleModel { + children: PivotTupleModel[]; + caption?: string; + name: string; + levelName?: string; + levelNum: number; + hasChildren?: boolean; + hierarchy?: string; + } + + interface PivotSchemaRowAxis { + tuples: PivotTupleModel[]; + } + + interface PivotSchemaColumnAxis { + tuples: PivotTupleModel[]; + } + + interface PivotSchemaAxes { + rows: PivotSchemaRowAxis; + columns: PivotSchemaColumnAxis; + } + + interface PivotSchema extends DataSourceSchema{ + axes?: any; + catalogs?: any; + cubes?: any; + data?: any; + dimensions?: any; + hierarchies?: any; + levels?: any; + measures?: any; + } + + class PivotDataSource extends DataSource { + axes(): PivotSchemaAxes; + constructor(options?: PivotDataSourceOptions); + init(options?: PivotDataSourceOptions): void; + catalog(val: string): void; + columns(val: string[]): string[]; + cube(val: string): void; + discover(options: PivotDiscoverRequestOptions): JQueryPromise; + measures(val: string[]): string[]; + measuresAxis(): string; + rows(val: string[]): string[]; + schemaCatalogs(): JQueryPromise; + schemaCubes(): JQueryPromise; + schemaDimensions(): JQueryPromise; + schemaHierarchies(): JQueryPromise; + schemaLevels(): JQueryPromise; + schemaMeasures(): JQueryPromise; + } + + interface DataSourceTransport { + parameterMap?(data: DataSourceTransportParameterMapData, type: string): any; + create?: DataSourceTransportCreate; + destroy?: DataSourceTransportDestroy; + push?: Function; + read?: DataSourceTransportRead; + signalr?: DataSourceTransportSignalr; + update?: DataSourceTransportUpdate; + } + + interface DataSourceTransportSignalrClient { + create?: string; + destroy?: string; + read?: string; + update?: string; + } + + interface DataSourceTransportSignalrServer { + create?: string; + destroy?: string; + read?: string; + update?: string; + } + + interface DataSourceTransportSignalr { + client?: DataSourceTransportSignalrClient; + hub?: any; + promise?: any; + server?: DataSourceTransportSignalrServer; + } + + + interface DataSourceParameterMapDataAggregate { + field?: string; + aggregate?: string; + } + + interface DataSourceParameterMapDataGroup { + aggregate?: DataSourceParameterMapDataAggregate[]; + field?: string; + dir?: string; + } + + interface DataSourceParameterMapDataFilter { + field?: string; + filters?: DataSourceParameterMapDataFilter[]; + logic?: string; + operator?: string; + value?: any; + } + + interface DataSourceParameterMapDataSort { + field?: string; + dir?: string; + } + + interface DataSourceTransportParameterMapData { + aggregate?: DataSourceParameterMapDataAggregate[]; + group?: DataSourceParameterMapDataGroup[]; + filter?: DataSourceParameterMapDataFilter; + models?: Model[]; + page?: number; + pageSize?: number; + skip?: number; + sort?: DataSourceParameterMapDataSort[]; + take?: number; + } + + interface DataSourceSchema { + model?: any; + } + + interface DataSourceSchemaWithOptionsModel extends DataSourceSchema { + model?: DataSourceSchemaModel; + } + + interface DataSourceSchemaWithConstructorModel extends DataSourceSchema { + model?: typeof Model; + } + + interface DataSourceSchemaModel { + id?: string; + fields?: any; + } + + interface DataSourceSchemaModelWithFieldsArray extends DataSourceSchemaModel { + fields?: DataSourceSchemaModelField[]; + } + + interface DataSourceSchemaModelWithFieldsObject extends DataSourceSchemaModel { + fields?: DataSourceSchemaModelFields; + } + + interface DataSourceSchemaModelFields { + [index: string]: DataSourceSchemaModelField; + } + + interface DataSourceSchemaModelField { + field?: string; + from?: string; + defaultValue?: any; + editable?: boolean; + nullable?: boolean; + parse?: Function; + type?: string; + validation?: DataSourceSchemaModelFieldValidation; + } + + interface DataSourceSchemaModelFieldValidation { + required?: boolean; + min?: any; + max?: any; + } + + class ObservableArray extends Observable { + constructor(array: any[]); + init(array: any[]): void; + [index: number]: any; + + empty(): void; + every(callback: (item: Object, index: number, source: ObservableArray) => boolean): boolean; + filter(callback: (item: Object, index: number, source: ObservableArray) => boolean): any[]; + find(callback: (item: Object, index: number, source: ObservableArray) => boolean): any; + forEach(callback: (item: Object, index: number, source: ObservableArray) => void ): void; + indexOf(item: any): number; + join(separator: string): string; + length: number; + map(callback: (item: Object, index: number, source: ObservableArray) => any): any[]; + parent(): ObservableObject; + pop(): ObservableObject; + push(...items: any[]): number; + remove(item: Object): void; + shift(): any; + slice(begin: number, end?: number): any[]; + some(callback: (item: Object, index: number, source: ObservableArray) => boolean): boolean; + splice(start: number): any[]; + splice(start: number, deleteCount: number, ...items: any[]): any[]; + toJSON(): any[]; + unshift(...items: any[]): number; + wrap(object: Object, parent: Object): any; + wrapAll(source: Object, target: Object): any; + } + + interface ObservableArrayEvent { + field?: string; + action?: string; + index?: number; + items?: kendo.data.Model[]; + } + + class DataSource extends Observable{ + constructor(options?: DataSourceOptions); + init(options?: DataSourceOptions): void; + static create(options?: DataSourceOptions): DataSource; + options: DataSourceOptions; + add(model: Object): kendo.data.Model; + add(model: kendo.data.Model): kendo.data.Model; + aggregate(val: any): void; + aggregate(): any; + aggregates(): any; + at(index: number): kendo.data.ObservableObject; + cancelChanges(model?: kendo.data.Model): void; + data(): kendo.data.ObservableArray; + data(value: any): void; + fetch(callback?: Function): JQueryPromise; + filter(filters: DataSourceFilterItem): void; + filter(filters: DataSourceFilterItem[]): void; + filter(filters: DataSourceFilters): void; + filter(): DataSourceFilters; + get(id: any): kendo.data.Model; + getByUid(uid: string): kendo.data.Model; + group(groups: any): void; + group(): any; + hasChanges(): boolean; + indexOf(value: kendo.data.ObservableObject): number; + insert(index: number, model: kendo.data.Model): kendo.data.Model; + insert(index: number, model: Object): kendo.data.Model; + online(value: boolean): void; + online(): boolean; + offlineData(data: any[]): void; + offlineData(): any[]; + page(): number; + page(page: number): void; + pageSize(): number; + pageSize(size: number): void; + query(options?: any): JQueryPromise; + read(data?: any): JQueryPromise; + remove(model: kendo.data.ObservableObject): void; + sort(sort: DataSourceSortItem): void; + sort(sort: DataSourceSortItem[]): void; + sort(): DataSourceSortItem[]; + sync(): JQueryPromise; + total(): number; + totalPages(): number; + view(): kendo.data.ObservableArray; + } + + interface DataSourceAggregateItem { + field?: string; + aggregate?: string; + } + + interface DataSourceFilter { + } + + interface DataSourceFilterItem extends DataSourceFilter { + operator?: string; + field?: string; + value?: any; + } + + interface DataSourceFilters extends DataSourceFilter { + logic?: string; + filters?: DataSourceFilter[]; + } + + interface DataSourceGroupItemAggregate { + field?: string; + aggregate?: string; + } + + interface DataSourceGroupItem { + field?: string; + dir?: string; + aggregates?: DataSourceGroupItemAggregate[]; + } + + interface DataSourceSchema { + aggregates?: any; + data?: any; + errors?: any; + groups?: any; + parse?: Function; + total?: any; + type?: string; + } + + interface DataSourceSortItem { + field?: string; + dir?: string; + } + + interface DataSourceTransportCreate { + cache?: boolean; + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface DataSourceTransportDestroy { + cache?: boolean; + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface DataSourceTransportRead { + cache?: boolean; + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface DataSourceTransportUpdate { + cache?: boolean; + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface DataSourceTransportWithObjectOperations extends DataSourceTransport { + create?: DataSourceTransportCreate; + destroy?: DataSourceTransportDestroy; + read?: DataSourceTransportRead; + update?: DataSourceTransportUpdate; + } + + interface DataSourceTransportWithFunctionOperations extends DataSourceTransport { + create?: (options: DataSourceTransportOptions) => void; + destroy?: (options: DataSourceTransportOptions) => void; + read?: (options: DataSourceTransportReadOptions) => void; + update?: (options: DataSourceTransportOptions) => void; + } + + interface DataSourceTransportOptions { + success: (data?: any) => void; + error: (error?: any) => void; + data: any; + } + + interface DataSourceTransportReadOptionsData { + sort?: DataSourceSortItem[]; + filter?: DataSourceFilters; + group?: DataSourceGroupItem[]; + take?: number; + skip?: number; + } + + interface DataSourceTransportReadOptions extends DataSourceTransportOptions { + data: DataSourceTransportReadOptionsData; + } + + interface DataSourceTransportBatchOptionsData { + models: any[]; + } + + interface DataSourceTransportBatchOptions extends DataSourceTransportOptions { + data: DataSourceTransportBatchOptionsData; + } + + interface DataSourceOptions { + aggregate?: DataSourceAggregateItem[]; + autoSync?: boolean; + batch?: boolean; + data?: any; + filter?: any; + group?: DataSourceGroupItem[]; + offlineStorage?: any; + page?: number; + pageSize?: number; + schema?: DataSourceSchema; + serverAggregates?: boolean; + serverFiltering?: boolean; + serverGrouping?: boolean; + serverPaging?: boolean; + serverSorting?: boolean; + sort?: any; + transport?: DataSourceTransport; + type?: string; + change? (e: DataSourceChangeEvent): void; + error?(e: DataSourceErrorEvent): void; + sync?(e: DataSourceEvent): void; + requestStart?(e: DataSourceRequestStartEvent): void; + requestEnd?(e: DataSourceRequestEndEvent): void; + } + + interface DataSourceEvent { + sender?: DataSource; + } + + interface DataSourceItemOrGroup { + } + + interface DataSourceGroup extends DataSourceItemOrGroup { + aggregates: any[]; + field: string; + hasSubgroups: boolean; + items: DataSourceItemOrGroup[]; + value: any; + } + + interface DataSourceChangeEvent extends DataSourceEvent { + field?: string; + value?: Model; + action?: string; + index?: number; + items?: DataSourceItemOrGroup[]; + node?: any; + } + + interface DataSourceErrorEvent extends DataSourceEvent { + xhr: JQueryXHR; + status: string; + errorThrown: any; + errors?: any; + } + + interface DataSourceRequestStartEvent extends DataSourceEvent { + type?: string; + } + + interface DataSourceRequestEndEvent extends DataSourceEvent { + response?: any; + type?: string; + } +} + +declare module kendo.data.transports { + var odata : DataSourceTransport; +} + +declare module kendo.ui { + function progress(container: JQuery, toggle: boolean): void; + + class Widget extends Observable { + static fn: Widget; + static extend(prototype: Object): Widget; + + constructor(element: Element, options?: Object); + constructor(element: JQuery, options?: Object); + constructor(selector: String, options?: Object); + init(element: Element, options?: Object): void; + init(element: JQuery, options?: Object): void; + init(selector: String, options?: Object): void; + destroy(): void; + element: JQuery; + setOptions(options: Object): void; + resize(force?: boolean): void; + options: Object; + events: string[]; + } + + function plugin(widget: typeof kendo.ui.Widget, register?: typeof kendo.ui, prefix?: String): void; + function plugin(widget: any, register?: typeof kendo.ui, prefix?: String): void; + function plugin(widget: typeof kendo.ui.Widget, register?: typeof kendo.mobile.ui, prefix?: String): void; + function plugin(widget: any, register?: typeof kendo.mobile.ui, prefix?: String): void; + function plugin(widget: typeof kendo.ui.Widget, register?: typeof kendo.dataviz.ui, prefix?: String): void; + function plugin(widget: any, register?: typeof kendo.dataviz.ui, prefix?: String): void; + + class Draggable extends kendo.ui.Widget{ + element: JQuery; + currentTarget: JQuery; + constructor(element: Element, options?: DraggableOptions); + options: DraggableOptions; + } + + interface DraggableEvent { + sender?: Draggable; + } + + class DropTarget extends kendo.ui.Widget{ + element: JQuery; + constructor(element: Element, options?: DropTargetOptions); + options: DropTargetOptions; + static destroyGroup(groupName: string): void; + } + + interface DropTargetOptions { + group?: string; + dragenter?(e: DropTargetDragenterEvent): void; + dragleave?(e: DropTargetDragleaveEvent): void; + drop?(e: DropTargetDropEvent): void; + } + + interface DropTargetEvent { + sender?: DropTarget; + } + + interface DropTargetDragenterEvent extends DropTargetEvent { + draggable?: kendo.ui.Draggable; + } + + interface DropTargetDragleaveEvent extends DropTargetEvent { + draggable?: kendo.ui.Draggable; + } + + interface DropTargetDropEvent extends DropTargetEvent { + draggable?: kendo.ui.Draggable; + } + + class DropTargetArea extends kendo.ui.Widget{ + element: JQuery; + constructor(element: Element, options?: DropTargetAreaOptions); + options: DropTargetAreaOptions; + } + + interface DropTargetAreaOptions { + group?: string; + filter?: string; + dragenter?(e: DropTargetAreaDragenterEvent): void; + dragleave?(e: DropTargetAreaDragleaveEvent): void; + drop?(e: DropTargetAreaDropEvent): void; + } + + interface DropTargetAreaEvent { + sender: DropTargetArea; + } + + interface DropTargetAreaDragenterEvent extends DropTargetAreaEvent { + draggable?: JQuery; + dropTarget?: JQuery; + } + + interface DropTargetAreaDragleaveEvent extends DropTargetAreaEvent { + draggable?: JQuery; + dropTarget?: JQuery; + } + + interface DropTargetAreaDropEvent extends DropTargetAreaEvent { + draggable?: kendo.ui.Draggable; + dropTarget?: JQuery; + } + + interface DraggableOptions { + axis?: string; + container?: JQuery; + cursorOffset?: any; + distance?: number; + filter?: string; + group?: string; + hint?: Function; + ignore?: string; + drag?(e: DraggableEvent): void; + dragcancel?(e: DraggableEvent): void; + dragend?(e: DraggableEvent): void; + dragstart?(e: DraggableEvent): void; + } + + interface GridColumnEditorOptions { + field?: string; + format?: string; + model?: kendo.data.Model; + values?: any[]; + } + + interface GridColumn { + editor?(container: JQuery, options: GridColumnEditorOptions): void; + } +} + +declare module kendo.mobile { + function init(selector: string): void; + function init(element: JQuery): void; + function init(element: Element): void; + + class Application extends Observable { + constructor(element?: any, options?: ApplicationOptions); + init(element?: any, options?: ApplicationOptions): void; + options: ApplicationOptions; + hideLoading(): void; + navigate(url: string, transition?: string): void; + scroller(): kendo.mobile.ui.Scroller; + showLoading(): void; + view(): kendo.mobile.ui.View; + router: kendo.Router; + pane: kendo.mobile.ui.Pane; + } + + interface ApplicationOptions { + hideAddressBar?: boolean; + updateDocumentTitle?: boolean; + initial?: string; + layout?: string; + loading?: string; + platform?: string; + serverNavigation?: boolean; + transition?: string; + } + + interface ApplicationEvent { + sender: Application; + } +} + +declare module kendo.mobile.ui { + + class Widget extends kendo.ui.Widget { + } + + interface TouchAxis { + location?: number; + startLocation?: number; + client?: number; + delta?: number; + velocity?: number; + } + + interface TouchEventOptions { + target?: JQuery; + x?: TouchAxis; + y?: TouchAxis; + } + + interface Point { + x?: number; + y?: number; + } +} +declare module kendo.dataviz.ui { + function registerTheme(name: string, options: any): void; + + function plugin(widget: typeof kendo.ui.Widget): void; + function plugin(widget: any): void; +} + +declare module kendo.dataviz.map { + class Marker { + } +} + +declare module kendo.dataviz.map.layer { + class Shape { + } +} + +declare module kendo.drawing { + class Arc extends kendo.drawing.Element { + constructor(options?: ArcOptions); + options: ArcOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Arc; + geometry(value: kendo.geometry.Arc): void; + fill(color: string, opacity?: number): kendo.drawing.Arc; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Arc; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ArcOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ArcEvent { + sender: Arc; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Circle extends kendo.drawing.Element { + constructor(options?: CircleOptions); + options: CircleOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Circle; + geometry(value: kendo.geometry.Circle): void; + fill(color: string, opacity?: number): kendo.drawing.Circle; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Circle; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface CircleOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Element extends kendo.Class { + constructor(options?: ElementOptions); + options: ElementOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ElementOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ElementEvent { + sender: Element; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface FillOptions { + color: string; + opacity: number; + } + + + + class Gradient extends kendo.Class { + constructor(options?: GradientOptions); + options: GradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface GradientOptions { + name?: string; + stops?: any; + } + interface GradientEvent { + sender: Gradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class GradientStop extends kendo.Class { + constructor(options?: GradientStopOptions); + options: GradientStopOptions; + } + + interface GradientStopOptions { + name?: string; + offset?: number; + color?: string; + opacity?: number; + } + interface GradientStopEvent { + sender: GradientStop; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Group extends kendo.drawing.Element { + constructor(options?: GroupOptions); + options: GroupOptions; + append(element: kendo.drawing.Element): void; + clear(): void; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + remove(element: kendo.drawing.Element): void; + removeAt(index: number): void; + visible(): boolean; + visible(visible: boolean): void; + children: any; + } + + interface GroupOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + pdf?: kendo.drawing.PDFOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface GroupEvent { + sender: Group; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Image extends kendo.drawing.Element { + constructor(options?: ImageOptions); + options: ImageOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + src(): string; + src(value: string): void; + rect(): kendo.geometry.Rect; + rect(value: kendo.geometry.Rect): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ImageOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ImageEvent { + sender: Image; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Layout extends kendo.drawing.Group { + constructor(options?: LayoutOptions); + options: LayoutOptions; + rect(): kendo.geometry.Rect; + rect(rect: kendo.geometry.Rect): void; + reflow(): void; + } + + interface LayoutOptions { + name?: string; + alignContent?: string; + alignItems?: string; + justifyContent?: string; + lineSpacing?: number; + spacing?: number; + orientation?: string; + wrap?: boolean; + } + interface LayoutEvent { + sender: Layout; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class LinearGradient extends kendo.drawing.Gradient { + constructor(options?: LinearGradientOptions); + options: LinearGradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + end(): kendo.geometry.Point; + end(end: any): void; + end(end: kendo.geometry.Point): void; + start(): kendo.geometry.Point; + start(start: any): void; + start(start: kendo.geometry.Point): void; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface LinearGradientOptions { + name?: string; + stops?: any; + } + interface LinearGradientEvent { + sender: LinearGradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class MultiPath extends kendo.drawing.Element { + constructor(options?: MultiPathOptions); + options: MultiPathOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: any): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: kendo.geometry.Point): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: any): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point): kendo.drawing.MultiPath; + fill(color: string, opacity?: number): kendo.drawing.MultiPath; + lineTo(x: number, y?: number): kendo.drawing.MultiPath; + lineTo(x: any, y?: number): kendo.drawing.MultiPath; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + moveTo(x: number, y?: number): kendo.drawing.MultiPath; + moveTo(x: any, y?: number): kendo.drawing.MultiPath; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.MultiPath; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + paths: any; + } + + interface MultiPathOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface MultiPathEvent { + sender: MultiPath; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class OptionsStore extends kendo.Class { + options: OptionsStoreOptions; + get(field: string): any; + set(field: string, value: any): void; + observer: any; + } + + interface OptionsStoreOptions { + name?: string; + } + interface OptionsStoreEvent { + sender: OptionsStore; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface PDFOptions { + creator: string; + date: Date; + keywords: string; + landscape: boolean; + margin: any; + paperSize: any; + subject: string; + title: string; + } + + + + class Path extends kendo.drawing.Element { + constructor(options?: PathOptions); + options: PathOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: any): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: kendo.geometry.Point): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: any): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point): kendo.drawing.Path; + fill(color: string, opacity?: number): kendo.drawing.Path; + lineTo(x: number, y?: number): kendo.drawing.Path; + lineTo(x: any, y?: number): kendo.drawing.Path; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + moveTo(x: number, y?: number): kendo.drawing.Path; + moveTo(x: any, y?: number): kendo.drawing.Path; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Path; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + static fromPoints(points: any): kendo.drawing.Path; + static fromRect(rect: kendo.geometry.Rect): kendo.drawing.Path; + static parse(svgPath: string, options?: any): kendo.drawing.Path; + segments: any; + } + + interface PathOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface PathEvent { + sender: Path; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class RadialGradient extends kendo.drawing.Gradient { + constructor(options?: RadialGradientOptions); + options: RadialGradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + center(): kendo.geometry.Point; + center(center: any): void; + center(center: kendo.geometry.Point): void; + radius(): number; + radius(value: number): void; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface RadialGradientOptions { + name?: string; + center?: any; + radius?: number; + stops?: any; + } + interface RadialGradientEvent { + sender: RadialGradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Segment extends kendo.Class { + options: SegmentOptions; + anchor(): kendo.geometry.Point; + anchor(value: kendo.geometry.Point): void; + controlIn(): kendo.geometry.Point; + controlIn(value: kendo.geometry.Point): void; + controlOut(): kendo.geometry.Point; + controlOut(value: kendo.geometry.Point): void; + } + + interface SegmentOptions { + name?: string; + } + interface SegmentEvent { + sender: Segment; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface StrokeOptions { + color: string; + dashType: string; + lineCap: string; + lineJoin: string; + opacity: number; + width: number; + } + + + + class Surface extends kendo.Observable { + constructor(options?: SurfaceOptions); + options: SurfaceOptions; + clear(): void; + draw(element: kendo.drawing.Element): void; + eventTarget(e: any): kendo.drawing.Element; + resize(force?: boolean): void; + static create(element: JQuery, options?: any): kendo.drawing.Surface; + static create(element: Element, options?: any): kendo.drawing.Surface; + } + + interface SurfaceOptions { + name?: string; + type?: string; + height?: string; + width?: string; + click?(e: SurfaceClickEvent): void; + mouseenter?(e: SurfaceMouseenterEvent): void; + mouseleave?(e: SurfaceMouseleaveEvent): void; + } + interface SurfaceEvent { + sender: Surface; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SurfaceClickEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseenterEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseleaveEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + + class Text extends kendo.drawing.Element { + constructor(options?: TextOptions); + options: TextOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + content(): string; + content(value: string): void; + fill(color: string, opacity?: number): kendo.drawing.Text; + opacity(): number; + opacity(opacity: number): void; + position(): kendo.geometry.Point; + position(value: kendo.geometry.Point): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Text; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface TextOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + font?: string; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface TextEvent { + sender: Text; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo.geometry { + class Arc extends Observable { + options: ArcOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + getAnticlockwise(): boolean; + getCenter(): kendo.geometry.Point; + getEndAngle(): number; + getRadiusX(): number; + getRadiusY(): number; + getStartAngle(): number; + pointAt(angle: number): kendo.geometry.Point; + setAnticlockwise(value: boolean): kendo.geometry.Arc; + setCenter(value: kendo.geometry.Point): kendo.geometry.Arc; + setEndAngle(value: number): kendo.geometry.Arc; + setRadiusX(value: number): kendo.geometry.Arc; + setRadiusY(value: number): kendo.geometry.Arc; + setStartAngle(value: number): kendo.geometry.Arc; + anticlockwise: boolean; + center: kendo.geometry.Point; + endAngle: number; + radiusX: number; + radiusY: number; + startAngle: number; + } + + interface ArcOptions { + name?: string; + } + interface ArcEvent { + sender: Arc; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Circle extends Observable { + options: CircleOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + clone(): kendo.geometry.Circle; + equals(other: kendo.geometry.Circle): boolean; + getCenter(): kendo.geometry.Point; + getRadius(): number; + pointAt(angle: number): kendo.geometry.Point; + setCenter(value: kendo.geometry.Point): kendo.geometry.Point; + setCenter(value: any): kendo.geometry.Point; + setRadius(value: number): kendo.geometry.Circle; + center: kendo.geometry.Point; + radius: number; + } + + interface CircleOptions { + name?: string; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Matrix extends Observable { + options: MatrixOptions; + clone(): kendo.geometry.Matrix; + equals(other: kendo.geometry.Matrix): boolean; + round(digits: number): kendo.geometry.Matrix; + multiplyCopy(matrix: kendo.geometry.Matrix): kendo.geometry.Matrix; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + static rotate(angle: number, x: number, y: number): kendo.geometry.Matrix; + static scale(scaleX: number, scaleY: number): kendo.geometry.Matrix; + static translate(x: number, y: number): kendo.geometry.Matrix; + static unit(): kendo.geometry.Matrix; + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + } + + interface MatrixOptions { + name?: string; + } + interface MatrixEvent { + sender: Matrix; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Point extends Observable { + options: PointOptions; + clone(): kendo.geometry.Point; + distanceTo(point: kendo.geometry.Point): number; + equals(other: kendo.geometry.Point): boolean; + getX(): number; + getY(): number; + move(x: number, y: number): kendo.geometry.Point; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Point; + rotate(angle: number, center: any): kendo.geometry.Point; + round(digits: number): kendo.geometry.Point; + scale(scaleX: number, scaleY: number): kendo.geometry.Point; + scaleCopy(scaleX: number, scaleY: number): kendo.geometry.Point; + setX(value: number): kendo.geometry.Point; + setY(value: number): kendo.geometry.Point; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + transform(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + transformCopy(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + translate(dx: number, dy: number): kendo.geometry.Point; + translateWith(vector: kendo.geometry.Point): kendo.geometry.Point; + translateWith(vector: any): kendo.geometry.Point; + static create(x: number, y: number): kendo.geometry.Point; + static create(x: any, y: number): kendo.geometry.Point; + static create(x: kendo.geometry.Point, y: number): kendo.geometry.Point; + static min(): kendo.geometry.Point; + static max(): kendo.geometry.Point; + static minPoint(): kendo.geometry.Point; + static maxPoint(): kendo.geometry.Point; + x: number; + y: number; + } + + interface PointOptions { + name?: string; + } + interface PointEvent { + sender: Point; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Rect extends Observable { + options: RectOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + bottomLeft(): kendo.geometry.Point; + bottomRight(): kendo.geometry.Point; + center(): kendo.geometry.Point; + clone(): kendo.geometry.Rect; + equals(other: kendo.geometry.Rect): boolean; + getOrigin(): kendo.geometry.Point; + getSize(): kendo.geometry.Size; + height(): number; + setOrigin(value: kendo.geometry.Point): kendo.geometry.Rect; + setOrigin(value: any): kendo.geometry.Rect; + setSize(value: kendo.geometry.Size): kendo.geometry.Rect; + setSize(value: any): kendo.geometry.Rect; + topLeft(): kendo.geometry.Point; + topRight(): kendo.geometry.Point; + width(): number; + static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; + static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; + origin: kendo.geometry.Point; + size: kendo.geometry.Size; + } + + interface RectOptions { + name?: string; + } + interface RectEvent { + sender: Rect; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Size extends Observable { + options: SizeOptions; + clone(): kendo.geometry.Size; + equals(other: kendo.geometry.Size): boolean; + getWidth(): number; + getHeight(): number; + setWidth(value: number): kendo.geometry.Size; + setHeight(value: number): kendo.geometry.Size; + static create(width: number, height: number): kendo.geometry.Size; + static create(width: any, height: number): kendo.geometry.Size; + static create(width: kendo.geometry.Size, height: number): kendo.geometry.Size; + width: number; + height: number; + } + + interface SizeOptions { + name?: string; + } + interface SizeEvent { + sender: Size; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Transformation extends Observable { + options: TransformationOptions; + clone(): kendo.geometry.Transformation; + equals(other: kendo.geometry.Transformation): boolean; + matrix(): kendo.geometry.Matrix; + multiply(transformation: kendo.geometry.Transformation): kendo.geometry.Transformation; + rotate(angle: number, center: any): kendo.geometry.Transformation; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Transformation; + scale(scaleX: number, scaleY: number): kendo.geometry.Transformation; + translate(x: number, y: number): kendo.geometry.Transformation; + } + + interface TransformationOptions { + name?: string; + } + interface TransformationEvent { + sender: Transformation; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo.ui { + class AutoComplete extends kendo.ui.Widget { + static fn: AutoComplete; + static extend(proto: Object): AutoComplete; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: AutoCompleteOptions); + options: AutoCompleteOptions; + dataSource: kendo.data.DataSource; + close(): void; + dataItem(index: number): any; + destroy(): void; + enable(enable: boolean): void; + focus(): void; + readonly(readonly: boolean): void; + refresh(): void; + search(word: string): void; + select(item: string): void; + select(item: Element): void; + select(item: JQuery): void; + setDataSource(dataSource: kendo.data.DataSource): void; + suggest(value: string): void; + value(): string; + value(value: string): void; + list: JQuery; + ul: JQuery; + } + + interface AutoCompleteAnimationClose { + duration?: number; + effects?: string; + } + + interface AutoCompleteAnimationOpen { + duration?: number; + effects?: string; + } + + interface AutoCompleteAnimation { + close?: AutoCompleteAnimationClose; + open?: AutoCompleteAnimationOpen; + } + + interface AutoCompleteVirtual { + itemHeight?: number; + valueMapper?: Function; + } + + interface AutoCompleteOptions { + name?: string; + animation?: AutoCompleteAnimation; + dataSource?: any; + dataTextField?: string; + delay?: number; + enable?: boolean; + filter?: string; + fixedGroupTemplate?: any; + groupTemplate?: any; + height?: number; + highlightFirst?: boolean; + ignoreCase?: boolean; + minLength?: number; + placeholder?: string; + separator?: string; + suggest?: boolean; + headerTemplate?: any; + template?: any; + valuePrimitive?: boolean; + virtual?: AutoCompleteVirtual; + change?(e: AutoCompleteChangeEvent): void; + close?(e: AutoCompleteCloseEvent): void; + dataBound?(e: AutoCompleteDataBoundEvent): void; + filtering?(e: AutoCompleteFilteringEvent): void; + open?(e: AutoCompleteOpenEvent): void; + select?(e: AutoCompleteSelectEvent): void; + } + interface AutoCompleteEvent { + sender: AutoComplete; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface AutoCompleteChangeEvent extends AutoCompleteEvent { + } + + interface AutoCompleteCloseEvent extends AutoCompleteEvent { + } + + interface AutoCompleteDataBoundEvent extends AutoCompleteEvent { + } + + interface AutoCompleteFilteringEvent extends AutoCompleteEvent { + filter?: any; + } + + interface AutoCompleteOpenEvent extends AutoCompleteEvent { + } + + interface AutoCompleteSelectEvent extends AutoCompleteEvent { + item?: JQuery; + } + + + class Button extends kendo.ui.Widget { + static fn: Button; + static extend(proto: Object): Button; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ButtonOptions); + options: ButtonOptions; + enable(toggle: boolean): void; + } + + interface ButtonOptions { + name?: string; + enable?: boolean; + icon?: string; + imageUrl?: string; + spriteCssClass?: string; + click?(e: ButtonClickEvent): void; + } + interface ButtonEvent { + sender: Button; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ButtonClickEvent extends ButtonEvent { + event?: any; + } + + + class Calendar extends kendo.ui.Widget { + static fn: Calendar; + static extend(proto: Object): Calendar; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: CalendarOptions); + options: CalendarOptions; + current(): Date; + destroy(): void; + max(): Date; + max(value: Date): void; + max(value: string): void; + min(): Date; + min(value: Date): void; + min(value: string): void; + navigate(value: Date, view: string): void; + navigateDown(value: Date): void; + navigateToFuture(): void; + navigateToPast(): void; + navigateUp(): void; + value(): Date; + value(value: Date): void; + value(value: string): void; + view(): any; + } + + interface CalendarMonth { + content?: string; + empty?: string; + } + + interface CalendarOptions { + name?: string; + culture?: string; + dates?: any; + depth?: string; + footer?: any; + format?: string; + max?: Date; + min?: Date; + month?: CalendarMonth; + start?: string; + value?: Date; + change?(e: CalendarEvent): void; + navigate?(e: CalendarEvent): void; + } + interface CalendarEvent { + sender: Calendar; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class ColorPalette extends kendo.ui.Widget { + static fn: ColorPalette; + static extend(proto: Object): ColorPalette; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ColorPaletteOptions); + options: ColorPaletteOptions; + value(): string; + value(color?: string): void; + color(): kendo.Color; + color(color?: kendo.Color): void; + enable(enable?: boolean): void; + } + + interface ColorPaletteTileSize { + width?: number; + height?: number; + } + + interface ColorPaletteOptions { + name?: string; + palette?: any; + columns?: number; + tileSize?: ColorPaletteTileSize; + value?: string; + change?(e: ColorPaletteEvent): void; + } + interface ColorPaletteEvent { + sender: ColorPalette; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class ColorPicker extends kendo.ui.Widget { + static fn: ColorPicker; + static extend(proto: Object): ColorPicker; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ColorPickerOptions); + options: ColorPickerOptions; + close(): void; + open(): void; + toggle(): void; + value(): string; + value(color?: string): void; + color(): kendo.Color; + color(color?: kendo.Color): void; + enable(enable?: boolean): void; + } + + interface ColorPickerMessages { + apply?: string; + cancel?: string; + } + + interface ColorPickerTileSize { + width?: number; + height?: number; + } + + interface ColorPickerOptions { + name?: string; + buttons?: boolean; + columns?: number; + tileSize?: ColorPickerTileSize; + messages?: ColorPickerMessages; + palette?: any; + opacity?: boolean; + preview?: boolean; + toolIcon?: string; + value?: string; + change?(e: ColorPickerChangeEvent): void; + select?(e: ColorPickerSelectEvent): void; + open?(e: ColorPickerEvent): void; + close?(e: ColorPickerEvent): void; + } + interface ColorPickerEvent { + sender: ColorPicker; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ColorPickerChangeEvent extends ColorPickerEvent { + value?: string; + } + + interface ColorPickerSelectEvent extends ColorPickerEvent { + value?: string; + } + + + class ComboBox extends kendo.ui.Widget { + static fn: ComboBox; + static extend(proto: Object): ComboBox; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ComboBoxOptions); + options: ComboBoxOptions; + dataSource: kendo.data.DataSource; + close(): void; + dataItem(index?: number): any; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + focus(): void; + open(): void; + refresh(): void; + search(word: string): void; + select(): number; + select(li: JQuery): void; + select(li: number): void; + select(li: Function): void; + setDataSource(dataSource: kendo.data.DataSource): void; + suggest(value: string): void; + text(): string; + text(text: string): void; + toggle(toggle: boolean): void; + value(): string; + value(value: string): void; + input: JQuery; + list: JQuery; + ul: JQuery; + } + + interface ComboBoxAnimationClose { + effects?: string; + duration?: number; + } + + interface ComboBoxAnimationOpen { + effects?: string; + duration?: number; + } + + interface ComboBoxAnimation { + close?: ComboBoxAnimationClose; + open?: ComboBoxAnimationOpen; + } + + interface ComboBoxVirtual { + itemHeight?: number; + valueMapper?: Function; + } + + interface ComboBoxOptions { + name?: string; + animation?: ComboBoxAnimation; + autoBind?: boolean; + cascadeFrom?: string; + cascadeFromField?: string; + dataSource?: any; + dataTextField?: string; + dataValueField?: string; + delay?: number; + enable?: boolean; + filter?: string; + fixedGroupTemplate?: any; + groupTemplate?: any; + height?: number; + highlightFirst?: boolean; + ignoreCase?: string; + index?: number; + minLength?: number; + placeholder?: string; + suggest?: boolean; + headerTemplate?: any; + template?: any; + text?: string; + value?: string; + valuePrimitive?: boolean; + virtual?: ComboBoxVirtual; + change?(e: ComboBoxChangeEvent): void; + close?(e: ComboBoxCloseEvent): void; + dataBound?(e: ComboBoxDataBoundEvent): void; + filtering?(e: ComboBoxFilteringEvent): void; + open?(e: ComboBoxOpenEvent): void; + select?(e: ComboBoxSelectEvent): void; + cascade?(e: ComboBoxCascadeEvent): void; + } + interface ComboBoxEvent { + sender: ComboBox; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ComboBoxChangeEvent extends ComboBoxEvent { + } + + interface ComboBoxCloseEvent extends ComboBoxEvent { + } + + interface ComboBoxDataBoundEvent extends ComboBoxEvent { + } + + interface ComboBoxFilteringEvent extends ComboBoxEvent { + filter?: any; + } + + interface ComboBoxOpenEvent extends ComboBoxEvent { + } + + interface ComboBoxSelectEvent extends ComboBoxEvent { + item?: JQuery; + } + + interface ComboBoxCascadeEvent extends ComboBoxEvent { + } + + + class ContextMenu extends kendo.ui.Widget { + static fn: ContextMenu; + static extend(proto: Object): ContextMenu; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ContextMenuOptions); + options: ContextMenuOptions; + append(item: any, referenceItem: string): kendo.ui.ContextMenu; + append(item: any, referenceItem: JQuery): kendo.ui.ContextMenu; + close(element: Element): kendo.ui.ContextMenu; + close(element: JQuery): kendo.ui.ContextMenu; + destroy(): void; + enable(element: string, enable: boolean): kendo.ui.ContextMenu; + enable(element: Element, enable: boolean): kendo.ui.ContextMenu; + enable(element: JQuery, enable: boolean): kendo.ui.ContextMenu; + insertAfter(item: string, referenceItem: string): kendo.ui.ContextMenu; + insertAfter(item: string, referenceItem: Element): kendo.ui.ContextMenu; + insertAfter(item: string, referenceItem: JQuery): kendo.ui.ContextMenu; + insertAfter(item: Element, referenceItem: string): kendo.ui.ContextMenu; + insertAfter(item: Element, referenceItem: Element): kendo.ui.ContextMenu; + insertAfter(item: Element, referenceItem: JQuery): kendo.ui.ContextMenu; + insertAfter(item: JQuery, referenceItem: string): kendo.ui.ContextMenu; + insertAfter(item: JQuery, referenceItem: Element): kendo.ui.ContextMenu; + insertAfter(item: JQuery, referenceItem: JQuery): kendo.ui.ContextMenu; + insertBefore(item: string, referenceItem: string): kendo.ui.ContextMenu; + insertBefore(item: string, referenceItem: Element): kendo.ui.ContextMenu; + insertBefore(item: string, referenceItem: JQuery): kendo.ui.ContextMenu; + insertBefore(item: Element, referenceItem: string): kendo.ui.ContextMenu; + insertBefore(item: Element, referenceItem: Element): kendo.ui.ContextMenu; + insertBefore(item: Element, referenceItem: JQuery): kendo.ui.ContextMenu; + insertBefore(item: JQuery, referenceItem: string): kendo.ui.ContextMenu; + insertBefore(item: JQuery, referenceItem: Element): kendo.ui.ContextMenu; + insertBefore(item: JQuery, referenceItem: JQuery): kendo.ui.ContextMenu; + open(x: number, y: number): kendo.ui.ContextMenu; + open(x: Element, y: number): kendo.ui.ContextMenu; + open(x: JQuery, y: number): kendo.ui.ContextMenu; + remove(element: string): kendo.ui.ContextMenu; + remove(element: Element): kendo.ui.ContextMenu; + remove(element: JQuery): kendo.ui.ContextMenu; + } + + interface ContextMenuAnimationClose { + effects?: string; + duration?: number; + } + + interface ContextMenuAnimationOpen { + effects?: string; + duration?: number; + } + + interface ContextMenuAnimation { + close?: ContextMenuAnimationClose; + open?: ContextMenuAnimationOpen; + } + + interface ContextMenuOptions { + name?: string; + alignToAnchor?: boolean; + animation?: ContextMenuAnimation; + closeOnClick?: boolean; + dataSource?: any; + direction?: string; + filter?: string; + hoverDelay?: number; + orientation?: string; + popupCollision?: string; + showOn?: string; + target?: any; + close?(e: ContextMenuCloseEvent): void; + open?(e: ContextMenuOpenEvent): void; + activate?(e: ContextMenuActivateEvent): void; + deactivate?(e: ContextMenuDeactivateEvent): void; + select?(e: ContextMenuSelectEvent): void; + } + interface ContextMenuEvent { + sender: ContextMenu; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ContextMenuCloseEvent extends ContextMenuEvent { + item?: Element; + type?: string; + target?: Element; + event?: JQueryEventObject; + } + + interface ContextMenuOpenEvent extends ContextMenuEvent { + item?: Element; + type?: string; + target?: Element; + event?: JQueryEventObject; + } + + interface ContextMenuActivateEvent extends ContextMenuEvent { + item?: Element; + type?: string; + target?: Element; + } + + interface ContextMenuDeactivateEvent extends ContextMenuEvent { + item?: Element; + type?: string; + target?: Element; + } + + interface ContextMenuSelectEvent extends ContextMenuEvent { + item?: Element; + type?: string; + target?: Element; + } + + + class DatePicker extends kendo.ui.Widget { + static fn: DatePicker; + static extend(proto: Object): DatePicker; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DatePickerOptions); + options: DatePickerOptions; + close(): void; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + max(): Date; + max(value: Date): void; + max(value: string): void; + min(): Date; + min(value: Date): void; + min(value: string): void; + open(): void; + setOptions(options: any): void; + value(): Date; + value(value: Date): void; + value(value: string): void; + } + + interface DatePickerAnimationClose { + effects?: string; + duration?: number; + } + + interface DatePickerAnimationOpen { + effects?: string; + duration?: number; + } + + interface DatePickerAnimation { + close?: DatePickerAnimationClose; + open?: DatePickerAnimationOpen; + } + + interface DatePickerMonth { + content?: string; + empty?: string; + } + + interface DatePickerOptions { + name?: string; + animation?: DatePickerAnimation; + ARIATemplate?: string; + culture?: string; + dates?: any; + depth?: string; + footer?: any; + format?: string; + max?: Date; + min?: Date; + month?: DatePickerMonth; + parseFormats?: any; + start?: string; + value?: Date; + change?(e: DatePickerChangeEvent): void; + close?(e: DatePickerCloseEvent): void; + open?(e: DatePickerOpenEvent): void; + } + interface DatePickerEvent { + sender: DatePicker; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DatePickerChangeEvent extends DatePickerEvent { + } + + interface DatePickerCloseEvent extends DatePickerEvent { + } + + interface DatePickerOpenEvent extends DatePickerEvent { + } + + + class DateTimePicker extends kendo.ui.Widget { + static fn: DateTimePicker; + static extend(proto: Object): DateTimePicker; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DateTimePickerOptions); + options: DateTimePickerOptions; + close(view: string): void; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + max(): Date; + max(value: Date): void; + max(value: string): void; + min(): Date; + min(value: Date): void; + min(value: string): void; + open(view: string): void; + setOptions(options: any): void; + toggle(view: string): void; + value(): Date; + value(value: Date): void; + value(value: string): void; + } + + interface DateTimePickerAnimationClose { + effects?: string; + duration?: number; + } + + interface DateTimePickerAnimationOpen { + effects?: string; + duration?: number; + } + + interface DateTimePickerAnimation { + close?: DateTimePickerAnimationClose; + open?: DateTimePickerAnimationOpen; + } + + interface DateTimePickerMonth { + content?: string; + empty?: string; + } + + interface DateTimePickerOptions { + name?: string; + animation?: DateTimePickerAnimation; + ARIATemplate?: string; + culture?: string; + dates?: any; + depth?: string; + footer?: string; + format?: string; + interval?: number; + max?: Date; + min?: Date; + month?: DateTimePickerMonth; + parseFormats?: any; + start?: string; + timeFormat?: string; + value?: Date; + change?(e: DateTimePickerChangeEvent): void; + close?(e: DateTimePickerCloseEvent): void; + open?(e: DateTimePickerOpenEvent): void; + } + interface DateTimePickerEvent { + sender: DateTimePicker; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DateTimePickerChangeEvent extends DateTimePickerEvent { + } + + interface DateTimePickerCloseEvent extends DateTimePickerEvent { + view?: string; + } + + interface DateTimePickerOpenEvent extends DateTimePickerEvent { + view?: string; + } + + + class DropDownList extends kendo.ui.Widget { + static fn: DropDownList; + static extend(proto: Object): DropDownList; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DropDownListOptions); + options: DropDownListOptions; + dataSource: kendo.data.DataSource; + close(): void; + dataItem(index?: number): any; + destroy(): void; + focus(): void; + open(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + refresh(): void; + search(word: string): void; + select(): number; + select(li: JQuery): void; + select(li: number): void; + select(li: Function): void; + setDataSource(dataSource: kendo.data.DataSource): void; + text(): string; + text(text: string): void; + toggle(toggle: boolean): void; + value(): string; + value(value: string): void; + span: JQuery; + filterInput: JQuery; + list: JQuery; + ul: JQuery; + } + + interface DropDownListAnimationClose { + effects?: string; + duration?: number; + } + + interface DropDownListAnimationOpen { + effects?: string; + duration?: number; + } + + interface DropDownListAnimation { + close?: DropDownListAnimationClose; + open?: DropDownListAnimationOpen; + } + + interface DropDownListVirtual { + itemHeight?: number; + valueMapper?: Function; + } + + interface DropDownListOptions { + name?: string; + animation?: DropDownListAnimation; + autoBind?: boolean; + cascadeFrom?: string; + cascadeFromField?: string; + dataSource?: any; + dataTextField?: string; + dataValueField?: string; + delay?: number; + enable?: boolean; + filter?: string; + fixedGroupTemplate?: any; + groupTemplate?: any; + height?: number; + ignoreCase?: string; + index?: number; + minLength?: number; + optionLabel?: any; + optionLabelTemplate?: any; + headerTemplate?: any; + template?: any; + valueTemplate?: any; + text?: string; + value?: string; + valuePrimitive?: boolean; + virtual?: DropDownListVirtual; + change?(e: DropDownListChangeEvent): void; + close?(e: DropDownListCloseEvent): void; + dataBound?(e: DropDownListDataBoundEvent): void; + filtering?(e: DropDownListFilteringEvent): void; + open?(e: DropDownListOpenEvent): void; + select?(e: DropDownListSelectEvent): void; + cascade?(e: DropDownListCascadeEvent): void; + } + interface DropDownListEvent { + sender: DropDownList; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DropDownListChangeEvent extends DropDownListEvent { + } + + interface DropDownListCloseEvent extends DropDownListEvent { + } + + interface DropDownListDataBoundEvent extends DropDownListEvent { + } + + interface DropDownListFilteringEvent extends DropDownListEvent { + filter?: any; + } + + interface DropDownListOpenEvent extends DropDownListEvent { + } + + interface DropDownListSelectEvent extends DropDownListEvent { + item?: JQuery; + } + + interface DropDownListCascadeEvent extends DropDownListEvent { + } + + + class Editor extends kendo.ui.Widget { + static fn: Editor; + static extend(proto: Object): Editor; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: EditorOptions); + options: EditorOptions; + createRange(document?: Document): Range; + destroy(): void; + encodedValue(): void; + exec(name: string, params: any): void; + focus(): void; + getRange(): Range; + getSelection(): Selection; + paste(html: string, options: any): void; + selectedHtml(): string; + refresh(): void; + saveAsPDF(): JQueryPromise; + selectRange(range: Range): void; + update(): void; + state(toolName: string): boolean; + value(): string; + value(value: string): void; + body: Element; + } + + interface EditorFileBrowserMessages { + uploadFile?: string; + orderBy?: string; + orderByName?: string; + orderBySize?: string; + directoryNotFound?: string; + emptyFolder?: string; + deleteFile?: string; + invalidFileType?: string; + overwriteFile?: string; + search?: string; + } + + interface EditorFileBrowserSchemaModelFieldsName { + field?: string; + parse?: Function; + } + + interface EditorFileBrowserSchemaModelFieldsSize { + field?: string; + parse?: Function; + } + + interface EditorFileBrowserSchemaModelFieldsType { + parse?: Function; + field?: string; + } + + interface EditorFileBrowserSchemaModelFields { + name?: EditorFileBrowserSchemaModelFieldsName; + type?: EditorFileBrowserSchemaModelFieldsType; + size?: EditorFileBrowserSchemaModelFieldsSize; + } + + interface EditorFileBrowserSchemaModel { + id?: string; + fields?: EditorFileBrowserSchemaModelFields; + } + + interface EditorFileBrowserSchema { + } + + interface EditorFileBrowserTransportCreate { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorFileBrowserTransportDestroy { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorFileBrowserTransportRead { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorFileBrowserTransport { + read?: EditorFileBrowserTransportRead; + uploadUrl?: string; + fileUrl?: any; + destroy?: EditorFileBrowserTransportDestroy; + create?: EditorFileBrowserTransportCreate; + } + + interface EditorFileBrowser { + fileTypes?: string; + path?: string; + transport?: EditorFileBrowserTransport; + schema?: EditorFileBrowserSchema; + messages?: EditorFileBrowserMessages; + } + + interface EditorImageBrowserMessages { + uploadFile?: string; + orderBy?: string; + orderByName?: string; + orderBySize?: string; + directoryNotFound?: string; + emptyFolder?: string; + deleteFile?: string; + invalidFileType?: string; + overwriteFile?: string; + search?: string; + } + + interface EditorImageBrowserSchemaModelFieldsName { + field?: string; + parse?: Function; + } + + interface EditorImageBrowserSchemaModelFieldsSize { + field?: string; + parse?: Function; + } + + interface EditorImageBrowserSchemaModelFieldsType { + parse?: Function; + field?: string; + } + + interface EditorImageBrowserSchemaModelFields { + name?: EditorImageBrowserSchemaModelFieldsName; + type?: EditorImageBrowserSchemaModelFieldsType; + size?: EditorImageBrowserSchemaModelFieldsSize; + } + + interface EditorImageBrowserSchemaModel { + id?: string; + fields?: EditorImageBrowserSchemaModelFields; + } + + interface EditorImageBrowserSchema { + } + + interface EditorImageBrowserTransportCreate { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorImageBrowserTransportDestroy { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorImageBrowserTransportRead { + contentType?: string; + data?: any; + dataType?: string; + type?: string; + url?: any; + } + + interface EditorImageBrowserTransport { + read?: EditorImageBrowserTransportRead; + thumbnailUrl?: any; + uploadUrl?: string; + imageUrl?: any; + destroy?: EditorImageBrowserTransportDestroy; + create?: EditorImageBrowserTransportCreate; + } + + interface EditorImageBrowser { + fileTypes?: string; + path?: string; + transport?: EditorImageBrowserTransport; + schema?: EditorImageBrowserSchema; + messages?: EditorImageBrowserMessages; + } + + interface EditorMessages { + bold?: string; + italic?: string; + underline?: string; + strikethrough?: string; + superscript?: string; + subscript?: string; + justifyCenter?: string; + justifyLeft?: string; + justifyRight?: string; + justifyFull?: string; + insertUnorderedList?: string; + insertOrderedList?: string; + indent?: string; + outdent?: string; + createLink?: string; + unlink?: string; + insertImage?: string; + insertFile?: string; + insertHtml?: string; + viewHtml?: string; + fontName?: string; + fontNameInherit?: string; + fontSize?: string; + fontSizeInherit?: string; + formatBlock?: string; + formatting?: string; + foreColor?: string; + backColor?: string; + style?: string; + emptyFolder?: string; + uploadFile?: string; + editAreaTitle?: string; + orderBy?: string; + orderBySize?: string; + orderByName?: string; + invalidFileType?: string; + deleteFile?: string; + overwriteFile?: string; + directoryNotFound?: string; + imageWebAddress?: string; + imageAltText?: string; + imageWidth?: string; + imageHeight?: string; + fileWebAddress?: string; + fileTitle?: string; + linkWebAddress?: string; + linkText?: string; + linkToolTip?: string; + linkOpenInNewWindow?: string; + dialogUpdate?: string; + dialogInsert?: string; + dialogCancel?: string; + createTable?: string; + createTableHint?: string; + addColumnLeft?: string; + addColumnRight?: string; + addRowAbove?: string; + addRowBelow?: string; + deleteRow?: string; + deleteColumn?: string; + } + + interface EditorPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface EditorPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: EditorPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface EditorResizable { + min?: number; + max?: number; + } + + interface EditorSerialization { + entities?: boolean; + scripts?: boolean; + semantic?: boolean; + } + + interface EditorToolItem { + text?: string; + value?: string; + context?: string; + } + + interface EditorTool { + name?: string; + tooltip?: string; + exec?: Function; + items?: EditorToolItem[]; + template?: string; + } + + interface EditorExecParams { + value?: any; + } + + interface EditorPasteOptions { + split?: boolean; + } + + interface EditorOptions { + name?: string; + domain?: string; + encoded?: boolean; + messages?: EditorMessages; + pdf?: EditorPdf; + resizable?: EditorResizable; + serialization?: EditorSerialization; + stylesheets?: any; + tools?: EditorTool[]; + imageBrowser?: EditorImageBrowser; + fileBrowser?: EditorFileBrowser; + change?(e: EditorEvent): void; + execute?(e: EditorExecuteEvent): void; + keydown?(e: EditorEvent): void; + keyup?(e: EditorEvent): void; + paste?(e: EditorPasteEvent): void; + pdfExport?(e: EditorPdfExportEvent): void; + select?(e: EditorEvent): void; + } + interface EditorEvent { + sender: Editor; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface EditorExecuteEvent extends EditorEvent { + name?: string; + command?: any; + } + + interface EditorPasteEvent extends EditorEvent { + html?: any; + } + + interface EditorPdfExportEvent extends EditorEvent { + promise?: JQueryPromise; + } + + + class FlatColorPicker extends kendo.ui.Widget { + static fn: FlatColorPicker; + static extend(proto: Object): FlatColorPicker; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: FlatColorPickerOptions); + options: FlatColorPickerOptions; + focus(): void; + value(): string; + value(color?: string): void; + color(): kendo.Color; + color(color?: kendo.Color): void; + enable(enable?: boolean): void; + } + + interface FlatColorPickerMessages { + apply?: string; + cancel?: string; + } + + interface FlatColorPickerOptions { + name?: string; + opacity?: boolean; + buttons?: boolean; + value?: string; + preview?: boolean; + autoupdate?: boolean; + messages?: FlatColorPickerMessages; + change?(e: FlatColorPickerChangeEvent): void; + } + interface FlatColorPickerEvent { + sender: FlatColorPicker; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface FlatColorPickerChangeEvent extends FlatColorPickerEvent { + value?: string; + } + + + class Gantt extends kendo.ui.Widget { + static fn: Gantt; + static extend(proto: Object): Gantt; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: GanttOptions); + options: GanttOptions; + dataSource: kendo.data.DataSource; + clearSelection(): void; + dataItem(row: string): kendo.data.GanttTask; + dataItem(row: Element): kendo.data.GanttTask; + dataItem(row: JQuery): kendo.data.GanttTask; + destroy(): void; + refresh(): void; + refreshDependencies(): void; + removeDependency(dependency: string): void; + removeDependency(dependency: kendo.data.GanttDependency): void; + removeTask(task: string): void; + removeTask(task: kendo.data.GanttTask): void; + saveAsPDF(): JQueryPromise; + select(): JQuery; + select(row: string): void; + select(row: Element): void; + select(row: JQuery): void; + setDataSource(dataSource: kendo.data.GanttDataSource): void; + setDependenciesDataSource(dataSource: kendo.data.GanttDependencyDataSource): void; + view(): kendo.ui.GanttView; + view(type?: string): void; + dependencies: kendo.data.GanttDependencyDataSource; + } + + interface GanttAssignments { + dataSource?: any; + dataResourceIdField?: string; + dataTaskIdField?: string; + dataValueField?: string; + } + + interface GanttColumn { + field?: string; + title?: string; + format?: string; + width?: any; + editable?: boolean; + sortable?: boolean; + } + + interface GanttCurrentTimeMarker { + updateInterval?: number; + } + + interface GanttEditable { + confirmation?: boolean; + template?: any; + } + + interface GanttMessagesActions { + addChild?: string; + append?: string; + insertAfter?: string; + insertBefore?: string; + pdf?: string; + } + + interface GanttMessagesEditor { + assignButton?: string; + editorTitle?: string; + end?: string; + percentComplete?: string; + resources?: string; + resourcesEditorTitle?: string; + resourcesHeader?: string; + start?: string; + title?: string; + unitsHeader?: string; + } + + interface GanttMessagesViews { + day?: string; + end?: string; + month?: string; + start?: string; + week?: string; + year?: string; + } + + interface GanttMessages { + actions?: GanttMessagesActions; + cancel?: string; + deleteDependencyWindowTitle?: string; + deleteTaskWindowTitle?: string; + destroy?: string; + editor?: GanttMessagesEditor; + save?: string; + views?: GanttMessagesViews; + } + + interface GanttPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface GanttPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: GanttPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface GanttResources { + dataFormatField?: string; + dataColorField?: string; + dataSource?: any; + dataTextField?: string; + field?: string; + } + + interface GanttToolbarItem { + name?: string; + template?: any; + text?: string; + } + + interface GanttTooltip { + template?: any; + visible?: boolean; + } + + interface GanttView { + type?: string; + selected?: boolean; + slotSize?: any; + timeHeaderTemplate?: any; + dayHeaderTemplate?: any; + weekHeaderTemplate?: any; + monthHeaderTemplate?: any; + yearHeaderTemplate?: any; + resizeTooltipFormat?: string; + } + + interface GanttOptions { + name?: string; + assignments?: GanttAssignments; + autoBind?: boolean; + columns?: GanttColumn[]; + currentTimeMarker?: GanttCurrentTimeMarker; + dataSource?: any; + dependencies?: any; + editable?: GanttEditable; + navigatable?: boolean; + workDayStart?: Date; + workDayEnd?: Date; + workWeekStart?: number; + workWeekEnd?: number; + hourSpan?: number; + snap?: boolean; + height?: any; + listWidth?: any; + messages?: GanttMessages; + pdf?: GanttPdf; + selectable?: boolean; + showWorkDays?: boolean; + showWorkHours?: boolean; + toolbar?: GanttToolbarItem[]; + tooltip?: GanttTooltip; + views?: GanttView[]; + resources?: GanttResources; + dataBinding?(e: GanttDataBindingEvent): void; + dataBound?(e: GanttDataBoundEvent): void; + add?(e: GanttAddEvent): void; + edit?(e: GanttEditEvent): void; + remove?(e: GanttRemoveEvent): void; + cancel?(e: GanttCancelEvent): void; + save?(e: GanttSaveEvent): void; + change?(e: GanttChangeEvent): void; + navigate?(e: GanttNavigateEvent): void; + moveStart?(e: GanttMoveStartEvent): void; + move?(e: GanttMoveEvent): void; + moveEnd?(e: GanttMoveEndEvent): void; + pdfExport?(e: GanttPdfExportEvent): void; + resizeStart?(e: GanttResizeStartEvent): void; + resize?(e: GanttResizeEvent): void; + resizeEnd?(e: GanttResizeEndEvent): void; + } + interface GanttEvent { + sender: Gantt; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface GanttDataBindingEvent extends GanttEvent { + } + + interface GanttDataBoundEvent extends GanttEvent { + } + + interface GanttAddEvent extends GanttEvent { + task?: kendo.data.GanttTask; + dependency?: kendo.data.GanttDependency; + } + + interface GanttEditEvent extends GanttEvent { + container?: JQuery; + task?: kendo.data.GanttTask; + } + + interface GanttRemoveEvent extends GanttEvent { + task?: kendo.data.GanttTask; + dependencies?: any; + } + + interface GanttCancelEvent extends GanttEvent { + container?: JQuery; + task?: kendo.data.GanttTask; + } + + interface GanttSaveEvent extends GanttEvent { + task?: kendo.data.GanttTask; + values?: any; + } + + interface GanttChangeEvent extends GanttEvent { + } + + interface GanttNavigateEvent extends GanttEvent { + view?: string; + } + + interface GanttMoveStartEvent extends GanttEvent { + task?: kendo.data.GanttTask; + } + + interface GanttMoveEvent extends GanttEvent { + task?: kendo.data.GanttTask; + start?: Date; + end?: Date; + } + + interface GanttMoveEndEvent extends GanttEvent { + task?: kendo.data.GanttTask; + start?: Date; + end?: Date; + } + + interface GanttPdfExportEvent extends GanttEvent { + promise?: JQueryPromise; + } + + interface GanttResizeStartEvent extends GanttEvent { + task?: kendo.data.GanttTask; + } + + interface GanttResizeEvent extends GanttEvent { + task?: kendo.data.GanttTask; + start?: Date; + end?: Date; + } + + interface GanttResizeEndEvent extends GanttEvent { + task?: kendo.data.GanttTask; + start?: Date; + end?: Date; + } + + + class Grid extends kendo.ui.Widget { + static fn: Grid; + static extend(proto: Object): Grid; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: GridOptions); + options: GridOptions; + dataSource: kendo.data.DataSource; + addRow(): void; + autoFitColumn(column: number): void; + autoFitColumn(column: string): void; + autoFitColumn(column: any): void; + cancelChanges(): void; + cancelRow(): void; + cellIndex(cell: string): number; + cellIndex(cell: Element): number; + cellIndex(cell: JQuery): number; + clearSelection(): void; + closeCell(isCancel?: boolean): void; + collapseGroup(row: string): void; + collapseGroup(row: Element): void; + collapseGroup(row: JQuery): void; + collapseRow(row: string): void; + collapseRow(row: Element): void; + collapseRow(row: JQuery): void; + current(): JQuery; + current(cell: JQuery): void; + dataItem(row: string): kendo.data.ObservableObject; + dataItem(row: Element): kendo.data.ObservableObject; + dataItem(row: JQuery): kendo.data.ObservableObject; + destroy(): void; + editCell(cell: JQuery): void; + editRow(row: JQuery): void; + expandGroup(row: string): void; + expandGroup(row: Element): void; + expandGroup(row: JQuery): void; + expandRow(row: string): void; + expandRow(row: Element): void; + expandRow(row: JQuery): void; + getOptions(): GridOptions; + hideColumn(column: number): void; + hideColumn(column: string): void; + hideColumn(column: any): void; + lockColumn(column: number): void; + lockColumn(column: string): void; + refresh(): void; + removeRow(row: string): void; + removeRow(row: Element): void; + removeRow(row: JQuery): void; + reorderColumn(destIndex: number, column: any): void; + saveAsExcel(): void; + saveAsPDF(): JQueryPromise; + saveChanges(): void; + saveRow(): void; + select(): JQuery; + select(rows: string): void; + select(rows: Element): void; + select(rows: JQuery): void; + setDataSource(dataSource: kendo.data.DataSource): void; + setOptions(options: any): void; + showColumn(column: number): void; + showColumn(column: string): void; + showColumn(column: any): void; + unlockColumn(column: number): void; + unlockColumn(column: string): void; + columns: GridColumn[]; + footer: JQuery; + pager: kendo.ui.Pager; + table: JQuery; + tbody: JQuery; + thead: JQuery; + content: JQuery; + lockedHeader: JQuery; + lockedTable: JQuery; + lockedContent: JQuery; + } + + interface GridAllowCopy { + delimeter?: any; + } + + interface GridColumnMenuMessages { + columns?: string; + filter?: string; + sortAscending?: string; + sortDescending?: string; + settings?: string; + done?: string; + lock?: string; + unlock?: string; + } + + interface GridColumnMenu { + columns?: boolean; + filterable?: boolean; + sortable?: boolean; + messages?: GridColumnMenuMessages; + } + + interface GridColumnCommandItemText { + edit?: string; + cancel?: string; + update?: string; + } + + interface GridColumnCommandItem { + name?: string; + text?: GridColumnCommandItemText; + className?: string; + click?: Function; + } + + interface GridColumnFilterableCell { + dataSource?: any; + dataTextField?: string; + delay?: number; + inputWidth?: number; + suggestionOperator?: string; + minLength?: number; + enabled?: boolean; + operator?: string; + showOperators?: boolean; + template?: Function; + } + + interface GridColumnFilterable { + cell?: GridColumnFilterableCell; + multi?: boolean; + dataSource?: any; + checkAll?: boolean; + itemTemplate?: Function; + ui?: any; + } + + interface GridColumnSortable { + compare?: Function; + } + + interface GridColumn { + aggregates?: any; + attributes?: any; + columns?: any; + command?: GridColumnCommandItem[]; + encoded?: boolean; + field?: string; + filterable?: GridColumnFilterable; + footerTemplate?: any; + format?: string; + groupable?: boolean; + groupHeaderTemplate?: any; + groupFooterTemplate?: any; + headerAttributes?: any; + headerTemplate?: any; + hidden?: boolean; + locked?: boolean; + lockable?: boolean; + minScreenWidth?: number; + sortable?: GridColumnSortable; + template?: any; + title?: string; + width?: any; + values?: any; + menu?: boolean; + } + + interface GridEditable { + confirmation?: any; + cancelDelete?: string; + confirmDelete?: string; + createAt?: string; + destroy?: boolean; + mode?: string; + template?: any; + update?: boolean; + window?: any; + } + + interface GridExcel { + allPages?: boolean; + fileName?: string; + filterable?: boolean; + forceProxy?: boolean; + proxyURL?: string; + } + + interface GridFilterableMessages { + and?: string; + clear?: string; + filter?: string; + info?: string; + isFalse?: string; + isTrue?: string; + or?: string; + selectValue?: string; + cancel?: string; + operator?: string; + value?: string; + checkAll?: string; + } + + interface GridFilterableOperatorsDate { + eq?: string; + neq?: string; + gte?: string; + gt?: string; + lte?: string; + lt?: string; + } + + interface GridFilterableOperatorsEnums { + eq?: string; + neq?: string; + } + + interface GridFilterableOperatorsNumber { + eq?: string; + neq?: string; + gte?: string; + gt?: string; + lte?: string; + lt?: string; + } + + interface GridFilterableOperatorsString { + eq?: string; + neq?: string; + startswith?: string; + contains?: string; + doesnotcontain?: string; + endswith?: string; + } + + interface GridFilterableOperators { + string?: GridFilterableOperatorsString; + number?: GridFilterableOperatorsNumber; + date?: GridFilterableOperatorsDate; + enums?: GridFilterableOperatorsEnums; + } + + interface GridFilterable { + extra?: boolean; + messages?: GridFilterableMessages; + operators?: GridFilterableOperators; + mode?: string; + } + + interface GridGroupableMessages { + empty?: string; + } + + interface GridGroupable { + enabled?: boolean; + showFooter?: boolean; + messages?: GridGroupableMessages; + } + + interface GridMessagesCommands { + cancel?: string; + canceledit?: string; + create?: string; + destroy?: string; + edit?: string; + excel?: string; + save?: string; + update?: string; + } + + interface GridMessages { + commands?: GridMessagesCommands; + } + + interface GridPageableMessages { + display?: string; + empty?: string; + page?: string; + of?: string; + itemsPerPage?: string; + first?: string; + last?: string; + next?: string; + previous?: string; + refresh?: string; + morePages?: string; + } + + interface GridPageable { + pageSize?: number; + previousNext?: boolean; + numeric?: boolean; + buttonCount?: number; + input?: boolean; + pageSizes?: any; + refresh?: boolean; + info?: boolean; + messages?: GridPageableMessages; + } + + interface GridPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface GridPdf { + allPages?: boolean; + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: GridPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface GridScrollable { + virtual?: boolean; + } + + interface GridSortable { + allowUnsort?: boolean; + mode?: string; + } + + interface GridToolbarItem { + name?: string; + template?: any; + text?: string; + } + + interface GridOptions { + name?: string; + allowCopy?: GridAllowCopy; + altRowTemplate?: any; + autoBind?: boolean; + columnResizeHandleWidth?: number; + columns?: GridColumn[]; + columnMenu?: GridColumnMenu; + dataSource?: any; + detailTemplate?: any; + editable?: GridEditable; + excel?: GridExcel; + filterable?: GridFilterable; + groupable?: GridGroupable; + height?: any; + messages?: GridMessages; + mobile?: any; + navigatable?: boolean; + pageable?: GridPageable; + pdf?: GridPdf; + reorderable?: boolean; + resizable?: boolean; + rowTemplate?: any; + scrollable?: GridScrollable; + selectable?: any; + sortable?: GridSortable; + toolbar?: GridToolbarItem[]; + cancel?(e: GridCancelEvent): void; + change?(e: GridChangeEvent): void; + columnHide?(e: GridColumnHideEvent): void; + columnMenuInit?(e: GridColumnMenuInitEvent): void; + columnReorder?(e: GridColumnReorderEvent): void; + columnResize?(e: GridColumnResizeEvent): void; + columnShow?(e: GridColumnShowEvent): void; + dataBinding?(e: GridDataBindingEvent): void; + dataBound?(e: GridDataBoundEvent): void; + detailCollapse?(e: GridDetailCollapseEvent): void; + detailExpand?(e: GridDetailExpandEvent): void; + detailInit?(e: GridDetailInitEvent): void; + edit?(e: GridEditEvent): void; + excelExport?(e: GridExcelExportEvent): void; + pdfExport?(e: GridPdfExportEvent): void; + filterMenuInit?(e: GridFilterMenuInitEvent): void; + remove?(e: GridRemoveEvent): void; + save?(e: GridSaveEvent): void; + saveChanges?(e: GridSaveChangesEvent): void; + columnLock?(e: GridColumnLockEvent): void; + columnUnlock?(e: GridColumnUnlockEvent): void; + } + interface GridEvent { + sender: Grid; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface GridCancelEvent extends GridEvent { + container?: JQuery; + model?: kendo.data.Model; + } + + interface GridChangeEvent extends GridEvent { + } + + interface GridColumnHideEvent extends GridEvent { + column?: any; + } + + interface GridColumnMenuInitEvent extends GridEvent { + container?: JQuery; + field?: string; + } + + interface GridColumnReorderEvent extends GridEvent { + column?: any; + newIndex?: number; + oldIndex?: number; + } + + interface GridColumnResizeEvent extends GridEvent { + column?: any; + newWidth?: number; + oldWidth?: number; + } + + interface GridColumnShowEvent extends GridEvent { + column?: any; + } + + interface GridDataBindingEvent extends GridEvent { + action?: string; + index?: number; + items?: any; + } + + interface GridDataBoundEvent extends GridEvent { + } + + interface GridDetailCollapseEvent extends GridEvent { + detailRow?: JQuery; + masterRow?: JQuery; + } + + interface GridDetailExpandEvent extends GridEvent { + detailRow?: JQuery; + masterRow?: JQuery; + } + + interface GridDetailInitEvent extends GridEvent { + data?: kendo.data.ObservableObject; + detailCell?: JQuery; + detailRow?: JQuery; + masterRow?: JQuery; + } + + interface GridEditEvent extends GridEvent { + container?: JQuery; + model?: kendo.data.Model; + } + + interface GridExcelExportEvent extends GridEvent { + data?: any; + workbook?: kendo.ooxml.Workbook; + } + + interface GridPdfExportEvent extends GridEvent { + promise?: JQueryPromise; + } + + interface GridFilterMenuInitEvent extends GridEvent { + container?: JQuery; + field?: string; + } + + interface GridRemoveEvent extends GridEvent { + model?: kendo.data.Model; + row?: JQuery; + } + + interface GridSaveEvent extends GridEvent { + model?: kendo.data.Model; + container?: JQuery; + values?: any; + } + + interface GridSaveChangesEvent extends GridEvent { + } + + interface GridColumnLockEvent extends GridEvent { + column?: any; + } + + interface GridColumnUnlockEvent extends GridEvent { + column?: any; + } + + + class ListView extends kendo.ui.Widget { + static fn: ListView; + static extend(proto: Object): ListView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ListViewOptions); + options: ListViewOptions; + dataSource: kendo.data.DataSource; + add(): void; + cancel(): void; + clearSelection(): void; + dataItem(row: string): kendo.data.ObservableObject; + dataItem(row: Element): kendo.data.ObservableObject; + dataItem(row: JQuery): kendo.data.ObservableObject; + dataItems(): void; + destroy(): void; + edit(item: JQuery): void; + refresh(): void; + remove(item: any): void; + save(): void; + select(): JQuery; + select(items: JQuery): void; + select(items: any): void; + setDataSource(dataSource: kendo.data.DataSource): void; + } + + interface ListViewOptions { + name?: string; + autoBind?: boolean; + dataSource?: any; + editTemplate?: Function; + navigatable?: boolean; + selectable?: any; + template?: Function; + altTemplate?: Function; + cancel?(e: ListViewCancelEvent): void; + change?(e: ListViewEvent): void; + dataBound?(e: ListViewEvent): void; + dataBinding?(e: ListViewEvent): void; + edit?(e: ListViewEditEvent): void; + remove?(e: ListViewRemoveEvent): void; + save?(e: ListViewSaveEvent): void; + } + interface ListViewEvent { + sender: ListView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ListViewCancelEvent extends ListViewEvent { + container?: JQuery; + model?: kendo.data.Model; + } + + interface ListViewEditEvent extends ListViewEvent { + item?: JQuery; + model?: kendo.data.Model; + } + + interface ListViewRemoveEvent extends ListViewEvent { + item?: JQuery; + model?: kendo.data.Model; + } + + interface ListViewSaveEvent extends ListViewEvent { + model?: kendo.data.Model; + item?: JQuery; + } + + + class MaskedTextBox extends kendo.ui.Widget { + static fn: MaskedTextBox; + static extend(proto: Object): MaskedTextBox; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: MaskedTextBoxOptions); + options: MaskedTextBoxOptions; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + raw(): string; + value(): string; + value(value: string): void; + } + + interface MaskedTextBoxOptions { + name?: string; + clearPromptChar?: boolean; + culture?: string; + mask?: string; + promptChar?: string; + rules?: any; + unmaskOnPost?: boolean; + value?: string; + change?(e: MaskedTextBoxChangeEvent): void; + } + interface MaskedTextBoxEvent { + sender: MaskedTextBox; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface MaskedTextBoxChangeEvent extends MaskedTextBoxEvent { + } + + + class Menu extends kendo.ui.Widget { + static fn: Menu; + static extend(proto: Object): Menu; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: MenuOptions); + options: MenuOptions; + append(item: any, referenceItem: string): kendo.ui.Menu; + append(item: any, referenceItem: JQuery): kendo.ui.Menu; + close(element: string): kendo.ui.Menu; + close(element: Element): kendo.ui.Menu; + close(element: JQuery): kendo.ui.Menu; + destroy(): void; + enable(element: string, enable: boolean): kendo.ui.Menu; + enable(element: Element, enable: boolean): kendo.ui.Menu; + enable(element: JQuery, enable: boolean): kendo.ui.Menu; + insertAfter(item: string, referenceItem: string): kendo.ui.Menu; + insertAfter(item: string, referenceItem: Element): kendo.ui.Menu; + insertAfter(item: string, referenceItem: JQuery): kendo.ui.Menu; + insertAfter(item: Element, referenceItem: string): kendo.ui.Menu; + insertAfter(item: Element, referenceItem: Element): kendo.ui.Menu; + insertAfter(item: Element, referenceItem: JQuery): kendo.ui.Menu; + insertAfter(item: JQuery, referenceItem: string): kendo.ui.Menu; + insertAfter(item: JQuery, referenceItem: Element): kendo.ui.Menu; + insertAfter(item: JQuery, referenceItem: JQuery): kendo.ui.Menu; + insertBefore(item: string, referenceItem: string): kendo.ui.Menu; + insertBefore(item: string, referenceItem: Element): kendo.ui.Menu; + insertBefore(item: string, referenceItem: JQuery): kendo.ui.Menu; + insertBefore(item: Element, referenceItem: string): kendo.ui.Menu; + insertBefore(item: Element, referenceItem: Element): kendo.ui.Menu; + insertBefore(item: Element, referenceItem: JQuery): kendo.ui.Menu; + insertBefore(item: JQuery, referenceItem: string): kendo.ui.Menu; + insertBefore(item: JQuery, referenceItem: Element): kendo.ui.Menu; + insertBefore(item: JQuery, referenceItem: JQuery): kendo.ui.Menu; + open(element: string): kendo.ui.Menu; + open(element: Element): kendo.ui.Menu; + open(element: JQuery): kendo.ui.Menu; + remove(element: string): kendo.ui.Menu; + remove(element: Element): kendo.ui.Menu; + remove(element: JQuery): kendo.ui.Menu; + } + + interface MenuAnimationClose { + effects?: string; + duration?: number; + } + + interface MenuAnimationOpen { + effects?: string; + duration?: number; + } + + interface MenuAnimation { + close?: MenuAnimationClose; + open?: MenuAnimationOpen; + } + + interface MenuOptions { + name?: string; + animation?: MenuAnimation; + closeOnClick?: boolean; + dataSource?: any; + direction?: string; + hoverDelay?: number; + openOnClick?: boolean; + orientation?: string; + popupCollision?: string; + close?(e: MenuCloseEvent): void; + open?(e: MenuOpenEvent): void; + activate?(e: MenuActivateEvent): void; + deactivate?(e: MenuDeactivateEvent): void; + select?(e: MenuSelectEvent): void; + } + interface MenuEvent { + sender: Menu; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface MenuCloseEvent extends MenuEvent { + item?: HTMLElement; + } + + interface MenuOpenEvent extends MenuEvent { + item?: HTMLElement; + } + + interface MenuActivateEvent extends MenuEvent { + item?: HTMLElement; + } + + interface MenuDeactivateEvent extends MenuEvent { + item?: HTMLElement; + } + + interface MenuSelectEvent extends MenuEvent { + item?: HTMLElement; + } + + + class MultiSelect extends kendo.ui.Widget { + static fn: MultiSelect; + static extend(proto: Object): MultiSelect; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: MultiSelectOptions); + options: MultiSelectOptions; + dataSource: kendo.data.DataSource; + close(): void; + dataItems(): any; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + focus(): void; + open(): void; + refresh(): void; + search(word: string): void; + setDataSource(dataSource: kendo.data.DataSource): void; + toggle(toggle: boolean): void; + value(): any; + value(value: any): void; + value(value: string): void; + input: JQuery; + list: JQuery; + ul: JQuery; + tagList: JQuery; + } + + interface MultiSelectAnimationClose { + effects?: string; + duration?: number; + } + + interface MultiSelectAnimationOpen { + effects?: string; + duration?: number; + } + + interface MultiSelectAnimation { + close?: MultiSelectAnimationClose; + open?: MultiSelectAnimationOpen; + } + + interface MultiSelectVirtual { + itemHeight?: number; + valueMapper?: Function; + } + + interface MultiSelectOptions { + name?: string; + animation?: MultiSelectAnimation; + autoBind?: boolean; + autoClose?: boolean; + dataSource?: any; + dataTextField?: string; + dataValueField?: string; + delay?: number; + enable?: boolean; + filter?: string; + fixedGroupTemplate?: any; + groupTemplate?: any; + height?: number; + highlightFirst?: boolean; + ignoreCase?: string; + minLength?: number; + maxSelectedItems?: number; + placeholder?: string; + headerTemplate?: any; + itemTemplate?: any; + tagTemplate?: string; + value?: any; + valuePrimitive?: boolean; + virtual?: MultiSelectVirtual; + change?(e: MultiSelectChangeEvent): void; + close?(e: MultiSelectCloseEvent): void; + dataBound?(e: MultiSelectDataBoundEvent): void; + filtering?(e: MultiSelectFilteringEvent): void; + open?(e: MultiSelectOpenEvent): void; + select?(e: MultiSelectSelectEvent): void; + } + interface MultiSelectEvent { + sender: MultiSelect; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface MultiSelectChangeEvent extends MultiSelectEvent { + } + + interface MultiSelectCloseEvent extends MultiSelectEvent { + } + + interface MultiSelectDataBoundEvent extends MultiSelectEvent { + } + + interface MultiSelectFilteringEvent extends MultiSelectEvent { + filter?: any; + } + + interface MultiSelectOpenEvent extends MultiSelectEvent { + } + + interface MultiSelectSelectEvent extends MultiSelectEvent { + item?: JQuery; + } + + + class Notification extends kendo.ui.Widget { + static fn: Notification; + static extend(proto: Object): Notification; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: NotificationOptions); + options: NotificationOptions; + error(data: any): void; + error(data: string): void; + error(data: Function): void; + getNotifications(): JQuery; + hide(): void; + info(data: any): void; + info(data: string): void; + info(data: Function): void; + show(data: any, type: string): void; + show(data: string, type: string): void; + show(data: Function, type: string): void; + success(data: any): void; + success(data: string): void; + success(data: Function): void; + warning(data: any): void; + warning(data: string): void; + warning(data: Function): void; + } + + interface NotificationPosition { + bottom?: number; + left?: number; + pinned?: boolean; + right?: number; + top?: number; + } + + interface NotificationTemplate { + type?: string; + template?: string; + } + + interface NotificationOptions { + name?: string; + allowHideAfter?: number; + animation?: any; + appendTo?: any; + autoHideAfter?: number; + button?: boolean; + height?: any; + hideOnClick?: boolean; + position?: NotificationPosition; + stacking?: string; + templates?: NotificationTemplate[]; + width?: any; + hide?(e: NotificationHideEvent): void; + show?(e: NotificationShowEvent): void; + } + interface NotificationEvent { + sender: Notification; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface NotificationHideEvent extends NotificationEvent { + element?: JQuery; + } + + interface NotificationShowEvent extends NotificationEvent { + element?: JQuery; + } + + + class NumericTextBox extends kendo.ui.Widget { + static fn: NumericTextBox; + static extend(proto: Object): NumericTextBox; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: NumericTextBoxOptions); + options: NumericTextBoxOptions; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + focus(): void; + max(): number; + max(value: number): void; + max(value: string): void; + min(): number; + min(value: number): void; + min(value: string): void; + step(): number; + step(value: number): void; + step(value: string): void; + value(): number; + value(value: number): void; + value(value: string): void; + } + + interface NumericTextBoxOptions { + name?: string; + culture?: string; + decimals?: number; + downArrowText?: string; + format?: string; + max?: number; + min?: number; + placeholder?: string; + spinners?: boolean; + step?: number; + upArrowText?: string; + value?: number; + change?(e: NumericTextBoxChangeEvent): void; + spin?(e: NumericTextBoxSpinEvent): void; + } + interface NumericTextBoxEvent { + sender: NumericTextBox; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface NumericTextBoxChangeEvent extends NumericTextBoxEvent { + } + + interface NumericTextBoxSpinEvent extends NumericTextBoxEvent { + } + + + class Pager extends kendo.ui.Widget { + static fn: Pager; + static extend(proto: Object): Pager; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PagerOptions); + options: PagerOptions; + dataSource: kendo.data.DataSource; + totalPages(): number; + pageSize(): number; + page(page: boolean): number; + refresh(): void; + destroy(): void; + } + + interface PagerMessages { + display?: string; + empty?: string; + page?: string; + of?: string; + itemsPerPage?: string; + first?: string; + previous?: string; + next?: string; + last?: string; + refresh?: string; + } + + interface PagerOptions { + name?: string; + autoBind?: boolean; + buttonCount?: number; + dataSource?: any; + selectTemplate?: string; + linkTemplate?: string; + info?: boolean; + input?: boolean; + numeric?: boolean; + pageSizes?: any; + previousNext?: boolean; + refresh?: boolean; + messages?: PagerMessages; + change?(e: PagerChangeEvent): void; + } + interface PagerEvent { + sender: Pager; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface PagerChangeEvent extends PagerEvent { + } + + + class PanelBar extends kendo.ui.Widget { + static fn: PanelBar; + static extend(proto: Object): PanelBar; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PanelBarOptions); + options: PanelBarOptions; + append(item: string, referenceItem: string): kendo.ui.PanelBar; + append(item: string, referenceItem: Element): kendo.ui.PanelBar; + append(item: string, referenceItem: JQuery): kendo.ui.PanelBar; + append(item: Element, referenceItem: string): kendo.ui.PanelBar; + append(item: Element, referenceItem: Element): kendo.ui.PanelBar; + append(item: Element, referenceItem: JQuery): kendo.ui.PanelBar; + append(item: JQuery, referenceItem: string): kendo.ui.PanelBar; + append(item: JQuery, referenceItem: Element): kendo.ui.PanelBar; + append(item: JQuery, referenceItem: JQuery): kendo.ui.PanelBar; + append(item: any, referenceItem: string): kendo.ui.PanelBar; + append(item: any, referenceItem: Element): kendo.ui.PanelBar; + append(item: any, referenceItem: JQuery): kendo.ui.PanelBar; + clearSelection(): void; + collapse(element: string, useAnimation: boolean): kendo.ui.PanelBar; + collapse(element: Element, useAnimation: boolean): kendo.ui.PanelBar; + collapse(element: JQuery, useAnimation: boolean): kendo.ui.PanelBar; + destroy(): void; + enable(element: string, enable: boolean): void; + enable(element: Element, enable: boolean): void; + enable(element: JQuery, enable: boolean): void; + expand(element: string, useAnimation: boolean): kendo.ui.PanelBar; + expand(element: Element, useAnimation: boolean): kendo.ui.PanelBar; + expand(element: JQuery, useAnimation: boolean): kendo.ui.PanelBar; + insertAfter(item: string, referenceItem: string): void; + insertAfter(item: string, referenceItem: Element): void; + insertAfter(item: string, referenceItem: JQuery): void; + insertAfter(item: Element, referenceItem: string): void; + insertAfter(item: Element, referenceItem: Element): void; + insertAfter(item: Element, referenceItem: JQuery): void; + insertAfter(item: JQuery, referenceItem: string): void; + insertAfter(item: JQuery, referenceItem: Element): void; + insertAfter(item: JQuery, referenceItem: JQuery): void; + insertAfter(item: any, referenceItem: string): void; + insertAfter(item: any, referenceItem: Element): void; + insertAfter(item: any, referenceItem: JQuery): void; + insertBefore(item: string, referenceItem: string): kendo.ui.PanelBar; + insertBefore(item: string, referenceItem: Element): kendo.ui.PanelBar; + insertBefore(item: string, referenceItem: JQuery): kendo.ui.PanelBar; + insertBefore(item: Element, referenceItem: string): kendo.ui.PanelBar; + insertBefore(item: Element, referenceItem: Element): kendo.ui.PanelBar; + insertBefore(item: Element, referenceItem: JQuery): kendo.ui.PanelBar; + insertBefore(item: JQuery, referenceItem: string): kendo.ui.PanelBar; + insertBefore(item: JQuery, referenceItem: Element): kendo.ui.PanelBar; + insertBefore(item: JQuery, referenceItem: JQuery): kendo.ui.PanelBar; + insertBefore(item: any, referenceItem: string): kendo.ui.PanelBar; + insertBefore(item: any, referenceItem: Element): kendo.ui.PanelBar; + insertBefore(item: any, referenceItem: JQuery): kendo.ui.PanelBar; + reload(element: string): void; + reload(element: Element): void; + reload(element: JQuery): void; + remove(element: string): void; + remove(element: Element): void; + remove(element: JQuery): void; + select(): JQuery; + select(element?: string): void; + select(element?: Element): void; + select(element?: JQuery): void; + } + + interface PanelBarAnimationCollapse { + duration?: number; + effects?: string; + } + + interface PanelBarAnimationExpand { + duration?: number; + effects?: string; + } + + interface PanelBarAnimation { + collapse?: PanelBarAnimationCollapse; + expand?: PanelBarAnimationExpand; + } + + interface PanelBarOptions { + name?: string; + animation?: PanelBarAnimation; + contentUrls?: any; + dataSource?: any; + expandMode?: string; + activate?(e: PanelBarActivateEvent): void; + collapse?(e: PanelBarCollapseEvent): void; + contentLoad?(e: PanelBarContentLoadEvent): void; + error?(e: PanelBarErrorEvent): void; + expand?(e: PanelBarExpandEvent): void; + select?(e: PanelBarSelectEvent): void; + } + interface PanelBarEvent { + sender: PanelBar; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface PanelBarActivateEvent extends PanelBarEvent { + item?: Element; + } + + interface PanelBarCollapseEvent extends PanelBarEvent { + item?: Element; + } + + interface PanelBarContentLoadEvent extends PanelBarEvent { + item?: Element; + contentElement?: Element; + } + + interface PanelBarErrorEvent extends PanelBarEvent { + xhr?: JQueryXHR; + status?: string; + } + + interface PanelBarExpandEvent extends PanelBarEvent { + item?: Element; + } + + interface PanelBarSelectEvent extends PanelBarEvent { + item?: Element; + } + + + class PivotConfigurator extends kendo.ui.Widget { + static fn: PivotConfigurator; + static extend(proto: Object): PivotConfigurator; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PivotConfiguratorOptions); + options: PivotConfiguratorOptions; + dataSource: kendo.data.DataSource; + destroy(): void; + refresh(): void; + setDataSource(dataSource: kendo.data.PivotDataSource): void; + } + + interface PivotConfiguratorMessagesFieldMenuOperators { + contains?: string; + doesnotcontain?: string; + startswith?: string; + endswith?: string; + eq?: string; + neq?: string; + } + + interface PivotConfiguratorMessagesFieldMenu { + info?: string; + sortAscending?: string; + sortDescending?: string; + filterFields?: string; + filter?: string; + include?: string; + title?: string; + clear?: string; + ok?: string; + cancel?: string; + operators?: PivotConfiguratorMessagesFieldMenuOperators; + } + + interface PivotConfiguratorMessages { + measures?: string; + columns?: string; + rows?: string; + measuresLabel?: string; + rowsLabel?: string; + columnsLabel?: string; + fieldsLabel?: string; + fieldMenu?: PivotConfiguratorMessagesFieldMenu; + } + + interface PivotConfiguratorSortable { + allowUnsort?: boolean; + } + + interface PivotConfiguratorOptions { + name?: string; + dataSource?: any; + filterable?: boolean; + sortable?: PivotConfiguratorSortable; + height?: any; + messages?: PivotConfiguratorMessages; + } + interface PivotConfiguratorEvent { + sender: PivotConfigurator; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class PivotGrid extends kendo.ui.Widget { + static fn: PivotGrid; + static extend(proto: Object): PivotGrid; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PivotGridOptions); + options: PivotGridOptions; + dataSource: kendo.data.DataSource; + cellInfo(columnIndex: number, rowIndex: number): any; + cellInfoByElement(cell: string): any; + cellInfoByElement(cell: Element): any; + cellInfoByElement(cell: JQuery): any; + destroy(): void; + refresh(): void; + setDataSource(dataSource: kendo.data.PivotDataSource): void; + saveAsExcel(): void; + saveAsPDF(): JQueryPromise; + } + + interface PivotGridExcel { + fileName?: string; + filterable?: boolean; + forceProxy?: boolean; + proxyURL?: string; + } + + interface PivotGridMessagesFieldMenuOperators { + contains?: string; + doesnotcontain?: string; + startswith?: string; + endswith?: string; + eq?: string; + neq?: string; + } + + interface PivotGridMessagesFieldMenu { + info?: string; + sortAscending?: string; + sortDescending?: string; + filterFields?: string; + filter?: string; + include?: string; + title?: string; + clear?: string; + ok?: string; + cancel?: string; + operators?: PivotGridMessagesFieldMenuOperators; + } + + interface PivotGridMessages { + measureFields?: string; + columnFields?: string; + rowFields?: string; + fieldMenu?: PivotGridMessagesFieldMenu; + } + + interface PivotGridPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface PivotGridPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: PivotGridPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface PivotGridSortable { + allowUnsort?: boolean; + } + + interface PivotGridOptions { + name?: string; + dataSource?: any; + autoBind?: boolean; + reorderable?: boolean; + excel?: PivotGridExcel; + pdf?: PivotGridPdf; + filterable?: boolean; + sortable?: PivotGridSortable; + columnWidth?: number; + height?: any; + columnHeaderTemplate?: any; + dataCellTemplate?: any; + kpiStatusTemplate?: any; + kpiTrendTemplate?: any; + rowHeaderTemplate?: any; + messages?: PivotGridMessages; + dataBinding?(e: PivotGridDataBindingEvent): void; + dataBound?(e: PivotGridDataBoundEvent): void; + expandMember?(e: PivotGridExpandMemberEvent): void; + collapseMember?(e: PivotGridCollapseMemberEvent): void; + excelExport?(e: PivotGridExcelExportEvent): void; + pdfExport?(e: PivotGridPdfExportEvent): void; + } + interface PivotGridEvent { + sender: PivotGrid; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface PivotGridDataBindingEvent extends PivotGridEvent { + } + + interface PivotGridDataBoundEvent extends PivotGridEvent { + } + + interface PivotGridExpandMemberEvent extends PivotGridEvent { + axis?: string; + path?: string; + } + + interface PivotGridCollapseMemberEvent extends PivotGridEvent { + axis?: string; + path?: string; + } + + interface PivotGridExcelExportEvent extends PivotGridEvent { + data?: any; + workbook?: any; + } + + interface PivotGridPdfExportEvent extends PivotGridEvent { + promise?: JQueryPromise; + } + + + class ProgressBar extends kendo.ui.Widget { + static fn: ProgressBar; + static extend(proto: Object): ProgressBar; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ProgressBarOptions); + options: ProgressBarOptions; + enable(enable: boolean): void; + value(): number; + value(value: number): void; + progressStatus: JQuery; + progressWrapper: JQuery; + } + + interface ProgressBarAnimation { + duration?: number; + } + + interface ProgressBarOptions { + name?: string; + animation?: ProgressBarAnimation; + chunkCount?: number; + enable?: boolean; + max?: number; + min?: number; + orientation?: string; + reverse?: boolean; + showStatus?: boolean; + type?: string; + value?: number; + change?(e: ProgressBarChangeEvent): void; + complete?(e: ProgressBarCompleteEvent): void; + } + interface ProgressBarEvent { + sender: ProgressBar; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ProgressBarChangeEvent extends ProgressBarEvent { + value?: number; + } + + interface ProgressBarCompleteEvent extends ProgressBarEvent { + value?: number; + } + + + class RangeSlider extends kendo.ui.Widget { + static fn: RangeSlider; + static extend(proto: Object): RangeSlider; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: RangeSliderOptions); + options: RangeSliderOptions; + destroy(): void; + enable(enable: boolean): void; + value(): any; + value(selectionStart: number, selectionEnd: number): void; + resize(): void; + } + + interface RangeSliderTooltip { + enabled?: boolean; + format?: string; + template?: string; + } + + interface RangeSliderOptions { + name?: string; + largeStep?: number; + max?: number; + min?: number; + orientation?: string; + selectionEnd?: number; + selectionStart?: number; + smallStep?: number; + tickPlacement?: string; + tooltip?: RangeSliderTooltip; + change?(e: RangeSliderChangeEvent): void; + slide?(e: RangeSliderSlideEvent): void; + } + interface RangeSliderEvent { + sender: RangeSlider; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface RangeSliderChangeEvent extends RangeSliderEvent { + value?: number; + } + + interface RangeSliderSlideEvent extends RangeSliderEvent { + value?: number; + } + + + class ResponsivePanel extends kendo.ui.Widget { + static fn: ResponsivePanel; + static extend(proto: Object): ResponsivePanel; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ResponsivePanelOptions); + options: ResponsivePanelOptions; + close(): void; + destroy(): void; + open(): void; + } + + interface ResponsivePanelOptions { + name?: string; + autoClose?: boolean; + breakpoint?: number; + orientation?: string; + toggleButton?: string; + close?(e: ResponsivePanelEvent): void; + open?(e: ResponsivePanelEvent): void; + } + interface ResponsivePanelEvent { + sender: ResponsivePanel; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Scheduler extends kendo.ui.Widget { + static fn: Scheduler; + static extend(proto: Object): Scheduler; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SchedulerOptions); + options: SchedulerOptions; + dataSource: kendo.data.DataSource; + addEvent(data: any): void; + cancelEvent(): void; + data(): void; + date(): Date; + date(value?: Date): void; + destroy(): void; + editEvent(event: string): void; + editEvent(event: kendo.data.SchedulerEvent): void; + occurrenceByUid(uid: string): kendo.data.SchedulerEvent; + occurrencesInRange(start: Date, end: Date): any; + refresh(): void; + removeEvent(event: string): void; + removeEvent(event: kendo.data.SchedulerEvent): void; + resourcesBySlot(slot: any): any; + saveAsPDF(): JQueryPromise; + saveEvent(): void; + select(): void; + select(events: any, options: any): void; + setDataSource(dataSource: kendo.data.SchedulerDataSource): void; + slotByPosition(xPosition: number, yPosition: number): any; + slotByElement(element: Element): any; + slotByElement(element: JQuery): any; + view(): kendo.ui.SchedulerView; + view(type?: string): void; + } + + interface SchedulerCurrentTimeMarker { + updateInterval?: number; + useLocalTimezone?: boolean; + } + + interface SchedulerEditable { + confirmation?: any; + create?: boolean; + destroy?: boolean; + editRecurringMode?: string; + move?: boolean; + resize?: boolean; + template?: any; + update?: boolean; + window?: any; + } + + interface SchedulerFooter { + command?: any; + } + + interface SchedulerGroup { + resources?: any; + orientation?: string; + } + + interface SchedulerMessagesEditor { + allDayEvent?: string; + description?: string; + editorTitle?: string; + end?: string; + endTimezone?: string; + repeat?: string; + separateTimezones?: string; + start?: string; + startTimezone?: string; + timezone?: string; + timezoneEditorButton?: string; + timezoneEditorTitle?: string; + title?: string; + } + + interface SchedulerMessagesRecurrenceEditorDaily { + interval?: string; + repeatEvery?: string; + } + + interface SchedulerMessagesRecurrenceEditorEnd { + after?: string; + occurrence?: string; + label?: string; + never?: string; + mobileLabel?: string; + on?: string; + } + + interface SchedulerMessagesRecurrenceEditorFrequencies { + daily?: string; + monthly?: string; + never?: string; + weekly?: string; + yearly?: string; + } + + interface SchedulerMessagesRecurrenceEditorMonthly { + day?: string; + interval?: string; + repeatEvery?: string; + repeatOn?: string; + } + + interface SchedulerMessagesRecurrenceEditorOffsetPositions { + first?: string; + second?: string; + third?: string; + fourth?: string; + last?: string; + } + + interface SchedulerMessagesRecurrenceEditorWeekdays { + day?: string; + weekday?: string; + weekend?: string; + } + + interface SchedulerMessagesRecurrenceEditorWeekly { + interval?: string; + repeatEvery?: string; + repeatOn?: string; + } + + interface SchedulerMessagesRecurrenceEditorYearly { + of?: string; + repeatEvery?: string; + repeatOn?: string; + interval?: string; + } + + interface SchedulerMessagesRecurrenceEditor { + daily?: SchedulerMessagesRecurrenceEditorDaily; + end?: SchedulerMessagesRecurrenceEditorEnd; + frequencies?: SchedulerMessagesRecurrenceEditorFrequencies; + monthly?: SchedulerMessagesRecurrenceEditorMonthly; + offsetPositions?: SchedulerMessagesRecurrenceEditorOffsetPositions; + weekly?: SchedulerMessagesRecurrenceEditorWeekly; + weekdays?: SchedulerMessagesRecurrenceEditorWeekdays; + yearly?: SchedulerMessagesRecurrenceEditorYearly; + } + + interface SchedulerMessagesRecurrenceMessages { + deleteRecurring?: string; + deleteWindowOccurrence?: string; + deleteWindowSeries?: string; + deleteWindowTitle?: string; + editRecurring?: string; + editWindowOccurrence?: string; + editWindowSeries?: string; + editWindowTitle?: string; + } + + interface SchedulerMessagesViews { + day?: string; + week?: string; + month?: string; + agenda?: string; + } + + interface SchedulerMessages { + allDay?: string; + ariaEventLabel?: string; + ariaSlotLabel?: string; + cancel?: string; + date?: string; + deleteWindowTitle?: string; + destroy?: string; + event?: string; + defaultRowText?: string; + pdf?: string; + save?: string; + showFullDay?: string; + showWorkDay?: string; + time?: string; + today?: string; + editor?: SchedulerMessagesEditor; + recurrenceEditor?: SchedulerMessagesRecurrenceEditor; + recurrenceMessages?: SchedulerMessagesRecurrenceMessages; + views?: SchedulerMessagesViews; + } + + interface SchedulerPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface SchedulerPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: SchedulerPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface SchedulerResource { + dataColorField?: string; + dataSource?: any; + dataTextField?: string; + dataValueField?: string; + field?: string; + multiple?: boolean; + name?: string; + title?: string; + valuePrimitive?: boolean; + } + + interface SchedulerToolbarItem { + name?: string; + } + + interface SchedulerViewEditable { + create?: boolean; + destroy?: boolean; + update?: boolean; + } + + interface SchedulerViewGroup { + orientation?: string; + } + + interface SchedulerView { + allDayEventTemplate?: any; + allDaySlot?: boolean; + allDaySlotTemplate?: any; + columnWidth?: number; + dateHeaderTemplate?: any; + dayTemplate?: any; + editable?: SchedulerViewEditable; + endTime?: Date; + eventHeight?: number; + eventTemplate?: any; + eventTimeTemplate?: any; + group?: SchedulerViewGroup; + majorTick?: number; + majorTimeHeaderTemplate?: any; + minorTickCount?: number; + minorTimeHeaderTemplate?: any; + selected?: boolean; + selectedDateFormat?: string; + showWorkHours?: boolean; + slotTemplate?: any; + startTime?: Date; + title?: string; + type?: string; + workWeekStart?: number; + workWeekEnd?: number; + } + + interface SchedulerSelectOptions { + events?: any; + resources?: any; + start?: Date; + end?: Date; + isAllDay?: boolean; + } + + interface SchedulerOptions { + name?: string; + allDayEventTemplate?: any; + allDaySlot?: boolean; + autoBind?: boolean; + currentTimeMarker?: SchedulerCurrentTimeMarker; + dataSource?: any; + date?: Date; + dateHeaderTemplate?: any; + editable?: SchedulerEditable; + endTime?: Date; + eventTemplate?: any; + footer?: SchedulerFooter; + group?: SchedulerGroup; + height?: any; + majorTick?: number; + majorTimeHeaderTemplate?: any; + max?: Date; + messages?: SchedulerMessages; + min?: Date; + minorTickCount?: number; + minorTimeHeaderTemplate?: any; + mobile?: any; + pdf?: SchedulerPdf; + resources?: SchedulerResource[]; + selectable?: boolean; + showWorkHours?: boolean; + snap?: boolean; + startTime?: Date; + timezone?: string; + toolbar?: SchedulerToolbarItem[]; + views?: SchedulerView[]; + groupHeaderTemplate?: any; + width?: any; + workDayStart?: Date; + workDayEnd?: Date; + workWeekStart?: number; + workWeekEnd?: number; + add?(e: SchedulerAddEvent): void; + cancel?(e: SchedulerCancelEvent): void; + change?(e: SchedulerChangeEvent): void; + dataBinding?(e: SchedulerDataBindingEvent): void; + dataBound?(e: SchedulerDataBoundEvent): void; + edit?(e: SchedulerEditEvent): void; + moveStart?(e: SchedulerMoveStartEvent): void; + move?(e: SchedulerMoveEvent): void; + moveEnd?(e: SchedulerMoveEndEvent): void; + navigate?(e: SchedulerNavigateEvent): void; + pdfExport?(e: SchedulerPdfExportEvent): void; + remove?(e: SchedulerRemoveEvent): void; + resizeStart?(e: SchedulerResizeStartEvent): void; + resize?(e: SchedulerResizeEvent): void; + resizeEnd?(e: SchedulerResizeEndEvent): void; + save?(e: SchedulerSaveEvent): void; + } + interface SchedulerEvent { + sender: Scheduler; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SchedulerAddEvent extends SchedulerEvent { + event?: any; + } + + interface SchedulerCancelEvent extends SchedulerEvent { + container?: JQuery; + event?: kendo.data.SchedulerEvent; + } + + interface SchedulerChangeEvent extends SchedulerEvent { + start?: Date; + end?: Date; + events?: any; + slots?: any; + resources?: any; + } + + interface SchedulerDataBindingEvent extends SchedulerEvent { + } + + interface SchedulerDataBoundEvent extends SchedulerEvent { + } + + interface SchedulerEditEvent extends SchedulerEvent { + container?: JQuery; + event?: kendo.data.SchedulerEvent; + } + + interface SchedulerMoveStartEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + } + + interface SchedulerMoveEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + slot?: any; + } + + interface SchedulerMoveEndEvent extends SchedulerEvent { + start?: Date; + end?: Date; + event?: kendo.data.SchedulerEvent; + slot?: any; + resources?: any; + } + + interface SchedulerNavigateEvent extends SchedulerEvent { + action?: string; + date?: Date; + view?: string; + } + + interface SchedulerPdfExportEvent extends SchedulerEvent { + promise?: JQueryPromise; + } + + interface SchedulerRemoveEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + } + + interface SchedulerResizeStartEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + } + + interface SchedulerResizeEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + slot?: any; + } + + interface SchedulerResizeEndEvent extends SchedulerEvent { + event?: kendo.data.SchedulerEvent; + slot?: any; + } + + interface SchedulerSaveEvent extends SchedulerEvent { + container?: JQuery; + event?: kendo.data.SchedulerEvent; + } + + + class Slider extends kendo.ui.Widget { + static fn: Slider; + static extend(proto: Object): Slider; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SliderOptions); + options: SliderOptions; + destroy(): void; + enable(enable: boolean): void; + value(): number; + value(value: number): void; + resize(): void; + } + + interface SliderTooltip { + enabled?: boolean; + format?: string; + template?: string; + } + + interface SliderOptions { + name?: string; + decreaseButtonTitle?: string; + increaseButtonTitle?: string; + largeStep?: number; + max?: number; + min?: number; + orientation?: string; + showButtons?: boolean; + smallStep?: number; + tickPlacement?: string; + tooltip?: SliderTooltip; + value?: number; + change?(e: SliderChangeEvent): void; + slide?(e: SliderSlideEvent): void; + } + interface SliderEvent { + sender: Slider; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SliderChangeEvent extends SliderEvent { + value?: number; + } + + interface SliderSlideEvent extends SliderEvent { + value?: number; + } + + + class Sortable extends kendo.ui.Widget { + static fn: Sortable; + static extend(proto: Object): Sortable; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SortableOptions); + options: SortableOptions; + indexOf(element: JQuery): number; + items(): JQuery; + } + + interface SortableCursorOffset { + left?: number; + top?: number; + } + + interface SortableOptions { + name?: string; + axis?: string; + container?: any; + connectWith?: any; + cursor?: string; + cursorOffset?: SortableCursorOffset; + disabled?: string; + filter?: string; + handler?: string; + hint?: any; + holdToDrag?: boolean; + ignore?: string; + placeholder?: any; + start?(e: SortableStartEvent): void; + move?(e: SortableMoveEvent): void; + end?(e: SortableEndEvent): void; + change?(e: SortableChangeEvent): void; + cancel?(e: SortableCancelEvent): void; + } + interface SortableEvent { + sender: Sortable; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SortableStartEvent extends SortableEvent { + draggableEvent?: any; + item?: JQuery; + } + + interface SortableMoveEvent extends SortableEvent { + item?: JQuery; + target?: JQuery; + list?: kendo.ui.Sortable; + draggableEvent?: any; + } + + interface SortableEndEvent extends SortableEvent { + action?: string; + item?: JQuery; + oldIndex?: number; + newIndex?: number; + draggableEvent?: any; + } + + interface SortableChangeEvent extends SortableEvent { + action?: string; + item?: JQuery; + oldIndex?: number; + newIndex?: number; + draggableEvent?: any; + } + + interface SortableCancelEvent extends SortableEvent { + item?: JQuery; + } + + + class Splitter extends kendo.ui.Widget { + static fn: Splitter; + static extend(proto: Object): Splitter; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SplitterOptions); + options: SplitterOptions; + ajaxRequest(pane: string, url: string, data: any): void; + ajaxRequest(pane: string, url: string, data: string): void; + ajaxRequest(pane: Element, url: string, data: any): void; + ajaxRequest(pane: Element, url: string, data: string): void; + ajaxRequest(pane: JQuery, url: string, data: any): void; + ajaxRequest(pane: JQuery, url: string, data: string): void; + append(config?: any): JQuery; + collapse(pane: string): void; + collapse(pane: Element): void; + collapse(pane: JQuery): void; + destroy(): void; + expand(pane: string): void; + expand(pane: Element): void; + expand(pane: JQuery): void; + insertAfter(config: any, referencePane: string): JQuery; + insertAfter(config: any, referencePane: Element): JQuery; + insertAfter(config: any, referencePane: JQuery): JQuery; + insertBefore(config: any, referencePane: string): JQuery; + insertBefore(config: any, referencePane: Element): JQuery; + insertBefore(config: any, referencePane: JQuery): JQuery; + max(pane: string, value: string): void; + max(pane: Element, value: string): void; + max(pane: JQuery, value: string): void; + min(pane: string, value: string): void; + min(pane: Element, value: string): void; + min(pane: JQuery, value: string): void; + remove(pane: string): void; + remove(pane: Element): void; + remove(pane: JQuery): void; + size(pane: string, value: string): void; + size(pane: Element, value: string): void; + size(pane: JQuery, value: string): void; + toggle(pane: string, expand?: boolean): void; + toggle(pane: Element, expand?: boolean): void; + toggle(pane: JQuery, expand?: boolean): void; + } + + interface SplitterPane { + collapsed?: boolean; + collapsedSize?: string; + collapsible?: boolean; + contentUrl?: string; + max?: string; + min?: string; + resizable?: boolean; + scrollable?: boolean; + size?: string; + } + + interface SplitterOptions { + name?: string; + orientation?: string; + panes?: SplitterPane[]; + collapse?(e: SplitterCollapseEvent): void; + contentLoad?(e: SplitterContentLoadEvent): void; + error?(e: SplitterErrorEvent): void; + expand?(e: SplitterExpandEvent): void; + layoutChange?(e: SplitterEvent): void; + resize?(e: SplitterEvent): void; + } + interface SplitterEvent { + sender: Splitter; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SplitterCollapseEvent extends SplitterEvent { + pane?: Element; + } + + interface SplitterContentLoadEvent extends SplitterEvent { + pane?: Element; + } + + interface SplitterErrorEvent extends SplitterEvent { + xhr?: JQueryXHR; + status?: string; + } + + interface SplitterExpandEvent extends SplitterEvent { + pane?: Element; + } + + + class TabStrip extends kendo.ui.Widget { + static fn: TabStrip; + static extend(proto: Object): TabStrip; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TabStripOptions); + options: TabStripOptions; + activateTab(item: JQuery): void; + append(tab: any): kendo.ui.TabStrip; + contentElement(itemIndex: number): Element; + contentHolder(itemIndex: number): Element; + deactivateTab(item: JQuery): void; + destroy(): void; + disable(element: string): kendo.ui.TabStrip; + disable(element: Element): kendo.ui.TabStrip; + disable(element: JQuery): kendo.ui.TabStrip; + enable(element: string, enable?: boolean): kendo.ui.TabStrip; + enable(element: Element, enable?: boolean): kendo.ui.TabStrip; + enable(element: JQuery, enable?: boolean): kendo.ui.TabStrip; + insertAfter(item: string, referenceTab: string): kendo.ui.TabStrip; + insertAfter(item: string, referenceTab: Element): kendo.ui.TabStrip; + insertAfter(item: string, referenceTab: JQuery): kendo.ui.TabStrip; + insertAfter(item: Element, referenceTab: string): kendo.ui.TabStrip; + insertAfter(item: Element, referenceTab: Element): kendo.ui.TabStrip; + insertAfter(item: Element, referenceTab: JQuery): kendo.ui.TabStrip; + insertAfter(item: JQuery, referenceTab: string): kendo.ui.TabStrip; + insertAfter(item: JQuery, referenceTab: Element): kendo.ui.TabStrip; + insertAfter(item: JQuery, referenceTab: JQuery): kendo.ui.TabStrip; + insertBefore(item: string, referenceTab: string): kendo.ui.TabStrip; + insertBefore(item: string, referenceTab: Element): kendo.ui.TabStrip; + insertBefore(item: string, referenceTab: JQuery): kendo.ui.TabStrip; + insertBefore(item: Element, referenceTab: string): kendo.ui.TabStrip; + insertBefore(item: Element, referenceTab: Element): kendo.ui.TabStrip; + insertBefore(item: Element, referenceTab: JQuery): kendo.ui.TabStrip; + insertBefore(item: JQuery, referenceTab: string): kendo.ui.TabStrip; + insertBefore(item: JQuery, referenceTab: Element): kendo.ui.TabStrip; + insertBefore(item: JQuery, referenceTab: JQuery): kendo.ui.TabStrip; + items(): HTMLCollection; + reload(element: string): kendo.ui.TabStrip; + reload(element: Element): kendo.ui.TabStrip; + reload(element: JQuery): kendo.ui.TabStrip; + remove(element: string): kendo.ui.TabStrip; + remove(element: number): kendo.ui.TabStrip; + select(): JQuery; + select(element: string): void; + select(element: Element): void; + select(element: JQuery): void; + select(element: number): void; + setDataSource(): void; + tabGroup: JQuery; + } + + interface TabStripAnimationClose { + duration?: number; + effects?: string; + } + + interface TabStripAnimationOpen { + duration?: number; + effects?: string; + } + + interface TabStripAnimation { + close?: TabStripAnimationClose; + open?: TabStripAnimationOpen; + } + + interface TabStripOptions { + name?: string; + animation?: TabStripAnimation; + collapsible?: boolean; + contentUrls?: any; + dataContentField?: string; + dataContentUrlField?: string; + dataImageUrlField?: string; + dataSpriteCssClass?: string; + dataTextField?: string; + dataUrlField?: string; + navigatable?: boolean; + tabPosition?: string; + activate?(e: TabStripActivateEvent): void; + contentLoad?(e: TabStripContentLoadEvent): void; + error?(e: TabStripErrorEvent): void; + select?(e: TabStripSelectEvent): void; + show?(e: TabStripShowEvent): void; + } + interface TabStripEvent { + sender: TabStrip; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TabStripActivateEvent extends TabStripEvent { + item?: Element; + contentElement?: Element; + } + + interface TabStripContentLoadEvent extends TabStripEvent { + item?: Element; + contentElement?: Element; + } + + interface TabStripErrorEvent extends TabStripEvent { + xhr?: JQueryXHR; + status?: string; + } + + interface TabStripSelectEvent extends TabStripEvent { + item?: Element; + contentElement?: Element; + } + + interface TabStripShowEvent extends TabStripEvent { + item?: Element; + contentElement?: Element; + } + + + class TimePicker extends kendo.ui.Widget { + static fn: TimePicker; + static extend(proto: Object): TimePicker; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TimePickerOptions); + options: TimePickerOptions; + close(): void; + destroy(): void; + enable(enable: boolean): void; + readonly(readonly: boolean): void; + max(): Date; + max(value: Date): void; + max(value: string): void; + min(): Date; + min(value: Date): void; + min(value: string): void; + open(): void; + setOptions(options: any): void; + value(): Date; + value(value: Date): void; + value(value: string): void; + } + + interface TimePickerAnimationClose { + effects?: string; + duration?: number; + } + + interface TimePickerAnimationOpen { + effects?: string; + duration?: number; + } + + interface TimePickerAnimation { + close?: TimePickerAnimationClose; + open?: TimePickerAnimationOpen; + } + + interface TimePickerOptions { + name?: string; + animation?: TimePickerAnimation; + culture?: string; + dates?: any; + format?: string; + interval?: number; + max?: Date; + min?: Date; + parseFormats?: any; + value?: Date; + change?(e: TimePickerChangeEvent): void; + close?(e: TimePickerCloseEvent): void; + open?(e: TimePickerOpenEvent): void; + } + interface TimePickerEvent { + sender: TimePicker; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TimePickerChangeEvent extends TimePickerEvent { + } + + interface TimePickerCloseEvent extends TimePickerEvent { + } + + interface TimePickerOpenEvent extends TimePickerEvent { + } + + + class ToolBar extends kendo.ui.Widget { + static fn: ToolBar; + static extend(proto: Object): ToolBar; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ToolBarOptions); + options: ToolBarOptions; + add(command: any): void; + destroy(): void; + enable(command: string, enable: boolean): void; + enable(command: Element, enable: boolean): void; + enable(command: JQuery, enable: boolean): void; + getSelectedFromGroup(groupName: string): void; + remove(command: string): void; + remove(command: Element): void; + remove(command: JQuery): void; + toggle(): void; + } + + interface ToolBarItemButton { + attributes?: any; + click?: Function; + enable?: boolean; + group?: string; + icon?: string; + id?: string; + imageUrl?: string; + selected?: boolean; + showIcon?: string; + showText?: string; + spriteCssClass?: string; + toggle?: Function; + togglable?: boolean; + text?: string; + url?: string; + } + + interface ToolBarItemMenuButton { + attributes?: any; + enable?: boolean; + icon?: string; + id?: string; + imageUrl?: string; + spriteCssClass?: string; + text?: string; + url?: string; + } + + interface ToolBarItem { + attributes?: any; + buttons?: ToolBarItemButton[]; + click?: Function; + enable?: boolean; + group?: string; + icon?: string; + id?: string; + imageUrl?: string; + menuButtons?: ToolBarItemMenuButton[]; + overflow?: string; + overflowTemplate?: any; + primary?: boolean; + selected?: boolean; + showIcon?: string; + showText?: string; + spriteCssClass?: string; + template?: any; + text?: string; + togglable?: boolean; + toggle?: Function; + type?: string; + url?: string; + } + + interface ToolBarOptions { + name?: string; + resizable?: boolean; + items?: ToolBarItem[]; + click?(e: ToolBarClickEvent): void; + close?(e: ToolBarCloseEvent): void; + open?(e: ToolBarOpenEvent): void; + toggle?(e: ToolBarToggleEvent): void; + overflowClose?(e: ToolBarOverflowCloseEvent): void; + overflowOpen?(e: ToolBarOverflowOpenEvent): void; + } + interface ToolBarEvent { + sender: ToolBar; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ToolBarClickEvent extends ToolBarEvent { + target?: JQuery; + id?: string; + } + + interface ToolBarCloseEvent extends ToolBarEvent { + SplitButton?: JQuery; + } + + interface ToolBarOpenEvent extends ToolBarEvent { + SplitButton?: JQuery; + } + + interface ToolBarToggleEvent extends ToolBarEvent { + target?: JQuery; + checked?: boolean; + id?: string; + } + + interface ToolBarOverflowCloseEvent extends ToolBarEvent { + } + + interface ToolBarOverflowOpenEvent extends ToolBarEvent { + } + + + class Tooltip extends kendo.ui.Widget { + static fn: Tooltip; + static extend(proto: Object): Tooltip; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TooltipOptions); + options: TooltipOptions; + show(element: JQuery): void; + hide(): void; + refresh(): void; + target(): JQuery; + } + + interface TooltipAnimationClose { + effects?: string; + duration?: number; + } + + interface TooltipAnimationOpen { + effects?: string; + duration?: number; + } + + interface TooltipAnimation { + close?: TooltipAnimationClose; + open?: TooltipAnimationOpen; + } + + interface TooltipContent { + url?: string; + } + + interface TooltipOptions { + name?: string; + autoHide?: boolean; + animation?: TooltipAnimation; + content?: TooltipContent; + callout?: boolean; + filter?: string; + iframe?: boolean; + height?: number; + width?: number; + position?: string; + showAfter?: number; + showOn?: string; + contentLoad?(e: TooltipEvent): void; + show?(e: TooltipEvent): void; + hide?(e: TooltipEvent): void; + requestStart?(e: TooltipRequestStartEvent): void; + error?(e: TooltipErrorEvent): void; + } + interface TooltipEvent { + sender: Tooltip; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TooltipRequestStartEvent extends TooltipEvent { + target?: JQuery; + options?: any; + } + + interface TooltipErrorEvent extends TooltipEvent { + xhr?: JQueryXHR; + status?: string; + } + + + class Touch extends kendo.ui.Widget { + static fn: Touch; + static extend(proto: Object): Touch; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TouchOptions); + options: TouchOptions; + cancel(): void; + destroy(): void; + } + + interface TouchOptions { + name?: string; + filter?: string; + surface?: JQuery; + multiTouch?: boolean; + enableSwipe?: boolean; + minXDelta?: number; + maxYDelta?: number; + maxDuration?: number; + minHold?: number; + doubleTapTimeout?: number; + touchstart?(e: TouchTouchstartEvent): void; + dragstart?(e: TouchDragstartEvent): void; + drag?(e: TouchDragEvent): void; + dragend?(e: TouchDragendEvent): void; + tap?(e: TouchTapEvent): void; + doubletap?(e: TouchDoubletapEvent): void; + hold?(e: TouchHoldEvent): void; + swipe?(e: TouchSwipeEvent): void; + gesturestart?(e: TouchGesturestartEvent): void; + gesturechange?(e: TouchGesturechangeEvent): void; + gestureend?(e: TouchGestureendEvent): void; + } + interface TouchEvent { + sender: Touch; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TouchTouchstartEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchDragstartEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchDragEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchDragendEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchTapEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchDoubletapEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchHoldEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchSwipeEvent extends TouchEvent { + touch?: kendo.mobile.ui.TouchEventOptions; + event?: JQueryEventObject; + } + + interface TouchGesturestartEvent extends TouchEvent { + touches?: any; + event?: JQueryEventObject; + distance?: number; + center?: kendo.mobile.ui.Point; + } + + interface TouchGesturechangeEvent extends TouchEvent { + touches?: any; + event?: JQueryEventObject; + distance?: number; + center?: kendo.mobile.ui.Point; + } + + interface TouchGestureendEvent extends TouchEvent { + touches?: any; + event?: JQueryEventObject; + distance?: number; + center?: kendo.mobile.ui.Point; + } + + + class TreeList extends kendo.ui.Widget { + static fn: TreeList; + static extend(proto: Object): TreeList; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TreeListOptions); + options: TreeListOptions; + dataSource: kendo.data.DataSource; + addRow(parentRow: string): void; + addRow(parentRow: Element): void; + addRow(parentRow: JQuery): void; + cancelRow(): void; + clearSelection(): void; + collapse(): void; + dataItem(row: string): kendo.data.TreeListModel; + dataItem(row: Element): kendo.data.TreeListModel; + dataItem(row: JQuery): kendo.data.TreeListModel; + destroy(): void; + editRow(row: JQuery): void; + expand(): void; + refresh(): void; + removeRow(row: string): void; + removeRow(row: Element): void; + removeRow(row: JQuery): void; + saveAsExcel(): void; + saveAsPDF(): JQueryPromise; + saveRow(): void; + select(): JQuery; + select(rows: Element): void; + select(rows: JQuery): void; + setDataSource(dataSource: kendo.data.TreeListDataSource): void; + showColumn(column: number): void; + showColumn(column: string): void; + hideColumn(column: number): void; + hideColumn(column: string): void; + lockColumn(column: number): void; + lockColumn(column: string): void; + unlockColumn(column: number): void; + unlockColumn(column: string): void; + reorderColumn(destIndex: number, column: any): void; + } + + interface TreeListColumnMenuMessages { + columns?: string; + filter?: string; + sortAscending?: string; + sortDescending?: string; + } + + interface TreeListColumnMenu { + columns?: boolean; + filterable?: boolean; + sortable?: boolean; + messages?: TreeListColumnMenuMessages; + } + + interface TreeListColumnCommandItem { + className?: string; + click?: Function; + name?: string; + text?: string; + } + + interface TreeListColumnFilterable { + ui?: any; + } + + interface TreeListColumnSortable { + compare?: Function; + } + + interface TreeListColumn { + attributes?: any; + command?: TreeListColumnCommandItem[]; + encoded?: boolean; + expandable?: boolean; + field?: string; + filterable?: TreeListColumnFilterable; + footerTemplate?: any; + format?: string; + headerAttributes?: any; + headerTemplate?: any; + sortable?: TreeListColumnSortable; + template?: any; + title?: string; + width?: any; + hidden?: boolean; + menu?: boolean; + locked?: boolean; + lockable?: boolean; + } + + interface TreeListEditable { + mode?: string; + template?: any; + window?: any; + } + + interface TreeListExcel { + fileName?: string; + filterable?: boolean; + forceProxy?: boolean; + proxyURL?: string; + } + + interface TreeListFilterableMessages { + and?: string; + clear?: string; + filter?: string; + info?: string; + isFalse?: string; + isTrue?: string; + or?: string; + selectValue?: string; + cancel?: string; + operator?: string; + } + + interface TreeListFilterable { + extra?: boolean; + messages?: TreeListFilterableMessages; + } + + interface TreeListMessagesCommands { + canceledit?: string; + create?: string; + createchild?: string; + destroy?: string; + edit?: string; + excel?: string; + pdf?: string; + update?: string; + } + + interface TreeListMessages { + commands?: TreeListMessagesCommands; + loading?: string; + noRows?: string; + requestFailed?: string; + retry?: string; + } + + interface TreeListPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface TreeListPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: TreeListPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface TreeListSortable { + allowUnsort?: boolean; + mode?: string; + } + + interface TreeListToolbarItem { + name?: string; + text?: string; + } + + interface TreeListOptions { + name?: string; + autoBind?: boolean; + columns?: TreeListColumn[]; + resizable?: boolean; + reorderable?: boolean; + columnMenu?: TreeListColumnMenu; + dataSource?: any; + editable?: TreeListEditable; + excel?: TreeListExcel; + filterable?: TreeListFilterable; + height?: any; + messages?: TreeListMessages; + pdf?: TreeListPdf; + scrollable?: any; + selectable?: any; + sortable?: TreeListSortable; + toolbar?: TreeListToolbarItem[]; + cancel?(e: TreeListCancelEvent): void; + change?(e: TreeListChangeEvent): void; + collapse?(e: TreeListCollapseEvent): void; + dataBinding?(e: TreeListDataBindingEvent): void; + dataBound?(e: TreeListDataBoundEvent): void; + edit?(e: TreeListEditEvent): void; + excelExport?(e: TreeListExcelExportEvent): void; + expand?(e: TreeListExpandEvent): void; + filterMenuInit?(e: TreeListFilterMenuInitEvent): void; + pdfExport?(e: TreeListPdfExportEvent): void; + remove?(e: TreeListRemoveEvent): void; + save?(e: TreeListSaveEvent): void; + columnShow?(e: TreeListColumnShowEvent): void; + columnHide?(e: TreeListColumnHideEvent): void; + columnReorder?(e: TreeListColumnReorderEvent): void; + columnMenuInit?(e: TreeListColumnMenuInitEvent): void; + columnLock?(e: TreeListColumnLockEvent): void; + columnUnlock?(e: TreeListColumnUnlockEvent): void; + } + interface TreeListEvent { + sender: TreeList; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TreeListCancelEvent extends TreeListEvent { + container?: JQuery; + model?: kendo.data.TreeListModel; + } + + interface TreeListChangeEvent extends TreeListEvent { + } + + interface TreeListCollapseEvent extends TreeListEvent { + model?: kendo.data.TreeListModel; + } + + interface TreeListDataBindingEvent extends TreeListEvent { + } + + interface TreeListDataBoundEvent extends TreeListEvent { + } + + interface TreeListEditEvent extends TreeListEvent { + container?: JQuery; + model?: kendo.data.TreeListModel; + } + + interface TreeListExcelExportEvent extends TreeListEvent { + data?: any; + workbook?: any; + } + + interface TreeListExpandEvent extends TreeListEvent { + model?: kendo.data.TreeListModel; + } + + interface TreeListFilterMenuInitEvent extends TreeListEvent { + container?: JQuery; + field?: string; + } + + interface TreeListPdfExportEvent extends TreeListEvent { + promise?: JQueryPromise; + } + + interface TreeListRemoveEvent extends TreeListEvent { + model?: kendo.data.TreeListModel; + row?: JQuery; + } + + interface TreeListSaveEvent extends TreeListEvent { + model?: kendo.data.TreeListModel; + container?: JQuery; + } + + interface TreeListColumnShowEvent extends TreeListEvent { + column?: any; + } + + interface TreeListColumnHideEvent extends TreeListEvent { + column?: any; + } + + interface TreeListColumnReorderEvent extends TreeListEvent { + column?: any; + newIndex?: number; + oldIndex?: number; + } + + interface TreeListColumnMenuInitEvent extends TreeListEvent { + container?: JQuery; + field?: string; + } + + interface TreeListColumnLockEvent extends TreeListEvent { + column?: any; + } + + interface TreeListColumnUnlockEvent extends TreeListEvent { + column?: any; + } + + + class TreeView extends kendo.ui.Widget { + static fn: TreeView; + static extend(proto: Object): TreeView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TreeViewOptions); + options: TreeViewOptions; + dataSource: kendo.data.DataSource; + append(nodeData: any, parentNode?: JQuery, success?: Function): JQuery; + append(nodeData: JQuery, parentNode?: JQuery, success?: Function): JQuery; + collapse(nodes: JQuery): void; + collapse(nodes: Element): void; + collapse(nodes: string): void; + dataItem(node: JQuery): kendo.data.Node; + dataItem(node: Element): kendo.data.Node; + dataItem(node: string): kendo.data.Node; + destroy(): void; + detach(node: JQuery): JQuery; + detach(node: Element): JQuery; + detach(node: string): JQuery; + enable(nodes: JQuery, enable?: boolean): void; + enable(nodes: Element, enable?: boolean): void; + enable(nodes: string, enable?: boolean): void; + expand(nodes: JQuery): void; + expand(nodes: Element): void; + expand(nodes: string): void; + expandPath(path: any, complete: Function): void; + expandTo(targetNode: kendo.data.Node): void; + expandTo(targetNode: any): void; + findByText(text: string): JQuery; + findByUid(text: string): JQuery; + insertAfter(nodeData: any, referenceNode: JQuery): void; + insertBefore(nodeData: any, referenceNode: JQuery): void; + parent(node: JQuery): JQuery; + parent(node: Element): JQuery; + parent(node: string): JQuery; + remove(node: JQuery): void; + remove(node: Element): void; + remove(node: string): void; + select(): JQuery; + select(node?: JQuery): void; + select(node?: Element): void; + select(node?: string): void; + setDataSource(dataSource: kendo.data.HierarchicalDataSource): void; + text(): string; + text(node: JQuery, newText: string): void; + text(node: Element, newText: string): void; + text(node: string, newText: string): void; + toggle(node: JQuery): void; + toggle(node: Element): void; + toggle(node: string): void; + updateIndeterminate(node: JQuery): void; + } + + interface TreeViewAnimationCollapse { + duration?: number; + effects?: string; + } + + interface TreeViewAnimationExpand { + duration?: number; + effects?: string; + } + + interface TreeViewAnimation { + collapse?: TreeViewAnimationCollapse; + expand?: TreeViewAnimationExpand; + } + + interface TreeViewCheckboxes { + checkChildren?: boolean; + name?: string; + template?: any; + } + + interface TreeViewMessages { + loading?: string; + requestFailed?: string; + retry?: string; + } + + interface TreeViewOptions { + name?: string; + animation?: TreeViewAnimation; + autoBind?: boolean; + checkboxes?: TreeViewCheckboxes; + dataImageUrlField?: string; + dataSource?: any; + dataSpriteCssClassField?: string; + dataTextField?: any; + dataUrlField?: string; + dragAndDrop?: boolean; + loadOnDemand?: boolean; + messages?: TreeViewMessages; + template?: any; + change?(e: TreeViewEvent): void; + check?(e: TreeViewCheckEvent): void; + collapse?(e: TreeViewCollapseEvent): void; + dataBound?(e: TreeViewDataBoundEvent): void; + drag?(e: TreeViewDragEvent): void; + dragend?(e: TreeViewDragendEvent): void; + dragstart?(e: TreeViewDragstartEvent): void; + drop?(e: TreeViewDropEvent): void; + expand?(e: TreeViewExpandEvent): void; + navigate?(e: TreeViewNavigateEvent): void; + select?(e: TreeViewSelectEvent): void; + } + interface TreeViewEvent { + sender: TreeView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TreeViewCheckEvent extends TreeViewEvent { + node?: Element; + } + + interface TreeViewCollapseEvent extends TreeViewEvent { + node?: Element; + } + + interface TreeViewDataBoundEvent extends TreeViewEvent { + node?: JQuery; + } + + interface TreeViewDragEvent extends TreeViewEvent { + sourceNode?: Element; + dropTarget?: Element; + pageX?: number; + pageY?: number; + statusClass?: string; + setStatusClass?: Function; + } + + interface TreeViewDragendEvent extends TreeViewEvent { + sourceNode?: Element; + destinationNode?: Element; + dropPosition?: string; + } + + interface TreeViewDragstartEvent extends TreeViewEvent { + sourceNode?: Element; + } + + interface TreeViewDropEvent extends TreeViewEvent { + sourceNode?: Element; + destinationNode?: Element; + valid?: boolean; + setValid?: Function; + dropTarget?: Element; + dropPosition?: string; + } + + interface TreeViewExpandEvent extends TreeViewEvent { + node?: Element; + } + + interface TreeViewNavigateEvent extends TreeViewEvent { + node?: Element; + } + + interface TreeViewSelectEvent extends TreeViewEvent { + node?: Element; + } + + + class Upload extends kendo.ui.Widget { + static fn: Upload; + static extend(proto: Object): Upload; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: UploadOptions); + options: UploadOptions; + destroy(): void; + disable(): void; + enable(enable?: boolean): void; + toggle(enable: boolean): void; + } + + interface UploadAsync { + autoUpload?: boolean; + batch?: boolean; + removeField?: string; + removeUrl?: string; + removeVerb?: string; + saveField?: string; + saveUrl?: string; + withCredentials?: boolean; + } + + interface UploadFile { + extension?: string; + name?: string; + size?: number; + } + + interface UploadLocalization { + cancel?: string; + dropFilesHere?: string; + headerStatusUploaded?: string; + headerStatusUploading?: string; + remove?: string; + retry?: string; + select?: string; + statusFailed?: string; + statusUploaded?: string; + statusUploading?: string; + uploadSelectedFiles?: string; + } + + interface UploadOptions { + name?: string; + async?: UploadAsync; + enabled?: boolean; + files?: UploadFile[]; + localization?: UploadLocalization; + multiple?: boolean; + showFileList?: boolean; + template?: any; + cancel?(e: UploadCancelEvent): void; + complete?(e: UploadEvent): void; + error?(e: UploadErrorEvent): void; + progress?(e: UploadProgressEvent): void; + remove?(e: UploadRemoveEvent): void; + select?(e: UploadSelectEvent): void; + success?(e: UploadSuccessEvent): void; + upload?(e: UploadUploadEvent): void; + } + interface UploadEvent { + sender: Upload; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface UploadCancelEvent extends UploadEvent { + files?: any; + } + + interface UploadErrorEvent extends UploadEvent { + files?: any; + operation?: string; + XMLHttpRequest?: any; + } + + interface UploadProgressEvent extends UploadEvent { + files?: any; + percentComplete?: number; + } + + interface UploadRemoveEvent extends UploadEvent { + files?: any; + data?: any; + } + + interface UploadSelectEvent extends UploadEvent { + e?: any; + files?: any; + } + + interface UploadSuccessEvent extends UploadEvent { + files?: any; + operation?: string; + response?: string; + XMLHttpRequest?: any; + } + + interface UploadUploadEvent extends UploadEvent { + files?: any; + data?: any; + formData?: any; + XMLHttpRequest?: any; + } + + + class Validator extends kendo.ui.Widget { + static fn: Validator; + static extend(proto: Object): Validator; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ValidatorOptions); + options: ValidatorOptions; + errors(): any; + hideMessages(): void; + validate(): boolean; + validateInput(input: Element): boolean; + validateInput(input: JQuery): boolean; + } + + interface ValidatorOptions { + name?: string; + errorTemplate?: string; + messages?: any; + rules?: any; + validateOnBlur?: boolean; + validate?(e: ValidatorValidateEvent): void; + } + interface ValidatorEvent { + sender: Validator; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ValidatorValidateEvent extends ValidatorEvent { + } + + + class Window extends kendo.ui.Widget { + static fn: Window; + static extend(proto: Object): Window; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: WindowOptions); + options: WindowOptions; + center(): kendo.ui.Window; + close(): kendo.ui.Window; + content(): any; + content(content?: string): void; + destroy(): void; + maximize(): kendo.ui.Window; + minimize(): kendo.ui.Window; + open(): kendo.ui.Window; + pin(): void; + refresh(options: any): kendo.ui.Window; + restore(): kendo.ui.Window; + setOptions(options: any): void; + title(): kendo.ui.Window; + title(text?: string): void; + toFront(): kendo.ui.Window; + toggleMaximization(): kendo.ui.Window; + unpin(): void; + } + + interface WindowAnimationClose { + effects?: string; + duration?: number; + } + + interface WindowAnimationOpen { + effects?: string; + duration?: number; + } + + interface WindowAnimation { + close?: WindowAnimationClose; + open?: WindowAnimationOpen; + } + + interface WindowContent { + template?: string; + } + + interface WindowPosition { + top?: any; + left?: any; + } + + interface WindowRefreshOptions { + url?: string; + data?: any; + type?: string; + template?: string; + iframe?: boolean; + } + + interface WindowOptions { + name?: string; + actions?: any; + animation?: WindowAnimation; + appendTo?: any; + autoFocus?: boolean; + content?: WindowContent; + draggable?: boolean; + iframe?: boolean; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + modal?: boolean; + pinned?: boolean; + position?: WindowPosition; + resizable?: boolean; + title?: any; + visible?: boolean; + width?: any; + height?: any; + activate?(e: WindowEvent): void; + close?(e: WindowCloseEvent): void; + deactivate?(e: WindowEvent): void; + dragend?(e: WindowEvent): void; + dragstart?(e: WindowEvent): void; + error?(e: WindowErrorEvent): void; + open?(e: WindowEvent): void; + refresh?(e: WindowEvent): void; + resize?(e: WindowEvent): void; + } + interface WindowEvent { + sender: Window; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface WindowCloseEvent extends WindowEvent { + userTriggered?: boolean; + } + + interface WindowErrorEvent extends WindowEvent { + xhr?: JQueryXHR; + status?: string; + } + + +} +declare module kendo.dataviz.ui { + class Barcode extends kendo.ui.Widget { + static fn: Barcode; + static extend(proto: Object): Barcode; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: BarcodeOptions); + options: BarcodeOptions; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + imageDataURL(): string; + redraw(): void; + resize(force?: boolean): void; + svg(): string; + value(): string; + value(value: number): void; + value(value: string): void; + } + + interface BarcodeBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface BarcodePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface BarcodeTextMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface BarcodeText { + color?: string; + font?: string; + margin?: BarcodeTextMargin; + visible?: boolean; + } + + interface BarcodeExportImageOptions { + width?: string; + height?: string; + } + + interface BarcodeExportSVGOptions { + raw?: boolean; + } + + interface BarcodeOptions { + name?: string; + renderAs?: string; + background?: string; + border?: BarcodeBorder; + checksum?: boolean; + color?: string; + height?: number; + padding?: BarcodePadding; + text?: BarcodeText; + type?: string; + value?: string; + width?: number; + } + interface BarcodeEvent { + sender: Barcode; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Chart extends kendo.ui.Widget { + static fn: Chart; + static extend(proto: Object): Chart; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ChartOptions); + options: ChartOptions; + dataSource: kendo.data.DataSource; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + getAxis(name: string): kendo.dataviz.ChartAxis; + redraw(): void; + refresh(): void; + resize(force?: boolean): void; + saveAsPDF(): void; + setDataSource(dataSource: kendo.data.DataSource): void; + setOptions(options: any): void; + svg(): string; + imageDataURL(): string; + toggleHighlight(show: boolean, options: any): void; + } + + interface ChartCategoryAxisItemAutoBaseUnitSteps { + seconds?: any; + minutes?: any; + hours?: any; + days?: any; + weeks?: any; + months?: any; + years?: any; + } + + interface ChartCategoryAxisItemCrosshairTooltipBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartCategoryAxisItemCrosshairTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartCategoryAxisItemCrosshairTooltip { + background?: string; + border?: ChartCategoryAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartCategoryAxisItemCrosshairTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartCategoryAxisItemCrosshair { + color?: string; + opacity?: number; + tooltip?: ChartCategoryAxisItemCrosshairTooltip; + visible?: boolean; + width?: number; + } + + interface ChartCategoryAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartCategoryAxisItemLabelsDateFormats { + days?: string; + hours?: string; + months?: string; + weeks?: string; + years?: string; + } + + interface ChartCategoryAxisItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartCategoryAxisItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartCategoryAxisItemLabels { + background?: string; + border?: ChartCategoryAxisItemLabelsBorder; + color?: string; + culture?: string; + dateFormats?: ChartCategoryAxisItemLabelsDateFormats; + font?: string; + format?: string; + margin?: ChartCategoryAxisItemLabelsMargin; + mirror?: boolean; + padding?: ChartCategoryAxisItemLabelsPadding; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + visual?: Function; + } + + interface ChartCategoryAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface ChartCategoryAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartCategoryAxisItemMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartCategoryAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartCategoryAxisItemMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartCategoryAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface ChartCategoryAxisItemNotesDataItemIcon { + background?: string; + border?: ChartCategoryAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartCategoryAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartCategoryAxisItemNotesDataItemLabel { + background?: string; + border?: ChartCategoryAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface ChartCategoryAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartCategoryAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: ChartCategoryAxisItemNotesDataItemIcon; + label?: ChartCategoryAxisItemNotesDataItemLabel; + line?: ChartCategoryAxisItemNotesDataItemLine; + } + + interface ChartCategoryAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartCategoryAxisItemNotesIcon { + background?: string; + border?: ChartCategoryAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartCategoryAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartCategoryAxisItemNotesLabel { + background?: string; + border?: ChartCategoryAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartCategoryAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartCategoryAxisItemNotes { + position?: string; + icon?: ChartCategoryAxisItemNotesIcon; + label?: ChartCategoryAxisItemNotesLabel; + line?: ChartCategoryAxisItemNotesLine; + data?: ChartCategoryAxisItemNotesDataItem[]; + visual?: Function; + } + + interface ChartCategoryAxisItemPlotBand { + color?: string; + from?: number; + opacity?: number; + to?: number; + } + + interface ChartCategoryAxisItemSelectMousewheel { + reverse?: boolean; + zoom?: string; + } + + interface ChartCategoryAxisItemSelect { + from?: any; + max?: any; + min?: any; + mousewheel?: ChartCategoryAxisItemSelectMousewheel; + to?: any; + } + + interface ChartCategoryAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartCategoryAxisItemTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartCategoryAxisItemTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartCategoryAxisItemTitle { + background?: string; + border?: ChartCategoryAxisItemTitleBorder; + color?: string; + font?: string; + margin?: ChartCategoryAxisItemTitleMargin; + padding?: ChartCategoryAxisItemTitlePadding; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + visual?: Function; + } + + interface ChartCategoryAxisItem { + autoBaseUnitSteps?: ChartCategoryAxisItemAutoBaseUnitSteps; + axisCrossingValue?: any; + background?: string; + baseUnit?: string; + baseUnitStep?: any; + categories?: any; + color?: string; + crosshair?: ChartCategoryAxisItemCrosshair; + field?: string; + justified?: boolean; + labels?: ChartCategoryAxisItemLabels; + line?: ChartCategoryAxisItemLine; + majorGridLines?: ChartCategoryAxisItemMajorGridLines; + majorTicks?: ChartCategoryAxisItemMajorTicks; + max?: any; + maxDateGroups?: number; + min?: any; + minorGridLines?: ChartCategoryAxisItemMinorGridLines; + minorTicks?: ChartCategoryAxisItemMinorTicks; + name?: string; + pane?: string; + plotBands?: ChartCategoryAxisItemPlotBand[]; + reverse?: boolean; + roundToBaseUnit?: boolean; + select?: ChartCategoryAxisItemSelect; + startAngle?: number; + title?: ChartCategoryAxisItemTitle; + type?: string; + visible?: boolean; + weekStartDay?: number; + notes?: ChartCategoryAxisItemNotes; + } + + interface ChartChartAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartChartAreaMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartChartArea { + background?: string; + border?: ChartChartAreaBorder; + height?: number; + margin?: ChartChartAreaMargin; + opacity?: number; + width?: number; + } + + interface ChartLegendBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartLegendInactiveItemsLabels { + color?: string; + font?: string; + template?: any; + } + + interface ChartLegendInactiveItems { + labels?: ChartLegendInactiveItemsLabels; + } + + interface ChartLegendItem { + visual?: Function; + } + + interface ChartLegendLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartLegendLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartLegendLabels { + color?: string; + font?: string; + margin?: ChartLegendLabelsMargin; + padding?: ChartLegendLabelsPadding; + template?: any; + } + + interface ChartLegendMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartLegendPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartLegend { + align?: string; + background?: string; + border?: ChartLegendBorder; + height?: number; + inactiveItems?: ChartLegendInactiveItems; + item?: ChartLegendItem; + labels?: ChartLegendLabels; + margin?: ChartLegendMargin; + offsetX?: number; + offsetY?: number; + orientation?: string; + padding?: ChartLegendPadding; + position?: string; + reverse?: boolean; + visible?: boolean; + width?: number; + } + + interface ChartPaneBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartPaneMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartPanePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartPaneTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartPaneTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartPaneTitle { + background?: string; + border?: ChartPaneTitleBorder; + color?: string; + font?: string; + margin?: ChartPaneTitleMargin; + position?: string; + text?: string; + visible?: boolean; + visual?: Function; + } + + interface ChartPane { + background?: string; + border?: ChartPaneBorder; + clip?: boolean; + height?: number; + margin?: ChartPaneMargin; + name?: string; + padding?: ChartPanePadding; + title?: ChartPaneTitle; + } + + interface ChartPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface ChartPdf { + author?: string; + creator?: string; + date?: Date; + forceProxy?: boolean; + fileName?: string; + keywords?: string; + landscape?: boolean; + margin?: ChartPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface ChartPlotAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartPlotAreaMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartPlotAreaPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartPlotArea { + background?: string; + border?: ChartPlotAreaBorder; + margin?: ChartPlotAreaMargin; + opacity?: number; + padding?: ChartPlotAreaPadding; + } + + interface ChartSeriesItemBorder { + color?: any; + dashType?: any; + opacity?: any; + width?: any; + } + + interface ChartSeriesItemConnectors { + color?: string; + padding?: number; + width?: number; + } + + interface ChartSeriesItemErrorBarsLine { + width?: number; + dashType?: string; + } + + interface ChartSeriesItemErrorBars { + value?: any; + visual?: Function; + xValue?: any; + yValue?: any; + endCaps?: boolean; + color?: string; + line?: ChartSeriesItemErrorBarsLine; + } + + interface ChartSeriesItemExtremesBorder { + color?: any; + width?: any; + } + + interface ChartSeriesItemExtremes { + background?: any; + border?: ChartSeriesItemExtremesBorder; + size?: any; + type?: any; + rotation?: any; + } + + interface ChartSeriesItemHighlightBorder { + color?: string; + opacity?: number; + width?: number; + } + + interface ChartSeriesItemHighlightLine { + color?: string; + opacity?: number; + width?: number; + } + + interface ChartSeriesItemHighlight { + border?: ChartSeriesItemHighlightBorder; + color?: string; + line?: ChartSeriesItemHighlightLine; + opacity?: number; + toggle?: Function; + visible?: boolean; + visual?: Function; + } + + interface ChartSeriesItemLabelsBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface ChartSeriesItemLabelsFromBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface ChartSeriesItemLabelsFromMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsFromPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsFrom { + background?: any; + border?: ChartSeriesItemLabelsFromBorder; + color?: any; + font?: any; + format?: any; + margin?: ChartSeriesItemLabelsFromMargin; + padding?: ChartSeriesItemLabelsFromPadding; + position?: any; + template?: any; + visible?: any; + } + + interface ChartSeriesItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsToBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface ChartSeriesItemLabelsToMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsToPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemLabelsTo { + background?: any; + border?: ChartSeriesItemLabelsToBorder; + color?: any; + font?: any; + format?: any; + margin?: ChartSeriesItemLabelsToMargin; + padding?: ChartSeriesItemLabelsToPadding; + position?: any; + template?: any; + visible?: any; + } + + interface ChartSeriesItemLabels { + align?: string; + background?: any; + border?: ChartSeriesItemLabelsBorder; + color?: any; + distance?: number; + font?: any; + format?: any; + margin?: ChartSeriesItemLabelsMargin; + padding?: ChartSeriesItemLabelsPadding; + position?: any; + template?: any; + visible?: any; + visual?: Function; + from?: ChartSeriesItemLabelsFrom; + to?: ChartSeriesItemLabelsTo; + } + + interface ChartSeriesItemLine { + color?: string; + opacity?: number; + width?: string; + style?: string; + } + + interface ChartSeriesItemMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemMarkersBorder { + color?: any; + width?: any; + } + + interface ChartSeriesItemMarkers { + background?: any; + border?: ChartSeriesItemMarkersBorder; + size?: any; + type?: any; + visible?: any; + visual?: Function; + rotation?: any; + } + + interface ChartSeriesItemNegativeValues { + color?: string; + visible?: boolean; + } + + interface ChartSeriesItemNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartSeriesItemNotesIcon { + background?: string; + border?: ChartSeriesItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartSeriesItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesItemNotesLabel { + background?: string; + border?: ChartSeriesItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartSeriesItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartSeriesItemNotes { + position?: string; + icon?: ChartSeriesItemNotesIcon; + label?: ChartSeriesItemNotesLabel; + line?: ChartSeriesItemNotesLine; + visual?: Function; + } + + interface ChartSeriesItemOutliersBorder { + color?: any; + width?: any; + } + + interface ChartSeriesItemOutliers { + background?: any; + border?: ChartSeriesItemOutliersBorder; + size?: any; + type?: any; + rotation?: any; + } + + interface ChartSeriesItemOverlay { + gradient?: string; + } + + interface ChartSeriesItemStack { + type?: string; + group?: string; + } + + interface ChartSeriesItemTargetBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface ChartSeriesItemTargetLine { + width?: any; + } + + interface ChartSeriesItemTarget { + border?: ChartSeriesItemTargetBorder; + color?: any; + line?: ChartSeriesItemTargetLine; + } + + interface ChartSeriesItemTooltipBorder { + color?: string; + width?: number; + } + + interface ChartSeriesItemTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesItemTooltip { + background?: string; + border?: ChartSeriesItemTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartSeriesItemTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartSeriesItem { + aggregate?: any; + axis?: string; + border?: ChartSeriesItemBorder; + categoryField?: string; + closeField?: string; + color?: any; + colorField?: string; + connectors?: ChartSeriesItemConnectors; + currentField?: string; + dashType?: string; + data?: any; + downColor?: any; + downColorField?: string; + segmentSpacing?: number; + summaryField?: string; + neckRatio?: number; + dynamicSlope?: boolean; + dynamicHeight?: boolean; + errorBars?: ChartSeriesItemErrorBars; + errorLowField?: string; + errorHighField?: string; + xErrorLowField?: string; + xErrorHighField?: string; + yErrorLowField?: string; + yErrorHighField?: string; + explodeField?: string; + field?: string; + fromField?: string; + toField?: string; + noteTextField?: string; + lowerField?: string; + q1Field?: string; + medianField?: string; + q3Field?: string; + upperField?: string; + meanField?: string; + outliersField?: string; + gap?: number; + highField?: string; + highlight?: ChartSeriesItemHighlight; + holeSize?: number; + labels?: ChartSeriesItemLabels; + line?: ChartSeriesItemLine; + lowField?: string; + margin?: ChartSeriesItemMargin; + markers?: ChartSeriesItemMarkers; + outliers?: ChartSeriesItemOutliers; + extremes?: ChartSeriesItemExtremes; + maxSize?: number; + minSize?: number; + missingValues?: string; + style?: string; + name?: string; + negativeColor?: string; + negativeValues?: ChartSeriesItemNegativeValues; + opacity?: number; + openField?: string; + overlay?: ChartSeriesItemOverlay; + padding?: number; + size?: number; + sizeField?: string; + spacing?: number; + stack?: ChartSeriesItemStack; + startAngle?: number; + target?: ChartSeriesItemTarget; + targetField?: string; + tooltip?: ChartSeriesItemTooltip; + type?: string; + visible?: boolean; + visibleInLegend?: boolean; + visibleInLegendField?: string; + visual?: Function; + width?: number; + xAxis?: string; + xField?: string; + yAxis?: string; + yField?: string; + notes?: ChartSeriesItemNotes; + zIndex?: number; + } + + interface ChartSeriesDefaultsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesDefaultsLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesDefaultsLabelsFromBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesDefaultsLabelsFromMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsFromPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsFrom { + background?: string; + border?: ChartSeriesDefaultsLabelsFromBorder; + color?: string; + font?: string; + format?: string; + margin?: ChartSeriesDefaultsLabelsFromMargin; + padding?: ChartSeriesDefaultsLabelsFromPadding; + template?: any; + visible?: boolean; + } + + interface ChartSeriesDefaultsLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsToBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesDefaultsLabelsToMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsToPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsLabelsTo { + background?: string; + border?: ChartSeriesDefaultsLabelsToBorder; + color?: string; + font?: string; + format?: string; + margin?: ChartSeriesDefaultsLabelsToMargin; + padding?: ChartSeriesDefaultsLabelsToPadding; + template?: any; + visible?: boolean; + } + + interface ChartSeriesDefaultsLabels { + background?: string; + border?: ChartSeriesDefaultsLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: ChartSeriesDefaultsLabelsMargin; + padding?: ChartSeriesDefaultsLabelsPadding; + template?: any; + visible?: boolean; + visual?: Function; + from?: ChartSeriesDefaultsLabelsFrom; + to?: ChartSeriesDefaultsLabelsTo; + } + + interface ChartSeriesDefaultsNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartSeriesDefaultsNotesIcon { + background?: string; + border?: ChartSeriesDefaultsNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartSeriesDefaultsNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartSeriesDefaultsNotesLabel { + background?: string; + border?: ChartSeriesDefaultsNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartSeriesDefaultsNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartSeriesDefaultsNotes { + icon?: ChartSeriesDefaultsNotesIcon; + label?: ChartSeriesDefaultsNotesLabel; + line?: ChartSeriesDefaultsNotesLine; + visual?: Function; + } + + interface ChartSeriesDefaultsOverlay { + gradient?: string; + } + + interface ChartSeriesDefaultsStack { + type?: string; + } + + interface ChartSeriesDefaultsTooltipBorder { + color?: string; + width?: number; + } + + interface ChartSeriesDefaultsTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartSeriesDefaultsTooltip { + background?: string; + border?: ChartSeriesDefaultsTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartSeriesDefaultsTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartSeriesDefaults { + area?: any; + bar?: any; + border?: ChartSeriesDefaultsBorder; + bubble?: any; + candlestick?: any; + column?: any; + donut?: any; + gap?: number; + labels?: ChartSeriesDefaultsLabels; + line?: any; + ohlc?: any; + overlay?: ChartSeriesDefaultsOverlay; + pie?: any; + scatter?: any; + scatterLine?: any; + spacing?: number; + stack?: ChartSeriesDefaultsStack; + type?: string; + tooltip?: ChartSeriesDefaultsTooltip; + verticalArea?: any; + verticalLine?: any; + visual?: Function; + notes?: ChartSeriesDefaultsNotes; + } + + interface ChartTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartTitle { + align?: string; + background?: string; + border?: ChartTitleBorder; + color?: string; + font?: string; + margin?: ChartTitleMargin; + padding?: ChartTitlePadding; + position?: string; + text?: string; + visible?: boolean; + } + + interface ChartTooltipBorder { + color?: string; + width?: number; + } + + interface ChartTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartTooltip { + background?: string; + border?: ChartTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartTooltipPadding; + shared?: boolean; + sharedTemplate?: any; + template?: any; + visible?: boolean; + } + + interface ChartValueAxisItemCrosshairTooltipBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartValueAxisItemCrosshairTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartValueAxisItemCrosshairTooltip { + background?: string; + border?: ChartValueAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartValueAxisItemCrosshairTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartValueAxisItemCrosshair { + color?: string; + opacity?: number; + tooltip?: ChartValueAxisItemCrosshairTooltip; + visible?: boolean; + width?: number; + } + + interface ChartValueAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartValueAxisItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartValueAxisItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartValueAxisItemLabels { + background?: string; + border?: ChartValueAxisItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: ChartValueAxisItemLabelsMargin; + mirror?: boolean; + padding?: ChartValueAxisItemLabelsPadding; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + visual?: Function; + } + + interface ChartValueAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface ChartValueAxisItemMajorGridLines { + color?: string; + dashType?: string; + type?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartValueAxisItemMajorTicks { + color?: string; + size?: number; + visible?: boolean; + step?: number; + skip?: number; + } + + interface ChartValueAxisItemMinorGridLines { + color?: string; + dashType?: string; + type?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartValueAxisItemMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartValueAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface ChartValueAxisItemNotesDataItemIcon { + background?: string; + border?: ChartValueAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartValueAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartValueAxisItemNotesDataItemLabel { + background?: string; + border?: ChartValueAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface ChartValueAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartValueAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: ChartValueAxisItemNotesDataItemIcon; + label?: ChartValueAxisItemNotesDataItemLabel; + line?: ChartValueAxisItemNotesDataItemLine; + } + + interface ChartValueAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartValueAxisItemNotesIcon { + background?: string; + border?: ChartValueAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartValueAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartValueAxisItemNotesLabel { + background?: string; + border?: ChartValueAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartValueAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartValueAxisItemNotes { + position?: string; + icon?: ChartValueAxisItemNotesIcon; + label?: ChartValueAxisItemNotesLabel; + line?: ChartValueAxisItemNotesLine; + data?: ChartValueAxisItemNotesDataItem[]; + visual?: Function; + } + + interface ChartValueAxisItemPlotBand { + color?: string; + from?: number; + opacity?: number; + to?: number; + } + + interface ChartValueAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartValueAxisItemTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartValueAxisItemTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartValueAxisItemTitle { + background?: string; + border?: ChartValueAxisItemTitleBorder; + color?: string; + font?: string; + margin?: ChartValueAxisItemTitleMargin; + padding?: ChartValueAxisItemTitlePadding; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + visual?: Function; + } + + interface ChartValueAxisItem { + axisCrossingValue?: any; + background?: string; + color?: string; + crosshair?: ChartValueAxisItemCrosshair; + labels?: ChartValueAxisItemLabels; + line?: ChartValueAxisItemLine; + majorGridLines?: ChartValueAxisItemMajorGridLines; + majorUnit?: number; + max?: number; + min?: number; + minorGridLines?: ChartValueAxisItemMinorGridLines; + majorTicks?: ChartValueAxisItemMajorTicks; + minorTicks?: ChartValueAxisItemMinorTicks; + minorUnit?: number; + name?: any; + narrowRange?: boolean; + pane?: string; + plotBands?: ChartValueAxisItemPlotBand[]; + reverse?: boolean; + title?: ChartValueAxisItemTitle; + type?: string; + visible?: boolean; + notes?: ChartValueAxisItemNotes; + } + + interface ChartXAxisItemCrosshairTooltipBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartXAxisItemCrosshairTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartXAxisItemCrosshairTooltip { + background?: string; + border?: ChartXAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartXAxisItemCrosshairTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartXAxisItemCrosshair { + color?: string; + opacity?: number; + tooltip?: ChartXAxisItemCrosshairTooltip; + visible?: boolean; + width?: number; + } + + interface ChartXAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartXAxisItemLabelsDateFormats { + days?: string; + hours?: string; + months?: string; + weeks?: string; + years?: string; + } + + interface ChartXAxisItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartXAxisItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartXAxisItemLabels { + background?: string; + border?: ChartXAxisItemLabelsBorder; + color?: string; + culture?: string; + dateFormats?: ChartXAxisItemLabelsDateFormats; + font?: string; + format?: string; + margin?: ChartXAxisItemLabelsMargin; + mirror?: boolean; + padding?: ChartXAxisItemLabelsPadding; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + visual?: Function; + } + + interface ChartXAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface ChartXAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartXAxisItemMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartXAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartXAxisItemMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartXAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface ChartXAxisItemNotesDataItemIcon { + background?: string; + border?: ChartXAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartXAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartXAxisItemNotesDataItemLabel { + background?: string; + border?: ChartXAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface ChartXAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartXAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: ChartXAxisItemNotesDataItemIcon; + label?: ChartXAxisItemNotesDataItemLabel; + line?: ChartXAxisItemNotesDataItemLine; + } + + interface ChartXAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartXAxisItemNotesIcon { + background?: string; + border?: ChartXAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartXAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartXAxisItemNotesLabel { + background?: string; + border?: ChartXAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartXAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartXAxisItemNotes { + position?: string; + icon?: ChartXAxisItemNotesIcon; + label?: ChartXAxisItemNotesLabel; + line?: ChartXAxisItemNotesLine; + data?: ChartXAxisItemNotesDataItem[]; + visual?: Function; + } + + interface ChartXAxisItemPlotBand { + color?: string; + from?: number; + opacity?: number; + to?: number; + } + + interface ChartXAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartXAxisItemTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartXAxisItemTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartXAxisItemTitle { + background?: string; + border?: ChartXAxisItemTitleBorder; + color?: string; + font?: string; + margin?: ChartXAxisItemTitleMargin; + padding?: ChartXAxisItemTitlePadding; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + visual?: Function; + } + + interface ChartXAxisItem { + axisCrossingValue?: any; + background?: string; + baseUnit?: string; + color?: string; + crosshair?: ChartXAxisItemCrosshair; + labels?: ChartXAxisItemLabels; + line?: ChartXAxisItemLine; + majorGridLines?: ChartXAxisItemMajorGridLines; + minorGridLines?: ChartXAxisItemMinorGridLines; + minorTicks?: ChartXAxisItemMinorTicks; + majorTicks?: ChartXAxisItemMajorTicks; + majorUnit?: number; + max?: any; + min?: any; + minorUnit?: number; + name?: any; + narrowRange?: boolean; + pane?: string; + plotBands?: ChartXAxisItemPlotBand[]; + reverse?: boolean; + startAngle?: number; + title?: ChartXAxisItemTitle; + type?: string; + visible?: boolean; + notes?: ChartXAxisItemNotes; + } + + interface ChartYAxisItemCrosshairTooltipBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartYAxisItemCrosshairTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartYAxisItemCrosshairTooltip { + background?: string; + border?: ChartYAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: ChartYAxisItemCrosshairTooltipPadding; + template?: any; + visible?: boolean; + } + + interface ChartYAxisItemCrosshair { + color?: string; + opacity?: number; + tooltip?: ChartYAxisItemCrosshairTooltip; + visible?: boolean; + width?: number; + } + + interface ChartYAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartYAxisItemLabelsDateFormats { + days?: string; + hours?: string; + months?: string; + weeks?: string; + years?: string; + } + + interface ChartYAxisItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartYAxisItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartYAxisItemLabels { + background?: string; + border?: ChartYAxisItemLabelsBorder; + color?: string; + culture?: string; + dateFormats?: ChartYAxisItemLabelsDateFormats; + font?: string; + format?: string; + margin?: ChartYAxisItemLabelsMargin; + mirror?: boolean; + padding?: ChartYAxisItemLabelsPadding; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + visual?: Function; + } + + interface ChartYAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface ChartYAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartYAxisItemMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartYAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartYAxisItemMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface ChartYAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface ChartYAxisItemNotesDataItemIcon { + background?: string; + border?: ChartYAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartYAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartYAxisItemNotesDataItemLabel { + background?: string; + border?: ChartYAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface ChartYAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartYAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: ChartYAxisItemNotesDataItemIcon; + label?: ChartYAxisItemNotesDataItemLabel; + line?: ChartYAxisItemNotesDataItemLine; + } + + interface ChartYAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface ChartYAxisItemNotesIcon { + background?: string; + border?: ChartYAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface ChartYAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartYAxisItemNotesLabel { + background?: string; + border?: ChartYAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface ChartYAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface ChartYAxisItemNotes { + position?: string; + icon?: ChartYAxisItemNotesIcon; + label?: ChartYAxisItemNotesLabel; + line?: ChartYAxisItemNotesLine; + data?: ChartYAxisItemNotesDataItem[]; + visual?: Function; + } + + interface ChartYAxisItemPlotBand { + color?: string; + from?: number; + opacity?: number; + to?: number; + } + + interface ChartYAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface ChartYAxisItemTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartYAxisItemTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface ChartYAxisItemTitle { + background?: string; + border?: ChartYAxisItemTitleBorder; + color?: string; + font?: string; + margin?: ChartYAxisItemTitleMargin; + padding?: ChartYAxisItemTitlePadding; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + visual?: Function; + } + + interface ChartYAxisItem { + axisCrossingValue?: any; + background?: string; + baseUnit?: string; + color?: string; + crosshair?: ChartYAxisItemCrosshair; + labels?: ChartYAxisItemLabels; + line?: ChartYAxisItemLine; + majorGridLines?: ChartYAxisItemMajorGridLines; + minorGridLines?: ChartYAxisItemMinorGridLines; + minorTicks?: ChartYAxisItemMinorTicks; + majorTicks?: ChartYAxisItemMajorTicks; + majorUnit?: number; + max?: any; + min?: any; + minorUnit?: number; + name?: any; + narrowRange?: boolean; + pane?: string; + plotBands?: ChartYAxisItemPlotBand[]; + reverse?: boolean; + title?: ChartYAxisItemTitle; + type?: string; + visible?: boolean; + notes?: ChartYAxisItemNotes; + } + + interface ChartExportImageOptions { + width?: string; + height?: string; + } + + interface ChartExportSVGOptions { + raw?: boolean; + } + + interface ChartToggleHighlightOptions { + series?: string; + category?: string; + } + + interface ChartSeriesClickEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface ChartSeriesHoverEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface ChartOptions { + name?: string; + autoBind?: boolean; + axisDefaults?: any; + categoryAxis?: ChartCategoryAxisItem[]; + chartArea?: ChartChartArea; + dataSource?: any; + legend?: ChartLegend; + panes?: ChartPane[]; + pdf?: ChartPdf; + plotArea?: ChartPlotArea; + renderAs?: string; + series?: ChartSeriesItem[]; + seriesColors?: any; + seriesDefaults?: ChartSeriesDefaults; + theme?: string; + title?: ChartTitle; + tooltip?: ChartTooltip; + transitions?: boolean; + valueAxis?: ChartValueAxisItem[]; + xAxis?: ChartXAxisItem[]; + yAxis?: ChartYAxisItem[]; + axisLabelClick?(e: ChartAxisLabelClickEvent): void; + legendItemClick?(e: ChartLegendItemClickEvent): void; + legendItemHover?(e: ChartLegendItemHoverEvent): void; + dataBound?(e: ChartDataBoundEvent): void; + drag?(e: ChartDragEvent): void; + dragEnd?(e: ChartDragEndEvent): void; + dragStart?(e: ChartDragStartEvent): void; + noteClick?(e: ChartNoteClickEvent): void; + noteHover?(e: ChartNoteHoverEvent): void; + plotAreaClick?(e: ChartPlotAreaClickEvent): void; + render?(e: ChartEvent): void; + select?(e: ChartSelectEvent): void; + selectEnd?(e: ChartSelectEndEvent): void; + selectStart?(e: ChartSelectStartEvent): void; + seriesClick?(e: ChartSeriesClickEvent): void; + seriesHover?(e: ChartSeriesHoverEvent): void; + zoom?(e: ChartZoomEvent): void; + zoomEnd?(e: ChartZoomEndEvent): void; + zoomStart?(e: ChartZoomStartEvent): void; + } + interface ChartEvent { + sender: Chart; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ChartAxisLabelClickEvent extends ChartEvent { + axis?: any; + dataItem?: any; + element?: any; + index?: any; + text?: string; + value?: any; + } + + interface ChartLegendItemClickEvent extends ChartEvent { + text?: string; + series?: any; + seriesIndex?: number; + pointIndex?: number; + element?: any; + } + + interface ChartLegendItemHoverEvent extends ChartEvent { + text?: string; + series?: any; + seriesIndex?: number; + pointIndex?: number; + element?: any; + } + + interface ChartDataBoundEvent extends ChartEvent { + } + + interface ChartDragEvent extends ChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface ChartDragEndEvent extends ChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface ChartDragStartEvent extends ChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface ChartNoteClickEvent extends ChartEvent { + category?: any; + element?: any; + value?: any; + series?: any; + dataItem?: any; + } + + interface ChartNoteHoverEvent extends ChartEvent { + category?: any; + element?: any; + value?: any; + series?: any; + dataItem?: any; + } + + interface ChartPlotAreaClickEvent extends ChartEvent { + category?: any; + element?: any; + originalEvent?: any; + value?: any; + x?: any; + y?: any; + } + + interface ChartSelectEvent extends ChartEvent { + axis?: any; + from?: any; + to?: any; + } + + interface ChartSelectEndEvent extends ChartEvent { + axis?: any; + from?: any; + to?: any; + } + + interface ChartSelectStartEvent extends ChartEvent { + axis?: any; + from?: any; + to?: any; + } + + interface ChartSeriesClickEvent extends ChartEvent { + category?: any; + element?: any; + originalEvent?: any; + series?: ChartSeriesClickEventSeries; + dataItem?: any; + value?: any; + percentage?: any; + } + + interface ChartSeriesHoverEvent extends ChartEvent { + category?: any; + categoryPoints?: any; + element?: any; + originalEvent?: any; + series?: ChartSeriesHoverEventSeries; + dataItem?: any; + value?: any; + percentage?: any; + } + + interface ChartZoomEvent extends ChartEvent { + axisRanges?: any; + delta?: number; + originalEvent?: any; + } + + interface ChartZoomEndEvent extends ChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface ChartZoomStartEvent extends ChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + + class Diagram extends kendo.ui.Widget { + static fn: Diagram; + static extend(proto: Object): Diagram; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DiagramOptions); + options: DiagramOptions; + dataSource: kendo.data.DataSource; + addConnection(connection: any, undoable: boolean): void; + addShape(obj: any, undoable: boolean): kendo.dataviz.diagram.Shape; + alignShapes(direction: string): void; + boundingBox(items: any): kendo.dataviz.diagram.Rect; + bringIntoView(obj: any, options: any): void; + cancelEdit(): void; + clear(): void; + connect(source: any, target: any, options: any): void; + connected(source: any, target: any): void; + copy(): void; + createConnection(item: any): void; + createShape(item: any): void; + cut(): void; + destroy(): void; + documentToModel(point: any): any; + documentToView(point: any): any; + edit(item: any): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + focus(): void; + getShapeById(id: string): any; + layerToModel(point: any): any; + layout(options: any): void; + load(json: string): void; + modelToDocument(point: any): any; + modelToLayer(point: any): any; + modelToView(point: any): any; + pan(pan: any): void; + paste(): void; + redo(): void; + remove(items: any, undoable: boolean): void; + resize(): void; + save(): void; + saveEdit(): void; + select(): any; + select(elements: kendo.dataviz.diagram.Connection, options: any): void; + select(elements: kendo.dataviz.diagram.Shape, options: any): void; + select(elements: any, options: any): void; + selectAll(): void; + selectArea(rect: kendo.dataviz.diagram.Rect): void; + setConnectionsDataSource(dataSource: kendo.data.DataSource): void; + setDataSource(dataSource: kendo.data.DataSource): void; + toBack(items: any, undoable: boolean): void; + toFront(items: any, undoable: boolean): void; + transformPoint(p: any): void; + transformRect(r: any): void; + undo(): void; + viewToDocument(point: any): any; + viewToModel(point: any): any; + viewport(): void; + zoom(zoom: number, point: any): void; + } + + interface DiagramConnectionDefaultsContent { + template?: any; + text?: string; + } + + interface DiagramConnectionDefaultsEditableTool { + name?: string; + } + + interface DiagramConnectionDefaultsEditable { + tools?: DiagramConnectionDefaultsEditableTool[]; + } + + interface DiagramConnectionDefaultsEndCapFill { + color?: string; + } + + interface DiagramConnectionDefaultsEndCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramConnectionDefaultsEndCap { + fill?: DiagramConnectionDefaultsEndCapFill; + stroke?: DiagramConnectionDefaultsEndCapStroke; + type?: string; + } + + interface DiagramConnectionDefaultsHoverStroke { + color?: string; + } + + interface DiagramConnectionDefaultsHover { + stroke?: DiagramConnectionDefaultsHoverStroke; + } + + interface DiagramConnectionDefaultsSelectionHandlesFill { + color?: string; + } + + interface DiagramConnectionDefaultsSelectionHandlesStroke { + color?: string; + } + + interface DiagramConnectionDefaultsSelectionHandles { + fill?: DiagramConnectionDefaultsSelectionHandlesFill; + stroke?: DiagramConnectionDefaultsSelectionHandlesStroke; + } + + interface DiagramConnectionDefaultsSelection { + handles?: DiagramConnectionDefaultsSelectionHandles; + } + + interface DiagramConnectionDefaultsStartCapFill { + color?: string; + } + + interface DiagramConnectionDefaultsStartCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramConnectionDefaultsStartCap { + fill?: DiagramConnectionDefaultsStartCapFill; + stroke?: DiagramConnectionDefaultsStartCapStroke; + type?: string; + } + + interface DiagramConnectionDefaultsStroke { + color?: string; + width?: number; + } + + interface DiagramConnectionDefaults { + content?: DiagramConnectionDefaultsContent; + editable?: DiagramConnectionDefaultsEditable; + endCap?: DiagramConnectionDefaultsEndCap; + hover?: DiagramConnectionDefaultsHover; + selectable?: boolean; + selection?: DiagramConnectionDefaultsSelection; + startCap?: DiagramConnectionDefaultsStartCap; + stroke?: DiagramConnectionDefaultsStroke; + } + + interface DiagramConnectionContent { + template?: any; + text?: string; + } + + interface DiagramConnectionEditableTool { + name?: string; + } + + interface DiagramConnectionEditable { + tools?: DiagramConnectionEditableTool[]; + } + + interface DiagramConnectionEndCapFill { + color?: string; + } + + interface DiagramConnectionEndCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramConnectionEndCap { + fill?: DiagramConnectionEndCapFill; + stroke?: DiagramConnectionEndCapStroke; + type?: string; + } + + interface DiagramConnectionFrom { + x?: number; + y?: number; + } + + interface DiagramConnectionHoverStroke { + color?: string; + } + + interface DiagramConnectionHover { + stroke?: DiagramConnectionHoverStroke; + } + + interface DiagramConnectionPoint { + x?: number; + y?: number; + } + + interface DiagramConnectionSelectionHandlesFill { + color?: string; + } + + interface DiagramConnectionSelectionHandlesStroke { + color?: string; + } + + interface DiagramConnectionSelectionHandles { + fill?: DiagramConnectionSelectionHandlesFill; + stroke?: DiagramConnectionSelectionHandlesStroke; + } + + interface DiagramConnectionSelection { + handles?: DiagramConnectionSelectionHandles; + } + + interface DiagramConnectionStartCapFill { + color?: string; + } + + interface DiagramConnectionStartCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramConnectionStartCap { + fill?: DiagramConnectionStartCapFill; + stroke?: DiagramConnectionStartCapStroke; + type?: string; + } + + interface DiagramConnectionStroke { + color?: string; + width?: number; + } + + interface DiagramConnectionTo { + x?: number; + y?: number; + } + + interface DiagramConnection { + content?: DiagramConnectionContent; + editable?: DiagramConnectionEditable; + endCap?: DiagramConnectionEndCap; + from?: DiagramConnectionFrom; + hover?: DiagramConnectionHover; + points?: DiagramConnectionPoint[]; + selection?: DiagramConnectionSelection; + startCap?: DiagramConnectionStartCap; + stroke?: DiagramConnectionStroke; + to?: DiagramConnectionTo; + } + + interface DiagramEditableResizeHandlesFill { + color?: string; + opacity?: number; + } + + interface DiagramEditableResizeHandlesHoverFill { + color?: string; + opacity?: number; + } + + interface DiagramEditableResizeHandlesHoverStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramEditableResizeHandlesHover { + fill?: DiagramEditableResizeHandlesHoverFill; + stroke?: DiagramEditableResizeHandlesHoverStroke; + } + + interface DiagramEditableResizeHandlesStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramEditableResizeHandles { + fill?: DiagramEditableResizeHandlesFill; + height?: number; + hover?: DiagramEditableResizeHandlesHover; + stroke?: DiagramEditableResizeHandlesStroke; + width?: number; + } + + interface DiagramEditableResize { + handles?: DiagramEditableResizeHandles; + } + + interface DiagramEditableRotateFill { + color?: string; + opacity?: number; + } + + interface DiagramEditableRotateStroke { + color?: string; + width?: number; + } + + interface DiagramEditableRotate { + fill?: DiagramEditableRotateFill; + stroke?: DiagramEditableRotateStroke; + } + + interface DiagramEditableTool { + name?: string; + step?: number; + } + + interface DiagramEditable { + connectionTemplate?: any; + resize?: DiagramEditableResize; + rotate?: DiagramEditableRotate; + shapeTemplate?: any; + tools?: DiagramEditableTool[]; + } + + interface DiagramLayoutGrid { + componentSpacingX?: number; + componentSpacingY?: number; + offsetX?: number; + offsetY?: number; + width?: number; + } + + interface DiagramLayout { + endRadialAngle?: number; + grid?: DiagramLayoutGrid; + horizontalSeparation?: number; + iterations?: number; + layerSeparation?: number; + nodeDistance?: number; + radialFirstLevelSeparation?: number; + radialSeparation?: number; + startRadialAngle?: number; + subtype?: string; + type?: string; + underneathHorizontalOffset?: number; + underneathVerticalSeparation?: number; + underneathVerticalTopOffset?: number; + verticalSeparation?: number; + } + + interface DiagramPannable { + key?: string; + } + + interface DiagramPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface DiagramPdf { + author?: string; + creator?: string; + date?: Date; + fileName?: string; + forceProxy?: boolean; + keywords?: string; + landscape?: boolean; + margin?: DiagramPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface DiagramSelectableStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramSelectable { + key?: string; + stroke?: DiagramSelectableStroke; + } + + interface DiagramShapeDefaultsConnector { + name?: string; + position?: any; + } + + interface DiagramShapeDefaultsContent { + align?: string; + color?: string; + fontFamily?: string; + fontSize?: number; + template?: any; + text?: string; + } + + interface DiagramShapeDefaultsEditableTool { + name?: string; + step?: number; + } + + interface DiagramShapeDefaultsEditable { + connect?: boolean; + tools?: DiagramShapeDefaultsEditableTool[]; + } + + interface DiagramShapeDefaultsFill { + color?: string; + opacity?: number; + } + + interface DiagramShapeDefaultsHoverFill { + color?: string; + opacity?: number; + } + + interface DiagramShapeDefaultsHover { + fill?: DiagramShapeDefaultsHoverFill; + } + + interface DiagramShapeDefaultsRotation { + angle?: number; + } + + interface DiagramShapeDefaultsStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramShapeDefaults { + connectors?: DiagramShapeDefaultsConnector[]; + content?: DiagramShapeDefaultsContent; + editable?: DiagramShapeDefaultsEditable; + fill?: DiagramShapeDefaultsFill; + height?: number; + hover?: DiagramShapeDefaultsHover; + minHeight?: number; + minWidth?: number; + path?: string; + rotation?: DiagramShapeDefaultsRotation; + selectable?: boolean; + source?: string; + stroke?: DiagramShapeDefaultsStroke; + type?: string; + visual?: Function; + width?: number; + x?: number; + y?: number; + } + + interface DiagramShapeConnector { + description?: string; + name?: string; + position?: any; + } + + interface DiagramShapeContent { + align?: string; + color?: string; + fontFamily?: string; + fontSize?: number; + template?: any; + text?: string; + } + + interface DiagramShapeEditableTool { + name?: string; + step?: number; + } + + interface DiagramShapeEditable { + connect?: boolean; + tools?: DiagramShapeEditableTool[]; + } + + interface DiagramShapeFill { + color?: string; + opacity?: number; + } + + interface DiagramShapeHoverFill { + color?: string; + opacity?: number; + } + + interface DiagramShapeHover { + fill?: DiagramShapeHoverFill; + } + + interface DiagramShapeRotation { + angle?: number; + } + + interface DiagramShapeStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface DiagramShape { + connectors?: DiagramShapeConnector[]; + content?: DiagramShapeContent; + editable?: DiagramShapeEditable; + fill?: DiagramShapeFill; + height?: number; + hover?: DiagramShapeHover; + id?: string; + minHeight?: number; + minWidth?: number; + path?: string; + rotation?: DiagramShapeRotation; + source?: string; + stroke?: DiagramShapeStroke; + type?: string; + visual?: Function; + width?: number; + x?: number; + y?: number; + } + + interface DiagramExportImageOptions { + width?: string; + height?: string; + } + + interface DiagramExportSVGOptions { + raw?: boolean; + } + + interface DiagramSelectOptions { + addToSelection?: boolean; + } + + interface DiagramOptions { + name?: string; + autoBind?: boolean; + connectionDefaults?: DiagramConnectionDefaults; + connections?: DiagramConnection[]; + connectionsDataSource?: any; + dataSource?: any; + editable?: DiagramEditable; + layout?: DiagramLayout; + pannable?: DiagramPannable; + pdf?: DiagramPdf; + selectable?: DiagramSelectable; + shapeDefaults?: DiagramShapeDefaults; + shapes?: DiagramShape[]; + template?: any; + zoom?: number; + zoomMax?: number; + zoomMin?: number; + zoomRate?: number; + add?(e: DiagramAddEvent): void; + cancel?(e: DiagramCancelEvent): void; + change?(e: DiagramChangeEvent): void; + click?(e: DiagramClickEvent): void; + dataBound?(e: DiagramDataBoundEvent): void; + edit?(e: DiagramEditEvent): void; + itemBoundsChange?(e: DiagramItemBoundsChangeEvent): void; + itemRotate?(e: DiagramItemRotateEvent): void; + mouseEnter?(e: DiagramMouseEnterEvent): void; + mouseLeave?(e: DiagramMouseLeaveEvent): void; + pan?(e: DiagramPanEvent): void; + remove?(e: DiagramRemoveEvent): void; + save?(e: DiagramSaveEvent): void; + select?(e: DiagramSelectEvent): void; + zoomEnd?(e: DiagramZoomEndEvent): void; + zoomStart?(e: DiagramZoomStartEvent): void; + } + interface DiagramEvent { + sender: Diagram; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DiagramAddEvent extends DiagramEvent { + connection?: kendo.dataviz.diagram.Connection; + shape?: kendo.dataviz.diagram.Shape; + } + + interface DiagramCancelEvent extends DiagramEvent { + container?: JQuery; + connection?: kendo.data.Model; + shape?: kendo.data.Model; + } + + interface DiagramChangeEvent extends DiagramEvent { + added?: any; + removed?: any; + } + + interface DiagramClickEvent extends DiagramEvent { + item?: any; + point?: kendo.dataviz.diagram.Point; + } + + interface DiagramDataBoundEvent extends DiagramEvent { + } + + interface DiagramEditEvent extends DiagramEvent { + container?: JQuery; + connection?: kendo.data.Model; + shape?: kendo.data.Model; + } + + interface DiagramItemBoundsChangeEvent extends DiagramEvent { + bounds?: kendo.dataviz.diagram.Rect; + item?: any; + } + + interface DiagramItemRotateEvent extends DiagramEvent { + item?: any; + } + + interface DiagramMouseEnterEvent extends DiagramEvent { + item?: any; + } + + interface DiagramMouseLeaveEvent extends DiagramEvent { + item?: any; + } + + interface DiagramPanEvent extends DiagramEvent { + } + + interface DiagramRemoveEvent extends DiagramEvent { + connection?: kendo.dataviz.diagram.Connection; + shape?: kendo.dataviz.diagram.Shape; + } + + interface DiagramSaveEvent extends DiagramEvent { + container?: JQuery; + connection?: kendo.data.Model; + shape?: kendo.data.Model; + } + + interface DiagramSelectEvent extends DiagramEvent { + selected?: any; + deselected?: any; + } + + interface DiagramZoomEndEvent extends DiagramEvent { + point?: kendo.dataviz.diagram.Point; + zoom?: number; + } + + interface DiagramZoomStartEvent extends DiagramEvent { + point?: kendo.dataviz.diagram.Point; + zoom?: number; + } + + + class LinearGauge extends kendo.ui.Widget { + static fn: LinearGauge; + static extend(proto: Object): LinearGauge; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: LinearGaugeOptions); + options: LinearGaugeOptions; + allValues(values: any): any; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + redraw(): void; + resize(force?: boolean): void; + svg(): void; + imageDataURL(): string; + value(): void; + } + + interface LinearGaugeGaugeAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface LinearGaugeGaugeArea { + background?: any; + border?: LinearGaugeGaugeAreaBorder; + height?: number; + margin?: any; + width?: number; + } + + interface LinearGaugePointerItemBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface LinearGaugePointerItemTrackBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface LinearGaugePointerItemTrack { + border?: LinearGaugePointerItemTrackBorder; + color?: string; + opacity?: number; + size?: number; + visible?: boolean; + } + + interface LinearGaugePointerItem { + border?: LinearGaugePointerItemBorder; + color?: string; + margin?: any; + opacity?: number; + shape?: string; + size?: number; + track?: LinearGaugePointerItemTrack; + value?: number; + } + + interface LinearGaugeScaleLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface LinearGaugeScaleLabels { + background?: string; + border?: LinearGaugeScaleLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + padding?: any; + template?: any; + visible?: boolean; + } + + interface LinearGaugeScaleLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface LinearGaugeScaleMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + } + + interface LinearGaugeScaleMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + } + + interface LinearGaugeScaleRange { + from?: number; + to?: number; + opacity?: number; + color?: string; + } + + interface LinearGaugeScale { + line?: LinearGaugeScaleLine; + labels?: LinearGaugeScaleLabels; + majorTicks?: LinearGaugeScaleMajorTicks; + majorUnit?: number; + max?: number; + min?: number; + minorTicks?: LinearGaugeScaleMinorTicks; + minorUnit?: number; + mirror?: boolean; + ranges?: LinearGaugeScaleRange[]; + rangePlaceholderColor?: string; + rangeSize?: number; + reverse?: boolean; + vertical?: boolean; + } + + interface LinearGaugeExportImageOptions { + width?: string; + height?: string; + } + + interface LinearGaugeExportSVGOptions { + raw?: boolean; + } + + interface LinearGaugeOptions { + name?: string; + gaugeArea?: LinearGaugeGaugeArea; + pointer?: LinearGaugePointerItem[]; + renderAs?: string; + scale?: LinearGaugeScale; + transitions?: boolean; + } + interface LinearGaugeEvent { + sender: LinearGauge; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Map extends kendo.ui.Widget { + static fn: Map; + static extend(proto: Object): Map; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: MapOptions); + options: MapOptions; + center(): kendo.dataviz.map.Location; + center(center: any): void; + center(center: kendo.dataviz.map.Location): void; + destroy(): void; + eventOffset(e: any): kendo.geometry.Point; + eventOffset(e: JQueryEventObject): kendo.geometry.Point; + eventToLayer(e: any): kendo.geometry.Point; + eventToLayer(e: JQueryEventObject): kendo.geometry.Point; + eventToLocation(e: any): kendo.geometry.Point; + eventToLocation(e: JQueryEventObject): kendo.geometry.Point; + eventToView(e: any): kendo.geometry.Point; + eventToView(e: JQueryEventObject): kendo.geometry.Point; + extent(): kendo.dataviz.map.Extent; + extent(extent: kendo.dataviz.map.Extent): void; + layerToLocation(point: any, zoom: number): kendo.dataviz.map.Location; + layerToLocation(point: kendo.geometry.Point, zoom: number): kendo.dataviz.map.Location; + locationToLayer(location: any, zoom: number): kendo.geometry.Point; + locationToLayer(location: kendo.dataviz.map.Location, zoom: number): kendo.geometry.Point; + locationToView(location: any): kendo.geometry.Point; + locationToView(location: kendo.dataviz.map.Location): kendo.geometry.Point; + resize(force?: boolean): void; + setOptions(options: any): void; + viewSize(): any; + viewToLocation(point: any, zoom: number): kendo.dataviz.map.Location; + viewToLocation(point: kendo.geometry.Point, zoom: number): kendo.dataviz.map.Location; + zoom(): number; + zoom(level: number): void; + layers: any; + } + + interface MapControlsAttribution { + position?: string; + } + + interface MapControlsNavigator { + position?: string; + } + + interface MapControlsZoom { + position?: string; + } + + interface MapControls { + attribution?: MapControlsAttribution; + navigator?: MapControlsNavigator; + zoom?: MapControlsZoom; + } + + interface MapLayerDefaultsBing { + attribution?: string; + opacity?: number; + key?: string; + imagerySet?: string; + } + + interface MapLayerDefaultsBubbleStyleFill { + color?: string; + opacity?: number; + } + + interface MapLayerDefaultsBubbleStyleStroke { + color?: string; + dashType?: string; + opacity?: number; + width?: number; + } + + interface MapLayerDefaultsBubbleStyle { + fill?: MapLayerDefaultsBubbleStyleFill; + stroke?: MapLayerDefaultsBubbleStyleStroke; + } + + interface MapLayerDefaultsBubble { + attribution?: string; + opacity?: number; + maxSize?: number; + minSize?: number; + style?: MapLayerDefaultsBubbleStyle; + symbol?: any; + } + + interface MapLayerDefaultsMarkerTooltipAnimationClose { + effects?: string; + duration?: number; + } + + interface MapLayerDefaultsMarkerTooltipAnimationOpen { + effects?: string; + duration?: number; + } + + interface MapLayerDefaultsMarkerTooltipAnimation { + close?: MapLayerDefaultsMarkerTooltipAnimationClose; + open?: MapLayerDefaultsMarkerTooltipAnimationOpen; + } + + interface MapLayerDefaultsMarkerTooltipContent { + url?: string; + } + + interface MapLayerDefaultsMarkerTooltip { + autoHide?: boolean; + animation?: MapLayerDefaultsMarkerTooltipAnimation; + content?: MapLayerDefaultsMarkerTooltipContent; + template?: string; + callout?: boolean; + iframe?: boolean; + height?: number; + width?: number; + position?: string; + showAfter?: number; + showOn?: string; + } + + interface MapLayerDefaultsMarker { + shape?: string; + tooltip?: MapLayerDefaultsMarkerTooltip; + opacity?: number; + } + + interface MapLayerDefaultsShapeStyleFill { + color?: string; + opacity?: number; + } + + interface MapLayerDefaultsShapeStyleStroke { + color?: string; + dashType?: string; + opacity?: number; + width?: number; + } + + interface MapLayerDefaultsShapeStyle { + fill?: MapLayerDefaultsShapeStyleFill; + stroke?: MapLayerDefaultsShapeStyleStroke; + } + + interface MapLayerDefaultsShape { + attribution?: string; + opacity?: number; + style?: MapLayerDefaultsShapeStyle; + } + + interface MapLayerDefaultsTile { + urlTemplate?: string; + attribution?: string; + subdomains?: any; + opacity?: number; + } + + interface MapLayerDefaults { + marker?: MapLayerDefaultsMarker; + shape?: MapLayerDefaultsShape; + bubble?: MapLayerDefaultsBubble; + tile?: MapLayerDefaultsTile; + bing?: MapLayerDefaultsBing; + } + + interface MapLayerStyleFill { + color?: string; + opacity?: number; + } + + interface MapLayerStyleStroke { + color?: string; + dashType?: number; + opacity?: number; + width?: number; + } + + interface MapLayerStyle { + fill?: MapLayerStyleFill; + stroke?: MapLayerStyleStroke; + } + + interface MapLayerTooltipAnimationClose { + effects?: string; + duration?: number; + } + + interface MapLayerTooltipAnimationOpen { + effects?: string; + duration?: number; + } + + interface MapLayerTooltipAnimation { + close?: MapLayerTooltipAnimationClose; + open?: MapLayerTooltipAnimationOpen; + } + + interface MapLayerTooltipContent { + url?: string; + } + + interface MapLayerTooltip { + autoHide?: boolean; + animation?: MapLayerTooltipAnimation; + content?: MapLayerTooltipContent; + template?: string; + callout?: boolean; + iframe?: boolean; + height?: number; + width?: number; + position?: string; + showAfter?: number; + showOn?: string; + } + + interface MapLayer { + attribution?: string; + autoBind?: boolean; + dataSource?: any; + extent?: any; + key?: string; + imagerySet?: string; + locationField?: string; + shape?: string; + titleField?: string; + tooltip?: MapLayerTooltip; + maxSize?: number; + minSize?: number; + opacity?: number; + subdomains?: any; + symbol?: any; + type?: string; + style?: MapLayerStyle; + urlTemplate?: string; + valueField?: string; + zIndex?: number; + } + + interface MapMarkerDefaultsTooltipAnimationClose { + effects?: string; + duration?: number; + } + + interface MapMarkerDefaultsTooltipAnimationOpen { + effects?: string; + duration?: number; + } + + interface MapMarkerDefaultsTooltipAnimation { + close?: MapMarkerDefaultsTooltipAnimationClose; + open?: MapMarkerDefaultsTooltipAnimationOpen; + } + + interface MapMarkerDefaultsTooltipContent { + url?: string; + } + + interface MapMarkerDefaultsTooltip { + autoHide?: boolean; + animation?: MapMarkerDefaultsTooltipAnimation; + content?: MapMarkerDefaultsTooltipContent; + template?: string; + callout?: boolean; + iframe?: boolean; + height?: number; + width?: number; + position?: string; + showAfter?: number; + showOn?: string; + } + + interface MapMarkerDefaults { + shape?: string; + tooltip?: MapMarkerDefaultsTooltip; + } + + interface MapMarkerTooltipAnimationClose { + effects?: string; + duration?: number; + } + + interface MapMarkerTooltipAnimationOpen { + effects?: string; + duration?: number; + } + + interface MapMarkerTooltipAnimation { + close?: MapMarkerTooltipAnimationClose; + open?: MapMarkerTooltipAnimationOpen; + } + + interface MapMarkerTooltipContent { + url?: string; + } + + interface MapMarkerTooltip { + autoHide?: boolean; + animation?: MapMarkerTooltipAnimation; + content?: MapMarkerTooltipContent; + template?: string; + callout?: boolean; + iframe?: boolean; + height?: number; + width?: number; + position?: string; + showAfter?: number; + showOn?: string; + } + + interface MapMarker { + location?: any; + shape?: string; + title?: string; + tooltip?: MapMarkerTooltip; + } + + interface MapOptions { + name?: string; + center?: any; + controls?: MapControls; + layerDefaults?: MapLayerDefaults; + layers?: MapLayer[]; + markerDefaults?: MapMarkerDefaults; + markers?: MapMarker[]; + minZoom?: number; + maxZoom?: number; + minSize?: number; + pannable?: boolean; + wraparound?: boolean; + zoom?: number; + zoomable?: boolean; + beforeReset?(e: MapBeforeResetEvent): void; + click?(e: MapClickEvent): void; + markerActivate?(e: MapMarkerActivateEvent): void; + markerCreated?(e: MapMarkerCreatedEvent): void; + markerClick?(e: MapMarkerClickEvent): void; + pan?(e: MapPanEvent): void; + panEnd?(e: MapPanEndEvent): void; + reset?(e: MapResetEvent): void; + shapeClick?(e: MapShapeClickEvent): void; + shapeCreated?(e: MapShapeCreatedEvent): void; + shapeMouseEnter?(e: MapShapeMouseEnterEvent): void; + shapeMouseLeave?(e: MapShapeMouseLeaveEvent): void; + zoomStart?(e: MapZoomStartEvent): void; + zoomEnd?(e: MapZoomEndEvent): void; + } + interface MapEvent { + sender: Map; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface MapBeforeResetEvent extends MapEvent { + } + + interface MapClickEvent extends MapEvent { + location?: kendo.dataviz.map.Location; + originalEvent?: any; + } + + interface MapMarkerActivateEvent extends MapEvent { + marker?: kendo.dataviz.map.Marker; + layer?: kendo.dataviz.map.Marker; + } + + interface MapMarkerCreatedEvent extends MapEvent { + marker?: kendo.dataviz.map.Marker; + layer?: kendo.dataviz.map.Marker; + } + + interface MapMarkerClickEvent extends MapEvent { + marker?: kendo.dataviz.map.Marker; + layer?: kendo.dataviz.map.Marker; + } + + interface MapPanEvent extends MapEvent { + origin?: kendo.dataviz.map.Location; + center?: kendo.dataviz.map.Location; + originalEvent?: any; + } + + interface MapPanEndEvent extends MapEvent { + origin?: kendo.dataviz.map.Location; + center?: kendo.dataviz.map.Location; + originalEvent?: any; + } + + interface MapResetEvent extends MapEvent { + } + + interface MapShapeClickEvent extends MapEvent { + layer?: kendo.dataviz.map.layer.Shape; + shape?: kendo.drawing.Element; + originalEvent?: any; + } + + interface MapShapeCreatedEvent extends MapEvent { + layer?: kendo.dataviz.map.layer.Shape; + shape?: kendo.drawing.Element; + originalEvent?: any; + } + + interface MapShapeMouseEnterEvent extends MapEvent { + layer?: kendo.dataviz.map.layer.Shape; + shape?: kendo.drawing.Element; + originalEvent?: any; + } + + interface MapShapeMouseLeaveEvent extends MapEvent { + layer?: kendo.dataviz.map.layer.Shape; + shape?: kendo.drawing.Element; + originalEvent?: any; + } + + interface MapZoomStartEvent extends MapEvent { + originalEvent?: any; + } + + interface MapZoomEndEvent extends MapEvent { + originalEvent?: any; + } + + + class QRCode extends kendo.ui.Widget { + static fn: QRCode; + static extend(proto: Object): QRCode; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: QRCodeOptions); + options: QRCodeOptions; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + imageDataURL(): string; + redraw(): void; + resize(force?: boolean): void; + setOptions(options: any): void; + svg(): string; + value(options: string): void; + value(options: number): void; + } + + interface QRCodeBorder { + color?: string; + width?: number; + } + + interface QRCodeExportImageOptions { + width?: string; + height?: string; + } + + interface QRCodeExportSVGOptions { + raw?: boolean; + } + + interface QRCodeOptions { + name?: string; + background?: string; + border?: QRCodeBorder; + color?: string; + encoding?: string; + errorCorrection?: string; + padding?: number; + renderAs?: string; + size?: any; + value?: any; + } + interface QRCodeEvent { + sender: QRCode; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class RadialGauge extends kendo.ui.Widget { + static fn: RadialGauge; + static extend(proto: Object): RadialGauge; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: RadialGaugeOptions); + options: RadialGaugeOptions; + allValues(values: any): any; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + redraw(): void; + resize(force?: boolean): void; + svg(): void; + imageDataURL(): string; + value(): void; + } + + interface RadialGaugeGaugeAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface RadialGaugeGaugeArea { + background?: any; + border?: RadialGaugeGaugeAreaBorder; + height?: number; + margin?: any; + width?: number; + } + + interface RadialGaugePointerItemCap { + color?: string; + size?: number; + } + + interface RadialGaugePointerItem { + cap?: RadialGaugePointerItemCap; + color?: string; + value?: number; + } + + interface RadialGaugeScaleLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface RadialGaugeScaleLabels { + background?: string; + border?: RadialGaugeScaleLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + padding?: any; + position?: string; + template?: any; + visible?: boolean; + } + + interface RadialGaugeScaleMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + } + + interface RadialGaugeScaleMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + } + + interface RadialGaugeScaleRange { + from?: number; + to?: number; + opacity?: number; + color?: string; + } + + interface RadialGaugeScale { + endAngle?: number; + labels?: RadialGaugeScaleLabels; + majorTicks?: RadialGaugeScaleMajorTicks; + majorUnit?: number; + max?: number; + min?: number; + minorTicks?: RadialGaugeScaleMinorTicks; + minorUnit?: number; + ranges?: RadialGaugeScaleRange[]; + rangePlaceholderColor?: string; + rangeSize?: number; + rangeDistance?: number; + reverse?: boolean; + startAngle?: number; + } + + interface RadialGaugeExportImageOptions { + width?: string; + height?: string; + } + + interface RadialGaugeExportSVGOptions { + raw?: boolean; + } + + interface RadialGaugeOptions { + name?: string; + gaugeArea?: RadialGaugeGaugeArea; + pointer?: RadialGaugePointerItem[]; + renderAs?: string; + scale?: RadialGaugeScale; + transitions?: boolean; + } + interface RadialGaugeEvent { + sender: RadialGauge; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Sparkline extends kendo.ui.Widget { + static fn: Sparkline; + static extend(proto: Object): Sparkline; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SparklineOptions); + options: SparklineOptions; + dataSource: kendo.data.DataSource; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + refresh(): void; + setDataSource(dataSource: kendo.data.DataSource): void; + setOptions(options: any): void; + svg(): string; + imageDataURL(): string; + } + + interface SparklineCategoryAxisItemCrosshairTooltipBorder { + color?: string; + width?: number; + } + + interface SparklineCategoryAxisItemCrosshairTooltip { + background?: string; + border?: SparklineCategoryAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface SparklineCategoryAxisItemCrosshair { + color?: string; + width?: number; + opacity?: number; + dashType?: number; + visible?: boolean; + tooltip?: SparklineCategoryAxisItemCrosshairTooltip; + } + + interface SparklineCategoryAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineCategoryAxisItemLabels { + background?: string; + border?: SparklineCategoryAxisItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + mirror?: boolean; + padding?: any; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + culture?: string; + dateFormats?: any; + } + + interface SparklineCategoryAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface SparklineCategoryAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineCategoryAxisItemMajorTicks { + size?: number; + visible?: boolean; + color?: string; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineCategoryAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineCategoryAxisItemMinorTicks { + size?: number; + visible?: boolean; + color?: string; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineCategoryAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface SparklineCategoryAxisItemNotesDataItemIcon { + background?: string; + border?: SparklineCategoryAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface SparklineCategoryAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineCategoryAxisItemNotesDataItemLabel { + background?: string; + border?: SparklineCategoryAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface SparklineCategoryAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface SparklineCategoryAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: SparklineCategoryAxisItemNotesDataItemIcon; + label?: SparklineCategoryAxisItemNotesDataItemLabel; + line?: SparklineCategoryAxisItemNotesDataItemLine; + } + + interface SparklineCategoryAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface SparklineCategoryAxisItemNotesIcon { + background?: string; + border?: SparklineCategoryAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface SparklineCategoryAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineCategoryAxisItemNotesLabel { + background?: string; + border?: SparklineCategoryAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface SparklineCategoryAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface SparklineCategoryAxisItemNotes { + position?: string; + icon?: SparklineCategoryAxisItemNotesIcon; + label?: SparklineCategoryAxisItemNotesLabel; + line?: SparklineCategoryAxisItemNotesLine; + data?: SparklineCategoryAxisItemNotesDataItem[]; + } + + interface SparklineCategoryAxisItemPlotBand { + from?: number; + to?: number; + color?: string; + opacity?: number; + } + + interface SparklineCategoryAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineCategoryAxisItemTitle { + background?: string; + border?: SparklineCategoryAxisItemTitleBorder; + color?: string; + font?: string; + margin?: any; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + } + + interface SparklineCategoryAxisItem { + axisCrossingValue?: any; + categories?: any; + color?: string; + field?: string; + justified?: boolean; + labels?: SparklineCategoryAxisItemLabels; + line?: SparklineCategoryAxisItemLine; + majorGridLines?: SparklineCategoryAxisItemMajorGridLines; + majorTicks?: SparklineCategoryAxisItemMajorTicks; + minorGridLines?: SparklineCategoryAxisItemMinorGridLines; + minorTicks?: SparklineCategoryAxisItemMinorTicks; + name?: string; + plotBands?: SparklineCategoryAxisItemPlotBand[]; + reverse?: boolean; + title?: SparklineCategoryAxisItemTitle; + type?: string; + autoBaseUnitSteps?: any; + baseUnit?: string; + baseUnitStep?: any; + max?: any; + min?: any; + roundToBaseUnit?: boolean; + weekStartDay?: number; + maxDateGroups?: number; + visible?: boolean; + crosshair?: SparklineCategoryAxisItemCrosshair; + notes?: SparklineCategoryAxisItemNotes; + } + + interface SparklineChartAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineChartArea { + background?: string; + opacity?: number; + border?: SparklineChartAreaBorder; + height?: number; + margin?: any; + width?: number; + } + + interface SparklinePlotAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklinePlotArea { + background?: string; + opacity?: number; + border?: SparklinePlotAreaBorder; + margin?: any; + } + + interface SparklineSeriesItemBorder { + color?: any; + dashType?: any; + opacity?: any; + width?: any; + } + + interface SparklineSeriesItemConnectors { + color?: string; + padding?: number; + width?: number; + } + + interface SparklineSeriesItemHighlightBorder { + width?: number; + color?: string; + opacity?: number; + } + + interface SparklineSeriesItemHighlight { + border?: SparklineSeriesItemHighlightBorder; + color?: string; + opacity?: number; + visible?: boolean; + } + + interface SparklineSeriesItemLabelsBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface SparklineSeriesItemLabels { + align?: string; + background?: any; + border?: SparklineSeriesItemLabelsBorder; + color?: any; + distance?: number; + font?: any; + format?: any; + margin?: any; + padding?: any; + position?: any; + template?: any; + visible?: any; + } + + interface SparklineSeriesItemLine { + color?: string; + opacity?: number; + width?: string; + style?: string; + } + + interface SparklineSeriesItemMarkersBorder { + color?: any; + width?: any; + } + + interface SparklineSeriesItemMarkers { + background?: any; + border?: SparklineSeriesItemMarkersBorder; + size?: any; + type?: any; + visible?: any; + rotation?: any; + } + + interface SparklineSeriesItemNotesIconBorder { + color?: string; + width?: number; + } + + interface SparklineSeriesItemNotesIcon { + background?: string; + border?: SparklineSeriesItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface SparklineSeriesItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineSeriesItemNotesLabel { + background?: string; + border?: SparklineSeriesItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface SparklineSeriesItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface SparklineSeriesItemNotes { + position?: string; + icon?: SparklineSeriesItemNotesIcon; + label?: SparklineSeriesItemNotesLabel; + line?: SparklineSeriesItemNotesLine; + } + + interface SparklineSeriesItemOverlay { + gradient?: string; + } + + interface SparklineSeriesItemStack { + type?: string; + group?: string; + } + + interface SparklineSeriesItemTargetBorder { + color?: any; + dashType?: any; + width?: number; + } + + interface SparklineSeriesItemTargetLine { + width?: any; + } + + interface SparklineSeriesItemTarget { + line?: SparklineSeriesItemTargetLine; + color?: any; + border?: SparklineSeriesItemTargetBorder; + } + + interface SparklineSeriesItemTooltipBorder { + color?: string; + width?: number; + } + + interface SparklineSeriesItemTooltip { + background?: string; + border?: SparklineSeriesItemTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface SparklineSeriesItem { + type?: string; + dashType?: string; + data?: any; + explodeField?: string; + currentField?: string; + targetField?: string; + field?: string; + name?: string; + highlight?: SparklineSeriesItemHighlight; + aggregate?: any; + axis?: string; + border?: SparklineSeriesItemBorder; + categoryField?: string; + color?: any; + colorField?: string; + connectors?: SparklineSeriesItemConnectors; + gap?: number; + labels?: SparklineSeriesItemLabels; + line?: SparklineSeriesItemLine; + markers?: SparklineSeriesItemMarkers; + missingValues?: string; + style?: string; + negativeColor?: string; + opacity?: number; + overlay?: SparklineSeriesItemOverlay; + padding?: number; + size?: number; + startAngle?: number; + spacing?: number; + stack?: SparklineSeriesItemStack; + tooltip?: SparklineSeriesItemTooltip; + width?: number; + target?: SparklineSeriesItemTarget; + notes?: SparklineSeriesItemNotes; + zIndex?: number; + } + + interface SparklineSeriesDefaultsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineSeriesDefaultsLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineSeriesDefaultsLabels { + background?: string; + border?: SparklineSeriesDefaultsLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + padding?: any; + template?: any; + visible?: boolean; + } + + interface SparklineSeriesDefaultsStack { + type?: string; + } + + interface SparklineSeriesDefaultsTooltipBorder { + color?: string; + width?: number; + } + + interface SparklineSeriesDefaultsTooltip { + background?: string; + border?: SparklineSeriesDefaultsTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface SparklineSeriesDefaults { + area?: any; + bar?: any; + border?: SparklineSeriesDefaultsBorder; + column?: any; + gap?: number; + labels?: SparklineSeriesDefaultsLabels; + line?: any; + overlay?: any; + pie?: any; + spacing?: number; + stack?: SparklineSeriesDefaultsStack; + type?: string; + tooltip?: SparklineSeriesDefaultsTooltip; + } + + interface SparklineTooltipBorder { + color?: string; + width?: number; + } + + interface SparklineTooltip { + background?: string; + border?: SparklineTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + shared?: boolean; + sharedTemplate?: string; + } + + interface SparklineValueAxisItemCrosshairTooltipBorder { + color?: string; + width?: number; + } + + interface SparklineValueAxisItemCrosshairTooltip { + background?: string; + border?: SparklineValueAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface SparklineValueAxisItemCrosshair { + color?: string; + width?: number; + opacity?: number; + dashType?: number; + visible?: boolean; + tooltip?: SparklineValueAxisItemCrosshairTooltip; + } + + interface SparklineValueAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineValueAxisItemLabels { + background?: string; + border?: SparklineValueAxisItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + mirror?: boolean; + padding?: any; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + } + + interface SparklineValueAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface SparklineValueAxisItemMajorGridLines { + color?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineValueAxisItemMajorTicks { + size?: number; + visible?: boolean; + color?: string; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineValueAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface SparklineValueAxisItemMinorTicks { + size?: number; + color?: string; + width?: number; + visible?: boolean; + step?: number; + skip?: number; + } + + interface SparklineValueAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface SparklineValueAxisItemNotesDataItemIcon { + background?: string; + border?: SparklineValueAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface SparklineValueAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineValueAxisItemNotesDataItemLabel { + background?: string; + border?: SparklineValueAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface SparklineValueAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface SparklineValueAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: SparklineValueAxisItemNotesDataItemIcon; + label?: SparklineValueAxisItemNotesDataItemLabel; + line?: SparklineValueAxisItemNotesDataItemLine; + } + + interface SparklineValueAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface SparklineValueAxisItemNotesIcon { + background?: string; + border?: SparklineValueAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface SparklineValueAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineValueAxisItemNotesLabel { + background?: string; + border?: SparklineValueAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface SparklineValueAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface SparklineValueAxisItemNotes { + position?: string; + icon?: SparklineValueAxisItemNotesIcon; + label?: SparklineValueAxisItemNotesLabel; + line?: SparklineValueAxisItemNotesLine; + data?: SparklineValueAxisItemNotesDataItem[]; + } + + interface SparklineValueAxisItemPlotBand { + from?: number; + to?: number; + color?: string; + opacity?: number; + } + + interface SparklineValueAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface SparklineValueAxisItemTitle { + background?: string; + border?: SparklineValueAxisItemTitleBorder; + color?: string; + font?: string; + margin?: any; + padding?: any; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + } + + interface SparklineValueAxisItem { + axisCrossingValue?: any; + color?: string; + labels?: SparklineValueAxisItemLabels; + line?: SparklineValueAxisItemLine; + majorGridLines?: SparklineValueAxisItemMajorGridLines; + majorTicks?: SparklineValueAxisItemMajorTicks; + majorUnit?: number; + max?: number; + min?: number; + minorGridLines?: SparklineValueAxisItemMinorGridLines; + minorTicks?: SparklineValueAxisItemMinorTicks; + minorUnit?: number; + name?: any; + narrowRange?: boolean; + plotBands?: SparklineValueAxisItemPlotBand[]; + reverse?: boolean; + title?: SparklineValueAxisItemTitle; + visible?: boolean; + crosshair?: SparklineValueAxisItemCrosshair; + notes?: SparklineValueAxisItemNotes; + } + + interface SparklineExportImageOptions { + width?: string; + height?: string; + } + + interface SparklineExportSVGOptions { + raw?: boolean; + } + + interface SparklineSeriesClickEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface SparklineSeriesHoverEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface SparklineOptions { + name?: string; + axisDefaults?: any; + categoryAxis?: SparklineCategoryAxisItem[]; + chartArea?: SparklineChartArea; + data?: any; + dataSource?: any; + autoBind?: boolean; + plotArea?: SparklinePlotArea; + pointWidth?: number; + renderAs?: string; + series?: SparklineSeriesItem[]; + seriesColors?: any; + seriesDefaults?: SparklineSeriesDefaults; + theme?: string; + tooltip?: SparklineTooltip; + transitions?: boolean; + type?: string; + valueAxis?: SparklineValueAxisItem[]; + axisLabelClick?(e: SparklineAxisLabelClickEvent): void; + dataBound?(e: SparklineEvent): void; + dragStart?(e: SparklineDragStartEvent): void; + drag?(e: SparklineDragEvent): void; + dragEnd?(e: SparklineDragEndEvent): void; + plotAreaClick?(e: SparklinePlotAreaClickEvent): void; + seriesClick?(e: SparklineSeriesClickEvent): void; + seriesHover?(e: SparklineSeriesHoverEvent): void; + zoomStart?(e: SparklineZoomStartEvent): void; + zoom?(e: SparklineZoomEvent): void; + zoomEnd?(e: SparklineZoomEndEvent): void; + } + interface SparklineEvent { + sender: Sparkline; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SparklineAxisLabelClickEvent extends SparklineEvent { + axis?: any; + value?: any; + text?: any; + index?: any; + dataItem?: any; + element?: any; + } + + interface SparklineDragStartEvent extends SparklineEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface SparklineDragEvent extends SparklineEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface SparklineDragEndEvent extends SparklineEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface SparklinePlotAreaClickEvent extends SparklineEvent { + value?: any; + category?: any; + element?: any; + x?: any; + y?: any; + } + + interface SparklineSeriesClickEvent extends SparklineEvent { + value?: any; + category?: any; + series?: SparklineSeriesClickEventSeries; + dataItem?: any; + element?: any; + percentage?: any; + } + + interface SparklineSeriesHoverEvent extends SparklineEvent { + value?: any; + category?: any; + series?: SparklineSeriesHoverEventSeries; + dataItem?: any; + element?: any; + percentage?: any; + } + + interface SparklineZoomStartEvent extends SparklineEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface SparklineZoomEvent extends SparklineEvent { + axisRanges?: any; + delta?: number; + originalEvent?: any; + } + + interface SparklineZoomEndEvent extends SparklineEvent { + axisRanges?: any; + originalEvent?: any; + } + + + class StockChart extends kendo.ui.Widget { + static fn: StockChart; + static extend(proto: Object): StockChart; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: StockChartOptions); + options: StockChartOptions; + dataSource: kendo.data.DataSource; + destroy(): void; + exportImage(options: any): JQueryPromise; + exportPDF(options?: kendo.drawing.PDFOptions): JQueryPromise; + exportSVG(options: any): JQueryPromise; + redraw(): void; + refresh(): void; + resize(force?: boolean): void; + setDataSource(dataSource: kendo.data.DataSource): void; + svg(): string; + imageDataURL(): string; + } + + interface StockChartCategoryAxisItemAutoBaseUnitSteps { + days?: any; + hours?: any; + minutes?: any; + months?: any; + weeks?: any; + years?: any; + } + + interface StockChartCategoryAxisItemCrosshairTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartCategoryAxisItemCrosshairTooltip { + background?: string; + border?: StockChartCategoryAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartCategoryAxisItemCrosshair { + color?: string; + width?: number; + opacity?: number; + dashType?: number; + visible?: boolean; + tooltip?: StockChartCategoryAxisItemCrosshairTooltip; + } + + interface StockChartCategoryAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartCategoryAxisItemLabels { + background?: string; + border?: StockChartCategoryAxisItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + mirror?: boolean; + padding?: any; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + culture?: string; + dateFormats?: any; + } + + interface StockChartCategoryAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface StockChartCategoryAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartCategoryAxisItemMajorTicks { + color?: string; + size?: number; + width?: number; + visible?: boolean; + step?: number; + skip?: number; + } + + interface StockChartCategoryAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartCategoryAxisItemMinorTicks { + size?: number; + visible?: boolean; + color?: string; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartCategoryAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface StockChartCategoryAxisItemNotesDataItemIcon { + background?: string; + border?: StockChartCategoryAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartCategoryAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartCategoryAxisItemNotesDataItemLabel { + background?: string; + border?: StockChartCategoryAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface StockChartCategoryAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartCategoryAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: StockChartCategoryAxisItemNotesDataItemIcon; + label?: StockChartCategoryAxisItemNotesDataItemLabel; + line?: StockChartCategoryAxisItemNotesDataItemLine; + } + + interface StockChartCategoryAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface StockChartCategoryAxisItemNotesIcon { + background?: string; + border?: StockChartCategoryAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartCategoryAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartCategoryAxisItemNotesLabel { + background?: string; + border?: StockChartCategoryAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface StockChartCategoryAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartCategoryAxisItemNotes { + position?: string; + icon?: StockChartCategoryAxisItemNotesIcon; + label?: StockChartCategoryAxisItemNotesLabel; + line?: StockChartCategoryAxisItemNotesLine; + data?: StockChartCategoryAxisItemNotesDataItem[]; + } + + interface StockChartCategoryAxisItemPlotBand { + from?: number; + to?: number; + color?: string; + opacity?: number; + } + + interface StockChartCategoryAxisItemSelectMousewheel { + reverse?: boolean; + zoom?: string; + } + + interface StockChartCategoryAxisItemSelect { + from?: any; + to?: any; + min?: any; + max?: any; + mousewheel?: StockChartCategoryAxisItemSelectMousewheel; + } + + interface StockChartCategoryAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartCategoryAxisItemTitle { + background?: string; + border?: StockChartCategoryAxisItemTitleBorder; + color?: string; + font?: string; + margin?: any; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + } + + interface StockChartCategoryAxisItem { + axisCrossingValue?: any; + categories?: any; + color?: string; + field?: string; + justified?: boolean; + labels?: StockChartCategoryAxisItemLabels; + line?: StockChartCategoryAxisItemLine; + majorGridLines?: StockChartCategoryAxisItemMajorGridLines; + majorTicks?: StockChartCategoryAxisItemMajorTicks; + minorGridLines?: StockChartCategoryAxisItemMinorGridLines; + minorTicks?: StockChartCategoryAxisItemMinorTicks; + name?: string; + pane?: string; + plotBands?: StockChartCategoryAxisItemPlotBand[]; + reverse?: boolean; + select?: StockChartCategoryAxisItemSelect; + title?: StockChartCategoryAxisItemTitle; + type?: string; + autoBaseUnitSteps?: StockChartCategoryAxisItemAutoBaseUnitSteps; + background?: string; + baseUnit?: string; + baseUnitStep?: any; + max?: any; + min?: any; + roundToBaseUnit?: boolean; + weekStartDay?: number; + maxDateGroups?: number; + visible?: boolean; + crosshair?: StockChartCategoryAxisItemCrosshair; + notes?: StockChartCategoryAxisItemNotes; + } + + interface StockChartChartAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartChartArea { + background?: string; + opacity?: number; + border?: StockChartChartAreaBorder; + height?: number; + margin?: any; + width?: number; + } + + interface StockChartLegendBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartLegendInactiveItemsLabels { + color?: string; + font?: string; + template?: string; + } + + interface StockChartLegendInactiveItemsMarkers { + color?: string; + } + + interface StockChartLegendInactiveItems { + labels?: StockChartLegendInactiveItemsLabels; + markers?: StockChartLegendInactiveItemsMarkers; + } + + interface StockChartLegendLabels { + color?: string; + font?: string; + template?: string; + } + + interface StockChartLegend { + background?: string; + border?: StockChartLegendBorder; + labels?: StockChartLegendLabels; + margin?: any; + offsetX?: number; + offsetY?: number; + padding?: any; + position?: string; + reverse?: boolean; + visible?: boolean; + inactiveItems?: StockChartLegendInactiveItems; + } + + interface StockChartNavigatorCategoryAxisItemAutoBaseUnitSteps { + seconds?: any; + minutes?: any; + hours?: any; + days?: any; + weeks?: any; + months?: any; + years?: any; + } + + interface StockChartNavigatorCategoryAxisItemCrosshairTooltipBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemCrosshairTooltipPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorCategoryAxisItemCrosshairTooltip { + background?: string; + border?: StockChartNavigatorCategoryAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: StockChartNavigatorCategoryAxisItemCrosshairTooltipPadding; + template?: any; + visible?: boolean; + } + + interface StockChartNavigatorCategoryAxisItemCrosshair { + color?: string; + opacity?: number; + tooltip?: StockChartNavigatorCategoryAxisItemCrosshairTooltip; + visible?: boolean; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemLabelsDateFormats { + days?: string; + hours?: string; + months?: string; + weeks?: string; + years?: string; + } + + interface StockChartNavigatorCategoryAxisItemLabelsMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorCategoryAxisItemLabelsPadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorCategoryAxisItemLabels { + background?: string; + border?: StockChartNavigatorCategoryAxisItemLabelsBorder; + color?: string; + culture?: string; + dateFormats?: StockChartNavigatorCategoryAxisItemLabelsDateFormats; + font?: string; + format?: string; + margin?: StockChartNavigatorCategoryAxisItemLabelsMargin; + mirror?: boolean; + padding?: StockChartNavigatorCategoryAxisItemLabelsPadding; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + } + + interface StockChartNavigatorCategoryAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemMajorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartNavigatorCategoryAxisItemMajorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartNavigatorCategoryAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartNavigatorCategoryAxisItemMinorTicks { + color?: string; + size?: number; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItemIcon { + background?: string; + border?: StockChartNavigatorCategoryAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItemLabel { + background?: string; + border?: StockChartNavigatorCategoryAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: StockChartNavigatorCategoryAxisItemNotesDataItemIcon; + label?: StockChartNavigatorCategoryAxisItemNotesDataItemLabel; + line?: StockChartNavigatorCategoryAxisItemNotesDataItemLine; + } + + interface StockChartNavigatorCategoryAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesIcon { + background?: string; + border?: StockChartNavigatorCategoryAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartNavigatorCategoryAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotesLabel { + background?: string; + border?: StockChartNavigatorCategoryAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface StockChartNavigatorCategoryAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartNavigatorCategoryAxisItemNotes { + position?: string; + icon?: StockChartNavigatorCategoryAxisItemNotesIcon; + label?: StockChartNavigatorCategoryAxisItemNotesLabel; + line?: StockChartNavigatorCategoryAxisItemNotesLine; + data?: StockChartNavigatorCategoryAxisItemNotesDataItem[]; + } + + interface StockChartNavigatorCategoryAxisItemPlotBand { + color?: string; + from?: number; + opacity?: number; + to?: number; + } + + interface StockChartNavigatorCategoryAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorCategoryAxisItemTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorCategoryAxisItemTitlePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorCategoryAxisItemTitle { + background?: string; + border?: StockChartNavigatorCategoryAxisItemTitleBorder; + color?: string; + font?: string; + margin?: StockChartNavigatorCategoryAxisItemTitleMargin; + padding?: StockChartNavigatorCategoryAxisItemTitlePadding; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + } + + interface StockChartNavigatorCategoryAxisItem { + autoBaseUnitSteps?: StockChartNavigatorCategoryAxisItemAutoBaseUnitSteps; + axisCrossingValue?: any; + background?: string; + baseUnit?: string; + baseUnitStep?: any; + categories?: any; + color?: string; + crosshair?: StockChartNavigatorCategoryAxisItemCrosshair; + field?: string; + justified?: boolean; + labels?: StockChartNavigatorCategoryAxisItemLabels; + line?: StockChartNavigatorCategoryAxisItemLine; + majorGridLines?: StockChartNavigatorCategoryAxisItemMajorGridLines; + majorTicks?: StockChartNavigatorCategoryAxisItemMajorTicks; + max?: any; + maxDateGroups?: number; + min?: any; + minorGridLines?: StockChartNavigatorCategoryAxisItemMinorGridLines; + minorTicks?: StockChartNavigatorCategoryAxisItemMinorTicks; + plotBands?: StockChartNavigatorCategoryAxisItemPlotBand[]; + reverse?: boolean; + roundToBaseUnit?: boolean; + title?: StockChartNavigatorCategoryAxisItemTitle; + visible?: boolean; + weekStartDay?: number; + notes?: StockChartNavigatorCategoryAxisItemNotes; + } + + interface StockChartNavigatorHint { + visible?: boolean; + template?: any; + format?: string; + } + + interface StockChartNavigatorPaneBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorPaneMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorPanePadding { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorPaneTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorPaneTitleMargin { + bottom?: number; + left?: number; + right?: number; + top?: number; + } + + interface StockChartNavigatorPaneTitle { + background?: string; + border?: StockChartNavigatorPaneTitleBorder; + color?: string; + font?: string; + margin?: StockChartNavigatorPaneTitleMargin; + position?: string; + text?: string; + visible?: boolean; + } + + interface StockChartNavigatorPane { + background?: string; + border?: StockChartNavigatorPaneBorder; + height?: number; + margin?: StockChartNavigatorPaneMargin; + name?: string; + padding?: StockChartNavigatorPanePadding; + title?: StockChartNavigatorPaneTitle; + } + + interface StockChartNavigatorSelect { + from?: Date; + to?: Date; + } + + interface StockChartNavigatorSeriesItemBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorSeriesItemHighlightBorder { + width?: number; + color?: string; + opacity?: number; + } + + interface StockChartNavigatorSeriesItemHighlightLine { + width?: number; + color?: string; + opacity?: number; + } + + interface StockChartNavigatorSeriesItemHighlight { + border?: StockChartNavigatorSeriesItemHighlightBorder; + color?: string; + line?: StockChartNavigatorSeriesItemHighlightLine; + opacity?: number; + visible?: boolean; + } + + interface StockChartNavigatorSeriesItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartNavigatorSeriesItemLabels { + background?: string; + border?: StockChartNavigatorSeriesItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + padding?: any; + position?: string; + template?: any; + visible?: boolean; + } + + interface StockChartNavigatorSeriesItemLine { + color?: string; + opacity?: number; + width?: string; + } + + interface StockChartNavigatorSeriesItemMarkersBorder { + color?: string; + width?: number; + } + + interface StockChartNavigatorSeriesItemMarkers { + background?: string; + border?: StockChartNavigatorSeriesItemMarkersBorder; + rotation?: any; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartNavigatorSeriesItemOverlay { + gradient?: string; + } + + interface StockChartNavigatorSeriesItemStack { + type?: string; + group?: string; + } + + interface StockChartNavigatorSeriesItemTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartNavigatorSeriesItemTooltip { + background?: string; + border?: StockChartNavigatorSeriesItemTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartNavigatorSeriesItem { + type?: string; + dashType?: string; + data?: any; + highField?: string; + field?: string; + categoryField?: string; + name?: string; + highlight?: StockChartNavigatorSeriesItemHighlight; + aggregate?: any; + axis?: string; + border?: StockChartNavigatorSeriesItemBorder; + closeField?: string; + color?: string; + colorField?: string; + downColor?: string; + downColorField?: string; + gap?: number; + labels?: StockChartNavigatorSeriesItemLabels; + line?: StockChartNavigatorSeriesItemLine; + lowField?: string; + markers?: StockChartNavigatorSeriesItemMarkers; + missingValues?: string; + style?: string; + opacity?: number; + openField?: string; + overlay?: StockChartNavigatorSeriesItemOverlay; + spacing?: number; + stack?: StockChartNavigatorSeriesItemStack; + tooltip?: StockChartNavigatorSeriesItemTooltip; + width?: number; + } + + interface StockChartNavigator { + categoryAxis?: StockChartNavigatorCategoryAxisItem[]; + dataSource?: any; + autoBind?: boolean; + dateField?: string; + pane?: StockChartNavigatorPane; + visible?: boolean; + series?: StockChartNavigatorSeriesItem[]; + select?: StockChartNavigatorSelect; + hint?: StockChartNavigatorHint; + } + + interface StockChartPaneBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartPaneTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartPaneTitle { + background?: string; + border?: StockChartPaneTitleBorder; + color?: string; + font?: string; + margin?: any; + position?: string; + text?: string; + visible?: boolean; + } + + interface StockChartPane { + name?: string; + margin?: any; + padding?: any; + background?: string; + border?: StockChartPaneBorder; + clip?: boolean; + height?: number; + title?: StockChartPaneTitle; + } + + interface StockChartPdfMargin { + bottom?: any; + left?: any; + right?: any; + top?: any; + } + + interface StockChartPdf { + author?: string; + creator?: string; + date?: Date; + forceProxy?: boolean; + fileName?: string; + keywords?: string; + landscape?: boolean; + margin?: StockChartPdfMargin; + paperSize?: any; + proxyURL?: string; + proxyTarget?: string; + subject?: string; + title?: string; + } + + interface StockChartPlotAreaBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartPlotArea { + background?: string; + opacity?: number; + border?: StockChartPlotAreaBorder; + margin?: any; + } + + interface StockChartSeriesItemBorder { + color?: any; + dashType?: any; + opacity?: any; + width?: any; + } + + interface StockChartSeriesItemHighlightBorder { + width?: number; + color?: string; + opacity?: number; + } + + interface StockChartSeriesItemHighlightLine { + width?: number; + color?: string; + opacity?: number; + } + + interface StockChartSeriesItemHighlight { + visible?: boolean; + border?: StockChartSeriesItemHighlightBorder; + color?: string; + line?: StockChartSeriesItemHighlightLine; + opacity?: number; + } + + interface StockChartSeriesItemLabelsBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface StockChartSeriesItemLabels { + background?: any; + border?: StockChartSeriesItemLabelsBorder; + color?: any; + font?: any; + format?: any; + margin?: any; + padding?: any; + position?: any; + template?: any; + visible?: any; + } + + interface StockChartSeriesItemLine { + color?: string; + opacity?: number; + width?: string; + style?: string; + } + + interface StockChartSeriesItemMarkersBorder { + color?: any; + width?: any; + } + + interface StockChartSeriesItemMarkers { + background?: any; + border?: StockChartSeriesItemMarkersBorder; + size?: any; + rotation?: any; + type?: any; + visible?: any; + } + + interface StockChartSeriesItemNotesIconBorder { + color?: string; + width?: number; + } + + interface StockChartSeriesItemNotesIcon { + background?: string; + border?: StockChartSeriesItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartSeriesItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartSeriesItemNotesLabel { + background?: string; + border?: StockChartSeriesItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface StockChartSeriesItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartSeriesItemNotes { + position?: string; + icon?: StockChartSeriesItemNotesIcon; + label?: StockChartSeriesItemNotesLabel; + line?: StockChartSeriesItemNotesLine; + } + + interface StockChartSeriesItemOverlay { + gradient?: string; + } + + interface StockChartSeriesItemStack { + type?: string; + group?: string; + } + + interface StockChartSeriesItemTargetBorder { + color?: any; + dashType?: any; + width?: any; + } + + interface StockChartSeriesItemTargetLine { + width?: any; + } + + interface StockChartSeriesItemTarget { + line?: StockChartSeriesItemTargetLine; + color?: any; + border?: StockChartSeriesItemTargetBorder; + } + + interface StockChartSeriesItemTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartSeriesItemTooltip { + background?: string; + border?: StockChartSeriesItemTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartSeriesItem { + type?: string; + dashType?: string; + data?: any; + highField?: string; + field?: string; + categoryField?: string; + currentField?: string; + targetField?: string; + name?: string; + highlight?: StockChartSeriesItemHighlight; + aggregate?: any; + axis?: string; + border?: StockChartSeriesItemBorder; + closeField?: string; + color?: any; + colorField?: string; + downColor?: any; + downColorField?: string; + gap?: number; + labels?: StockChartSeriesItemLabels; + line?: StockChartSeriesItemLine; + lowField?: string; + markers?: StockChartSeriesItemMarkers; + missingValues?: string; + style?: string; + negativeColor?: string; + opacity?: number; + openField?: string; + overlay?: StockChartSeriesItemOverlay; + spacing?: number; + stack?: StockChartSeriesItemStack; + tooltip?: StockChartSeriesItemTooltip; + visibleInLegend?: boolean; + width?: number; + target?: StockChartSeriesItemTarget; + notes?: StockChartSeriesItemNotes; + zIndex?: number; + } + + interface StockChartSeriesDefaultsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartSeriesDefaultsLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartSeriesDefaultsLabels { + background?: string; + border?: StockChartSeriesDefaultsLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartSeriesDefaultsStack { + type?: string; + } + + interface StockChartSeriesDefaultsTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartSeriesDefaultsTooltip { + background?: string; + border?: StockChartSeriesDefaultsTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartSeriesDefaults { + area?: any; + candlestick?: any; + ohlc?: any; + border?: StockChartSeriesDefaultsBorder; + column?: any; + gap?: number; + labels?: StockChartSeriesDefaultsLabels; + line?: any; + overlay?: any; + pie?: any; + spacing?: number; + stack?: StockChartSeriesDefaultsStack; + type?: string; + tooltip?: StockChartSeriesDefaultsTooltip; + } + + interface StockChartTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartTitle { + align?: string; + background?: string; + border?: StockChartTitleBorder; + font?: string; + color?: string; + margin?: any; + padding?: any; + position?: string; + text?: string; + visible?: boolean; + } + + interface StockChartTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartTooltip { + background?: string; + border?: StockChartTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + shared?: boolean; + sharedTemplate?: string; + } + + interface StockChartValueAxisItemCrosshairTooltipBorder { + color?: string; + width?: number; + } + + interface StockChartValueAxisItemCrosshairTooltip { + background?: string; + border?: StockChartValueAxisItemCrosshairTooltipBorder; + color?: string; + font?: string; + format?: string; + padding?: any; + template?: any; + visible?: boolean; + } + + interface StockChartValueAxisItemCrosshair { + color?: string; + width?: number; + opacity?: number; + dashType?: number; + visible?: boolean; + tooltip?: StockChartValueAxisItemCrosshairTooltip; + } + + interface StockChartValueAxisItemLabelsBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartValueAxisItemLabels { + background?: string; + border?: StockChartValueAxisItemLabelsBorder; + color?: string; + font?: string; + format?: string; + margin?: any; + mirror?: boolean; + padding?: any; + rotation?: number; + skip?: number; + step?: number; + template?: any; + visible?: boolean; + } + + interface StockChartValueAxisItemLine { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + } + + interface StockChartValueAxisItemMajorGridLines { + color?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartValueAxisItemMajorTicks { + size?: number; + visible?: boolean; + color?: string; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartValueAxisItemMinorGridLines { + color?: string; + dashType?: string; + visible?: boolean; + width?: number; + step?: number; + skip?: number; + } + + interface StockChartValueAxisItemMinorTicks { + size?: number; + color?: string; + width?: number; + visible?: boolean; + step?: number; + skip?: number; + } + + interface StockChartValueAxisItemNotesDataItemIconBorder { + color?: string; + width?: number; + } + + interface StockChartValueAxisItemNotesDataItemIcon { + background?: string; + border?: StockChartValueAxisItemNotesDataItemIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartValueAxisItemNotesDataItemLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartValueAxisItemNotesDataItemLabel { + background?: string; + border?: StockChartValueAxisItemNotesDataItemLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + text?: string; + position?: string; + } + + interface StockChartValueAxisItemNotesDataItemLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartValueAxisItemNotesDataItem { + value?: any; + position?: string; + icon?: StockChartValueAxisItemNotesDataItemIcon; + label?: StockChartValueAxisItemNotesDataItemLabel; + line?: StockChartValueAxisItemNotesDataItemLine; + } + + interface StockChartValueAxisItemNotesIconBorder { + color?: string; + width?: number; + } + + interface StockChartValueAxisItemNotesIcon { + background?: string; + border?: StockChartValueAxisItemNotesIconBorder; + size?: number; + type?: string; + visible?: boolean; + } + + interface StockChartValueAxisItemNotesLabelBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartValueAxisItemNotesLabel { + background?: string; + border?: StockChartValueAxisItemNotesLabelBorder; + color?: string; + font?: string; + template?: any; + visible?: boolean; + rotation?: number; + format?: string; + position?: string; + } + + interface StockChartValueAxisItemNotesLine { + width?: number; + color?: string; + length?: number; + } + + interface StockChartValueAxisItemNotes { + position?: string; + icon?: StockChartValueAxisItemNotesIcon; + label?: StockChartValueAxisItemNotesLabel; + line?: StockChartValueAxisItemNotesLine; + data?: StockChartValueAxisItemNotesDataItem[]; + } + + interface StockChartValueAxisItemPlotBand { + from?: number; + to?: number; + color?: string; + opacity?: number; + } + + interface StockChartValueAxisItemTitleBorder { + color?: string; + dashType?: string; + width?: number; + } + + interface StockChartValueAxisItemTitle { + background?: string; + border?: StockChartValueAxisItemTitleBorder; + color?: string; + font?: string; + margin?: any; + padding?: any; + position?: string; + rotation?: number; + text?: string; + visible?: boolean; + } + + interface StockChartValueAxisItem { + axisCrossingValue?: any; + background?: string; + color?: string; + labels?: StockChartValueAxisItemLabels; + line?: StockChartValueAxisItemLine; + majorGridLines?: StockChartValueAxisItemMajorGridLines; + majorTicks?: StockChartValueAxisItemMajorTicks; + majorUnit?: number; + max?: number; + min?: number; + minorGridLines?: StockChartValueAxisItemMinorGridLines; + minorTicks?: StockChartValueAxisItemMinorTicks; + minorUnit?: number; + name?: any; + narrowRange?: boolean; + pane?: string; + plotBands?: StockChartValueAxisItemPlotBand[]; + reverse?: boolean; + title?: StockChartValueAxisItemTitle; + visible?: boolean; + crosshair?: StockChartValueAxisItemCrosshair; + notes?: StockChartValueAxisItemNotes; + } + + interface StockChartExportImageOptions { + width?: string; + height?: string; + } + + interface StockChartExportSVGOptions { + raw?: boolean; + } + + interface StockChartSeriesClickEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface StockChartSeriesHoverEventSeries { + type?: any; + name?: any; + data?: any; + } + + interface StockChartOptions { + name?: string; + dateField?: string; + navigator?: StockChartNavigator; + axisDefaults?: any; + categoryAxis?: StockChartCategoryAxisItem[]; + chartArea?: StockChartChartArea; + dataSource?: any; + autoBind?: boolean; + legend?: StockChartLegend; + panes?: StockChartPane[]; + pdf?: StockChartPdf; + plotArea?: StockChartPlotArea; + renderAs?: string; + series?: StockChartSeriesItem[]; + seriesColors?: any; + seriesDefaults?: StockChartSeriesDefaults; + theme?: string; + title?: StockChartTitle; + tooltip?: StockChartTooltip; + transitions?: boolean; + valueAxis?: StockChartValueAxisItem[]; + axisLabelClick?(e: StockChartAxisLabelClickEvent): void; + legendItemClick?(e: StockChartLegendItemClickEvent): void; + legendItemHover?(e: StockChartLegendItemHoverEvent): void; + dataBound?(e: StockChartEvent): void; + dragStart?(e: StockChartDragStartEvent): void; + drag?(e: StockChartDragEvent): void; + dragEnd?(e: StockChartDragEndEvent): void; + noteClick?(e: StockChartNoteClickEvent): void; + noteHover?(e: StockChartNoteHoverEvent): void; + plotAreaClick?(e: StockChartPlotAreaClickEvent): void; + render?(e: StockChartEvent): void; + seriesClick?(e: StockChartSeriesClickEvent): void; + seriesHover?(e: StockChartSeriesHoverEvent): void; + zoomStart?(e: StockChartZoomStartEvent): void; + zoom?(e: StockChartZoomEvent): void; + zoomEnd?(e: StockChartZoomEndEvent): void; + selectStart?(e: StockChartSelectStartEvent): void; + select?(e: StockChartSelectEvent): void; + selectEnd?(e: StockChartSelectEndEvent): void; + } + interface StockChartEvent { + sender: StockChart; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface StockChartAxisLabelClickEvent extends StockChartEvent { + axis?: any; + value?: any; + text?: any; + index?: any; + dataItem?: any; + element?: any; + } + + interface StockChartLegendItemClickEvent extends StockChartEvent { + text?: string; + series?: any; + seriesIndex?: number; + pointIndex?: number; + element?: any; + } + + interface StockChartLegendItemHoverEvent extends StockChartEvent { + text?: string; + series?: any; + seriesIndex?: number; + pointIndex?: number; + element?: any; + } + + interface StockChartDragStartEvent extends StockChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface StockChartDragEvent extends StockChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface StockChartDragEndEvent extends StockChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface StockChartNoteClickEvent extends StockChartEvent { + category?: any; + element?: any; + value?: any; + series?: any; + dataItem?: any; + } + + interface StockChartNoteHoverEvent extends StockChartEvent { + category?: any; + element?: any; + value?: any; + series?: any; + dataItem?: any; + } + + interface StockChartPlotAreaClickEvent extends StockChartEvent { + value?: any; + category?: any; + element?: any; + x?: any; + y?: any; + } + + interface StockChartSeriesClickEvent extends StockChartEvent { + value?: any; + category?: any; + series?: StockChartSeriesClickEventSeries; + dataItem?: any; + element?: any; + percentage?: any; + } + + interface StockChartSeriesHoverEvent extends StockChartEvent { + value?: any; + category?: any; + series?: StockChartSeriesHoverEventSeries; + dataItem?: any; + element?: any; + percentage?: any; + } + + interface StockChartZoomStartEvent extends StockChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface StockChartZoomEvent extends StockChartEvent { + axisRanges?: any; + delta?: number; + originalEvent?: any; + } + + interface StockChartZoomEndEvent extends StockChartEvent { + axisRanges?: any; + originalEvent?: any; + } + + interface StockChartSelectStartEvent extends StockChartEvent { + axis?: any; + from?: any; + to?: any; + } + + interface StockChartSelectEvent extends StockChartEvent { + axis?: any; + from?: any; + to?: any; + } + + interface StockChartSelectEndEvent extends StockChartEvent { + axis?: any; + from?: any; + to?: any; + } + + + class TreeMap extends kendo.ui.Widget { + static fn: TreeMap; + static extend(proto: Object): TreeMap; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TreeMapOptions); + options: TreeMapOptions; + dataSource: kendo.data.DataSource; + } + + interface TreeMapOptions { + name?: string; + dataSource?: any; + autoBind?: boolean; + type?: string; + theme?: string; + valueField?: string; + colorField?: string; + textField?: string; + template?: any; + colors?: any; + itemCreated?(e: TreeMapItemCreatedEvent): void; + dataBound?(e: TreeMapDataBoundEvent): void; + } + interface TreeMapEvent { + sender: TreeMap; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TreeMapItemCreatedEvent extends TreeMapEvent { + element?: any; + } + + interface TreeMapDataBoundEvent extends TreeMapEvent { + } + + +} +declare module kendo.dataviz { + class ChartAxis extends Observable { + options: ChartAxisOptions; + range(): any; + slot(from: string, to?: string): kendo.geometry.Rect; + slot(from: string, to?: number): kendo.geometry.Rect; + slot(from: string, to?: Date): kendo.geometry.Rect; + slot(from: number, to?: string): kendo.geometry.Rect; + slot(from: number, to?: number): kendo.geometry.Rect; + slot(from: number, to?: Date): kendo.geometry.Rect; + slot(from: Date, to?: string): kendo.geometry.Rect; + slot(from: Date, to?: number): kendo.geometry.Rect; + slot(from: Date, to?: Date): kendo.geometry.Rect; + } + + interface ChartAxisOptions { + name?: string; + } + interface ChartAxisEvent { + sender: ChartAxis; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo.dataviz.diagram { + class Circle extends Observable { + constructor(options?: CircleOptions); + options: CircleOptions; + visible(): boolean; + visible(visible: boolean): void; + } + + interface CircleFill { + color?: string; + opacity?: number; + } + + interface CircleStroke { + color?: string; + width?: number; + } + + interface CircleOptions { + name?: string; + fill?: CircleFill; + stroke?: CircleStroke; + center?: any; + radius?: number; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Connection extends Observable { + constructor(options?: ConnectionOptions); + options: ConnectionOptions; + source(): any; + source(source: kendo.dataviz.diagram.Shape): void; + source(source: kendo.dataviz.diagram.Point): void; + source(source: kendo.dataviz.diagram.Connector): void; + sourcePoint(): kendo.dataviz.diagram.Point; + target(): any; + target(target: kendo.dataviz.diagram.Shape): void; + target(target: kendo.dataviz.diagram.Point): void; + target(target: kendo.dataviz.diagram.Connector): void; + targetPoint(): kendo.dataviz.diagram.Point; + select(value: boolean): void; + type(): void; + type(value: string): void; + points(): any; + allPoints(): any; + redraw(): void; + } + + interface ConnectionEndCapFill { + color?: string; + } + + interface ConnectionEndCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface ConnectionEndCap { + fill?: ConnectionEndCapFill; + stroke?: ConnectionEndCapStroke; + type?: string; + } + + interface ConnectionHoverStroke { + color?: string; + } + + interface ConnectionHover { + stroke?: ConnectionHoverStroke; + } + + interface ConnectionPoint { + x?: number; + y?: number; + } + + interface ConnectionStartCapFill { + color?: string; + } + + interface ConnectionStartCapStroke { + color?: string; + dashType?: string; + width?: number; + } + + interface ConnectionStartCap { + fill?: ConnectionStartCapFill; + stroke?: ConnectionStartCapStroke; + type?: string; + } + + interface ConnectionStroke { + color?: string; + } + + interface ConnectionOptions { + name?: string; + stroke?: ConnectionStroke; + hover?: ConnectionHover; + startCap?: ConnectionStartCap; + endCap?: ConnectionEndCap; + points?: ConnectionPoint[]; + selectable?: boolean; + } + interface ConnectionEvent { + sender: Connection; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Connector extends Observable { + constructor(options?: ConnectorOptions); + options: ConnectorOptions; + position(): kendo.dataviz.diagram.Point; + position(position: kendo.dataviz.diagram.Point): void; + } + + interface ConnectorFill { + color?: string; + opacity?: number; + } + + interface ConnectorOptions { + name?: string; + width?: number; + height?: number; + fill?: ConnectorFill; + } + interface ConnectorEvent { + sender: Connector; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Group extends Observable { + constructor(options?: GroupOptions); + options: GroupOptions; + append(element: any): void; + clear(): void; + remove(element: any): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface GroupOptions { + name?: string; + x?: number; + y?: number; + } + interface GroupEvent { + sender: Group; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Image extends Observable { + constructor(options?: ImageOptions); + options: ImageOptions; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ImageOptions { + name?: string; + height?: number; + width?: number; + x?: number; + y?: number; + source?: string; + } + interface ImageEvent { + sender: Image; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Line extends Observable { + constructor(options?: LineOptions); + options: LineOptions; + visible(): boolean; + visible(visible: boolean): void; + } + + interface LineStroke { + color?: string; + width?: number; + } + + interface LineOptions { + name?: string; + stroke?: LineStroke; + from?: any; + to?: any; + } + interface LineEvent { + sender: Line; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Point extends Observable { + constructor(options?: PointOptions); + options: PointOptions; + } + + interface PointOptions { + name?: string; + x?: number; + y?: number; + } + interface PointEvent { + sender: Point; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Rect extends Observable { + constructor(options?: RectOptions); + options: RectOptions; + } + + interface RectOptions { + name?: string; + height?: number; + width?: number; + x?: number; + y?: number; + } + interface RectEvent { + sender: Rect; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Rectangle extends Observable { + constructor(options?: RectangleOptions); + options: RectangleOptions; + visible(): boolean; + visible(visible: boolean): void; + } + + interface RectangleFill { + color?: string; + opacity?: number; + } + + interface RectangleStroke { + color?: string; + width?: number; + } + + interface RectangleOptions { + name?: string; + fill?: RectangleFill; + height?: number; + stroke?: RectangleStroke; + width?: number; + x?: number; + y?: number; + } + interface RectangleEvent { + sender: Rectangle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Shape extends Observable { + constructor(options?: ShapeOptions); + options: ShapeOptions; + position(): void; + position(point: kendo.dataviz.diagram.Point): void; + clone(): kendo.dataviz.diagram.Shape; + select(value: boolean): void; + connections(type: string): void; + getConnector(): void; + getPosition(side: string): void; + redraw(): void; + } + + interface ShapeConnector { + name?: string; + description?: string; + position?: Function; + } + + interface ShapeContent { + text?: string; + align?: string; + } + + interface ShapeEditable { + connect?: boolean; + } + + interface ShapeFill { + color?: string; + opacity?: number; + } + + interface ShapeHoverFill { + color?: string; + opacity?: number; + } + + interface ShapeHover { + fill?: ShapeHoverFill; + } + + interface ShapeRotation { + angle?: number; + } + + interface ShapeStroke { + color?: string; + width?: number; + dashType?: string; + } + + interface ShapeOptions { + name?: string; + id?: string; + editable?: ShapeEditable; + path?: string; + stroke?: ShapeStroke; + type?: string; + x?: number; + y?: number; + minWidth?: number; + minHeight?: number; + width?: number; + height?: number; + fill?: ShapeFill; + hover?: ShapeHover; + connectors?: ShapeConnector[]; + rotation?: ShapeRotation; + content?: ShapeContent; + selectable?: boolean; + visual?: Function; + } + interface ShapeEvent { + sender: Shape; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class TextBlock extends Observable { + constructor(options?: TextBlockOptions); + options: TextBlockOptions; + content(): string; + content(content: string): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface TextBlockOptions { + name?: string; + color?: string; + fontFamily?: string; + fontSize?: number; + height?: number; + text?: string; + width?: number; + x?: number; + y?: number; + } + interface TextBlockEvent { + sender: TextBlock; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo { + class Color extends Observable { + options: ColorOptions; + diff(): number; + equals(): boolean; + } + + interface ColorOptions { + name?: string; + } + interface ColorEvent { + sender: Color; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + module drawing { + function align(elements: any, rect: kendo.geometry.Rect, alignment: string): void; + function drawDOM(element: HTMLElement): JQueryPromise; + function exportImage(group: kendo.drawing.Group, options: any): JQueryPromise; + function exportPDF(group: kendo.drawing.Group, options: kendo.drawing.PDFOptions): JQueryPromise; + function exportSVG(group: kendo.drawing.Group, options: any): JQueryPromise; + function fit(element: kendo.drawing.Element, rect: kendo.geometry.Rect): void; + function stack(elements: any): void; + function vAlign(elements: any, rect: kendo.geometry.Rect, alignment: string): void; + function vStack(elements: any): void; + function vWrap(elements: any, rect: kendo.geometry.Rect): any; + function wrap(elements: any, rect: kendo.geometry.Rect): any; + } + + module effects { + function box(element: HTMLElement): any; + function fillScale(firstElement: HTMLElement, secondElement: HTMLElement): number; + function fitScale(firstElement: HTMLElement, secondElement: HTMLElement): number; + function transformOrigin(firstElement: HTMLElement, secondElement: HTMLElement): any; + } + + function bind(element: string, viewModel: any, namespace?: any): void; + function bind(element: string, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function bind(element: JQuery, viewModel: any, namespace?: any): void; + function bind(element: JQuery, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function bind(element: Element, viewModel: any, namespace?: any): void; + function bind(element: Element, viewModel: kendo.data.ObservableObject, namespace?: any): void; + function observableHierarchy(array: any): void; + function culture(culture: string): void; + function destroy(element: string): void; + function destroy(element: JQuery): void; + function destroy(element: Element): void; + function htmlEncode(value: string): string; + function parseDate(value: string, formats?: string, culture?: string): Date; + function parseDate(value: string, formats?: any, culture?: string): Date; + function parseFloat(value: string, culture?: string): number; + function parseInt(value: string, culture?: string): number; + function parseColor(color: string, noerror: boolean): kendo.Color; + function resize(element: string, force: boolean): void; + function resize(element: JQuery, force: boolean): void; + function resize(element: Element, force: boolean): void; + function saveAs(options: any): void; + function stringify(value: any): string; + function throttle(fn: Function, timeout: number): void; + function touchScroller(element: string): void; + function touchScroller(element: JQuery): void; + function touchScroller(element: Element): void; + function toString(value: Date, format: string, culture?: string): string; + function toString(value: number, format: string, culture?: string): string; + function unbind(element: string): void; + function unbind(element: JQuery): void; + function unbind(element: Element): void; + +} +declare module kendo.dataviz.map { + class Extent extends kendo.Class { + options: ExtentOptions; + contains(location: kendo.dataviz.map.Location): boolean; + containsAny(locations: any): boolean; + center(): kendo.dataviz.map.Location; + include(location: kendo.dataviz.map.Location): void; + includeAll(locations: any): void; + edges(): any; + toArray(): any; + overlaps(extent: kendo.dataviz.map.Extent): boolean; + static create(a: kendo.dataviz.map.Location, b?: kendo.dataviz.map.Location): kendo.dataviz.map.Extent; + static create(a: kendo.dataviz.map.Location, b?: any): kendo.dataviz.map.Extent; + static create(a: any, b?: kendo.dataviz.map.Location): kendo.dataviz.map.Extent; + static create(a: any, b?: any): kendo.dataviz.map.Extent; + nw: kendo.dataviz.map.Location; + se: kendo.dataviz.map.Location; + } + + interface ExtentOptions { + name?: string; + } + interface ExtentEvent { + sender: Extent; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Layer extends kendo.Class { + options: LayerOptions; + show(): void; + hide(): void; + map: kendo.dataviz.ui.Map; + } + + interface LayerOptions { + name?: string; + } + interface LayerEvent { + sender: Layer; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Location extends kendo.Class { + options: LocationOptions; + clone(): kendo.dataviz.map.Location; + destination(destination: kendo.dataviz.map.Location): number; + distanceTo(distance: number, bearing: number): kendo.dataviz.map.Location; + equals(location: kendo.dataviz.map.Location): boolean; + round(digits: number): kendo.dataviz.map.Location; + toArray(): any; + toString(): string; + wrap(): kendo.dataviz.map.Location; + static create(lat: number, lng?: number): kendo.dataviz.map.Location; + static create(lat: any, lng?: number): kendo.dataviz.map.Location; + static create(lat: kendo.dataviz.map.Location, lng?: number): kendo.dataviz.map.Location; + static fromLngLat(lnglat: any): kendo.dataviz.map.Location; + static fromLatLng(lnglat: any): kendo.dataviz.map.Location; + lat: number; + lng: number; + } + + interface LocationOptions { + name?: string; + } + interface LocationEvent { + sender: Location; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo.mobile.ui { + class ActionSheet extends kendo.mobile.ui.Widget { + static fn: ActionSheet; + static extend(proto: Object): ActionSheet; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ActionSheetOptions); + options: ActionSheetOptions; + close(): void; + destroy(): void; + open(target: JQuery, context: any): void; + } + + interface ActionSheetPopup { + direction?: any; + height?: any; + width?: any; + } + + interface ActionSheetOptions { + name?: string; + cancel?: string; + popup?: ActionSheetPopup; + type?: string; + close?(e: ActionSheetEvent): void; + open?(e: ActionSheetOpenEvent): void; + } + interface ActionSheetEvent { + sender: ActionSheet; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ActionSheetOpenEvent extends ActionSheetEvent { + target?: JQuery; + context?: JQuery; + } + + + class BackButton extends kendo.mobile.ui.Widget { + static fn: BackButton; + static extend(proto: Object): BackButton; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: BackButtonOptions); + options: BackButtonOptions; + destroy(): void; + } + + interface BackButtonOptions { + name?: string; + click?(e: BackButtonClickEvent): void; + } + interface BackButtonEvent { + sender: BackButton; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface BackButtonClickEvent extends BackButtonEvent { + target?: JQuery; + button?: JQuery; + } + + + class Button extends kendo.mobile.ui.Widget { + static fn: Button; + static extend(proto: Object): Button; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ButtonOptions); + options: ButtonOptions; + badge(value: string): string; + badge(value: boolean): string; + destroy(): void; + enable(enable: boolean): void; + } + + interface ButtonOptions { + name?: string; + badge?: string; + clickOn?: string; + enable?: boolean; + icon?: string; + click?(e: ButtonClickEvent): void; + } + interface ButtonEvent { + sender: Button; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ButtonClickEvent extends ButtonEvent { + target?: JQuery; + button?: JQuery; + } + + + class ButtonGroup extends kendo.mobile.ui.Widget { + static fn: ButtonGroup; + static extend(proto: Object): ButtonGroup; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ButtonGroupOptions); + options: ButtonGroupOptions; + badge(button: string, value: string): string; + badge(button: string, value: boolean): string; + badge(button: number, value: string): string; + badge(button: number, value: boolean): string; + current(): JQuery; + destroy(): void; + enable(enable: boolean): void; + select(li: JQuery): void; + select(li: number): void; + } + + interface ButtonGroupOptions { + name?: string; + enable?: boolean; + index?: number; + selectOn?: string; + select?(e: ButtonGroupSelectEvent): void; + } + interface ButtonGroupEvent { + sender: ButtonGroup; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ButtonGroupSelectEvent extends ButtonGroupEvent { + index?: number; + } + + + class Collapsible extends kendo.mobile.ui.Widget { + static fn: Collapsible; + static extend(proto: Object): Collapsible; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: CollapsibleOptions); + options: CollapsibleOptions; + collapse(instant: boolean): void; + destroy(): void; + expand(instant?: boolean): void; + resize(): void; + toggle(instant?: boolean): void; + } + + interface CollapsibleOptions { + name?: string; + animation?: boolean; + collapsed?: boolean; + expandIcon?: string; + iconPosition?: string; + inset?: boolean; + collapse?(e: CollapsibleEvent): void; + expand?(e: CollapsibleEvent): void; + } + interface CollapsibleEvent { + sender: Collapsible; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class DetailButton extends kendo.mobile.ui.Widget { + static fn: DetailButton; + static extend(proto: Object): DetailButton; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DetailButtonOptions); + options: DetailButtonOptions; + destroy(): void; + } + + interface DetailButtonOptions { + name?: string; + click?(e: DetailButtonClickEvent): void; + } + interface DetailButtonEvent { + sender: DetailButton; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DetailButtonClickEvent extends DetailButtonEvent { + target?: JQuery; + button?: JQuery; + } + + + class Drawer extends kendo.mobile.ui.Widget { + static fn: Drawer; + static extend(proto: Object): Drawer; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: DrawerOptions); + options: DrawerOptions; + destroy(): void; + hide(): void; + show(): void; + } + + interface DrawerOptions { + name?: string; + container?: JQuery; + position?: string; + swipeToOpen?: boolean; + swipeToOpenViews?: any; + title?: string; + views?: any; + afterHide?(e: DrawerAfterHideEvent): void; + beforeShow?(e: DrawerEvent): void; + hide?(e: DrawerHideEvent): void; + init?(e: DrawerInitEvent): void; + show?(e: DrawerShowEvent): void; + } + interface DrawerEvent { + sender: Drawer; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface DrawerAfterHideEvent extends DrawerEvent { + } + + interface DrawerHideEvent extends DrawerEvent { + } + + interface DrawerInitEvent extends DrawerEvent { + } + + interface DrawerShowEvent extends DrawerEvent { + } + + + class Layout extends kendo.mobile.ui.Widget { + static fn: Layout; + static extend(proto: Object): Layout; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: LayoutOptions); + options: LayoutOptions; + } + + interface LayoutOptions { + name?: string; + id?: string; + platform?: string; + hide?(e: LayoutHideEvent): void; + init?(e: LayoutInitEvent): void; + show?(e: LayoutShowEvent): void; + } + interface LayoutEvent { + sender: Layout; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface LayoutHideEvent extends LayoutEvent { + layout?: JQuery; + view?: JQuery; + } + + interface LayoutInitEvent extends LayoutEvent { + layout?: JQuery; + } + + interface LayoutShowEvent extends LayoutEvent { + layout?: JQuery; + view?: JQuery; + } + + + class ListView extends kendo.mobile.ui.Widget { + static fn: ListView; + static extend(proto: Object): ListView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ListViewOptions); + options: ListViewOptions; + dataSource: kendo.data.DataSource; + append(dataItems: any): void; + prepend(dataItems: any): void; + replace(dataItems: any): void; + remove(dataItems: any): void; + setDataItem(item: JQuery, dataItem: kendo.data.Model): void; + destroy(): void; + items(): JQuery; + refresh(): void; + setDataSource(dataSource: kendo.data.DataSource): void; + } + + interface ListViewFilterable { + placeholder?: string; + autoFilter?: boolean; + field?: string; + ignoreCase?: boolean; + operator?: string; + } + + interface ListViewMessages { + loadMoreText?: string; + pullTemplate?: string; + refreshTemplate?: string; + releaseTemplate?: string; + } + + interface ListViewOptions { + name?: string; + appendOnRefresh?: boolean; + autoBind?: boolean; + dataSource?: any; + endlessScroll?: boolean; + fixedHeaders?: boolean; + headerTemplate?: any; + loadMore?: boolean; + messages?: ListViewMessages; + pullToRefresh?: boolean; + pullParameters?: Function; + style?: string; + template?: any; + type?: string; + filterable?: ListViewFilterable; + virtualViewSize?: number; + click?(e: ListViewClickEvent): void; + dataBound?(e: ListViewEvent): void; + dataBinding?(e: ListViewEvent): void; + itemChange?(e: ListViewEvent): void; + } + interface ListViewEvent { + sender: ListView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ListViewClickEvent extends ListViewEvent { + item?: JQuery; + target?: JQuery; + dataItem?: any; + button?: kendo.mobile.ui.Button; + } + + + class Loader extends kendo.mobile.ui.Widget { + static fn: Loader; + static extend(proto: Object): Loader; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: LoaderOptions); + options: LoaderOptions; + hide(): void; + show(): void; + } + + interface LoaderOptions { + name?: string; + } + interface LoaderEvent { + sender: Loader; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class ModalView extends kendo.mobile.ui.Widget { + static fn: ModalView; + static extend(proto: Object): ModalView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ModalViewOptions); + options: ModalViewOptions; + close(): void; + destroy(): void; + open(target: JQuery): void; + } + + interface ModalViewOptions { + name?: string; + height?: number; + modal?: boolean; + width?: number; + beforeOpen?(e: ModalViewBeforeOpenEvent): void; + close?(e: ModalViewCloseEvent): void; + init?(e: ModalViewInitEvent): void; + open?(e: ModalViewOpenEvent): void; + } + interface ModalViewEvent { + sender: ModalView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ModalViewBeforeOpenEvent extends ModalViewEvent { + target?: JQuery; + } + + interface ModalViewCloseEvent extends ModalViewEvent { + } + + interface ModalViewInitEvent extends ModalViewEvent { + } + + interface ModalViewOpenEvent extends ModalViewEvent { + target?: JQuery; + } + + + class NavBar extends kendo.mobile.ui.Widget { + static fn: NavBar; + static extend(proto: Object): NavBar; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: NavBarOptions); + options: NavBarOptions; + destroy(): void; + title(value: string): void; + } + + interface NavBarOptions { + name?: string; + } + interface NavBarEvent { + sender: NavBar; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Pane extends kendo.mobile.ui.Widget { + static fn: Pane; + static extend(proto: Object): Pane; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PaneOptions); + options: PaneOptions; + destroy(): void; + hideLoading(): void; + navigate(url: string, transition: string): void; + replace(url: string, transition: string): void; + Example(): void; + showLoading(): void; + view(): kendo.mobile.ui.View; + } + + interface PaneOptions { + name?: string; + collapsible?: boolean; + initial?: string; + layout?: string; + loading?: string; + portraitWidth?: number; + transition?: string; + navigate?(e: PaneNavigateEvent): void; + viewShow?(e: PaneViewShowEvent): void; + } + interface PaneEvent { + sender: Pane; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface PaneNavigateEvent extends PaneEvent { + url?: JQuery; + } + + interface PaneViewShowEvent extends PaneEvent { + view?: kendo.mobile.ui.View; + } + + + class PopOver extends kendo.mobile.ui.Widget { + static fn: PopOver; + static extend(proto: Object): PopOver; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: PopOverOptions); + options: PopOverOptions; + close(): void; + destroy(): void; + open(target: JQuery): void; + } + + interface PopOverPane { + initial?: string; + layout?: string; + loading?: string; + transition?: string; + } + + interface PopOverPopup { + height?: any; + width?: any; + } + + interface PopOverOptions { + name?: string; + pane?: PopOverPane; + popup?: PopOverPopup; + close?(e: PopOverCloseEvent): void; + open?(e: PopOverOpenEvent): void; + } + interface PopOverEvent { + sender: PopOver; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface PopOverCloseEvent extends PopOverEvent { + } + + interface PopOverOpenEvent extends PopOverEvent { + target?: JQuery; + } + + + class ScrollView extends kendo.mobile.ui.Widget { + static fn: ScrollView; + static extend(proto: Object): ScrollView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ScrollViewOptions); + options: ScrollViewOptions; + dataSource: kendo.data.DataSource; + content(content: string): void; + content(content: JQuery): void; + destroy(): void; + next(): void; + prev(): void; + refresh(): void; + scrollTo(page: number, instant: boolean): void; + setDataSource(dataSource: kendo.data.DataSource): void; + value(dataItem: any): any; + } + + interface ScrollViewOptions { + name?: string; + autoBind?: boolean; + bounceVelocityThreshold?: number; + contentHeight?: any; + dataSource?: any; + duration?: number; + emptyTemplate?: string; + enablePager?: boolean; + itemsPerPage?: number; + page?: number; + pageSize?: number; + template?: string; + velocityThreshold?: number; + changing?(e: ScrollViewChangingEvent): void; + change?(e: ScrollViewChangeEvent): void; + refresh?(e: ScrollViewRefreshEvent): void; + } + interface ScrollViewEvent { + sender: ScrollView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ScrollViewChangingEvent extends ScrollViewEvent { + currentPage?: number; + nextPage?: number; + } + + interface ScrollViewChangeEvent extends ScrollViewEvent { + page?: number; + element?: JQuery; + data?: any; + } + + interface ScrollViewRefreshEvent extends ScrollViewEvent { + pageCount?: number; + page?: number; + } + + + class Scroller extends kendo.mobile.ui.Widget { + static fn: Scroller; + static extend(proto: Object): Scroller; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ScrollerOptions); + options: ScrollerOptions; + animatedScrollTo(x: number, y: number): void; + destroy(): void; + disable(): void; + enable(): void; + height(): number; + pullHandled(): void; + reset(): void; + scrollHeight(): void; + scrollTo(x: number, y: number): void; + scrollWidth(): void; + zoomOut(): void; + } + + interface ScrollerMessages { + pullTemplate?: string; + refreshTemplate?: string; + releaseTemplate?: string; + } + + interface ScrollerOptions { + name?: string; + elastic?: boolean; + messages?: ScrollerMessages; + pullOffset?: number; + pullToRefresh?: boolean; + useNative?: boolean; + visibleScrollHints?: boolean; + zoom?: boolean; + pull?(e: ScrollerEvent): void; + resize?(e: ScrollerEvent): void; + scroll?(e: ScrollerScrollEvent): void; + } + interface ScrollerEvent { + sender: Scroller; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ScrollerScrollEvent extends ScrollerEvent { + scrollTop?: number; + scrollLeft?: number; + } + + + class SplitView extends kendo.mobile.ui.Widget { + static fn: SplitView; + static extend(proto: Object): SplitView; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SplitViewOptions); + options: SplitViewOptions; + destroy(): void; + expandPanes(): void; + collapsePanes(): void; + } + + interface SplitViewOptions { + name?: string; + style?: string; + init?(e: SplitViewInitEvent): void; + show?(e: SplitViewShowEvent): void; + } + interface SplitViewEvent { + sender: SplitView; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SplitViewInitEvent extends SplitViewEvent { + view?: JQuery; + } + + interface SplitViewShowEvent extends SplitViewEvent { + view?: JQuery; + } + + + class Switch extends kendo.mobile.ui.Widget { + static fn: Switch; + static extend(proto: Object): Switch; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: SwitchOptions); + options: SwitchOptions; + check(): boolean; + check(check: boolean): void; + destroy(): void; + enable(enable: boolean): void; + refresh(): void; + toggle(): void; + } + + interface SwitchOptions { + name?: string; + checked?: boolean; + enable?: boolean; + offLabel?: string; + onLabel?: string; + change?(e: SwitchChangeEvent): void; + } + interface SwitchEvent { + sender: Switch; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SwitchChangeEvent extends SwitchEvent { + checked?: any; + } + + + class TabStrip extends kendo.mobile.ui.Widget { + static fn: TabStrip; + static extend(proto: Object): TabStrip; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: TabStripOptions); + options: TabStripOptions; + badge(tab: string, value: string): string; + badge(tab: string, value: boolean): string; + badge(tab: number, value: string): string; + badge(tab: number, value: boolean): string; + currentItem(): JQuery; + destroy(): void; + switchTo(url: string): void; + switchTo(url: number): void; + switchByFullUrl(url: string): void; + clear(): void; + } + + interface TabStripOptions { + name?: string; + selectedIndex?: number; + select?(e: TabStripSelectEvent): void; + } + interface TabStripEvent { + sender: TabStrip; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface TabStripSelectEvent extends TabStripEvent { + item?: JQuery; + } + + + class View extends kendo.mobile.ui.Widget { + static fn: View; + static extend(proto: Object): View; + + element: JQuery; + wrapper: JQuery; + constructor(element: Element, options?: ViewOptions); + options: ViewOptions; + contentElement(): void; + destroy(): void; + enable(enable: boolean): void; + } + + interface ViewOptions { + name?: string; + model?: string; + reload?: boolean; + scroller?: any; + stretch?: boolean; + title?: string; + useNativeScrolling?: boolean; + zoom?: boolean; + afterShow?(e: ViewAfterShowEvent): void; + beforeHide?(e: ViewBeforeHideEvent): void; + beforeShow?(e: ViewBeforeShowEvent): void; + hide?(e: ViewHideEvent): void; + init?(e: ViewInitEvent): void; + show?(e: ViewShowEvent): void; + transitionStart?(e: ViewTransitionStartEvent): void; + transitionEnd?(e: ViewTransitionEndEvent): void; + } + interface ViewEvent { + sender: View; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface ViewAfterShowEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewBeforeHideEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewBeforeShowEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewHideEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewInitEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewShowEvent extends ViewEvent { + view?: kendo.mobile.ui.View; + } + + interface ViewTransitionStartEvent extends ViewEvent { + type?: string; + } + + interface ViewTransitionEndEvent extends ViewEvent { + type?: string; + } + + +} +declare module kendo.ooxml { + class Workbook extends Observable { + constructor(options?: WorkbookOptions); + options: WorkbookOptions; + toDataURL(): string; + sheets: WorkbookSheet[]; + } + + interface WorkbookSheetColumn { + autoWidth?: boolean; + width?: number; + } + + interface WorkbookSheetFilter { + from?: number; + to?: number; + } + + interface WorkbookSheetFreezePane { + colSplit?: number; + rowSplit?: number; + } + + interface WorkbookSheetRowCell { + background?: string; + bold?: boolean; + color?: string; + colSpan?: number; + fontName?: string; + fontSize?: number; + format?: string; + hAlign?: string; + italic?: boolean; + rowSpan?: number; + underline?: boolean; + wrap?: boolean; + vAlign?: string; + value?: any; + } + + interface WorkbookSheetRow { + cells?: WorkbookSheetRowCell[]; + } + + interface WorkbookSheet { + columns?: WorkbookSheetColumn[]; + freezePane?: WorkbookSheetFreezePane; + filter?: WorkbookSheetFilter; + rows?: WorkbookSheetRow[]; + title?: string; + } + + interface WorkbookOptions { + name?: string; + creator?: string; + date?: Date; + sheets?: WorkbookSheet[]; + } + interface WorkbookEvent { + sender: Workbook; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} + +declare module kendo.dataviz.drawing { + class Arc extends kendo.drawing.Element { + constructor(options?: ArcOptions); + options: ArcOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Arc; + geometry(value: kendo.geometry.Arc): void; + fill(color: string, opacity?: number): kendo.drawing.Arc; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Arc; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ArcOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ArcEvent { + sender: Arc; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Circle extends kendo.drawing.Element { + constructor(options?: CircleOptions); + options: CircleOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + geometry(): kendo.geometry.Circle; + geometry(value: kendo.geometry.Circle): void; + fill(color: string, opacity?: number): kendo.drawing.Circle; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Circle; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface CircleOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Element extends kendo.Class { + constructor(options?: ElementOptions); + options: ElementOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ElementOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ElementEvent { + sender: Element; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface FillOptions { + color: string; + opacity: number; + } + + + + class Gradient extends kendo.Class { + constructor(options?: GradientOptions); + options: GradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface GradientOptions { + name?: string; + stops?: any; + } + interface GradientEvent { + sender: Gradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class GradientStop extends kendo.Class { + constructor(options?: GradientStopOptions); + options: GradientStopOptions; + } + + interface GradientStopOptions { + name?: string; + offset?: number; + color?: string; + opacity?: number; + } + interface GradientStopEvent { + sender: GradientStop; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Group extends kendo.drawing.Element { + constructor(options?: GroupOptions); + options: GroupOptions; + append(element: kendo.drawing.Element): void; + clear(): void; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + remove(element: kendo.drawing.Element): void; + removeAt(index: number): void; + visible(): boolean; + visible(visible: boolean): void; + children: any; + } + + interface GroupOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + pdf?: kendo.drawing.PDFOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface GroupEvent { + sender: Group; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Image extends kendo.drawing.Element { + constructor(options?: ImageOptions); + options: ImageOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + opacity(): number; + opacity(opacity: number): void; + src(): string; + src(value: string): void; + rect(): kendo.geometry.Rect; + rect(value: kendo.geometry.Rect): void; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface ImageOptions { + name?: string; + clip?: kendo.drawing.Path; + opacity?: number; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface ImageEvent { + sender: Image; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Layout extends kendo.drawing.Group { + constructor(options?: LayoutOptions); + options: LayoutOptions; + rect(): kendo.geometry.Rect; + rect(rect: kendo.geometry.Rect): void; + reflow(): void; + } + + interface LayoutOptions { + name?: string; + alignContent?: string; + alignItems?: string; + justifyContent?: string; + lineSpacing?: number; + spacing?: number; + orientation?: string; + wrap?: boolean; + } + interface LayoutEvent { + sender: Layout; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class LinearGradient extends kendo.drawing.Gradient { + constructor(options?: LinearGradientOptions); + options: LinearGradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + end(): kendo.geometry.Point; + end(end: any): void; + end(end: kendo.geometry.Point): void; + start(): kendo.geometry.Point; + start(start: any): void; + start(start: kendo.geometry.Point): void; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface LinearGradientOptions { + name?: string; + stops?: any; + } + interface LinearGradientEvent { + sender: LinearGradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class MultiPath extends kendo.drawing.Element { + constructor(options?: MultiPathOptions); + options: MultiPathOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: any): kendo.drawing.MultiPath; + curveTo(controlOut: any, controlIn: kendo.geometry.Point): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: any): kendo.drawing.MultiPath; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point): kendo.drawing.MultiPath; + fill(color: string, opacity?: number): kendo.drawing.MultiPath; + lineTo(x: number, y?: number): kendo.drawing.MultiPath; + lineTo(x: any, y?: number): kendo.drawing.MultiPath; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + moveTo(x: number, y?: number): kendo.drawing.MultiPath; + moveTo(x: any, y?: number): kendo.drawing.MultiPath; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.MultiPath; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.MultiPath; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + paths: any; + } + + interface MultiPathOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface MultiPathEvent { + sender: MultiPath; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class OptionsStore extends kendo.Class { + options: OptionsStoreOptions; + get(field: string): any; + set(field: string, value: any): void; + observer: any; + } + + interface OptionsStoreOptions { + name?: string; + } + interface OptionsStoreEvent { + sender: OptionsStore; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface PDFOptions { + creator: string; + date: Date; + keywords: string; + landscape: boolean; + margin: any; + paperSize: any; + subject: string; + title: string; + } + + + + class Path extends kendo.drawing.Element { + constructor(options?: PathOptions); + options: PathOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + close(): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: any): kendo.drawing.Path; + curveTo(controlOut: any, controlIn: kendo.geometry.Point): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: any): kendo.drawing.Path; + curveTo(controlOut: kendo.geometry.Point, controlIn: kendo.geometry.Point): kendo.drawing.Path; + fill(color: string, opacity?: number): kendo.drawing.Path; + lineTo(x: number, y?: number): kendo.drawing.Path; + lineTo(x: any, y?: number): kendo.drawing.Path; + lineTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + moveTo(x: number, y?: number): kendo.drawing.Path; + moveTo(x: any, y?: number): kendo.drawing.Path; + moveTo(x: kendo.geometry.Point, y?: number): kendo.drawing.Path; + opacity(): number; + opacity(opacity: number): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Path; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + static fromPoints(points: any): kendo.drawing.Path; + static fromRect(rect: kendo.geometry.Rect): kendo.drawing.Path; + static parse(svgPath: string, options?: any): kendo.drawing.Path; + segments: any; + } + + interface PathOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface PathEvent { + sender: Path; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class RadialGradient extends kendo.drawing.Gradient { + constructor(options?: RadialGradientOptions); + options: RadialGradientOptions; + addStop(offset: number, color: string, opacity: number): kendo.drawing.GradientStop; + center(): kendo.geometry.Point; + center(center: any): void; + center(center: kendo.geometry.Point): void; + radius(): number; + radius(value: number): void; + removeStop(stop: kendo.drawing.GradientStop): void; + stops: any; + } + + interface RadialGradientOptions { + name?: string; + center?: any; + radius?: number; + stops?: any; + } + interface RadialGradientEvent { + sender: RadialGradient; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Segment extends kendo.Class { + options: SegmentOptions; + anchor(): kendo.geometry.Point; + anchor(value: kendo.geometry.Point): void; + controlIn(): kendo.geometry.Point; + controlIn(value: kendo.geometry.Point): void; + controlOut(): kendo.geometry.Point; + controlOut(value: kendo.geometry.Point): void; + } + + interface SegmentOptions { + name?: string; + } + interface SegmentEvent { + sender: Segment; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + interface StrokeOptions { + color: string; + dashType: string; + lineCap: string; + lineJoin: string; + opacity: number; + width: number; + } + + + + class Surface extends kendo.Observable { + constructor(options?: SurfaceOptions); + options: SurfaceOptions; + clear(): void; + draw(element: kendo.drawing.Element): void; + eventTarget(e: any): kendo.drawing.Element; + resize(force?: boolean): void; + static create(element: JQuery, options?: any): kendo.drawing.Surface; + static create(element: Element, options?: any): kendo.drawing.Surface; + } + + interface SurfaceOptions { + name?: string; + type?: string; + height?: string; + width?: string; + click?(e: SurfaceClickEvent): void; + mouseenter?(e: SurfaceMouseenterEvent): void; + mouseleave?(e: SurfaceMouseleaveEvent): void; + } + interface SurfaceEvent { + sender: Surface; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + interface SurfaceClickEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseenterEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + interface SurfaceMouseleaveEvent extends SurfaceEvent { + element?: kendo.drawing.Element; + originalEvent?: any; + } + + + class Text extends kendo.drawing.Element { + constructor(options?: TextOptions); + options: TextOptions; + bbox(): kendo.geometry.Rect; + clip(): kendo.drawing.Path; + clip(clip: kendo.drawing.Path): void; + clippedBBox(): kendo.geometry.Rect; + content(): string; + content(value: string): void; + fill(color: string, opacity?: number): kendo.drawing.Text; + opacity(): number; + opacity(opacity: number): void; + position(): kendo.geometry.Point; + position(value: kendo.geometry.Point): void; + stroke(color: string, width?: number, opacity?: number): kendo.drawing.Text; + transform(): kendo.geometry.Transformation; + transform(transform: kendo.geometry.Transformation): void; + visible(): boolean; + visible(visible: boolean): void; + } + + interface TextOptions { + name?: string; + clip?: kendo.drawing.Path; + fill?: kendo.drawing.FillOptions; + font?: string; + opacity?: number; + stroke?: kendo.drawing.StrokeOptions; + transform?: kendo.geometry.Transformation; + visible?: boolean; + } + interface TextEvent { + sender: Text; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} +declare module kendo.dataviz.geometry { + class Arc extends Observable { + options: ArcOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + getAnticlockwise(): boolean; + getCenter(): kendo.geometry.Point; + getEndAngle(): number; + getRadiusX(): number; + getRadiusY(): number; + getStartAngle(): number; + pointAt(angle: number): kendo.geometry.Point; + setAnticlockwise(value: boolean): kendo.geometry.Arc; + setCenter(value: kendo.geometry.Point): kendo.geometry.Arc; + setEndAngle(value: number): kendo.geometry.Arc; + setRadiusX(value: number): kendo.geometry.Arc; + setRadiusY(value: number): kendo.geometry.Arc; + setStartAngle(value: number): kendo.geometry.Arc; + anticlockwise: boolean; + center: kendo.geometry.Point; + endAngle: number; + radiusX: number; + radiusY: number; + startAngle: number; + } + + interface ArcOptions { + name?: string; + } + interface ArcEvent { + sender: Arc; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Circle extends Observable { + options: CircleOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + clone(): kendo.geometry.Circle; + equals(other: kendo.geometry.Circle): boolean; + getCenter(): kendo.geometry.Point; + getRadius(): number; + pointAt(angle: number): kendo.geometry.Point; + setCenter(value: kendo.geometry.Point): kendo.geometry.Point; + setCenter(value: any): kendo.geometry.Point; + setRadius(value: number): kendo.geometry.Circle; + center: kendo.geometry.Point; + radius: number; + } + + interface CircleOptions { + name?: string; + } + interface CircleEvent { + sender: Circle; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Matrix extends Observable { + options: MatrixOptions; + clone(): kendo.geometry.Matrix; + equals(other: kendo.geometry.Matrix): boolean; + round(digits: number): kendo.geometry.Matrix; + multiplyCopy(matrix: kendo.geometry.Matrix): kendo.geometry.Matrix; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + static rotate(angle: number, x: number, y: number): kendo.geometry.Matrix; + static scale(scaleX: number, scaleY: number): kendo.geometry.Matrix; + static translate(x: number, y: number): kendo.geometry.Matrix; + static unit(): kendo.geometry.Matrix; + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + } + + interface MatrixOptions { + name?: string; + } + interface MatrixEvent { + sender: Matrix; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Point extends Observable { + options: PointOptions; + clone(): kendo.geometry.Point; + distanceTo(point: kendo.geometry.Point): number; + equals(other: kendo.geometry.Point): boolean; + getX(): number; + getY(): number; + move(x: number, y: number): kendo.geometry.Point; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Point; + rotate(angle: number, center: any): kendo.geometry.Point; + round(digits: number): kendo.geometry.Point; + scale(scaleX: number, scaleY: number): kendo.geometry.Point; + scaleCopy(scaleX: number, scaleY: number): kendo.geometry.Point; + setX(value: number): kendo.geometry.Point; + setY(value: number): kendo.geometry.Point; + toArray(digits: number): any; + toString(digits: number, separator: string): string; + transform(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + transformCopy(tansformation: kendo.geometry.Transformation): kendo.geometry.Point; + translate(dx: number, dy: number): kendo.geometry.Point; + translateWith(vector: kendo.geometry.Point): kendo.geometry.Point; + translateWith(vector: any): kendo.geometry.Point; + static create(x: number, y: number): kendo.geometry.Point; + static create(x: any, y: number): kendo.geometry.Point; + static create(x: kendo.geometry.Point, y: number): kendo.geometry.Point; + static min(): kendo.geometry.Point; + static max(): kendo.geometry.Point; + static minPoint(): kendo.geometry.Point; + static maxPoint(): kendo.geometry.Point; + x: number; + y: number; + } + + interface PointOptions { + name?: string; + } + interface PointEvent { + sender: Point; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Rect extends Observable { + options: RectOptions; + bbox(matrix: kendo.geometry.Matrix): kendo.geometry.Rect; + bottomLeft(): kendo.geometry.Point; + bottomRight(): kendo.geometry.Point; + center(): kendo.geometry.Point; + clone(): kendo.geometry.Rect; + equals(other: kendo.geometry.Rect): boolean; + getOrigin(): kendo.geometry.Point; + getSize(): kendo.geometry.Size; + height(): number; + setOrigin(value: kendo.geometry.Point): kendo.geometry.Rect; + setOrigin(value: any): kendo.geometry.Rect; + setSize(value: kendo.geometry.Size): kendo.geometry.Rect; + setSize(value: any): kendo.geometry.Rect; + topLeft(): kendo.geometry.Point; + topRight(): kendo.geometry.Point; + width(): number; + static fromPoints(pointA: kendo.geometry.Point, pointB: kendo.geometry.Point): kendo.geometry.Rect; + static union(rectA: kendo.geometry.Rect, rectB: kendo.geometry.Rect): kendo.geometry.Rect; + origin: kendo.geometry.Point; + size: kendo.geometry.Size; + } + + interface RectOptions { + name?: string; + } + interface RectEvent { + sender: Rect; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Size extends Observable { + options: SizeOptions; + clone(): kendo.geometry.Size; + equals(other: kendo.geometry.Size): boolean; + getWidth(): number; + getHeight(): number; + setWidth(value: number): kendo.geometry.Size; + setHeight(value: number): kendo.geometry.Size; + static create(width: number, height: number): kendo.geometry.Size; + static create(width: any, height: number): kendo.geometry.Size; + static create(width: kendo.geometry.Size, height: number): kendo.geometry.Size; + width: number; + height: number; + } + + interface SizeOptions { + name?: string; + } + interface SizeEvent { + sender: Size; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + + class Transformation extends Observable { + options: TransformationOptions; + clone(): kendo.geometry.Transformation; + equals(other: kendo.geometry.Transformation): boolean; + matrix(): kendo.geometry.Matrix; + multiply(transformation: kendo.geometry.Transformation): kendo.geometry.Transformation; + rotate(angle: number, center: any): kendo.geometry.Transformation; + rotate(angle: number, center: kendo.geometry.Point): kendo.geometry.Transformation; + scale(scaleX: number, scaleY: number): kendo.geometry.Transformation; + translate(x: number, y: number): kendo.geometry.Transformation; + } + + interface TransformationOptions { + name?: string; + } + interface TransformationEvent { + sender: Transformation; + isDefaultPrevented(): boolean; + preventDefault: Function; + } + + +} + +interface HTMLElement { + kendoBindingTarget: kendo.data.BindingTarget; +} + +interface JQueryXHR { +} + +interface JQueryEventObject { +} + +interface JQueryPromise { + pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; + then(doneCallbacks: any, failCallbacks: any, progressCallbacks?: any): JQueryPromise; +} + +interface JQuery { + + kendoDraggable(): JQuery; + kendoDraggable(options: kendo.ui.DraggableOptions): JQuery; + + kendoDropTarget(): JQuery; + kendoDropTarget(options: kendo.ui.DropTargetOptions): JQuery; + + kendoDropTargetArea(): JQuery; + kendoDropTargetArea(options: kendo.ui.DropTargetAreaOptions): JQuery; + + data(key: any): any; + + kendoAutoComplete(): JQuery; + kendoAutoComplete(options: kendo.ui.AutoCompleteOptions): JQuery; + data(key: "kendoAutoComplete") : kendo.ui.AutoComplete; + + kendoBarcode(): JQuery; + kendoBarcode(options: kendo.dataviz.ui.BarcodeOptions): JQuery; + data(key: "kendoBarcode") : kendo.dataviz.ui.Barcode; + + kendoButton(): JQuery; + kendoButton(options: kendo.ui.ButtonOptions): JQuery; + data(key: "kendoButton") : kendo.ui.Button; + + kendoCalendar(): JQuery; + kendoCalendar(options: kendo.ui.CalendarOptions): JQuery; + data(key: "kendoCalendar") : kendo.ui.Calendar; + + kendoChart(): JQuery; + kendoChart(options: kendo.dataviz.ui.ChartOptions): JQuery; + data(key: "kendoChart") : kendo.dataviz.ui.Chart; + + kendoColorPalette(): JQuery; + kendoColorPalette(options: kendo.ui.ColorPaletteOptions): JQuery; + data(key: "kendoColorPalette") : kendo.ui.ColorPalette; + + kendoColorPicker(): JQuery; + kendoColorPicker(options: kendo.ui.ColorPickerOptions): JQuery; + data(key: "kendoColorPicker") : kendo.ui.ColorPicker; + + kendoComboBox(): JQuery; + kendoComboBox(options: kendo.ui.ComboBoxOptions): JQuery; + data(key: "kendoComboBox") : kendo.ui.ComboBox; + + kendoContextMenu(): JQuery; + kendoContextMenu(options: kendo.ui.ContextMenuOptions): JQuery; + data(key: "kendoContextMenu") : kendo.ui.ContextMenu; + + kendoDatePicker(): JQuery; + kendoDatePicker(options: kendo.ui.DatePickerOptions): JQuery; + data(key: "kendoDatePicker") : kendo.ui.DatePicker; + + kendoDateTimePicker(): JQuery; + kendoDateTimePicker(options: kendo.ui.DateTimePickerOptions): JQuery; + data(key: "kendoDateTimePicker") : kendo.ui.DateTimePicker; + + kendoDiagram(): JQuery; + kendoDiagram(options: kendo.dataviz.ui.DiagramOptions): JQuery; + data(key: "kendoDiagram") : kendo.dataviz.ui.Diagram; + + kendoDropDownList(): JQuery; + kendoDropDownList(options: kendo.ui.DropDownListOptions): JQuery; + data(key: "kendoDropDownList") : kendo.ui.DropDownList; + + kendoEditor(): JQuery; + kendoEditor(options: kendo.ui.EditorOptions): JQuery; + data(key: "kendoEditor") : kendo.ui.Editor; + + kendoFlatColorPicker(): JQuery; + kendoFlatColorPicker(options: kendo.ui.FlatColorPickerOptions): JQuery; + data(key: "kendoFlatColorPicker") : kendo.ui.FlatColorPicker; + + kendoGantt(): JQuery; + kendoGantt(options: kendo.ui.GanttOptions): JQuery; + data(key: "kendoGantt") : kendo.ui.Gantt; + + kendoGrid(): JQuery; + kendoGrid(options: kendo.ui.GridOptions): JQuery; + data(key: "kendoGrid") : kendo.ui.Grid; + + kendoLinearGauge(): JQuery; + kendoLinearGauge(options: kendo.dataviz.ui.LinearGaugeOptions): JQuery; + data(key: "kendoLinearGauge") : kendo.dataviz.ui.LinearGauge; + + kendoListView(): JQuery; + kendoListView(options: kendo.ui.ListViewOptions): JQuery; + data(key: "kendoListView") : kendo.ui.ListView; + + kendoMap(): JQuery; + kendoMap(options: kendo.dataviz.ui.MapOptions): JQuery; + data(key: "kendoMap") : kendo.dataviz.ui.Map; + + kendoMaskedTextBox(): JQuery; + kendoMaskedTextBox(options: kendo.ui.MaskedTextBoxOptions): JQuery; + data(key: "kendoMaskedTextBox") : kendo.ui.MaskedTextBox; + + kendoMenu(): JQuery; + kendoMenu(options: kendo.ui.MenuOptions): JQuery; + data(key: "kendoMenu") : kendo.ui.Menu; + + kendoMobileActionSheet(): JQuery; + kendoMobileActionSheet(options: kendo.mobile.ui.ActionSheetOptions): JQuery; + data(key: "kendoMobileActionSheet") : kendo.mobile.ui.ActionSheet; + + kendoMobileBackButton(): JQuery; + kendoMobileBackButton(options: kendo.mobile.ui.BackButtonOptions): JQuery; + data(key: "kendoMobileBackButton") : kendo.mobile.ui.BackButton; + + kendoMobileButton(): JQuery; + kendoMobileButton(options: kendo.mobile.ui.ButtonOptions): JQuery; + data(key: "kendoMobileButton") : kendo.mobile.ui.Button; + + kendoMobileButtonGroup(): JQuery; + kendoMobileButtonGroup(options: kendo.mobile.ui.ButtonGroupOptions): JQuery; + data(key: "kendoMobileButtonGroup") : kendo.mobile.ui.ButtonGroup; + + kendoMobileCollapsible(): JQuery; + kendoMobileCollapsible(options: kendo.mobile.ui.CollapsibleOptions): JQuery; + data(key: "kendoMobileCollapsible") : kendo.mobile.ui.Collapsible; + + kendoMobileDetailButton(): JQuery; + kendoMobileDetailButton(options: kendo.mobile.ui.DetailButtonOptions): JQuery; + data(key: "kendoMobileDetailButton") : kendo.mobile.ui.DetailButton; + + kendoMobileDrawer(): JQuery; + kendoMobileDrawer(options: kendo.mobile.ui.DrawerOptions): JQuery; + data(key: "kendoMobileDrawer") : kendo.mobile.ui.Drawer; + + kendoMobileLayout(): JQuery; + kendoMobileLayout(options: kendo.mobile.ui.LayoutOptions): JQuery; + data(key: "kendoMobileLayout") : kendo.mobile.ui.Layout; + + kendoMobileListView(): JQuery; + kendoMobileListView(options: kendo.mobile.ui.ListViewOptions): JQuery; + data(key: "kendoMobileListView") : kendo.mobile.ui.ListView; + + kendoMobileLoader(): JQuery; + kendoMobileLoader(options: kendo.mobile.ui.LoaderOptions): JQuery; + data(key: "kendoMobileLoader") : kendo.mobile.ui.Loader; + + kendoMobileModalView(): JQuery; + kendoMobileModalView(options: kendo.mobile.ui.ModalViewOptions): JQuery; + data(key: "kendoMobileModalView") : kendo.mobile.ui.ModalView; + + kendoMobileNavBar(): JQuery; + kendoMobileNavBar(options: kendo.mobile.ui.NavBarOptions): JQuery; + data(key: "kendoMobileNavBar") : kendo.mobile.ui.NavBar; + + kendoMobilePane(): JQuery; + kendoMobilePane(options: kendo.mobile.ui.PaneOptions): JQuery; + data(key: "kendoMobilePane") : kendo.mobile.ui.Pane; + + kendoMobilePopOver(): JQuery; + kendoMobilePopOver(options: kendo.mobile.ui.PopOverOptions): JQuery; + data(key: "kendoMobilePopOver") : kendo.mobile.ui.PopOver; + + kendoMobileScrollView(): JQuery; + kendoMobileScrollView(options: kendo.mobile.ui.ScrollViewOptions): JQuery; + data(key: "kendoMobileScrollView") : kendo.mobile.ui.ScrollView; + + kendoMobileScroller(): JQuery; + kendoMobileScroller(options: kendo.mobile.ui.ScrollerOptions): JQuery; + data(key: "kendoMobileScroller") : kendo.mobile.ui.Scroller; + + kendoMobileSplitView(): JQuery; + kendoMobileSplitView(options: kendo.mobile.ui.SplitViewOptions): JQuery; + data(key: "kendoMobileSplitView") : kendo.mobile.ui.SplitView; + + kendoMobileSwitch(): JQuery; + kendoMobileSwitch(options: kendo.mobile.ui.SwitchOptions): JQuery; + data(key: "kendoMobileSwitch") : kendo.mobile.ui.Switch; + + kendoMobileTabStrip(): JQuery; + kendoMobileTabStrip(options: kendo.mobile.ui.TabStripOptions): JQuery; + data(key: "kendoMobileTabStrip") : kendo.mobile.ui.TabStrip; + + kendoMobileView(): JQuery; + kendoMobileView(options: kendo.mobile.ui.ViewOptions): JQuery; + data(key: "kendoMobileView") : kendo.mobile.ui.View; + + kendoMultiSelect(): JQuery; + kendoMultiSelect(options: kendo.ui.MultiSelectOptions): JQuery; + data(key: "kendoMultiSelect") : kendo.ui.MultiSelect; + + kendoNotification(): JQuery; + kendoNotification(options: kendo.ui.NotificationOptions): JQuery; + data(key: "kendoNotification") : kendo.ui.Notification; + + kendoNumericTextBox(): JQuery; + kendoNumericTextBox(options: kendo.ui.NumericTextBoxOptions): JQuery; + data(key: "kendoNumericTextBox") : kendo.ui.NumericTextBox; + + kendoPager(): JQuery; + kendoPager(options: kendo.ui.PagerOptions): JQuery; + data(key: "kendoPager") : kendo.ui.Pager; + + kendoPanelBar(): JQuery; + kendoPanelBar(options: kendo.ui.PanelBarOptions): JQuery; + data(key: "kendoPanelBar") : kendo.ui.PanelBar; + + kendoPivotConfigurator(): JQuery; + kendoPivotConfigurator(options: kendo.ui.PivotConfiguratorOptions): JQuery; + data(key: "kendoPivotConfigurator") : kendo.ui.PivotConfigurator; + + kendoPivotGrid(): JQuery; + kendoPivotGrid(options: kendo.ui.PivotGridOptions): JQuery; + data(key: "kendoPivotGrid") : kendo.ui.PivotGrid; + + kendoProgressBar(): JQuery; + kendoProgressBar(options: kendo.ui.ProgressBarOptions): JQuery; + data(key: "kendoProgressBar") : kendo.ui.ProgressBar; + + kendoQRCode(): JQuery; + kendoQRCode(options: kendo.dataviz.ui.QRCodeOptions): JQuery; + data(key: "kendoQRCode") : kendo.dataviz.ui.QRCode; + + kendoRadialGauge(): JQuery; + kendoRadialGauge(options: kendo.dataviz.ui.RadialGaugeOptions): JQuery; + data(key: "kendoRadialGauge") : kendo.dataviz.ui.RadialGauge; + + kendoRangeSlider(): JQuery; + kendoRangeSlider(options: kendo.ui.RangeSliderOptions): JQuery; + data(key: "kendoRangeSlider") : kendo.ui.RangeSlider; + + kendoResponsivePanel(): JQuery; + kendoResponsivePanel(options: kendo.ui.ResponsivePanelOptions): JQuery; + data(key: "kendoResponsivePanel") : kendo.ui.ResponsivePanel; + + kendoScheduler(): JQuery; + kendoScheduler(options: kendo.ui.SchedulerOptions): JQuery; + data(key: "kendoScheduler") : kendo.ui.Scheduler; + + kendoSlider(): JQuery; + kendoSlider(options: kendo.ui.SliderOptions): JQuery; + data(key: "kendoSlider") : kendo.ui.Slider; + + kendoSortable(): JQuery; + kendoSortable(options: kendo.ui.SortableOptions): JQuery; + data(key: "kendoSortable") : kendo.ui.Sortable; + + kendoSparkline(): JQuery; + kendoSparkline(options: kendo.dataviz.ui.SparklineOptions): JQuery; + data(key: "kendoSparkline") : kendo.dataviz.ui.Sparkline; + + kendoSplitter(): JQuery; + kendoSplitter(options: kendo.ui.SplitterOptions): JQuery; + data(key: "kendoSplitter") : kendo.ui.Splitter; + + kendoStockChart(): JQuery; + kendoStockChart(options: kendo.dataviz.ui.StockChartOptions): JQuery; + data(key: "kendoStockChart") : kendo.dataviz.ui.StockChart; + + kendoTabStrip(): JQuery; + kendoTabStrip(options: kendo.ui.TabStripOptions): JQuery; + data(key: "kendoTabStrip") : kendo.ui.TabStrip; + + kendoTimePicker(): JQuery; + kendoTimePicker(options: kendo.ui.TimePickerOptions): JQuery; + data(key: "kendoTimePicker") : kendo.ui.TimePicker; + + kendoToolBar(): JQuery; + kendoToolBar(options: kendo.ui.ToolBarOptions): JQuery; + data(key: "kendoToolBar") : kendo.ui.ToolBar; + + kendoTooltip(): JQuery; + kendoTooltip(options: kendo.ui.TooltipOptions): JQuery; + data(key: "kendoTooltip") : kendo.ui.Tooltip; + + kendoTouch(): JQuery; + kendoTouch(options: kendo.ui.TouchOptions): JQuery; + data(key: "kendoTouch") : kendo.ui.Touch; + + kendoTreeList(): JQuery; + kendoTreeList(options: kendo.ui.TreeListOptions): JQuery; + data(key: "kendoTreeList") : kendo.ui.TreeList; + + kendoTreeMap(): JQuery; + kendoTreeMap(options: kendo.dataviz.ui.TreeMapOptions): JQuery; + data(key: "kendoTreeMap") : kendo.dataviz.ui.TreeMap; + + kendoTreeView(): JQuery; + kendoTreeView(options: kendo.ui.TreeViewOptions): JQuery; + data(key: "kendoTreeView") : kendo.ui.TreeView; + + kendoUpload(): JQuery; + kendoUpload(options: kendo.ui.UploadOptions): JQuery; + data(key: "kendoUpload") : kendo.ui.Upload; + + kendoValidator(): JQuery; + kendoValidator(options: kendo.ui.ValidatorOptions): JQuery; + data(key: "kendoValidator") : kendo.ui.Validator; + + kendoWindow(): JQuery; + kendoWindow(options: kendo.ui.WindowOptions): JQuery; + data(key: "kendoWindow") : kendo.ui.Window; + +} From 57158809b5b04fb96cca9f466edd4877a1a18b0e Mon Sep 17 00:00:00 2001 From: chr22 Date: Fri, 8 May 2015 15:52:01 +0200 Subject: [PATCH 133/534] Update namespace from ng -> angular --- angular-local-storage/angular-local-storage.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-local-storage/angular-local-storage.d.ts b/angular-local-storage/angular-local-storage.d.ts index 374f57af0..f0500a96f 100644 --- a/angular-local-storage/angular-local-storage.d.ts +++ b/angular-local-storage/angular-local-storage.d.ts @@ -129,7 +129,7 @@ declare module angular.local.storage { * @param value optional * @param key The corresponding key used in local storage */ - bind(scope:ng.IScope, property: string, value?: any, key?: string): Function; + bind(scope: angular.IScope, property: string, value?: any, key?: string): Function; /** * Return the derive key * Returns String From 06be629c1f42fa654ef5cb756b29714d210bad99 Mon Sep 17 00:00:00 2001 From: chr22 Date: Fri, 8 May 2015 16:02:02 +0200 Subject: [PATCH 134/534] Update namespace from ng -> angular --- angular-ui-router/angular-ui-router.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts index 8d42fee7d..bfec95156 100644 --- a/angular-ui-router/angular-ui-router.d.ts +++ b/angular-ui-router/angular-ui-router.d.ts @@ -64,7 +64,7 @@ declare module angular.ui { reloadOnSearch?: boolean; } - interface IStateProvider extends ng.IServiceProvider { + interface IStateProvider extends angular.IServiceProvider { state(name:string, config:IState): IStateProvider; state(config:IState): IStateProvider; decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any; @@ -83,7 +83,7 @@ declare module angular.ui { type(name: string, definition: any, definitionFn?: any): any; } - interface IUrlRouterProvider extends ng.IServiceProvider { + interface IUrlRouterProvider extends angular.IServiceProvider { when(whenPath: RegExp, handler: Function): IUrlRouterProvider; when(whenPath: RegExp, handler: any[]): IUrlRouterProvider; when(whenPath: RegExp, toPath: string): IUrlRouterProvider; @@ -145,7 +145,7 @@ declare module angular.ui { * * @param options Options object. */ - go(to: string, params?: {}, options?: IStateOptions): ng.IPromise; + go(to: string, params?: {}, options?: IStateOptions): angular.IPromise; transitionTo(state: string, params?: {}, updateLocation?: boolean): void; transitionTo(state: string, params?: {}, options?: IStateOptions): void; includes(state: string, params?: {}): boolean; From 7c6545df5512d44ad734f4a9f6eb5a652b638a77 Mon Sep 17 00:00:00 2001 From: Stefan Rahnev Date: Fri, 8 May 2015 17:05:30 +0300 Subject: [PATCH 135/534] Header definition comments added --- kendo-ui/kendo.all.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kendo-ui/kendo.all.d.ts b/kendo-ui/kendo.all.d.ts index 8f8658290..3f5cb5d4f 100644 --- a/kendo-ui/kendo.all.d.ts +++ b/kendo-ui/kendo.all.d.ts @@ -1,4 +1,7 @@ // Type definitions for Kendo UI +// Project: http://www.telerik.com/kendo-ui +// Definitions by: Stefan Rahnev +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare module kendo { function culture(): { From 3db27f0349ec72f580d3b28e9815f3a7060a32e4 Mon Sep 17 00:00:00 2001 From: Harel M Date: Fri, 8 May 2015 17:18:30 +0300 Subject: [PATCH 136/534] Update get language data --- moment/moment.d.ts | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/moment/moment.d.ts b/moment/moment.d.ts index 303a41099..b8c2ee23c 100644 --- a/moment/moment.d.ts +++ b/moment/moment.d.ts @@ -318,19 +318,27 @@ declare module moment { } - interface MomentLanguage { + interface BaseMomentLanguage { + months ?: any; + monthsShort ?: any; + weekdays ?: any; + weekdaysShort ?: any; + weekdaysMin ?: any; + relativeTime ?: MomentRelativeTime; + meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string; + calendar ?: MomentCalendar; + ordinal ?: (num: number) => string; + } - months?: any; - monthsShort?: any; - weekdays?: any; - weekdaysShort?: any; - weekdaysMin?: any; - longDateFormat(formatType: string): string; - relativeTime?: MomentRelativeTime; - meridiem?: (hour: number, minute: number, isLowercase: boolean) => string; - calendar?: MomentCalendar; - ordinal?: (num: number) => string; + interface MomentLanguage extends BaseMomentLanguage { + longDateFormat?: MomentLongDateFormat; + } + interface MomentLanguageData extends BaseMomentLanguage { + /* + * formatType should be L, LL, LLL, LLLL. + */ + longDateFormat(formatType: string): string; } interface MomentLongDateFormat { @@ -412,7 +420,7 @@ declare module moment { locale(language?: string[]): string; locale(language?: string, definition?: MomentLanguage): string; - localeData(language?: string): MomentLanguage; + localeData(language?: string): MomentLanguageData; longDateFormat: any; relativeTime: any; From 9d44f705dedb3bb1a207ae160113ab5783d4916a Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Fri, 8 May 2015 15:07:22 -0300 Subject: [PATCH 137/534] node: Declare global.gc() This function is available with the node flag --expose-gc --- node/node.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/node/node.d.ts b/node/node.d.ts index b0a7b77e5..2543ccaca 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -252,6 +252,7 @@ declare module NodeJS { setTimeout: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => NodeJS.Timer; undefined: typeof undefined; unescape: (str: string) => string; + gc: () => void; } export interface Timer { From d7ae91d9089693cb3502f70882e75b999a415404 Mon Sep 17 00:00:00 2001 From: Thijs Kuipers Date: Fri, 8 May 2015 21:32:15 +0200 Subject: [PATCH 138/534] Add DYMO Label Framework v1.2.6 Typescript definition --- .../dymo-label-framework.d.ts | 598 ++++++++++++++++++ 1 file changed, 598 insertions(+) create mode 100644 dymo-label-framework/dymo-label-framework.d.ts diff --git a/dymo-label-framework/dymo-label-framework.d.ts b/dymo-label-framework/dymo-label-framework.d.ts new file mode 100644 index 000000000..eb05b7434 --- /dev/null +++ b/dymo-label-framework/dymo-label-framework.d.ts @@ -0,0 +1,598 @@ +// Type definitions for DYMO Label Framework v1.2.6 +// Project: http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/index.html +// Definitions by: Thijs Kuipers +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * Top namespace for DYMO Label Framework JavaScript library. + * + * Based on information from http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/index.html + * which is Copyright (c), 2010, Sanford, L.P. All Rights Reserved. + * + * Based on information from http://developers.dymo.com/2010/06/02/dymo-label-framework-overview/ + * which is © 2013 DYMO Label Inside Out + */ +declare module dymo.label.framework { + + /** Enumeration that specifies where to draw the Intellegent Mail barcode for an Address object. */ + enum AddressBarcodePosition { + /** Indicates to print the barcode above the address. */ + AboveAddress, + /** Indicates to print the barcode below the address. */ + BelowAddress, + /** Indicates to not print the barcode at all. */ + Suppress + } + + /** + * Emuneration that specifies the direction in which objects and object text are laid out on the label. + * For Middle East labels/content specify "RightToLeft", otherwise specify "LeftToRight" (default). + */ + enum FlowDirection { + /** Indicates that the content flows from left to right. */ + LeftToRight, + /** Indicates that the content flows from right to left. */ + RightToLeft + } + + /** + * Enumeration that specifies the print quality when printing to a LabelWriter printer. + */ + enum LabelWriterPrintQuality { + /** Indicates that text print quality (fast) is used. */ + Text, + /** Indicates that barcode and images print quality (slow) is used. */ + BarcodeAndGraphics, + /** Indicates that the print quality is automatically determined based on the types of objects on the label. */ + Auto + } + + /** Print Job Status */ + enum PrintJobStatus { + Error, + Finished, + InQueue, + InvalidJobId, + NotSpooled, + PaperOut, + PrinterBusy, + Printing, + ProcessingError, + Unknown + } + + /** Enumeration that specifies the leader and trailer for a tape label when printing to a Tape printer. */ + enum TapeAlignment { + /** Indicates a 10mm leader and a 10mm trailer. */ + Center, + /** Indicates a 6mm leader and a 10mm trailer. */ + Left, + /** Indicates a 10mm leader and a 6mm trailer. */ + Right + } + + /** Enumeration that specifies the tape cut mode when printing multiple labels to a Tape printer. Note: This enumeration affects multiple page print jobs only. If a one page job is printed, the tape is always cut. */ + enum TapeCutMode { + /** Indicates to cut the tape between labels. */ + AutoCut, + /** Indicates to print cut marks between labels. */ + ChainMarks + } + + /** Enumeration that specifies which roll to print to when printing to a Twin Turbo printer. */ + enum TwinTurboRoll { + /** Indicates to print to the left roll only. */ + Left, + /** Indicates to print to the right roll only. */ + Right, + /** Indicates to continue printing to the other roll when the current roll is out of paper. Note: This does not indicate which roll to print to first; printing may start on either roll. */ + Auto + } + + /** Returns the library version number, e.g. "1.2.6" */ + var VERSION: string; + + /** Checks that the browser enviroment is suitable for the Framework. */ + function checkEnvironment(): { + /** Indicates whether the browser is supported or not. */ + isBrowserSupported: boolean, + /** Indicates whether the Framework is installed or not. */ + isFrameworkInstalled: boolean, + /** An empty string if no error is detected; an error message if an error is detected. */ + errorDetails: string + }; + + /** + * Object with properties 'a' or 'alpha' to specify color's alpha channel, + * r/red, g/green, b/blue for red, green, blue channels. + * The valid range for a/r/g/b fields is [0..255]. + */ + interface Color { + /** alpha channel [0..255] default: 255 */ + alpha?: number; + /** red channel [0..255] default: 0 */ + red?: number; + /** green channel [0..255] default: 0 */ + green?: number; + /** blue channel [0..255] default: 0 */ + blue?: number; + } + + interface CreateLabelRenderParamsXmlParams { + /** The color of the label. */ + labelColor?: Color; + /** The color of label shadow. */ + shadowColor?: Color; + /** The shadow width in TWIPS. If '0' is specified, no shadow is rendered. */ + shadowDepth?: number; + /** The direction of the label content on the label (left-to-right or right-to-left). Use the dymo.label.framework.FlowDirection enumeration to specify the value. */ + flowDirection?: FlowDirection; + /** + * If true, the PNG will be generated using the display resolution. + * If false, the PNG will be generated using the printer resolution. + * If the display resolution is used, the resulting PNG will be smaller. + * Use the printer resolution if the resulting image will be zoomed. This will give the zoomed preview better quality. + */ + pngUseDisplayResolution?: boolean; + } + + /** + * Creates an XML string suitable to pass to the dymo.label.framework.renderLabel function + * as renderParamsXml parameter. Returns an XML string. + * + * @param params A JavaScript object with the following properties + * (not all properties must be defined; if a property is not defined, a default value is used) + */ + function createLabelRenderParamsXml(params: CreateLabelRenderParamsXmlParams): string; + + interface CreateLabelWriterPrintParamsXmlParams { + /** The number of copies to print. */ + copies?: number; + /** The print job title/description. */ + jobTitle?: string; + /** The direction of the label content on the label (left-to-right or right-to-left). Use the dymo.label.framework.FlowDirection enumeration to specify the value. */ + flowDirection?: FlowDirection; + /** The print quality. Use the dymo.label.framework.LabelWriterPrintQuality enumeration to specify the value. */ + printQuality?: LabelWriterPrintQuality; + /** The roll to print to if the printer is a TwinTurbo printer. Use the dymo.label.framework.TwinTurboRoll enumeration to specify the value. */ + twinTurboRoll?: TwinTurboRoll; + } + + /** + * Creates an XML string suitable to to pass to the dymo.label.framework.printLabel function + * as printParamsXml parameter. Created print parameters are for printing to LabelWriter printers. + * Returns an XML string. + * + * @param params A JavaScript object with the following properties + * (not all properties must be defined; if a property is not defined, a default value is used) + */ + function createLabelWriterPrintParamsXml(params: CreateLabelWriterPrintParamsXmlParams): string; + + interface CreateTapePrintParamsXmlParams { + /** The number of copies to print. */ + copies: number; + /** The print job title/description. */ + jobTitle: string; + /** The direction of the label content on the label (left-to-right or right-to-left). Use the dymo.label.framework.FlowDirection enumeration to specify the value. */ + flowDirection: FlowDirection; + /** The label alignment on the tape. Use the dymo.label.framework.TapeAlignment enumeration to specify the value. */ + alignment: TapeAlignment; + /** The cut mode (if auto-cut is supported by the printer). Use the dymo.label.framework.TapeCutMode enumeration to specify the value. */ + cutMode: TapeCutMode; + } + + /** + * Creates an XML string suitable to pass to the dymo.label.framework.printLabel function as printParamsXml parameter. Created print parameters are for printing to Tape printers. + * Returns an XML string. + * + * @param params A JavaScript object with the following properties + * (not all properties must be defined; if a property is not defined, a default value is used) + */ + function createTapePrintParamsXml(params): string; + + interface PrinterInfo { + /** Indicates whether the Auto-Cut feature is supported by the printer or not. Note: The property is only defined if printerType is "TapePrinter". */ + isAutoCutSupported: boolean; + /** Indicates whether the printer is connected to a computer or not. Note: Currently only returns properly for local USB-connected printers on Windows. */ + isConnected: boolean; + /** Indicates whether the printer is a local USB-connected printer or a shared network printer. Note: Currently only returns properly on Windows. */ + isLocal: boolean; + /** Indicates whether the printer is a "LabelWriter Twin Turbo" (has two rolls) or not. Note: The property is only defined if printerType is "LabelWriterPrinter". */ + isTwinTurbo: boolean; + /** Returns the printer model/driver name. */ + modelName: string; + /** Returns the printer name (print queue name on Mac). */ + name: string; + /** Returns the printer type; "LabelWriterPrinter" or "TapePrinter". */ + printerType: string; + } + + /** + * Gets a list of all printers supported by the DYMO Label Framework. + * Results are returned in an array-like object. + * Each item is of the type dymo.label.framework.PrinterInfo. + * In addition, items can be accessed by printer name. + */ + function getPrinters(): PrinterInfo[]; + + /** + * Convenience method (overload of getPrinters) to get a list of all printers of type "LabelWriterPrinter". + */ + function getLabelWriterPrinters(): PrinterInfo[]; + + /** + * Convenience method (overload of getPrinters) to get a list of all printers of type "TapePrinter". + */ + function getTapePrinters(): PrinterInfo[]; + + /** + * Loads an image from a URL or file and returns it as a base64-encoded PNG stream. + * The loaded image is not necessarily in PNG format. + * The image can be in any format supported by the Framework (by DYMO Label v.8). + * The loaded data can be used to set content for an image object on a label. + * Note: The comments for {@link openLabelFile} apply to this function as well. + * + * @param imageUri URL or file name to load the image from. + * + * @returns A base64-encoded PNG stream. + */ + function loadImageAsPngBase64(imageUri: string): string; + + /** Print Job */ + interface PrintJob { + /** + * Gets a status of the print job + * + * @param replyCallback a function called when the status is available + */ + getStatus(replyCallback: (printJobStatusInfo: PrintJobStatusInfo) => any): void; + } + + /** Print Job Status Info */ + interface PrintJobStatusInfo { + statusMessage: string; + status: PrintJobStatus; + } + + /** + * There is no constructor function for ILabel. To get ILabel instance use the + * dymo.label.framework.openLabelFile or dymo.label.framework.openLabelXml function. + * ILabel provides methods for manipulating label content, such as set address or text + * on the label. + */ + interface ILabel { + /** + * Gets the Intelligent Mail barcode position for an Address object. + * + * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. + * + * @returns A string with one of the values defined by the dymo.label.framework.AddressBarcodePosition enumeration. + */ + getAddressBarcodePosition(addressIndex: number): AddressBarcodePosition; + + /** + * Gets the number of Address objects on the label. + */ + getAddressObjectCount(): number; + + /** + * Gets the text content of an Address object. + * + * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. + * + * @returns The plain text from the Address object. + */ + getAddressText(addressIndex: number): string; + + /** + * Returns the current label as an XML string. The returned XML string can be passed + * to functions that accept label XML as a parameter, or can be used to direct content + * manipulations not currently supported by the Framework. + */ + getLabelXml(): string; + + /** + * Gets an array of object reference names on the label. Returns an array of strings. + */ + getObjectNames(): string[]; + + /** + * Gets the 'text' content of an object. The content depends on the object type. + * * Address and Text objects - Returns the object text without formatting. + * * Barcode object - Returns the barcode string. + * * Image - Returns the base64-encoded string on the image's PNG stream (only if image data is embedded with the label and not linked to a URL or file). + * * Circular Text object - Returns the object text. + * * Other objects - Returns an empty string. + * + * @param objectName The name of the object. + */ + getObjectText(objectName: string): string; + + /** + * Prints the label. + * + * @param printerName The name of the printer to print to. A list of printers can be obtained using dymo.label.framework.getPrinters. + * @param printParamsXml The print parameters, such as number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}. + * @param labelSetXml + * The LabelSet to print. LabelSet is used to print multiple labels with the same layout, but with different + * data, such as multiple addresses. Use the dymo.label.framework.LabelSetBuilder class to create a LabelSet + * or construct XML manually according to [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. + */ + print(printerName: string, printParamsXml: string, labelSetXml: string): void; + + /** + * Prints a label and runs status checking in a loop + + * @param printerName The name of the printer to print to. A list of printers can be obtained using dymo.label.framework.getPrinters. + * @param printParamsXml The print parameters, such as number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}. + * @param labelSetXml The LabelSet to print. + * LabelSet is used to print multiple labels with the same layout, but with different data, such as multiple + * addresses. Use the dymo.label.framework.LabelSetBuilder class to create a LabelSet or construct XML manually + * according to [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. + * @param statusCallback Status callback function called when the service returned status information. + * The callback takes two parameters; the first is PrintJob object. It can be used to get the status information on demand, + * without using polling. Also, it might be extended in the future to provide more control over the print job, e.g. an ability + * to cancel it. The second parameter to the callback is PrintJobStatusInfo class. PrintJobStatusInfo has two properties: + * statusMessage that contains a status message string; and status that contains status code. The callback has to return a + * boolean value. If true is returned, than pritnAndPollStatus() will poll the service again after the pollInterval passed. + * If false is returned, then printAndPollStatus() finishes processing. + * @param pollInterval Interval in milliseconds to ask the proxy service for the job status information. + + * @returns The print job. + */ + printAndPollStatus( + printerName: string, + printParamsXml: string, + labelSetXml: string, + statusCallback: (printJob: PrintJob, printJobStatusInfo: PrintJobStatusInfo) => boolean, + pollInterval: number + ): PrintJob; + + /** + * Creates a label raster image that can be used for label previewing. + * + * @param renderParamsXml Rendering parameters, such as shadow depth, label color, etc. + * See [LabelRenderParams.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelRenderParams.xsd}. + * @param printerName The name of the printer that the preview is generated for. + * The preview/output can be different for different printers, + * especially for tape printers with different print head sizes. + * If it is not important what printer the label is printed to, + * an empty string can be passed. In this case, the default printer metrics will + * be used. The default is LW400 for LabelWriter printers and LW400 DUO Tape for + * tape printers. + */ + render(renderParamsXml: string, printerName: string): string; + + /** + * Sets the Intelligent Mail barcode position for an Address object. + * + * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. + * @param barcodePosition The barcode position. + * + * @returns self + */ + setAddressBarcodePosition(addressIndex: number, barcodePosition: AddressBarcodePosition): ILabel; + + /** + * Sets the text content of an Address object. + * + * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. + * @param text The plain text string that contains the content of the Address object. Note: The current text formatting is retained on a line-by-line basis. + * + * @returns self + */ + setAddressText(addressIndex: number, text: string): ILabel; + + /** + * Sets the text content for an object. The content and/or text formatting are set differently + * depending on the object type. + * + * * Address object - The formatting is applied on a line-by-line basis (using list). + * * Text object - The formatting of the current first character is applied to all text. + * * Barcode object - The barcode text. + * * Image object - The base64-encoded string of image's PNG stream. + * * CircularText object - The object text. + * * Date and Time and Counter objects - The object's 'Before' text. + * * Other objects - An empty string. + * + * @param objectName The name of the object. + * @param text The plain text string for new object content. + */ + setObjectText(objectName: string, text: string): ILabel; + } + + /** + * ILabelSetRecord instance holds data of one LabelSet record. ILabelSetRecord provides + * methods for adding data to the record. To create ILabelSetRecord instance, + * use dymo.label.framework.LabelSetBuilder.prototype.addRecord method. + */ + interface ILabelSetRecord { + /** + * Adds image data to the record. + * + * @param objectName The name of the object that the markup is set for. + * @param base64Image The string containing the base64-encoded PNG image stream. + * + * @returns self + */ + setBase64Image(objectName: string, base64Image: string): ILabelSetRecord; + + /** Adds data to the record specified as plain text. + * + * @param objectName The name of the object that the markup is set for. + * @param text The object text to set. + * + * @returns self + */ + setText(objectName: string, text: string): ILabelSetRecord; + + /** + * Adds data to the record specified as text markup. + * + * @param objectName The name of the object that the markup is set for. + * @param textMarkup The markup string. See [TextMarkup.xsd]{@link http://labelwriter.com/software/dls/sdk/TextMarkup.xsd}. + * + * @returns self + */ + setTextMarkup(objectName: string, textMarkup: string): ILabelSetRecord; + } + + /** + * Loads label content from a file or URL. + * The following considerations should be taken before using this function: + * + * * The full file name or URL should be specified. The function will not honor relative paths based on document.location.href. + * * The fileName can be an http:// or file:// URL. On Windows the file name can be a regular file name, for example 'c:\users\desktop\address.label'. + * * The content of the label will be loaded synchronously. Therefore, if the remote server is down there will be a timeout. + * * Any local file can be accessed or attempted to be accessed. The function is not limited by any browser restrictions. However, only a valid label file (according to label.xsd schema) can be loaded. This could still be a potential security concern. + * * The URL is not limited to same-site-origin browser policy. Any URL can be opened. + * * The proxy settings are the system default settings, these are not necessarily the browser settings. + * + * Use this function only when there is no other way to load label data. In most cases, label data should be loaded using dymo.label.framework.openLabelXml. + * + * @param fileName FileName or URL to load label from. + *  + * @returns Returns Label object; provides label manipulation methods. + */ + function openLabelFile(fileName: string): ILabel; + + /** + * Loads label content from an XML stream/string. + * Note: This is the preferred way to load/open label files. + * Use XMLHttpRequest() or other standard browser methods to get XML string. + * + * @param labelXml The label definition as an XML string. + * @returns Label object. + */ + function openLabelXml(labelXml: string): ILabel; + + /** + * Prints one or more labels. + * + * @param printerName The name of the printer to print to. A list of printers can be obtained using + * dymo.label.framework.getPrinters. + * @param printParamsXml The print parameters, such as number of copies, print quality, etc. + * See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}. + * @param labelXml The label to print. + * @param labelSetXml The LabelSet to print. LabelSet is used to print multiple labels with the same layout, + * but with different data, such as multiple addresses. Use dymo.label.framework.LabelSetBuilder class to + * create a LabelSet, or construct XML manualy according to + * [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. + */ + function printLabel(printerName: string, printParamsXml: string, labelXml: string, labelSetXml: string): void; + + /** + * Prints a label and returns a print job object + * + * @param printerName The printer to print on. A list of printers can be obtained by getPrinters() + * @param printParamsXml Printing parameters, like number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd} + * @param labelXml Label to print + * @param labelSetXml + * LabelSet to print. LabelSet is used to print multiple labels with same layout but different data, e.g. multiple addresses. + * Use LabelSetBuilder to create a LabelSet or construct xml manualy according to [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. + */ + function printLabel2(printerName: string, printParamsXml: string, labelXml: string, labelSetXml: string): PrintJob; + + /** + * Prints a label and runs status checking in a loop + * + * @param printerName The printer to print on. A list of printers can be obtained by getPrinters() + * @param printParamsXml Printing parameters, like number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd} + * @param labelXml Label to print + * @param labelSetXml + * LabelSet to print. LabelSet is used to print multiple labels with same layout but different data, e.g. + * multiple addresses. + * Use LabelSetBuilder to create a LabelSet or construct xml manually according to + * [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd} + * @param statusCallback + * Function to be called when a print job status is available. + * To continue polling the status the function should return true, false otherwise. + * @param pollInterval Polling interval in milliseconds + */ + function printLabelAndPollStatus( + printerName: string, + printParamsXml: string, + labelXml: string, + labelSetXml: string, + statusCallback: (printJob: PrintJob, printJobStatusInfo: PrintJobStatusInfo) => boolean, + pollInterval: number + ): PrintJob; + + /** + * Creates a label raster image that can be used for label previewing. + * Returns a string that is a base64-encoded PNG stream of the label image. + * This string can be used as data: url for element. + * Note: data: urls are not supported by IE6 and IE7. IE8 supports them with a 32KB limit (so it may not be possible to preview 'large' labels). + * + * @param labelXml Label to preview. + * @param renderParamsXml The rendering parameters, such as shadow depth, label color, etc. See [LabelRenderParams.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelRenderParams.xsd}. + * @param printerName The name of the printer that the preview is generated for. + * The preview/output can be different for different printers, especially for tape printers + * with different print head sizes. If it is not important what printer the label is + * printed to, an empty string can be passed. In this case, the default printer metrics + * will be used. The default is LW400 for LabelWriter printers and LW400 DUO Tape for tape printers. + * + * @returns A base64-encoded PNG stream of the label image. + */ + function renderLabel(labelXml: string, renderParamsXml: string, printerName: string): string; + + /** + * Undocumented + */ + interface AddPrinterUriCallback { + (printerUri: string): any; + } + + /** + * Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119 + */ + function addPrinterUri( + printerUri: string, + location?: string, + successCallback?: AddPrinterUriCallback, + errorCallback?: AddPrinterUriCallback + ): void; + + /** + * Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119 + */ + function removePrinterUri(printerUri: string): void; + + /** + * Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119 + */ + function removeAllPrinterUri(): void; + + /** + * LabelSetBuilder is used to create a LabelSet to print multiple labels in one print job. + * LabelSet is a collection of records. Each record contains multiple pairs; each pair consists + * of the object name and the object text data/content. The data of each record are applied to all + * corresponend objects and for each record one label is printed. + */ + class LabelSetBuilder { + /** + * Adds a new record to the LabelSet. Returns a record object. + */ + addRecord(): ILabelSetRecord; + + /** + * Get all record objects in this LabelSetBuilder. + */ + getRecords(): ILabelSetRecord[]; + + /** + * Converts the builder's content to an XML string suitable to pass to dymo.label.framefork.printLabel. + */ + toString(): string; + + /** + * Converts record objects to XML format. The XML format schema is defined in [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. + * Returned XML can be passed to dymo.label.framefork.printLabel as labelSetXml parameter. This function can be used independent of other LabelSetBuilder methods, if records data is generated by other functions. + * + * @param records The records to convert to XML. Records should be an array-like object of associative-arrays with object names as keys and object text as values. + * + * @returns An XML string. + */ + static toXml(records: {}[]): string; + } +} \ No newline at end of file From b7588285e456f90357bab6998ba462a3e8f70e28 Mon Sep 17 00:00:00 2001 From: Thijs Kuipers Date: Fri, 8 May 2015 21:40:21 +0200 Subject: [PATCH 139/534] Add link to latest javascript library --- dymo-label-framework/dymo-label-framework.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/dymo-label-framework/dymo-label-framework.d.ts b/dymo-label-framework/dymo-label-framework.d.ts index eb05b7434..128ff8087 100644 --- a/dymo-label-framework/dymo-label-framework.d.ts +++ b/dymo-label-framework/dymo-label-framework.d.ts @@ -5,6 +5,7 @@ /** * Top namespace for DYMO Label Framework JavaScript library. + * Latest library available at http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js * * Based on information from http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/index.html * which is Copyright (c), 2010, Sanford, L.P. All Rights Reserved. From 8d7ab3872263eab2793add2b55d9dfe687e5c086 Mon Sep 17 00:00:00 2001 From: Thijs Kuipers Date: Fri, 8 May 2015 21:54:34 +0200 Subject: [PATCH 140/534] Fix travis errors --- dymo-label-framework/dymo-label-framework.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dymo-label-framework/dymo-label-framework.d.ts b/dymo-label-framework/dymo-label-framework.d.ts index 128ff8087..48cb26cf2 100644 --- a/dymo-label-framework/dymo-label-framework.d.ts +++ b/dymo-label-framework/dymo-label-framework.d.ts @@ -96,11 +96,11 @@ declare module dymo.label.framework { /** Checks that the browser enviroment is suitable for the Framework. */ function checkEnvironment(): { /** Indicates whether the browser is supported or not. */ - isBrowserSupported: boolean, + isBrowserSupported: boolean; /** Indicates whether the Framework is installed or not. */ - isFrameworkInstalled: boolean, + isFrameworkInstalled: boolean; /** An empty string if no error is detected; an error message if an error is detected. */ - errorDetails: string + errorDetails: string; }; /** From 925d758564d71a1b05a65d4ebd2b18bd024f0bcd Mon Sep 17 00:00:00 2001 From: Thijs Kuipers Date: Fri, 8 May 2015 21:57:09 +0200 Subject: [PATCH 141/534] Fix createTapePrintParamsXml from npm test --- dymo-label-framework/dymo-label-framework.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dymo-label-framework/dymo-label-framework.d.ts b/dymo-label-framework/dymo-label-framework.d.ts index 48cb26cf2..246405960 100644 --- a/dymo-label-framework/dymo-label-framework.d.ts +++ b/dymo-label-framework/dymo-label-framework.d.ts @@ -189,7 +189,7 @@ declare module dymo.label.framework { * @param params A JavaScript object with the following properties * (not all properties must be defined; if a property is not defined, a default value is used) */ - function createTapePrintParamsXml(params): string; + function createTapePrintParamsXml(params: CreateTapePrintParamsXmlParams): string; interface PrinterInfo { /** Indicates whether the Auto-Cut feature is supported by the printer or not. Note: The property is only defined if printerType is "TapePrinter". */ From 6f75d87e3c9e5a1eb4f0a5ec741eb60315a26691 Mon Sep 17 00:00:00 2001 From: Thijs Kuipers Date: Fri, 8 May 2015 22:22:45 +0200 Subject: [PATCH 142/534] tslint suggestions cleanup --- .../dymo-label-framework.d.ts | 209 +++++++++--------- 1 file changed, 103 insertions(+), 106 deletions(-) diff --git a/dymo-label-framework/dymo-label-framework.d.ts b/dymo-label-framework/dymo-label-framework.d.ts index 246405960..88b87e431 100644 --- a/dymo-label-framework/dymo-label-framework.d.ts +++ b/dymo-label-framework/dymo-label-framework.d.ts @@ -5,16 +5,16 @@ /** * Top namespace for DYMO Label Framework JavaScript library. - * Latest library available at http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js - * + * Latest library available at http://labelwriter.com/software/dls/sdk/js/DYMO.Label.Framework.latest.js + * * Based on information from http://www.labelwriter.com/software/dls/sdk/docs/DYMOLabelFrameworkJavaScriptHelp/index.html * which is Copyright (c), 2010, Sanford, L.P. All Rights Reserved. - * + * * Based on information from http://developers.dymo.com/2010/06/02/dymo-label-framework-overview/ * which is © 2013 DYMO Label Inside Out */ declare module dymo.label.framework { - + /** Enumeration that specifies where to draw the Intellegent Mail barcode for an Address object. */ enum AddressBarcodePosition { /** Indicates to print the barcode above the address. */ @@ -24,8 +24,8 @@ declare module dymo.label.framework { /** Indicates to not print the barcode at all. */ Suppress } - - /** + + /** * Emuneration that specifies the direction in which objects and object text are laid out on the label. * For Middle East labels/content specify "RightToLeft", otherwise specify "LeftToRight" (default). */ @@ -35,9 +35,9 @@ declare module dymo.label.framework { /** Indicates that the content flows from right to left. */ RightToLeft } - + /** - * Enumeration that specifies the print quality when printing to a LabelWriter printer. + * Enumeration that specifies the print quality when printing to a LabelWriter printer. */ enum LabelWriterPrintQuality { /** Indicates that text print quality (fast) is used. */ @@ -47,7 +47,7 @@ declare module dymo.label.framework { /** Indicates that the print quality is automatically determined based on the types of objects on the label. */ Auto } - + /** Print Job Status */ enum PrintJobStatus { Error, @@ -61,7 +61,7 @@ declare module dymo.label.framework { ProcessingError, Unknown } - + /** Enumeration that specifies the leader and trailer for a tape label when printing to a Tape printer. */ enum TapeAlignment { /** Indicates a 10mm leader and a 10mm trailer. */ @@ -71,7 +71,7 @@ declare module dymo.label.framework { /** Indicates a 10mm leader and a 6mm trailer. */ Right } - + /** Enumeration that specifies the tape cut mode when printing multiple labels to a Tape printer. Note: This enumeration affects multiple page print jobs only. If a one page job is printed, the tape is always cut. */ enum TapeCutMode { /** Indicates to cut the tape between labels. */ @@ -79,7 +79,7 @@ declare module dymo.label.framework { /** Indicates to print cut marks between labels. */ ChainMarks } - + /** Enumeration that specifies which roll to print to when printing to a Twin Turbo printer. */ enum TwinTurboRoll { /** Indicates to print to the left roll only. */ @@ -92,7 +92,7 @@ declare module dymo.label.framework { /** Returns the library version number, e.g. "1.2.6" */ var VERSION: string; - + /** Checks that the browser enviroment is suitable for the Framework. */ function checkEnvironment(): { /** Indicates whether the browser is supported or not. */ @@ -136,11 +136,11 @@ declare module dymo.label.framework { */ pngUseDisplayResolution?: boolean; } - + /** * Creates an XML string suitable to pass to the dymo.label.framework.renderLabel function * as renderParamsXml parameter. Returns an XML string. - * + * * @param params A JavaScript object with the following properties * (not all properties must be defined; if a property is not defined, a default value is used) */ @@ -158,12 +158,12 @@ declare module dymo.label.framework { /** The roll to print to if the printer is a TwinTurbo printer. Use the dymo.label.framework.TwinTurboRoll enumeration to specify the value. */ twinTurboRoll?: TwinTurboRoll; } - + /** * Creates an XML string suitable to to pass to the dymo.label.framework.printLabel function * as printParamsXml parameter. Created print parameters are for printing to LabelWriter printers. * Returns an XML string. - * + * * @param params A JavaScript object with the following properties * (not all properties must be defined; if a property is not defined, a default value is used) */ @@ -185,7 +185,7 @@ declare module dymo.label.framework { /** * Creates an XML string suitable to pass to the dymo.label.framework.printLabel function as printParamsXml parameter. Created print parameters are for printing to Tape printers. * Returns an XML string. - * + * * @param params A JavaScript object with the following properties * (not all properties must be defined; if a property is not defined, a default value is used) */ @@ -207,54 +207,54 @@ declare module dymo.label.framework { /** Returns the printer type; "LabelWriterPrinter" or "TapePrinter". */ printerType: string; } - - /** + + /** * Gets a list of all printers supported by the DYMO Label Framework. * Results are returned in an array-like object. * Each item is of the type dymo.label.framework.PrinterInfo. * In addition, items can be accessed by printer name. */ function getPrinters(): PrinterInfo[]; - + /** * Convenience method (overload of getPrinters) to get a list of all printers of type "LabelWriterPrinter". */ function getLabelWriterPrinters(): PrinterInfo[]; - + /** * Convenience method (overload of getPrinters) to get a list of all printers of type "TapePrinter". */ function getTapePrinters(): PrinterInfo[]; - + /** * Loads an image from a URL or file and returns it as a base64-encoded PNG stream. * The loaded image is not necessarily in PNG format. * The image can be in any format supported by the Framework (by DYMO Label v.8). * The loaded data can be used to set content for an image object on a label. * Note: The comments for {@link openLabelFile} apply to this function as well. - * + * * @param imageUri URL or file name to load the image from. - * + * * @returns A base64-encoded PNG stream. */ function loadImageAsPngBase64(imageUri: string): string; - + /** Print Job */ interface PrintJob { - /** + /** * Gets a status of the print job * * @param replyCallback a function called when the status is available */ getStatus(replyCallback: (printJobStatusInfo: PrintJobStatusInfo) => any): void; } - + /** Print Job Status Info */ interface PrintJobStatusInfo { statusMessage: string; status: PrintJobStatus; } - + /** * There is no constructor function for ILabel. To get ILabel instance use the * dymo.label.framework.openLabelFile or dymo.label.framework.openLabelXml function. @@ -264,39 +264,39 @@ declare module dymo.label.framework { interface ILabel { /** * Gets the Intelligent Mail barcode position for an Address object. - * + * * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. - * + * * @returns A string with one of the values defined by the dymo.label.framework.AddressBarcodePosition enumeration. */ getAddressBarcodePosition(addressIndex: number): AddressBarcodePosition; - + /** - * Gets the number of Address objects on the label. + * Gets the number of Address objects on the label. */ getAddressObjectCount(): number; - + /** * Gets the text content of an Address object. - * + * * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. - * - * @returns The plain text from the Address object. + * + * @returns The plain text from the Address object. */ getAddressText(addressIndex: number): string; - + /** * Returns the current label as an XML string. The returned XML string can be passed * to functions that accept label XML as a parameter, or can be used to direct content * manipulations not currently supported by the Framework. */ getLabelXml(): string; - + /** * Gets an array of object reference names on the label. Returns an array of strings. */ getObjectNames(): string[]; - + /** * Gets the 'text' content of an object. The content depends on the object type. * * Address and Text objects - Returns the object text without formatting. @@ -304,14 +304,14 @@ declare module dymo.label.framework { * * Image - Returns the base64-encoded string on the image's PNG stream (only if image data is embedded with the label and not linked to a URL or file). * * Circular Text object - Returns the object text. * * Other objects - Returns an empty string. - * - * @param objectName The name of the object. + * + * @param objectName The name of the object. */ getObjectText(objectName: string): string; - + /** * Prints the label. - * + * * @param printerName The name of the printer to print to. A list of printers can be obtained using dymo.label.framework.getPrinters. * @param printParamsXml The print parameters, such as number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}. * @param labelSetXml @@ -320,10 +320,10 @@ declare module dymo.label.framework { * or construct XML manually according to [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. */ print(printerName: string, printParamsXml: string, labelSetXml: string): void; - + /** * Prints a label and runs status checking in a loop - + * * @param printerName The name of the printer to print to. A list of printers can be obtained using dymo.label.framework.getPrinters. * @param printParamsXml The print parameters, such as number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd}. * @param labelSetXml The LabelSet to print. @@ -338,20 +338,19 @@ declare module dymo.label.framework { * boolean value. If true is returned, than pritnAndPollStatus() will poll the service again after the pollInterval passed. * If false is returned, then printAndPollStatus() finishes processing. * @param pollInterval Interval in milliseconds to ask the proxy service for the job status information. - - * @returns The print job. - */ + * + * @returns The print job. + */ printAndPollStatus( printerName: string, printParamsXml: string, labelSetXml: string, statusCallback: (printJob: PrintJob, printJobStatusInfo: PrintJobStatusInfo) => boolean, - pollInterval: number - ): PrintJob; - + pollInterval: number): PrintJob; + /** * Creates a label raster image that can be used for label previewing. - * + * * @param renderParamsXml Rendering parameters, such as shadow depth, label color, etc. * See [LabelRenderParams.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelRenderParams.xsd}. * @param printerName The name of the printer that the preview is generated for. @@ -360,34 +359,34 @@ declare module dymo.label.framework { * If it is not important what printer the label is printed to, * an empty string can be passed. In this case, the default printer metrics will * be used. The default is LW400 for LabelWriter printers and LW400 DUO Tape for - * tape printers. + * tape printers. */ render(renderParamsXml: string, printerName: string): string; - + /** * Sets the Intelligent Mail barcode position for an Address object. - * + * * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. * @param barcodePosition The barcode position. - * + * * @returns self */ setAddressBarcodePosition(addressIndex: number, barcodePosition: AddressBarcodePosition): ILabel; - + /** * Sets the text content of an Address object. - * + * * @param addressIndex The zero-based index of the Address object in a 'virtual' array of all Address objects on the label. * @param text The plain text string that contains the content of the Address object. Note: The current text formatting is retained on a line-by-line basis. - * + * * @returns self */ setAddressText(addressIndex: number, text: string): ILabel; - + /** * Sets the text content for an object. The content and/or text formatting are set differently * depending on the object type. - * + * * * Address object - The formatting is applied on a line-by-line basis (using list). * * Text object - The formatting of the current first character is applied to all text. * * Barcode object - The barcode text. @@ -395,7 +394,7 @@ declare module dymo.label.framework { * * CircularText object - The object text. * * Date and Time and Counter objects - The object's 'Before' text. * * Other objects - An empty string. - * + * * @param objectName The name of the object. * @param text The plain text string for new object content. */ @@ -410,47 +409,47 @@ declare module dymo.label.framework { interface ILabelSetRecord { /** * Adds image data to the record. - * + * * @param objectName The name of the object that the markup is set for. * @param base64Image The string containing the base64-encoded PNG image stream. - * + * * @returns self */ setBase64Image(objectName: string, base64Image: string): ILabelSetRecord; - + /** Adds data to the record specified as plain text. - * + * * @param objectName The name of the object that the markup is set for. * @param text The object text to set. - * + * * @returns self */ setText(objectName: string, text: string): ILabelSetRecord; - + /** * Adds data to the record specified as text markup. - * + * * @param objectName The name of the object that the markup is set for. * @param textMarkup The markup string. See [TextMarkup.xsd]{@link http://labelwriter.com/software/dls/sdk/TextMarkup.xsd}. - * + * * @returns self */ setTextMarkup(objectName: string, textMarkup: string): ILabelSetRecord; } - + /** * Loads label content from a file or URL. * The following considerations should be taken before using this function: - * + * * * The full file name or URL should be specified. The function will not honor relative paths based on document.location.href. * * The fileName can be an http:// or file:// URL. On Windows the file name can be a regular file name, for example 'c:\users\desktop\address.label'. * * The content of the label will be loaded synchronously. Therefore, if the remote server is down there will be a timeout. * * Any local file can be accessed or attempted to be accessed. The function is not limited by any browser restrictions. However, only a valid label file (according to label.xsd schema) can be loaded. This could still be a potential security concern. * * The URL is not limited to same-site-origin browser policy. Any URL can be opened. * * The proxy settings are the system default settings, these are not necessarily the browser settings. - * + * * Use this function only when there is no other way to load label data. In most cases, label data should be loaded using dymo.label.framework.openLabelXml. - * + * * @param fileName FileName or URL to load label from. *  * @returns Returns Label object; provides label manipulation methods. @@ -469,7 +468,7 @@ declare module dymo.label.framework { /** * Prints one or more labels. - * + * * @param printerName The name of the printer to print to. A list of printers can be obtained using * dymo.label.framework.getPrinters. * @param printParamsXml The print parameters, such as number of copies, print quality, etc. @@ -481,10 +480,10 @@ declare module dymo.label.framework { * [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. */ function printLabel(printerName: string, printParamsXml: string, labelXml: string, labelSetXml: string): void; - + /** * Prints a label and returns a print job object - * + * * @param printerName The printer to print on. A list of printers can be obtained by getPrinters() * @param printParamsXml Printing parameters, like number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd} * @param labelXml Label to print @@ -500,9 +499,9 @@ declare module dymo.label.framework { * @param printerName The printer to print on. A list of printers can be obtained by getPrinters() * @param printParamsXml Printing parameters, like number of copies, print quality, etc. See [PrintParams.xsd]{@link http://labelwriter.com/software/dls/sdk/PrintParams.xsd} * @param labelXml Label to print - * @param labelSetXml + * @param labelSetXml * LabelSet to print. LabelSet is used to print multiple labels with same layout but different data, e.g. - * multiple addresses. + * multiple addresses. * Use LabelSetBuilder to create a LabelSet or construct xml manually according to * [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd} * @param statusCallback @@ -516,9 +515,8 @@ declare module dymo.label.framework { labelXml: string, labelSetXml: string, statusCallback: (printJob: PrintJob, printJobStatusInfo: PrintJobStatusInfo) => boolean, - pollInterval: number - ): PrintJob; - + pollInterval: number): PrintJob; + /** * Creates a label raster image that can be used for label previewing. * Returns a string that is a base64-encoded PNG stream of the label image. @@ -532,18 +530,18 @@ declare module dymo.label.framework { * with different print head sizes. If it is not important what printer the label is * printed to, an empty string can be passed. In this case, the default printer metrics * will be used. The default is LW400 for LabelWriter printers and LW400 DUO Tape for tape printers. - * - * @returns A base64-encoded PNG stream of the label image. + * + * @returns A base64-encoded PNG stream of the label image. */ function renderLabel(labelXml: string, renderParamsXml: string, printerName: string): string; - + /** * Undocumented */ interface AddPrinterUriCallback { (printerUri: string): any; } - + /** * Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119 */ @@ -551,19 +549,18 @@ declare module dymo.label.framework { printerUri: string, location?: string, successCallback?: AddPrinterUriCallback, - errorCallback?: AddPrinterUriCallback - ): void; - + errorCallback?: AddPrinterUriCallback): void; + /** * Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119 */ function removePrinterUri(printerUri: string): void; - + /** * Undocumented, removed, see http://developers.dymo.com/2013/08/14/dymo-sdk-qa/#comment-27119 */ function removeAllPrinterUri(): void; - + /** * LabelSetBuilder is used to create a LabelSet to print multiple labels in one print job. * LabelSet is a collection of records. Each record contains multiple pairs; each pair consists @@ -571,29 +568,29 @@ declare module dymo.label.framework { * corresponend objects and for each record one label is printed. */ class LabelSetBuilder { + /** + * Converts record objects to XML format. The XML format schema is defined in [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. + * Returned XML can be passed to dymo.label.framefork.printLabel as labelSetXml parameter. This function can be used independent of other LabelSetBuilder methods, if records data is generated by other functions. + * + * @param records The records to convert to XML. Records should be an array-like object of associative-arrays with object names as keys and object text as values. + * + * @returns An XML string. + */ + static toXml(records: {}[]): string; + /** * Adds a new record to the LabelSet. Returns a record object. */ addRecord(): ILabelSetRecord; - + /** * Get all record objects in this LabelSetBuilder. */ getRecords(): ILabelSetRecord[]; - + /** - * Converts the builder's content to an XML string suitable to pass to dymo.label.framefork.printLabel. + * Converts the builder's content to an XML string suitable to pass to dymo.label.framefork.printLabel. */ toString(): string; - - /** - * Converts record objects to XML format. The XML format schema is defined in [LabelSet.xsd]{@link http://labelwriter.com/software/dls/sdk/LabelSet.xsd}. - * Returned XML can be passed to dymo.label.framefork.printLabel as labelSetXml parameter. This function can be used independent of other LabelSetBuilder methods, if records data is generated by other functions. - * - * @param records The records to convert to XML. Records should be an array-like object of associative-arrays with object names as keys and object text as values. - * - * @returns An XML string. - */ - static toXml(records: {}[]): string; } -} \ No newline at end of file +} From 9a970c0e67d4d63dfc90681d700f3fa1fb7434e5 Mon Sep 17 00:00:00 2001 From: Thijs Kuipers Date: Fri, 8 May 2015 23:51:49 +0200 Subject: [PATCH 143/534] Fix optional properties of CreateTapePrintParamsXmlParams --- dymo-label-framework/dymo-label-framework.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dymo-label-framework/dymo-label-framework.d.ts b/dymo-label-framework/dymo-label-framework.d.ts index 88b87e431..b3209e15c 100644 --- a/dymo-label-framework/dymo-label-framework.d.ts +++ b/dymo-label-framework/dymo-label-framework.d.ts @@ -171,15 +171,15 @@ declare module dymo.label.framework { interface CreateTapePrintParamsXmlParams { /** The number of copies to print. */ - copies: number; + copies?: number; /** The print job title/description. */ - jobTitle: string; + jobTitle?: string; /** The direction of the label content on the label (left-to-right or right-to-left). Use the dymo.label.framework.FlowDirection enumeration to specify the value. */ - flowDirection: FlowDirection; + flowDirection?: FlowDirection; /** The label alignment on the tape. Use the dymo.label.framework.TapeAlignment enumeration to specify the value. */ - alignment: TapeAlignment; + alignment?: TapeAlignment; /** The cut mode (if auto-cut is supported by the printer). Use the dymo.label.framework.TapeCutMode enumeration to specify the value. */ - cutMode: TapeCutMode; + cutMode?: TapeCutMode; } /** From a494bae1bfecf760a5e69749da468905b588c456 Mon Sep 17 00:00:00 2001 From: Thijs Kuipers Date: Fri, 8 May 2015 23:52:19 +0200 Subject: [PATCH 144/534] Add test for all functions, classes, methods and interfaces. --- .../dymo-label-framework-tests.ts | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 dymo-label-framework/dymo-label-framework-tests.ts diff --git a/dymo-label-framework/dymo-label-framework-tests.ts b/dymo-label-framework/dymo-label-framework-tests.ts new file mode 100644 index 000000000..b64625eaa --- /dev/null +++ b/dymo-label-framework/dymo-label-framework-tests.ts @@ -0,0 +1,115 @@ +/// + +var f = dymo.label.framework; + +// Test checkEnvironment +var env = f.checkEnvironment(); + +env.errorDetails = ""; +env.isBrowserSupported = true; +env.isFrameworkInstalled = true; + +// Test getPrinters +var printers = f.getPrinters(); + +// Test PrinterInfo properties +printers.forEach((value) =>{ + value.isAutoCutSupported = true; + value.isConnected = true; + value.isLocal = true; + value.isTwinTurbo = true; + value.modelName = ""; + value.name = ""; +}); + +var testcolor:dymo.label.framework.Color = { alpha: 255, red: 0, green: 0, blue: 0}; + +// Test createLabelRenderParamsXml +var renderParamsXml: string = f.createLabelRenderParamsXml({ + flowDirection: f.FlowDirection.LeftToRight, + labelColor: testcolor, + pngUseDisplayResolution: true, + shadowColor: testcolor, + shadowDepth: 0 +}); +f.createLabelRenderParamsXml({}).charAt(0); // string, all optional params + +// Test renderLabel +f.renderLabel("", renderParamsXml, printers[0].name); + +// Test openLabelXml +var label = f.openLabelXml(""); + +// Test ILabel methods +label.getAddressBarcodePosition(0) == f.AddressBarcodePosition.AboveAddress; // enum +label.getAddressObjectCount().toFixed(); // number +label.getAddressText(0).charAt(0); // string +label.getLabelXml().charAt(0); // string +label.getObjectNames()[0].charAt(0); // string[] +label.getObjectText("").charAt(0); // string +label.print("", "", ""); +label.printAndPollStatus("", "", "", (printJob, printJobStatusInfo) => { + // Test PrintJob + printJob.getStatus((printJobStatusInfoA) => { + // Test PrintJobStatusInfo + printJobStatusInfoA.status.toFixed(); // number + printJobStatusInfoA.statusMessage.charAt(0); // string + }); + // Test callback (must return boolean) + return true; +}, 0); +label.render("", "").charAt(0); // string +// Test chainable "set" methods +label.setAddressBarcodePosition(0, dymo.label.framework.AddressBarcodePosition.AboveAddress) + .setAddressText(0, "") + .setObjectText("", "") + .setAddressText(1, ""); + +// Test LabelSetBuilder +var lsb = new f.LabelSetBuilder(); +var lsbRec = lsb.addRecord(); +lsb.toString().charAt(0); // string +lsb.getRecords().pop(); // array +lsb.getRecords()[0].setText("", ""); // array of ILabelSetRecord + +// Test chainable ILabelSetRecord methods. +lsbRec.setBase64Image("", "").setText("", "").setTextMarkup("", "").setText("", ""); + +// Test static toXml +f.LabelSetBuilder.toXml(lsb.getRecords()); + +// Test printLabel +f.printLabel("", "", "", ""); + +// Test printLabel2 +f.printLabel2("", "", "", "").getStatus((pjsi) => { + pjsi.status.toFixed(); + pjsi.statusMessage.charAt(0); +}); + + + +// Test createLabelWriterPrintParamsXml +var clwppxp: dymo.label.framework.CreateLabelWriterPrintParamsXmlParams = { + copies: 0, // number + flowDirection: dymo.label.framework.FlowDirection.LeftToRight, // enum + jobTitle: "", // string + printQuality: dymo.label.framework.LabelWriterPrintQuality.BarcodeAndGraphics, // enum + twinTurboRoll: dymo.label.framework.TwinTurboRoll.Left // enum +} +f.createLabelWriterPrintParamsXml(clwppxp).charAt(0); // string +f.createLabelWriterPrintParamsXml({}).charAt(0) // all optional params + +// Test createTapePrintParamsXml +var ctppxp: dymo.label.framework.CreateTapePrintParamsXmlParams = { + copies: 0, // number + flowDirection: dymo.label.framework.FlowDirection.RightToLeft, // enum + alignment: dymo.label.framework.TapeAlignment.Left, // enum + cutMode: dymo.label.framework.TapeCutMode.ChainMarks, // enum + jobTitle: "" // string +} +f.createTapePrintParamsXml(ctppxp).charAt(0); // string +f.createTapePrintParamsXml({}).charAt(0); // all optional params + +// Test VERSION +f.VERSION.charAt(0); // string From 821768c1d92fee73446b4d9dbbb637ee154ecc3c Mon Sep 17 00:00:00 2001 From: Harel M Date: Sat, 9 May 2015 02:53:35 +0300 Subject: [PATCH 145/534] Added comments for usage. --- moment/moment.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/moment/moment.d.ts b/moment/moment.d.ts index b8c2ee23c..d26834a03 100644 --- a/moment/moment.d.ts +++ b/moment/moment.d.ts @@ -335,8 +335,8 @@ declare module moment { } interface MomentLanguageData extends BaseMomentLanguage { - /* - * formatType should be L, LL, LLL, LLLL. + /** + * @param formatType should be L, LL, LLL, LLLL. */ longDateFormat(formatType: string): string; } From 1013e42c7acf6627b25a1b09329b73ee49a2b44a Mon Sep 17 00:00:00 2001 From: Tat Date: Sat, 9 May 2015 19:31:26 +0530 Subject: [PATCH 146/534] added some missing tests and fixed a couple of mistakes and typos in the function definitions --- gl-matrix/gl-matrix-tests.ts | 11 ++++++++++- gl-matrix/gl-matrix.d.ts | 7 +++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/gl-matrix/gl-matrix-tests.ts b/gl-matrix/gl-matrix-tests.ts index 4f4bbf43b..ce5251eda 100644 --- a/gl-matrix/gl-matrix-tests.ts +++ b/gl-matrix/gl-matrix-tests.ts @@ -58,6 +58,7 @@ outStr = vec2.str(vecA); // vec3 var matr: GLM.IArray; +var q: GLM.IArray; vecA = [1, 2, 3]; vecB = new Float32Array([4, 5, 6]); @@ -102,9 +103,12 @@ out = vec3.rotateY(out, vecA, vecB, Math.PI); out = vec3.rotateZ(out, vecA, vecB, Math.PI); out = vec3.transformMat3(out, vecA, matr); -matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ] +matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; out = vec3.transformMat4(out, vecA, matr); +q = [1, 2, 3, 4]; +out = vec3.transformQuat(out, vecA, matr); + out = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize); outVal = vec3.angle(vecA, vecB); outStr = vec3.str(vecA); @@ -237,10 +241,14 @@ out = mat3.normalFromMat4(out, matA); q = [ 0, -0.7071067811865475, 0, 0.7071067811865475 ]; out = mat3.fromQuat(out, q); +out = mat3.normalFromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]); out = mat3.fromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]); out = mat3.scale(out, matA, [2,2]); out = mat3.fromMat2d(out, [1, 2, 3, 4, 5, 6]); +out = mat3.translate(out, matA, [1, 2, 3]); +out = mat3.rotate(out, matA, Math.PI/2); + // mat4 matA = [1, 0, 0, 0, 0, 1, 0, 0, @@ -324,6 +332,7 @@ outVal = quat.len(quatA); outVal = quat.squaredLength(quatA); outVal = quat.sqrLen(quatA); out = quat.normalize(out, quatA); +outVal = quat.dot(out, quatA, quatB); out = quat.lerp(out, quatA, quatB, 0.5); out = quat.slerp(out, quatA, quatB, 0.5); out = quat.invert(out, quatA); diff --git a/gl-matrix/gl-matrix.d.ts b/gl-matrix/gl-matrix.d.ts index 3d4fc37a9..392a39220 100644 --- a/gl-matrix/gl-matrix.d.ts +++ b/gl-matrix/gl-matrix.d.ts @@ -6,6 +6,9 @@ declare module GLM { interface IArray { + /** + * Must be indexable like an array + */ [index: number]: number; } } @@ -1585,7 +1588,7 @@ declare module mat3 { * @param rad the angle to rotate the matrix by * @returns out */ - export function translate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; + export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray; } // mat4 @@ -2007,7 +2010,7 @@ declare module quat { * @returns dot product of a and b * @function */ - export function dot(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray; + export function dot(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): number; /** * Performs a linear interpolation between two quat's From 5ea1c5b513fee483cd2ee02e3c93d4d1b62cad2d Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Mon, 4 May 2015 15:11:12 -0500 Subject: [PATCH 147/534] Add type declarations for unorm: both importable module and ambient var --- unorm/unorm.d.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 unorm/unorm.d.ts diff --git a/unorm/unorm.d.ts b/unorm/unorm.d.ts new file mode 100644 index 000000000..9f96fcef0 --- /dev/null +++ b/unorm/unorm.d.ts @@ -0,0 +1,14 @@ +declare module unorm { + interface Static { + nfd(str: string): string; + nfkd(str: string): string; + nfc(str: string): string; + nfkc(str: string): string; + } +} + +declare var unorm: unorm.Static; + +declare module "unorm" { + export = unorm; +} From dde696d52e8a992a060db9e7fca64652984aa803 Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Mon, 4 May 2015 13:55:19 -0500 Subject: [PATCH 148/534] Add virtual-dom type declarations, based on virtual-dom's docs.jsig --- virtual-dom/virtual-dom.d.ts | 121 +++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 virtual-dom/virtual-dom.d.ts diff --git a/virtual-dom/virtual-dom.d.ts b/virtual-dom/virtual-dom.d.ts new file mode 100644 index 000000000..70166515f --- /dev/null +++ b/virtual-dom/virtual-dom.d.ts @@ -0,0 +1,121 @@ +declare module VirtualDOM { + interface VHook { + hook(node: Element, propertyName: string): void; + unhook(node: Element, propertyName: string): void; + } + + type EventHandler = (...args: any[]) => void; + + interface VProperties { + attributes?: {[index: string]: string}; + /** + I would like to use {[index: string]: string}, but then we couldn't use an + object literal when setting the styles, since TypeScript doesn't seem to + infer that {'fontSize': string; 'fontWeight': string;} is actually quite + assignable to the type { [index: string]: string; } + */ + style?: any; + /** + The relaxation on `style` above is the reason why we need `any` as an option + on the indexer type. + */ + [index: string]: any | string | boolean | number | VHook | EventHandler | {[index: string]: string | boolean | number}; + } + + interface VNode { + tagName: string; + properties: VProperties; + children: VTree[]; + key?: string; + namespace?: string; + count: number; + hasWidgets: boolean; + hasThunks: boolean; + hooks: any[]; + descendantHooks: any[]; + version: string; + type: string; // 'VirtualNode' + } + + interface VText { + text: string; + new (text: any); + version: string; + type: string; // 'VirtualText' + } + + interface Widget { + type: string; // 'Widget' + init(): Element; + update(previous: Widget, domNode: Element): void; + destroy(node: Element): void; + } + + interface Thunk { + type: string; // 'Thunk' + vnode: VTree; + render(previous: VTree): VTree; + } + + type VTree = VText | VNode | Widget | Thunk; + + // enum VPatch { + // NONE = 0, + // VTEXT = 1, + // VNODE = 2, + // WIDGET = 3, + // PROPS = 4, + // ORDER = 5, + // INSERT = 6, + // REMOVE = 7, + // THUNK = 8 + // } + interface VPatch { + vNode: VNode, + patch: any; + new(type: number, vNode: VNode, patch: any): VPatch; + version: string; + /** + type is set to 'VirtualPatch' on the prototype, but overridden in the + constructor with a number. + */ + type: number; + } + + interface createProperties extends VProperties { + key?: string; + namespace?: string; + } + type createChildren = Array; + + /** + create() calls either document.createElement() or document.createElementNS(), + for which the common denominator is Element (not HTMLElement). + */ + function create(vnode: VText, opts?: {document?: Document, warn?: boolean}): Text; + function create(vnode: VNode | Widget | Thunk, opts?: {document?: Document, warn?: boolean}): Element; + function h(tagName: string, properties: createProperties, ...children: createChildren): VNode; + function h(tagName: string, ...children: createChildren): VNode; + function diff(left: VTree, right: VTree): VPatch[]; + /** + patch() usually just returns rootNode after doing stuff to it, so we want + to preserve that type (though it will usually be just Element). + */ + function patch(rootNode: T, patches: VPatch[], renderOptions?: any): T; +} + +declare module "virtual-dom/h" { + export = VirtualDOM.h; +} +declare module "virtual-dom/create-element" { + export = VirtualDOM.create; +} +declare module "virtual-dom/diff" { + export = VirtualDOM.diff; +} +declare module "virtual-dom/patch" { + export = VirtualDOM.patch; +} +declare module "virtual-dom" { + export = VirtualDOM; +} From f0c29ac66109d0cd9a51ee724f4dcf9c3d1bba00 Mon Sep 17 00:00:00 2001 From: Adam Carr Date: Sat, 9 May 2015 11:32:40 -0700 Subject: [PATCH 149/534] adding forge-di typing declarations and tests --- forge-di/forge-di-test.ts | 52 ++++++++++ forge-di/forge-di.d.ts | 206 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 258 insertions(+) create mode 100644 forge-di/forge-di-test.ts create mode 100644 forge-di/forge-di.d.ts diff --git a/forge-di/forge-di-test.ts b/forge-di/forge-di-test.ts new file mode 100644 index 000000000..33bff4716 --- /dev/null +++ b/forge-di/forge-di-test.ts @@ -0,0 +1,52 @@ +/// + +import Forge = require('forge-di'); + +var forge = new Forge(); + +class Bar {} + +class Foo { + constructor(public bar: Bar) { + } +} + +forge.bind('foo').to.type(Foo); +forge.bind('bar').to.type(Bar); + +var foo: Foo = forge.get('foo'); +var barInst = foo.bar; + +// register functions +var createFoo = (bar: Bar) => new Foo(bar); +forge.bind('foo').to.function(createFoo); + +// Conditional bindings and resolution hints +class RedFoo {} +class BlueFoo {} + +forge.bind('foo').to.type(RedFoo).when('red'); +forge.bind('foo').to.type(BlueFoo).when((hint) => hint === 'blue'); + +// Lifecycles +forge.bind('foo').to.type(Foo).as.singleton(); +forge.bind('bar').to.type(Bar).as.transient(); + +// explicit arguments +var manuallyCreatedBar = new Bar(); +forge.bind('foo').to.type(Foo).with({bar: manuallyCreatedBar}); + +var bindingArgs: Forge.IBindingArguments = { + bar: manuallyCreatedBar +}; +forge.bind('foo').to.type(Foo).with(bindingArgs); + +// Ephemeral Bindings TODO +class DependsOnFoo { + constructor(public foo: Foo){} +} +var dependsOnFoo = forge.create(DependsOnFoo); + +// Unbinding and rebinding +forge.unbind('foo'); +forge.rebind('foo').to.type(Foo); \ No newline at end of file diff --git a/forge-di/forge-di.d.ts b/forge-di/forge-di.d.ts new file mode 100644 index 000000000..e28def38f --- /dev/null +++ b/forge-di/forge-di.d.ts @@ -0,0 +1,206 @@ +// Type definitions for forge-di v0.9.5 +// Project: https://github.com/nkohari/forge +// Definitions by: Adam Carr +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "forge-di" { + /** + * Implementation of the forge dependency injection manager. + */ + class Forge { + /** + * Creates a new instance + * @returns {Forge} a new instance. + */ + new(): Forge; + + /** + * The bindings mapped to this forge instance. + */ + bindings: Forge.IBindingMap; + + /** + * Creates a new binding. + * @param {string} name The binding name. + */ + bind(name: string): Forge.IBinding; + /** + * Unbinds then recreates a binding for this name. + * @param {string} name The binding name. + */ + rebind(name: string): Forge.IBinding; + /** + * Unbinds all bindings for this name. Returns the number of bindings removed. + * @param {string} name The binding name. + */ + unbind(name: string): number; + /** + * Get instance or instances of type registered under the provided name and optional hint. + * @param {string} name The binding name. + * @param {string} hint The binding hint. + * @param {...args} args Additional args. + */ + get(name: string, hint?: string, ...args: any[]): T; + /** + * Get a single instance of type registered under the provided name and optional hint. + * @param {string} name The binding name. + * @param {string} hint The binding hint. + * @param {...args} args Additional args. + */ + getOne(name: string, hint?: string, ...args: any[]): T; + /** + * Gets all instances of the type registered under the provided name. + * @param {string} name The binding name. + * @param {...args} args Additional args. + */ + getAll(name: string, ...args: any[]): T | T[]; + /** + * Creates an instance of the target type attempting to resolve any dependencies. + * @param {T} target The target type. + * @param {...args} args Additional args. + */ + create(target: T, ...args: any[]): T; + /** + * Get all bindings registered under a binding name and optional hint. + * @param {string} name The binding name. + * @param {string} hint The binding hint. + */ + getMatchingBindings(name: string, hint?: string): Forge.IBinding[]; + /** + * Returns a string that represents all bindings within this forge instance. + */ + inspect(): string; + + resolve(name: string, context?: Forge.IContext, hint?: string, all?: boolean, ...args: any[]): T | T[]; + resolveBindings(context: Forge.IContext, bindings: Forge.IBinding[], hint: string, args: any[], unwrap: boolean): Forge.IBinding[]; + } + + module Forge { + interface IContext { + new (): IContext; + bindings: IBinding[]; + has(binding: IBinding): boolean; + push(binding: IBinding): void; + pop(): IBinding; + toString(indent: number): string; + } + + interface IType { + new (...args: any[]): any; + } + + /** + * Represents arguments to help with resolving a binding. + */ + interface IBindingArguments { + [name: string]: any; + } + + /** + * Represents a binding between a name, type/instance/function and optional hint. + */ + interface IBinding { + /** The forge that contains this binding. */ + forge: Forge; + /** The binding name. */ + name: string; + /** Alias mapping to this binding. */ + to: IBinding; + /** Alias mapping to this binding. */ + as: IBinding; + /** Whether or not this binding is currently resolving. */ + isResolving: boolean; + /** The resolver for this binding. */ + resolver: IResolver; + /** The lifecycle associated with this binding. Defaults to singleton. */ + lifecycle: ILifecycle; + /** The predicate associated with this binding. Used to support hints. */ + predicate: IPredicate; + /** The additional binding arguments to help resolve dependencies. */ + arguments: IBindingArguments; + + /** + * Checks whether or not this binding matches the hint by executing the predicate. + * @param {string} hint The hint to check against. + */ + matches(hint: string): boolean; + /** + * Registers a type to a binding. This type must have a constructor. + * @param {T} target The target type. + */ + type(target: T): IBinding; + /** + * Registers a type to a binding. This must be a callable function. + * @param {T} target The target function. + */ + function(target: T): IBinding; + /** + * Registeres an instance to a binding. This instance will always be returned. + * @param {T} target The target instance. + */ + instance(target: T): IBinding; + /** + * Configures this binding lifecycle as a singleton. This is the default lifecycle. + */ + singleton(): IBinding; + /** + * Configures this binding lifecycle as transient. + * New instances will be created, if this is a type based binding, on each get. + */ + transient(): IBinding; + /** + * Registers a predicate for this binding. + * @param {IPredicate} predicate The predicate. + */ + when(predicate:IPredicate): IBinding; + /** + * Registers a hint for this binding. + * @param {string} hint The hint. + */ + when(hint: string): IBinding; + /** + * Registers additional binding arguments to help with resolving. + * @param {IBindingArguments} args The additional binding arguments. + */ + with(args: IBindingArguments): IBinding; + /** + * Returns a string representing this binding. + */ + toString(): string; + } + + /** Represents a binding map. */ + interface IBindingMap { + /** Gets a binding by name. */ + [name: string]: IBinding[]; + } + + /** Represents a predicate. */ + interface IPredicate { + /** + * Returns whether or not the hit satisfies this predicate. + * @param {string} hint The hint to check against. + */ + (hint: string): boolean; + } + + /** Represents a resolver. */ + interface IResolver { + /** + * Resolves a specific type. + */ + resolve(): T; + } + + /** Represents a binding lifecycle. */ + interface ILifecycle { + /** + * Returns the instance from a resolver based on the configured lifecycle. + * @param {IResolver} resolver The type resolver. + */ + getInstance(resolver: IResolver): T; + } + } + + export = Forge; +} From 28666dd8c44278523c780030d88fcd8c60b3acc4 Mon Sep 17 00:00:00 2001 From: Peter Grman Date: Sun, 10 May 2015 00:19:29 +0200 Subject: [PATCH 150/534] Add additional parameter types --- angular-meteor/angular-meteor.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts index 18f2e033e..89ae4bc9f 100644 --- a/angular-meteor/angular-meteor.d.ts +++ b/angular-meteor/angular-meteor.d.ts @@ -53,7 +53,7 @@ declare module angular.meteor { * @param [autoClientSave=true] - By default, changes in the Angular collection will automatically update the Meteor collection. * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. */ - collection(collection: Mongo.Collection|ReactiveResult, autoClientSave?: boolean): AngularMeteorCollection; + collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave?: boolean): AngularMeteorCollection; /** * A service that wraps the Meteor collections to enable reactivity within AngularJS. @@ -64,7 +64,7 @@ declare module angular.meteor { * - However if set to false, changes in the client won't be automatically propagated back to the Meteor collection. * @param [updateCollection] - A collection object which will be used for updates (insert, update, delete). */ - collection(collection: Mongo.Collection|ReactiveResult, autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2; + collection(collection: Mongo.Collection|ReactiveResult|Function|(()=>T), autoClientSave: boolean, updateCollection: Mongo.Collection): AngularMeteorCollection2; /** * A service that wraps a Meteor object to enable reactivity within AngularJS. @@ -303,7 +303,7 @@ declare module angular.meteor { * - If an object is passed, the method removes the object with that key from the AngularMeteorCollection. * - If an array is passed, the method removes all objects that matches the keys in the array from the AngularMeteorCollection. */ - remove(keys?: string|number|string[]|number[]): void; + remove(keys?: U|string|number|string[]|number[]): void; /** * A shorten (Syntactic sugar) function for the $meteor.subscribe function. From ebfa2af6d96aaef709137f9220c24de9be2fff9b Mon Sep 17 00:00:00 2001 From: Yuichi Murata Date: Sun, 10 May 2015 19:04:35 +0900 Subject: [PATCH 151/534] Fix `Router#run()` to be enabled to call with `ReactElement` created by `React.createFactory()` ref. #4267 --- react-router/react-router-test.ts | 20 ++++++++++++++++++++ react-router/react-router.d.ts | 6 +++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/react-router/react-router-test.ts b/react-router/react-router-test.ts index c220b3c24..41b352af3 100644 --- a/react-router/react-router-test.ts +++ b/react-router/react-router-test.ts @@ -263,6 +263,7 @@ class CreateTest { v: Router.Router; constructor() { + // React.createElement() version this.v = Router.create({ routes: React.createElement(Router.Route, null) }); @@ -271,6 +272,16 @@ class CreateTest { location: Router.HistoryLocation, scrollBehavior: Router.ImitateBrowserBehavior }); + + // React.createFactory() version + this.v = Router.create({ + routes: React.createFactory(Router.Route)() + }); + this.v = Router.create({ + routes: React.createFactory(Router.Route)(), + location: Router.HistoryLocation, + scrollBehavior: Router.ImitateBrowserBehavior + }); } run() { @@ -281,12 +292,21 @@ class CreateTest { class RunTest { constructor() { + // React.createElement() version var v1: Router.Router = Router.run(React.createElement(Router.Route, null), (Handler) => { React.render(React.createElement(Handler, null), document.body); }); var v2: Router.Router = Router.run(React.createElement(Router.Route, null), Router.HistoryLocation, (Handler, state) => { React.render(React.createElement(Handler, null), document.body); }); + + // React.createFactory() version + var v3: Router.Router = Router.run(React.createFactory(Router.Route)(), (Handler) => { + React.render(React.createElement(Handler, null), document.body); + }); + var v4: Router.Router = Router.run(React.createFactory(Router.Route)(), Router.HistoryLocation, (Handler, state) => { + React.render(React.createElement(Handler, null), document.body); + }); } } diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index 8f63f2d69..58ec9069a 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -179,7 +179,7 @@ declare module ReactRouter { } interface RouterCreateOption { - routes: Route; + routes: React.ReactElement; location?: LocationBase; scrollBehavior?: ScrollBehaviorBase; } @@ -187,8 +187,8 @@ declare module ReactRouter { type RouterRunCallback = (Handler: Router, state: RouterState) => void; function create(options: RouterCreateOption): Router; - function run(routes: Route, callback: RouterRunCallback): Router; - function run(routes: Route, location: LocationBase, callback: RouterRunCallback): Router; + function run(routes: React.ReactElement, callback: RouterRunCallback): Router; + function run(routes: React.ReactElement, location: LocationBase, callback: RouterRunCallback): Router; // From 5c11852cd6bc4f52a674f7a67c4db0ba454e076a Mon Sep 17 00:00:00 2001 From: sigita42 Date: Sun, 10 May 2015 15:41:05 +0200 Subject: [PATCH 152/534] Subscribe should work also on AngularMeteorObject --- angular-meteor/angular-meteor.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/angular-meteor/angular-meteor.d.ts b/angular-meteor/angular-meteor.d.ts index 89ae4bc9f..b3f520ac5 100644 --- a/angular-meteor/angular-meteor.d.ts +++ b/angular-meteor/angular-meteor.d.ts @@ -277,6 +277,14 @@ declare module angular.meteor { * The returned object is then safe to use as a parameter for method calls, or anywhere else where the data needs to be converted to JSON. */ getRawObject(): T; + + /** + * A shorten (Syntactic sugar) function for the $meteor.subscribe function. + * Takes only one parameter and not returns a promise like $meteor.subscribe does. + * + * @param subscriptionName - The subscription name to subscribe to. Exactly like the first parameter in $meteor.subscribe service. + */ + subscribe(subscriptionName:string): AngularMeteorObject; } /** From 97f329eb6dd95ee9ae439b8956838f09e91e1303 Mon Sep 17 00:00:00 2001 From: sigita42 Date: Sun, 10 May 2015 15:44:56 +0200 Subject: [PATCH 153/534] Add test for subscribe on single object --- angular-meteor/angular-meteor-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/angular-meteor/angular-meteor-tests.ts b/angular-meteor/angular-meteor-tests.ts index be75f196b..9ce0a33e9 100644 --- a/angular-meteor/angular-meteor-tests.ts +++ b/angular-meteor/angular-meteor-tests.ts @@ -18,6 +18,7 @@ interface CustomScope extends angular.meteor.IScope { todo: ITodo; todoNotAuto: TodoAngularMeteorObject; + todoSubscribed: TodoAngularMeteorObject; save: (todo: ITodo) => void; saveAll: () =>void; @@ -48,6 +49,7 @@ app.controller("mainCtrl", ['$scope', '$meteor', ($scope: CustomScope, $meteor: $scope.notAutoTodos = $meteor.collection(Todos, false).subscribe("publicTodos"); $scope.todoNotAuto = $meteor.object(Todos, 'TodoID', false); + $scope.todoSubscribed = $meteor.object(Todos, 'TodoID').subscribe('todos'); $scope.todo = $scope.todoNotAuto.getRawObject(); $scope.todoNotAuto.reset(); $scope.todoNotAuto.save($scope.todo).then((data) => { return data == 1; });; From ce539b1cd0bf655a25751582f28f37e4b2679033 Mon Sep 17 00:00:00 2001 From: campers Date: Mon, 11 May 2015 14:17:24 +0800 Subject: [PATCH 154/534] Update parse.d.ts Remove duplicate FILE_DELETE_ERROR, (keep in code numeric order) --- parse/parse.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/parse/parse.d.ts b/parse/parse.d.ts index 01d72df7a..9f8df5c3f 100644 --- a/parse/parse.d.ts +++ b/parse/parse.d.ts @@ -842,7 +842,6 @@ declare module Parse { INVALID_CONTENT_LENGTH = 128, FILE_TOO_LARGE = 129, FILE_SAVE_ERROR = 130, - FILE_DELETE_ERROR = 153, DUPLICATE_VALUE = 137, INVALID_ROLE_NAME = 139, EXCEEDED_QUOTA = 140, From 28ad1db4bfacce6af20b97a3977ff550b3ca7d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Morch=C3=B3n=20Poveda?= Date: Mon, 11 May 2015 10:02:25 +0200 Subject: [PATCH 155/534] Knockout uses Nodes, not Elements Less restrictive API: knockout uses nodes, not elements. --- knockout/knockout.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 5bbc116e0..8e923ac23 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -248,9 +248,9 @@ interface KnockoutUtils { removeDisposeCallback(node: Element, callback: Function): void; - cleanNode(node: Element): Element; + cleanNode(node: Node): Element; - removeNode(node: Element): void; + removeNode(node: Node): void; }; ////////////////////////////////// From 8d82fad51d9565e06cef265d8e7197fbb8817c3b Mon Sep 17 00:00:00 2001 From: Stefan Rahnev Date: Mon, 11 May 2015 12:25:34 +0300 Subject: [PATCH 156/534] file naming convention and test file added --- kendo-ui/kendo-ui-tests.ts | 1 + kendo-ui/{kendo.all.d.ts => kendo-ui.d.ts} | 0 2 files changed, 1 insertion(+) create mode 100644 kendo-ui/kendo-ui-tests.ts rename kendo-ui/{kendo.all.d.ts => kendo-ui.d.ts} (100%) diff --git a/kendo-ui/kendo-ui-tests.ts b/kendo-ui/kendo-ui-tests.ts new file mode 100644 index 000000000..a9944b6af --- /dev/null +++ b/kendo-ui/kendo-ui-tests.ts @@ -0,0 +1 @@ +/// \ No newline at end of file diff --git a/kendo-ui/kendo.all.d.ts b/kendo-ui/kendo-ui.d.ts similarity index 100% rename from kendo-ui/kendo.all.d.ts rename to kendo-ui/kendo-ui.d.ts From d1497a885a3a1e595e196d01e63f0175ad88ffb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Morch=C3=B3n=20Poveda?= Date: Mon, 11 May 2015 16:59:39 +0200 Subject: [PATCH 157/534] New Synchronous Asynchronous-loading option More details: http://knockoutjs.com/documentation/component-registration.html#controlling-synchronousasynchronous-loading --- knockout/knockout.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 5bbc116e0..603fd4f26 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -574,6 +574,7 @@ declare module KnockoutComponentTypes { interface Config { viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule; template: string | Node[]| DocumentFragment | TemplateElement | AMDModule; + synchronous?: boolean; } interface ComponentConfig { From 9f9214a5cf56f6d1ac80b421eb94157d42a005ba Mon Sep 17 00:00:00 2001 From: jonathantyates Date: Mon, 11 May 2015 11:29:10 -0400 Subject: [PATCH 158/534] Update whatwg-fetch.d.ts The json method when invoked, must return the result of running consume body with JSON. This implies that it must have the same return value as JSON.parse, which is any. --- whatwg-fetch/whatwg-fetch.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whatwg-fetch/whatwg-fetch.d.ts b/whatwg-fetch/whatwg-fetch.d.ts index 4a4a9612c..9efd039b4 100644 --- a/whatwg-fetch/whatwg-fetch.d.ts +++ b/whatwg-fetch/whatwg-fetch.d.ts @@ -51,7 +51,7 @@ declare class Body { arrayBuffer(): Promise; blob(): Promise; formData(): Promise; - json(): Promise; + json(): Promise; text(): Promise; } declare class Response extends Body { From d88886165d7e692e25fa5f3f5c4023faac6dd57b Mon Sep 17 00:00:00 2001 From: reppners Date: Mon, 11 May 2015 20:43:54 +0200 Subject: [PATCH 159/534] + completed typings for angular local forage --- .../angular-localForage-tests.ts | 126 ++++++++++++++++++ angular-localForage/angular-localForage.d.ts | 63 +++++++++ 2 files changed, 189 insertions(+) create mode 100644 angular-localForage/angular-localForage-tests.ts create mode 100644 angular-localForage/angular-localForage.d.ts diff --git a/angular-localForage/angular-localForage-tests.ts b/angular-localForage/angular-localForage-tests.ts new file mode 100644 index 000000000..8b31143c2 --- /dev/null +++ b/angular-localForage/angular-localForage-tests.ts @@ -0,0 +1,126 @@ +/// +/// + +var app = angular.module('angular-localForage-tests', ['LocalForageModule']); +app.config(function (localStorageServiceProvider:angular.localForage.ILocalForageProvider) { + + //TODO +}); + +var $rootScope:angular.IRootScopeService, + $localForage:angular.localForage.ILocalForageService, + instanceVersion = 0; + +// create a fresh instance +$localForage.clear().then(function () { + $localForage = $localForage.createInstance({ + name: ++instanceVersion + }); +}); + +$localForage.getItem('this key is unknown').then(function (value) { + +}); + + +$localForage.setItem('myName', 'Olivier Combe').then(function (data) { + + $localForage.getItem('myName').then(function (data) { + }); +}); + +var values = ['Olivier Combe', 'AngularJs', 'Open Source']; + +$localForage.setItem(['myName', 'myPassion', 'myHobbie'], values).then(function (data) { + + $localForage.getItem(['myHobbie', 'myName']).then(function (data) { + }); + +}); + +$localForage.removeItem('myName').then(function () { + + $localForage.getItem('myName').then(function (data) { + }); + +}); + +$localForage.removeItem(['myName', 'myPassion']).then(function () { + + $localForage.getItem(['myName', 'myPassion', 'myHobbie']).then(function (data) { + }); + +}); + +$localForage.pull('myName').then(function (data) { + + $localForage.getItem('myName').then(function (data) { + }); + +}); +$localForage.pull(['myName', 'myPassion']).then(function (data) { + + $localForage.getItem(['myName', 'myPassion', 'myHobbie']).then(function (data) { + }); + +}); + + +$localForage.setItem('myName', 'Olivier Combe').then(function (d) { + + $localForage.getItem('myName').then(function (data) { + }); + +}); + + +$localForage.setDriver('localStorageWrapper').then(function () { + $localForage.setItem('myName', 'Olivier Combe').then(function (d) { + $localForage.getItem('myName').then(function (data) { + }); + }); +}); + +$localForage.setItem('myArray', [{ + $$hashKey: '00A', + name: 'Olivier Combe' +}]).then(function (d) { + + $localForage.getItem('myArray').then(function (data) { + }); + +}); + +$localForage.setDriver('localStorageWrapper').then(function () { + $localForage.setItem('myArray', [{ + $$hashKey: '00A', + name: 'Olivier Combe' + }]).then(function (d) { + + $localForage.getItem('myArray').then(function (data) { + }); + + }); +}); + +var aFileParts = ["hey!<\/b><\/a>"]; +var oMyBlob = new Blob(aFileParts, {"type": "text\/xml"}); // the blob + +$localForage.setItem('myBlob', oMyBlob).then(function (data) { +}); + +// $localForage.setItem(['myName', 'myPassion', 'myHobbie'], 'value'); + +// $localForage.setItem(); + + +$localForage.iterate(function (value, key) { +}).then(function (data) { +}); + +$localForage.iterate(function (value, key) { + if (key == 'myPassion') { + return value; + } +}).then(function (data) { +}); diff --git a/angular-localForage/angular-localForage.d.ts b/angular-localForage/angular-localForage.d.ts new file mode 100644 index 000000000..ee2aeeb6d --- /dev/null +++ b/angular-localForage/angular-localForage.d.ts @@ -0,0 +1,63 @@ +// Type definitions for angular-localForage 1.2.2 +// Project: https://github.com/ocombe/angular-localForage +// Definitions by: Stefan Steinhart +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module angular.localForage { + + interface LocalForageConfig { + driver?:string; + name?:string | number; + version?:number; + storeName?:string; + description?:string; + } + + interface ILocalForageProvider { + config(config:LocalForageConfig):void; + setNotify(onItemSet:boolean, onItemRemove:boolean):void; + } + + interface ILocalForageService { + setDriver(driver:string):angular.IPromise; + driver():lf.ILocalForage; + + setItem(key:string, value:any):angular.IPromise; + setItem(keys:Array, values:Array):angular.IPromise; + + getItem(key:string):angular.IPromise; + getItem(keys:Array):angular.IPromise>; + + removeItem(key:string | Array):angular.IPromise; + + pull(key:string):angular.IPromise; + pull(keys:Array):angular.IPromise>; + + clear():angular.IPromise; + + key(n:number):angular.IPromise; + + keys():angular.IPromise; + + length():angular.IPromise; + + iterate(iteratorCallback:(value:string | number, key:string)=>T):angular.IPromise; + + bind($scope:ng.IScope, key:string):void; + + bind($scope:ng.IScope, config:{ + key:string; + defaultValue:any; + scopeKey:string; + name:string; + }):void; + + unbind($scope:ng.IScope, key:string, scopeKey?:string):void; + + createInstance(config:LocalForageConfig):ILocalForageService; + instance(name:string):ILocalForageService; + } +} From ab457e18986ef43b3dd8e3992f9bbf8dedace191 Mon Sep 17 00:00:00 2001 From: Nathan Pitman Date: Tue, 12 May 2015 16:51:56 +1200 Subject: [PATCH 160/534] Added type bindings for jQuery Sortable. --- jquery-sortable/jquery-sortable-tests.ts | 225 +++++++++++++++++++++++ jquery-sortable/jquery-sortable.d.ts | 104 +++++++++++ 2 files changed, 329 insertions(+) create mode 100644 jquery-sortable/jquery-sortable-tests.ts create mode 100644 jquery-sortable/jquery-sortable.d.ts diff --git a/jquery-sortable/jquery-sortable-tests.ts b/jquery-sortable/jquery-sortable-tests.ts new file mode 100644 index 000000000..67dcf01b4 --- /dev/null +++ b/jquery-sortable/jquery-sortable-tests.ts @@ -0,0 +1,225 @@ +/// + + +/** + * http://johnny.github.io/jquery-sortable/#connected + */ +function connectedListsWithDropAnimation() { + var adjustment: any; + + $('ol.simple_with_animation').sortable({ + group: 'simple_with_animation', + pullPlaceholder: false, + // animation on drop + onDrop: function (item, targetContainer, _super) { + var clonedItem = $('
  • ').css({height: 0}) + item.before(clonedItem) + clonedItem.animate({'height': item.height()}) + + item.animate(clonedItem.position(), function () { + clonedItem.detach(); + _super(item); + }) + }, + + // set item relative to cursor position + onDragStart: function ($item, container, _super) { + var offset = $item.offset(), + pointer = container.rootGroup.pointer; + + adjustment = { + left: pointer.left - offset.left, + top: pointer.top - offset.top + }; + + _super($item, container); + }, + onDrag: function ($item, position) { + $item.css({ + left: position.left - adjustment.left, + top: position.top - adjustment.top + }) + } + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#handle + */ +function sortHandleAndLimitedDragDrop() { + $('ol.simple_with_drop').sortable({ + group: 'no-drop', + handle: 'i.icon-move', + onDragStart: function (item, container, _super) { + // Duplicate items of the no drop area + if(!container.options.drop) + item.clone().insertAfter(item) + _super(item) + } + }); + + $('ol.simple_with_no_drop').sortable({ + group: 'no-drop', + drop: false + }); + + $('ol.simple_with_no_drag').sortable({ + group: 'no-drop', + drag: false + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#nested + */ +function toggleNestedLists() { + var oldContainer: any; + + $('ol.nested_with_switch').sortable({ + group: 'nested', + afterMove: function (placeholder, container) { + if(oldContainer != container){ + if(oldContainer) + oldContainer.el.removeClass('active') + container.el.addClass('active') + + oldContainer = container + } + }, + onDrop: function (item, container, _super) { + container.el.removeClass('active') + _super(item) + } + }); + + $('.switch-container').on('click', '.switch', function (e) { + var method = $(this).hasClass('active') ? 'enable' : 'disable' + $(e.delegateTarget).next().sortable(method) + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#limited-target + */ +function connectedListsWithLimitedDropTargets() { + var group = $('ol.limited_drop_targets').sortable({ + group: 'limited_drop_targets', + isValidTarget: function (item, container) { + if(item.is('.highlight')) + return true + else { + return item.parent('ol')[0] == container.el[0] + } + }, + onDrop: function (item, container, _super) { + $('#serialize_output').text(group.sortable('serialize').get().join('\n')); + _super(item, container); + }, + serialize: function (parent, children, isContainer) { + return isContainer ? children.join() : 24; + }, + tolerance: 6, + distance: 10 + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#bootstrap + */ +function sortingABootstrapMenu() { + $('ol.nav').sortable({ + group: 'nav', + nested: false, + vertical: false, + exclude: '.divider-vertical', + onDragStart: function($item, container, _super) { + $item.find('ol.dropdown-menu').sortable('disable'); + _super($item, container); + }, + onDrop: function($item, container, _super) { + $item.find('ol.dropdown-menu').sortable('enable'); + _super($item, container); + } + }); + + $('ol.dropdown-menu').sortable({ + group: 'nav' + }); +} + + +/** + * http://johnny.github.io/jquery-sortable#serialization + */ +function serializationAndDelay() { + var group = $('ol.serialization').sortable({ + group: 'serialization', + delay: 500, + onDrop: function (item, container, _super) { + var data = group.sortable('serialize').get(); + + var jsonString = JSON.stringify(data, null, ' '); + + $('#serialize_output2').text(jsonString); + _super(item, container); + } + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#table + */ +function sortTables() { + // Sortable rows + $('.sorted_table').sortable({ + containerSelector: 'table', + itemPath: '> tbody', + itemSelector: 'tr', + placeholder: '' + }); + + // Sortable column heads + var oldIndex: any; + + $('.sorted_head tr').sortable({ + containerSelector: 'tr', + itemSelector: 'th', + placeholder: '', + vertical: false, + onDragStart: function (item, group, _super) { + oldIndex = item.index(); + item.appendTo(item.parent()); + _super(item); + }, + onDrop: function (item, container, _super) { + var field: any, + newIndex = item.index() + + if (newIndex != oldIndex) + item.closest('table').find('tbody tr').each(function (i, row) { + var $row = $(row); + field = $row.children().eq(oldIndex); + if(newIndex) + field.before($row.children()[newIndex]); + else + $row.prepend(field); + }); + + _super(item); + } + }); +} + + +/** + * http://johnny.github.io/jquery-sortable/#docs + */ +function api() { + $('.horatio').sortable().sortable('disable').sortable('enable') + .sortable('refresh').sortable('serialize').sortable('destroy'); +} \ No newline at end of file diff --git a/jquery-sortable/jquery-sortable.d.ts b/jquery-sortable/jquery-sortable.d.ts new file mode 100644 index 000000000..82f4e8aa0 --- /dev/null +++ b/jquery-sortable/jquery-sortable.d.ts @@ -0,0 +1,104 @@ +// Type definitions for jQuery Sortable v0.9.12 +// Project: http://johnny.github.io/jquery-sortable/ +// Definitions by: Nathan Pitman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQuerySortable { + + interface Position { + top: number; + left: number; + } + + type Dimensions = number[]; + + interface ContainerGroup { + $document: JQuery; + containerDimensions: Dimensions[] + containers: Container[]; + delayMet: boolean; + dragInitDone: boolean; + dragProxy: any; + dragging: boolean; + dropProxy: any; + item: JQuery; + itemContainer: Container; + lastAppendedItem: JQuery; + lastPointer: Position; + lastRelativePointer: Position; + offsetParent: JQuery; + options: Options; + placeholder: JQuery; + pointer: Position; + relativePointer: Position; + sameResultBox: { bottom: number; left: number; right: number; top: number; }; + scrollProxy: any; + } + + interface Container { + el: JQuery; + options: Options; + group: ContainerGroup; + rootGroup: ContainerGroup; + handle: string; + target: JQuery; + itemDimensions: Dimensions[]; + items: HTMLElement[]; + } + + + type GenericEventHandler = ($item?: JQuery, container?: Container, _super?: GenericEventHandler, event?: Event) => void; + type OnDragEventHandler = ($item?: JQuery, position?: Position, _super?: OnDragEventHandler, event?: Event) => void; + type OnMousedownHandler = ($item?: JQuery, _super?: OnMousedownHandler, event?: Event) => void; + type OnCancelHandler = ($item?: JQuery, container?: Container, _super?: OnCancelHandler, event?: Event) => void; + + // Deliberately typing $children as an any here as it makes it much easier to use. Actual type is JQuery | any[] + type SerializeFunc = ($parent: JQuery, $children: any, parentIsContainer: boolean) => void; + + interface GroupOptions { + afterMove?: ($placeholder: JQuery, container: Container, $closestItemOrContainer: JQuery) => void; + containerPath?: string; + containerSelector?: string; + distance?: number; + delay?: number; + handle?: string; + itemPath?: string; + itemSelector?: string; + isValidTarget?: ($item: JQuery, container: Container) => boolean; + onCancel?: OnCancelHandler; + onDrag?: OnDragEventHandler; + onDragStart?: GenericEventHandler; + onDrop?: GenericEventHandler; + onMousedown?: OnMousedownHandler; + placeholder?: JQuery | any[] | Element | string; + pullPlaceholder?: boolean; + serialize?: SerializeFunc; + tolerance?: number; + } + + + interface ContainerOptions { + drag?: boolean; + drop?: boolean; + exclude?: string; + nested?: boolean; + vertical?: boolean; + } + + interface Options extends GroupOptions, ContainerOptions { + } +} + + +interface JQuery { + sortable(options?: JQuerySortable.Options): JQuery; + + sortable(methodName: 'enable'): JQuery; + sortable(methodName: 'disable'): JQuery; + sortable(methodName: 'refresh'): JQuery; + sortable(methodName: 'destroy'): JQuery; + sortable(methodName: 'serialize'): JQuery; + sortable(methodName: string): JQuery; +} From 9439dc4ab093788829067802c0fdff0e21fbce70 Mon Sep 17 00:00:00 2001 From: Nathan Pitman Date: Tue, 12 May 2015 17:07:03 +1200 Subject: [PATCH 161/534] Fixed nullability in qtip2.d.ts. Fixed style tests in qtip2-tests.ts --- qtip2/qtip2-tests.ts | 8 ++++---- qtip2/qtip2.d.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qtip2/qtip2-tests.ts b/qtip2/qtip2-tests.ts index ea4e16099..144b4aa51 100644 --- a/qtip2/qtip2-tests.ts +++ b/qtip2/qtip2-tests.ts @@ -398,7 +398,7 @@ function testStyleProperty() { }); $a.qtip({ - show: { + style: { classes: false, width: 24, height: 24, @@ -407,7 +407,7 @@ function testStyleProperty() { }); $a.qtip({ - show: { + style: { classes: false, width: false, height: false, @@ -423,7 +423,7 @@ function testStyleProperty() { }); $a.qtip({ - show: { + style: { tip: { corner: true, mimic: true, @@ -433,7 +433,7 @@ function testStyleProperty() { }); $a.qtip({ - show: { + style: { tip: { } } }); diff --git a/qtip2/qtip2.d.ts b/qtip2/qtip2.d.ts index 1691715b6..8d17544f1 100644 --- a/qtip2/qtip2.d.ts +++ b/qtip2/qtip2.d.ts @@ -98,8 +98,8 @@ declare module QTip2 { classes?: string | boolean; def?: boolean; widget?: boolean; - width: string | number | boolean; - height: string | number | boolean; + width?: string | number | boolean; + height?: string | number | boolean; tip?: string | boolean | Tip; } From f39cdea7ad90129418fdf5980f04aacc5952bf00 Mon Sep 17 00:00:00 2001 From: Nathan Pitman Date: Tue, 12 May 2015 17:08:33 +1200 Subject: [PATCH 162/534] Fix my contributor info in qtip2.d.ts and CONTRIBUTORS.md --- CONTRIBUTORS.md | 2 +- qtip2/qtip2.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 36bcdb307..a41d225ec 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -726,7 +726,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](q-io/Q-io.d.ts) [Q-io](https://github.com/kriskowal/q-io) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](q-retry/q-retry.d.ts) [q-retry](https://github.com/vilic/q-retry) by [VILIC VANE](https://github.com/vilic) * [:link:](qajax/qajax.d.ts) [Qajax](https://github.com/gre/qajax) by [Boltmade](https://github.com/Boltmade) -* [:link:](qtip2/qtip2.d.ts) [qtip2](http://qtip2.com) by [Nathan Pitman](https://github.com/Seltzer100) +* [:link:](qtip2/qtip2.d.ts) [qtip2](http://qtip2.com) by [Nathan Pitman](https://github.com/Seltzer) * [:link:](qunit/qunit.d.ts) [QUnit](http://qunitjs.com) by [Diullei Gomes](https://github.com/diullei) * [:link:](rabbit.js/rabbit.js.d.ts) [rabbit.js](https://github.com/squaremo/rabbit.js) by [Wonshik Kim](https://github.com/wokim) * [:link:](ractive/ractive.d.ts) [Ractive](http://ractivejs.org) by [Han Lin Yap](http://yap.nu) diff --git a/qtip2/qtip2.d.ts b/qtip2/qtip2.d.ts index 8d17544f1..3d1f841f2 100644 --- a/qtip2/qtip2.d.ts +++ b/qtip2/qtip2.d.ts @@ -1,6 +1,6 @@ // Type definitions for qtip2 v2.2.1 // Project: http://qtip2.com/ -// Definitions by: Nathan Pitman +// Definitions by: Nathan Pitman // Definitions: https://github.com/borisyankov/DefinitelyTyped // Notes: // - Type bindings for the QTip2 API and options are included. Bindings for global settings aren't required. From fa51db8eb0872d311240909c546d6add52118a1a Mon Sep 17 00:00:00 2001 From: ksmigiel Date: Tue, 12 May 2015 09:39:54 +0200 Subject: [PATCH 163/534] Typings file for jsblocks framework --- blocks/blocks-tests.ts | 333 +++++++++++++++++++ blocks/blocks.d.ts | 731 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1064 insertions(+) create mode 100644 blocks/blocks-tests.ts create mode 100644 blocks/blocks.d.ts diff --git a/blocks/blocks-tests.ts b/blocks/blocks-tests.ts new file mode 100644 index 000000000..5adc719e8 --- /dev/null +++ b/blocks/blocks-tests.ts @@ -0,0 +1,333 @@ +/// + +function test_blocks_methods() { + var extended; + blocks.extend(extended, new Object()); + + blocks.each([3, 1, 4], function(value, index, collection) { + // value is the current item (3, 1 and 4) + // index is the current index (0, 1 and 2) + // collection points to the array passed to the function - [3, 1, 4] + }); + + blocks.eachRight([3, 1, 4], function(value, index, collection) { + // value is the current item (4, 1 and 3) + // index is the current index (2, 1 and 0) + // collection points to the array passed to the function - [3, 1, 4] + }); + + blocks.isArray([1, 2, 3]); + // -> true + + function calculate() { + blocks.isArray(arguments); + // -> false + } + + function max(collection, callback) { + callback = callback || blocks.noop; + } + + blocks.type('a string'); + // -> string + + blocks.type(314); + // -> number + + blocks.type([]); + // -> array + + blocks.type({}); + // -> object + + blocks.type(blocks.noop); + // -> function + + blocks.type(new RegExp('')); + // -> regexp + + blocks.type(undefined); + // -> undefined + + blocks.type(null); + // -> null + + blocks.is([], 'array'); + // -> true + + blocks.is(function() { }, 'object'); + // -> false + + blocks.has({ + price: undefined + }, 'price'); + // -> true + + blocks.has({ + price: 314 + }, 'ratio'); + // -> false + + blocks.unwrap(blocks.observable(314)); + // -> 314 + + blocks.unwrap(blocks([3, 1, 4])); + // -> [3, 1, 4] + + blocks.unwrap('a string or any other value will not be changed'); + // -> 'a string or any other value will not be changed' + + blocks.toArray(3); + // -> [3] + + blocks.toArray([3, 1, 4]); + // -> [3, 1, 4] + + blocks.toUnit(230); + // -> 230px + + blocks.toUnit(230, '%'); + // -> 230% + + blocks.toUnit('60px', '%'); + // -> 60% + + var array = [3, 1, 4]; + var cloned = blocks.clone(array); + // -> [3, 1, 4] + var areEqual = array == cloned; + // -> false + + blocks.isElement(document.body); + // -> true + + blocks.isElement({}); + // -> false + + blocks.isBoolean(true); + // -> true + + blocks.isBoolean(new Boolean(false)); + // -> true + + blocks.isBoolean(1); + // -> false + + blocks.isPlainObject({ property: true }); + // -> true + + blocks.isPlainObject(new Object()); + // -> true + + function Car() { + + } + + blocks.isPlainObject(new Car()); + // -> false + + var alert = blocks.bind(function() { + alert(this); + }, 'Hello bind method!'); + + alert(); + // -> alerts 'Hello bind method' + + var alertAll = blocks.bind(function(firstName, lastName) { + alert('My name is ' + firstName + ' ' + lastName); + }, null, 'John', 'Doe'); + + alertAll(); + // -> alerts 'My name is John Doe' + + blocks.equals([3, 4], [3, 4]); + // -> true + + blocks.equals({ value: 7 }, { value: 7, result: 1 }); + // -> false + + blocks.query({ + message: 'Hello World!' + }); + + blocks.query({ + items: ['John', 'Alf', 'Mega'], + alertIndex: function(e) { + alert('Clicked an item with index:' + blocks.context(e.target).$index); + } + }); + + blocks.query({ + items: [1, 2, 3], + alertValue: function(e) { + alert('Clicked the value: ' + blocks.dataItem(e.target)); + } + }); + + blocks.isObservable(blocks.observable(3)); + // -> true + + blocks.isObservable(3); + // -> false + + blocks.unwrapObservable(blocks.observable(304)); + // -> 304 + + blocks.unwrapObservable(305); + // -> 305 +} + +function test_observable() { + blocks.observable['formatter'] = () => { + // your code here + }; + + // extending using the formatter extender + var data = blocks.observable([1, 2, 3]).extend('formatter'); +} + +function test_observable_array() { + // creates an observable array with [1, 2, 3] as values + var items = blocks.observable([1, 2, 3]); + + // removes the previous values and fills the observable array with [5, 6, 7] values + items.reset([5, 6, 7]) + + // results in observable array with [1, 2, 3, 4] values + items.add(4); + + // results in observable array with [1, 2, 3, 4, 5, 6] values + items.addMany([4, 5, 6]); + + var items = blocks.observable([4, 2, 3, 1]); + + // results in observable array with [1, 2, 3, 4] values + items.swap(0, 3); + + var items = blocks.observable([1, 4, 2, 3, 5]); + + // results in observable array with [1, 2, 3, 4, 5] values + items.move(1, 4); +} + +function test_Property() { + var App = blocks.Application(); + + var User = App.Model({ + username: App.Property({ + defaultValue: 'John Doe' + }) + }); +} + +function test_Model() { + var App = blocks.Application(); + + var User = App.Model({ + firstName: App.Property({ + required: true, + validateOnChange: true + }), + + lastName: App.Property({ + required: true, + validateOnChange: true + }), + + fullName: App.Property({ + value: function() { + return this.firstName() + ' ' + this.lastName(); + } + }) + }); + + App.View('Profile', { + user: User({ + firstName: 'John', + lastName: 'Doe' + }) + }); +} + +function test_Collection() { + var App = blocks.Application(); + + var User = App.Model({ + firstName: App.Property({ + required: true, + validateOnChange: true + }), + + lastName: App.Property({ + required: true, + validateOnChange: true + }), + + fullName: App.Property({ + value: function() { + return this.firstName() + ' ' + this.lastName(); + } + }) + }); + + var Users = App.Collection(User, { + count: App.Property({ + value: function() { + return this().length; + } + }) + }); + + App.View('Profiles', { + users: Users([{ + firstName: 'John', + lastName: 'Doe' + }, { + firstName: 'Johna', + lastName: 'Doa' + }]) + }); +} + +function test_View() { + var App = blocks.Application(); + + App.View('Clicker', { + handleClick: function() { + alert('Clicky! Click!'); + } + }); + + + App.View('Statistics', { + init: function() { + this.loadRemoteData(); + }, + + loadRemoteData: function() { + // ...stuff... + } + }); + + App.View('ContactUs', { + options: { + route: 'contactus' + }, + + routed: function() { + alert('Navigated to ContactUs page!') + } + }); + + App.View('ContactUs', { + options: { + route: 'contactus' + } + }); + + App.View('Navigation', { + navigateToContactUs: function() { + this.route('contactus') + } + }); +} \ No newline at end of file diff --git a/blocks/blocks.d.ts b/blocks/blocks.d.ts new file mode 100644 index 000000000..aedef9d04 --- /dev/null +++ b/blocks/blocks.d.ts @@ -0,0 +1,731 @@ +// Type definitions for jsblocks v0.3.0 +// Project: http://jsblocks.com/ +// Definitions by: Krzysztof Åšmigiel +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +///////////////////////////////////////// +// blocks methods +///////////////////////////////////////// + +interface BlocksStatic { + (obj: any): any; + + /** + * Performs a query operation on the DOM. Executes all data-query attributes + * and renders the html result to the specified HTMLElement if not specified + * uses document.body by default. + * + * @param model The model that will be used to query the DOM. + */ + query(model: any): void; + /** + * @param model The model that will be used to query the DOM. + * @param element Optional element on which to execute the query. + */ + query(model: any, element: HTMLElement): void; + + /** + * Copies properties from all provided objects into the first object parameter + */ + extend(obj: Object, ...objects): void; + + /** + * Iterates over the collection + * + * @param collection The array or object to iterate over + * @param callback The callback that will be executed for each element in the collection + * @param thisArg Optional this context for the callback + */ + each(collection: any, callback: (value: any, index: any, collection: any) => void, thisArg?: any): void; + + /** + * Iterates over the collection from end to start + * + * @param collection The array or object to iterate over + * @param callback The callback that will be executed for each element in the collection + * @param thisArg Optional this context for the callback + */ + eachRight(collection: any, callback: (value: any, index: any, collection: any) => void, thisArg?: any): void; + + /** + * Determines if a value is an array. + * Returns false for array like objects (for example arguments object). + * + * @param value The value to check if it is an array + */ + isArray(value: any): boolean; + + /** + * Represents a dummy empty function + */ + noop(): Function; + + /** + * Determines the true type of an object. + * Returns the type of the value as a string. + * + * @param value The value for which to determine its type + */ + type(value: any): string; + + /** + * Determines if a specific value is the specified type + * + * @param value The value + * @param type The type + */ + is(value: any, type: string): boolean; + + /** + * Checks if a variable has the specified property. Uses hasOwnProperty internally + * + * @param obj The object to call hasOwnPrototype for + * @param key The key to check if exists in the object + */ + has(obj: any, key: string): boolean; + + /** + * Unwraps a jsblocks value to its raw representation. + * Unwraps blocks.observable() and blocks() values + * + * @param value The value that will be unwrapped + */ + unwrap(value: any): any; + + /** + * Converts a value to an array. Arguments object is converted to array and primitive values + * are wrapped in an array. + * Does nothing when value is already an array + * + * @param value The value to be converted to an array + */ + toArray(value: any): any[]; + + /** + * Converts an integer or string to a unit. If the value could not be parsed to a number it is not converted + * + * @param value The value to be converted to the specified unit + */ + toUnit(value: any): any; + /** + * @param value The value to be converted to the specified unit + * @param unit Optionally provide a unit to convert to. Default value is 'px' + */ + toUnit(value: any, unit: string): any; + + /** + * Clones value. If deepClone is set to true the value will be cloned recursively + * + * @param value Value/object to be cloned + */ + clone(value: any): any; + /** + * @param value Value/object to be cloned + * @param deepClone By default false + */ + clone(value: any, deepClone: boolean): any; + + /** + * Determines if the specified value is a HTML elements collection. + * Returns whether the value is elements collection. + * + * @param value The value to check if it is elements collection + */ + isElements(value: any): boolean; + + /** + * Determines if the specified value is a HTML element. + * Returns whether the value is a HTML element. + * + * @param value The value to check if it is a HTML element + */ + isElement(value: any): boolean; + + /** + * Determines if a the specified value is a boolean. + * Whether the value is a boolean or not. + * + * @param value The value to be checked if it is a boolean + */ + isBoolean(value: any): boolean; + + /** + * Determines if the specified value is an object. + * Returns whether the value is an object. + * + * @param obj The value to check for if it is an object + */ + isObject(obj: any): boolean; + + /** + * Determines if a value is a object created using {} or new Object. + * Whether the value is a plain object or not. + * + * @param obj The value that will be checked + */ + isPlainObject(obj: any): boolean; + + /** + * Changes the this binding to a function and optionally passes additional parameters to the function. + * Returns the newly created function having the new this binding and optional arguments. + * + * @param func The function for which to change the this binding and optionally add arguments + * @param thisArg The new this binding context value + * @param args Optional arguments that will be passed to the function + */ + bind(func: Function, thisArg: any, ...args): Function; + + /** + * Determines if two values are deeply equal. Set deepEqual to false to stop recusively equality checking + * + * @param a The first object to be campared + * @param b The second object to be compared + */ + equals(a: any, b: any): boolean; + /** + * @param a The first object to be campared + * @param b The second object to be compared + * @param deepEqual Determines if the equality check will recursively check all child properties + */ + equals(a: any, b: any, deepEqual: boolean): boolean; + + /** + * Gets the context for a particular element. Searches all parents until it finds the context. + * + * @param element The element from which to search for a context + * + */ + context(element: any): any; + + /** + * Gets the associated dataItem for a particlar element. Searches all parents until it finds the context + * + * @param element The element from which to search for a dataItem + */ + dataItem(element: any): any; + + /** + * Determines if particular value is an blocks.observable + * + * @param value The value to check if the value is observable + */ + isObservable(value: any): boolean; + + /** + * Gets the raw value of an observable or returns the value if the specified object is not an observable + * + * @param value The value that could be any object observable or not + */ + unwrapObservable(value: any): any; + + route(route: string): BlocksStatic; + + optional(param: string): BlocksStatic; + optional(param: string, defaultValue: any): BlocksStatic; + + range(start: number, end: number): BlocksStatic; + + /** + * Creates the server which will automatically handle server-side rendering. + */ + server(): { express() }; + /** + * @param options Overrides default jsblocks options + */ + server(options: Server): { express() }; + + /** + * Make observable property. You can specify initial value in parentheses. + */ + observable(): BlocksObservable; + observable(value: any[]): BlocksArray; + observable(value: any): BlocksObservable; + + /** + * Use blocks.Application and its MVC(Model-View-Collection) structure to create better architecture and maintainability for your application. + */ + Application(): App; + Application(options: { history: string }): App; +} + +///////////////////////////////////////// +// blocks observable +///////////////////////////////////////// + +interface BlocksObservable extends Extendable { + (any): BlocksObservable; + + /** + * Updates all elements, expressions and dependencies where the observable is used + */ + update(): BlocksObservable; + + /** + * If event in prototype is not defined use this function instead. + * + * @param event Name of the event to raise + * @param trigger Function to be called when event is fired + */ + on(event: string, trigger: Function): BlocksObservable; +} + +///////////////////////////////////////// +// blocks array +///////////////////////////////////////// + +interface BlocksArray extends BlocksObservable { + + /** + * Updates all elements, expressions and dependencies where the observable is used + */ + update(): BlocksArray; + + /** + * Extends the current observable with particular functionality depending on the parameters specified. + * If the method is called without arguments and jsvalue framework is included the observable will be + * extended with the methods available in jsvalue for the current type. + * + * @param options Optional options + */ + extend(...options): BlocksArray; + /** + * @param name Name of the extender + * @param options Optional options + */ + extend(name: string, ...options): BlocksArray; + + /** + * Removes all items from the collection and replaces them with the new value provided. + * The value could be Array, observable array or jsvalue.Array + * + * @param value The new value that will be populated + */ + reset(value: any[]): BlocksArray; + + /** + * Adds values to the end of the observable array + * + * @param value The values that will be added to the end of the array + */ + add(value: any): BlocksArray; + /** + * @param value The values that will be added to the end of the array + * @param index Optional index specifying where to insert the value + */ + add(value: any, index: number): BlocksArray; + + /** + * Adds the values from the provided array(s) to the end of the collection + * + * @param value The array that will be added to the end of the array + */ + addMany(value: any[]): BlocksArray; + /** + * @param value The array that will be added to the end of the array + * @param index Optional position where the array of values to be inserted + */ + addMany(value: any[], index: number): BlocksArray; + + /** + * Swaps two values in the observable array. Note: Faster than removing the items and adding them at the locations + * + * @param indexA The first index that points to the index in the array that will be swapped + * @param indexB The second index that points to the index in the array that will be swapped + */ + swap(indexA: number, indexB: number): BlocksArray; + + /** + * Moves an item from one location to another in the array. Note: Faster than removing the item and adding it at the location + * + * @param sourceIndex The index pointing to the item that will be moved + * @param targetIndex The index where the item will be moved to + */ + move(sourceIndex: number, targetIndex: number): BlocksArray; + + /** + * Removes an item from the observable array + * + * @param value The value that will be removed or a callback function which returns true or false to determine if the value should be removed + */ + remove(value: any): BlocksArray; + /** + * @param value The value that will be removed or a callback function which returns true or false to determine if the value should be removed + * @param thisArg Optional this context for the callback + */ + remove(value: any, thisArg: Function): BlocksArray; + + /** + * Removes an item at the specified index + * + * @param index The index location of the item that will be removed + */ + removeAt(index: number): BlocksArray; + /** + * @param index The index location of the item that will be removed + * @param count Optional parameter that if specified will remove the next items starting from the specified index + */ + removeAt(index: number, count: number): BlocksArray; + + /** + * Removes all items from the observable array and optionally filter which items to be removed by providing a callback + */ + removeAll(): BlocksArray; + /** + * @param callback Optional callback function which filters which items to be removed. Returning a truthy value will remove the item and vice versa + */ + removeAll(callback: Function): BlocksArray; + /** + * @param callback Optional callback function which filters which items to be removed. Returning a truthy value will remove the item and vice versa + * @param thisArg Optional this context for the callback function + */ + removeAll(callback: Function, thisArg: any): BlocksArray; + + /** + * The concat() method is used to join two or more arrays + * + * @param arrays The arrays to be joined + */ + concat(...arrays: any[]): any[] + + /** + * The slice() method returns the selected elements in an array, as a new array object + * + * @param start An integer that specifies where to start the selection (The first element has an index of 0) + */ + slice(start: number): any[]; + /** + * @param start An integer that specifies where to start the selection (The first element has an index of 0) + * @param end An integer that specifies where to end the selection. If omitted, all elements from the start position and to the end of the array will be selected. + * Use negative numbers to select from the end of an array + */ + slice(start: number, end: number): any[]; + + /** + * The join() method joins the elements of an array into a string, and returns the string + */ + join(): string; + /** + * @param separator The separator to be used. If omitted, the elements are separated with a comma + */ + join(seperator: string): string; + + /** + * The pop() method removes the last element of a observable array, and returns that element + */ + pop(): any; + + /** + * The push() method adds new items to the end of the observable array, and returns the new length + * + * @param values The item(s) to add to the observable array + */ + push(...values): number; + + /** + * Reverses the order of the elements in the observable array + */ + reverse(): any[]; + + /** + * Removes the first element of a observable array, and returns that element + */ + shift(): any + + /** + * Sorts the elements of an array + */ + sort(): any[]; + /** + * @param sortfunction A function that defines the sort order + */ + sort(sortfunction: Function): any[]; + + /** + * Adds and/or removes elements from the observable array + * Returns A new array containing the removed items, if any. + * + * @param index An integer that specifies at what position to add/remove items. Use negative values to specify the position from the end of the array. + * @param howMany The number of items to be removed. If set to 0, no items will be removed. + * @param items The new item(s) to be added to the array. + */ + splice(index: number, howMany: number, ...items: any[]): any[]; + + /** + * The unshift() method adds new items to the beginning of an array, and returns the new length. + * + * @param items + */ + unshift(...items: any[]): number; +} + +///////////////////////////////////////// +// blocks MVC App +///////////////////////////////////////// + +interface App extends Extendable { + + /** + * Creates an application property for a Model. + */ + Property(): any; + /** + * @param options Configuration options for property + */ + Property(options: PropertyPrototype): any; + + /** + * Defines a view that will be part of the Application. + * + * @param name The name of the View you are creating + * @param prototype The object that will represent the View + */ + View(name: string, prototype: ViewPrototype): any; + /** + * Defines a view that will be part of the Application. + * + * @param parentViewName Provide this parameter only if you are creating nested views. This is the name of the parent View + * @param name The name of the View you are creating + * @param prototype The object that will represent the View + */ + View(parentViewName: string, name: string, prototype: ViewPrototype): any; + + /** + * Creates a new Model + * + * @param prototype The Model object properties that will be created + */ + Model(prototype: ModelPrototype): Model; + + /** + * Creates a new Collection + * + * @param prototype The Collection object properties that will be created. + */ + Collection(prototype: CollectionPrototype): Collection; + Collection(model: Model, prototype: CollectionPrototype): Collection; +} + +///////////////////////////////////////// +// App.Property +///////////////////////////////////////// + +interface PropertyPrototype { + defaultValue?: any; + isObservable?: boolean; + field?: string; + value?: any; + validateOnChange?: boolean; + maxErrors?: number; + validateInitially?: boolean + + // Validators + required?: Validator; + minlength?: Validator; + maxlength?: Validator; + min?: Validator; + max?: Validator; + email?: Validator; + url?: Validator; + date?: Validator; + creditcard?: Validator; + regexp?: Validator; + number?: Validator; + digits?: Validator; + letters?: Validator; + equals?: Validator; +} + +interface Validator { } + +///////////////////////////////////////// +// App.View +///////////////////////////////////////// + +interface ViewPrototype { + parentView?: any; + + /** + * Routes to a specific URL and actives the appropriate views associated with the URL + * + * @param name Name of the route + */ + route?(name: string): ViewPrototype; + + + /** + * Determines if the view is visible + */ + isActive?(): boolean; + + /** + * Override the init method to perform actions when the View is first created and shown on the page + */ + init?: Function; + + /** + * Override the routed method to perform actions when the View have routing and routing mechanism actives it. + */ + routed?: Function; + + navigateTo?: Function; + + /** + * Override the ready method to perform actions when the DOM is ready and + * all data-query have been executed. + */ + ready?: Function; + + options?: { + route?: any, + url?: string + }; +} + +///////////////////////////////////////// +// App.Model +///////////////////////////////////////// + +interface Model { + (): Model; + (props: Object): Model; + + /** + * Fires a request to the server to populate the Model based on the read URL specified + */ + read(): Model; + /** + * @param params The parameters Object that will be used to populate the Model from the specified options.read URL. If the URL does not contain parameters + */ + read(params: Object): Model; + + /** + * Synchronizes the changes with the server by sending requests to the provided URL's + */ + sync(): Model; +} + +interface ModelPrototype { + + /** + * Override the init method to perform actions on creation for each Model instance + */ + init?: Function; + + /** + * Validates all observable properties that have validation and returns true if all values are valid otherwise returns false + */ + validate?(): boolean; + + /** + * Extracts the raw(non observable) dataItem object values from the Model + */ + dataItem?(): Object; + + /** + * Applies new properties to the Model by providing an Object + * + * @param dataItem The object from which the new values will be applied + */ + reset?(dataItem: ModelPrototype): ModelPrototype; + + /** + * Determines whether the instance is new. If true when syncing the item will send for insertion instead of updating it. + * The check is determined by the idAttr value specified in the options. If idAttr is not specified the item will always be considered new. + * + */ + isNew?(): boolean; + + options?: { + idAttr?: string, + baseUrl?: string, + read?: { url?: string }, + create?: { url?: string }, + destroy?: { url?: string }, + update?: { url?: string }, + }; +} + +///////////////////////////////////////// +// App.Collection +///////////////////////////////////////// + +interface Collection extends Extendable { + (): Collection; + (props: Object[]): Collection; + + /** + * Fires a request to the server to populate the Model based on the read URL specified + */ + read(): Collection; + /** + * @param params The parameters Object that will be used to populate the Collection from the specified options.read URL. If the URL does not contain parameters + */ + read(params: Object): Collection; + + /** + * Clear all changes made to the collection + */ + clearChanges(): Collection; + + /** + * Performs an ajax request for all create, update and delete operations in order to sync them with a database. + */ + sync(): Collection; + + update(id: number, newValues: Object): Collection; +} + +interface CollectionPrototype { + options?: { + read?: { url?: string }, + create?: { url?: string }, + destroy?: { url?: string }, + update?: { url?: string }, + }; +} + +interface Extendable { + + /** + * Extends the current observable with particular functionality depending on the parameters specified. + * If the method is called without arguments and jsvalue framework is included the observable will be + * extended with the methods available in jsvalue for the current type. + * + * @param name Name of the extender + * @param options Optional options + */ + extend(name?: string, ...options): T; + extend(any): T; +} + +interface Server { + + /** + * The port at which your application will be run + */ + port?: number, + + /** + * The folder where your application files like .html, .js and .css are going to be. + * The value is passed to express.static() middleware. + */ + static?: string, + + /** + * Caches pages result instead of executing them each time. + * Disabling cache could impact performance. + */ + cache?: boolean, + + /** + * Provide an express middleware function or an array of middleware functions. + * Use: [compression(), bodyParser()] + */ + use?: any, +} + +declare var blocks: BlocksStatic; + +declare module "blocks" { + export = blocks; +} \ No newline at end of file From 9f576a221d3f1612649cf858fe40095e5ca2fde9 Mon Sep 17 00:00:00 2001 From: ksmigiel Date: Tue, 12 May 2015 11:08:38 +0200 Subject: [PATCH 164/534] Make Travis tests pass --- blocks/blocks-tests.ts | 41 ++++++++++++-------------------- blocks/blocks.d.ts | 54 +++++++++++++++++++++--------------------- 2 files changed, 42 insertions(+), 53 deletions(-) diff --git a/blocks/blocks-tests.ts b/blocks/blocks-tests.ts index 5adc719e8..7b83b52a6 100644 --- a/blocks/blocks-tests.ts +++ b/blocks/blocks-tests.ts @@ -1,7 +1,7 @@ /// function test_blocks_methods() { - var extended; + var extended: Object; blocks.extend(extended, new Object()); blocks.each([3, 1, 4], function(value, index, collection) { @@ -24,7 +24,7 @@ function test_blocks_methods() { // -> false } - function max(collection, callback) { + function max(collection: any, callback: any) { callback = callback || blocks.noop; } @@ -119,21 +119,19 @@ function test_blocks_methods() { blocks.isPlainObject(new Object()); // -> true - function Car() { + var car = new Object(); - } - - blocks.isPlainObject(new Car()); + blocks.isPlainObject(car); // -> false - var alert = blocks.bind(function() { + var alert = blocks.bind(() => { alert(this); }, 'Hello bind method!'); alert(); // -> alerts 'Hello bind method' - var alertAll = blocks.bind(function(firstName, lastName) { + var alertAll = blocks.bind((firstName: string, lastName: string) => { alert('My name is ' + firstName + ' ' + lastName); }, null, 'John', 'Doe'); @@ -150,16 +148,16 @@ function test_blocks_methods() { message: 'Hello World!' }); - blocks.query({ + blocks.query({ items: ['John', 'Alf', 'Mega'], - alertIndex: function(e) { + alertIndex: (e: any) => { alert('Clicked an item with index:' + blocks.context(e.target).$index); } }); blocks.query({ items: [1, 2, 3], - alertValue: function(e) { + alertValue: (e: any) => { alert('Clicked the value: ' + blocks.dataItem(e.target)); } }); @@ -177,15 +175,6 @@ function test_blocks_methods() { // -> 305 } -function test_observable() { - blocks.observable['formatter'] = () => { - // your code here - }; - - // extending using the formatter extender - var data = blocks.observable([1, 2, 3]).extend('formatter'); -} - function test_observable_array() { // creates an observable array with [1, 2, 3] as values var items = blocks.observable([1, 2, 3]); @@ -272,7 +261,7 @@ function test_Collection() { var Users = App.Collection(User, { count: App.Property({ - value: function() { + value: () => { return this().length; } }) @@ -293,18 +282,18 @@ function test_View() { var App = blocks.Application(); App.View('Clicker', { - handleClick: function() { + handleClick: () => { alert('Clicky! Click!'); } }); App.View('Statistics', { - init: function() { + init: () => { this.loadRemoteData(); }, - loadRemoteData: function() { + loadRemoteData: () => { // ...stuff... } }); @@ -314,7 +303,7 @@ function test_View() { route: 'contactus' }, - routed: function() { + routed: () => { alert('Navigated to ContactUs page!') } }); @@ -326,7 +315,7 @@ function test_View() { }); App.View('Navigation', { - navigateToContactUs: function() { + navigateToContactUs: () => { this.route('contactus') } }); diff --git a/blocks/blocks.d.ts b/blocks/blocks.d.ts index aedef9d04..ad492333e 100644 --- a/blocks/blocks.d.ts +++ b/blocks/blocks.d.ts @@ -27,7 +27,7 @@ interface BlocksStatic { /** * Copies properties from all provided objects into the first object parameter */ - extend(obj: Object, ...objects): void; + extend(obj: Object, ...objects: any[]): void; /** * Iterates over the collection @@ -173,7 +173,7 @@ interface BlocksStatic { * @param thisArg The new this binding context value * @param args Optional arguments that will be passed to the function */ - bind(func: Function, thisArg: any, ...args): Function; + bind(func: Function, thisArg: any, ...args: any[]): Function; /** * Determines if two values are deeply equal. Set deepEqual to false to stop recusively equality checking @@ -228,11 +228,11 @@ interface BlocksStatic { /** * Creates the server which will automatically handle server-side rendering. */ - server(): { express() }; + server(): { express(): any }; /** * @param options Overrides default jsblocks options */ - server(options: Server): { express() }; + server(options: Server): { express(): any }; /** * Make observable property. You can specify initial value in parentheses. @@ -253,7 +253,7 @@ interface BlocksStatic { ///////////////////////////////////////// interface BlocksObservable extends Extendable { - (any): BlocksObservable; + (arg: any): BlocksObservable; /** * Updates all elements, expressions and dependencies where the observable is used @@ -287,12 +287,12 @@ interface BlocksArray extends BlocksObservable { * * @param options Optional options */ - extend(...options): BlocksArray; + extend(...options: any[]): BlocksArray; /** * @param name Name of the extender * @param options Optional options */ - extend(name: string, ...options): BlocksArray; + extend(name: string, ...options: any[]): BlocksArray; /** * Removes all items from the collection and replaces them with the new value provided. @@ -419,7 +419,7 @@ interface BlocksArray extends BlocksObservable { * * @param values The item(s) to add to the observable array */ - push(...values): number; + push(...values: any[]): number; /** * Reverses the order of the elements in the observable array @@ -576,7 +576,7 @@ interface ViewPrototype { ready?: Function; options?: { - route?: any, + route?: any; url?: string }; } @@ -636,12 +636,12 @@ interface ModelPrototype { isNew?(): boolean; options?: { - idAttr?: string, - baseUrl?: string, - read?: { url?: string }, - create?: { url?: string }, - destroy?: { url?: string }, - update?: { url?: string }, + idAttr?: string; + baseUrl?: string; + read?: { url?: string }; + create?: { url?: string }; + destroy?: { url?: string }; + update?: { url?: string }; }; } @@ -677,10 +677,10 @@ interface Collection extends Extendable { interface CollectionPrototype { options?: { - read?: { url?: string }, - create?: { url?: string }, - destroy?: { url?: string }, - update?: { url?: string }, + read?: { url?: string }; + create?: { url?: string }; + destroy?: { url?: string }; + update?: { url?: string }; }; } @@ -694,8 +694,8 @@ interface Extendable { * @param name Name of the extender * @param options Optional options */ - extend(name?: string, ...options): T; - extend(any): T; + extend(name?: string, ...options: any[]): T; + extend(arg: any): T; } interface Server { @@ -703,25 +703,25 @@ interface Server { /** * The port at which your application will be run */ - port?: number, + port?: number; /** - * The folder where your application files like .html, .js and .css are going to be. + * The folder where your application files like .html; .js and .css are going to be. * The value is passed to express.static() middleware. */ - static?: string, + static?: string; /** * Caches pages result instead of executing them each time. * Disabling cache could impact performance. */ - cache?: boolean, + cache?: boolean; /** * Provide an express middleware function or an array of middleware functions. - * Use: [compression(), bodyParser()] + * Use: [compression(); bodyParser()] */ - use?: any, + use?: any; } declare var blocks: BlocksStatic; From 16744e323f0a6669bcb91dccfea8445823a7cf1e Mon Sep 17 00:00:00 2001 From: Max Nylin Date: Tue, 12 May 2015 11:45:48 +0200 Subject: [PATCH 165/534] Added definition of extendModel() in IService for Restangular --- restangular/restangular.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index f2388fc12..4f48101d8 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -95,6 +95,7 @@ declare module restangular { restangularizeCollection(parent: any, element: any, route: string): ICollection; service(route: string, parent?: any): IService; stripRestangular(element: any): any; + extendModel(route: string, extender: (model: IElement) => any): void; } interface IElement extends IService { From 943b4db4abb771ed881bb96a696f3a7d0760deb3 Mon Sep 17 00:00:00 2001 From: Joseph Rossi Date: Tue, 12 May 2015 12:10:16 -0400 Subject: [PATCH 166/534] Adding the default logger's `level` property. --- winston/winston-tests.ts | 4 +++- winston/winston.d.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/winston/winston-tests.ts b/winston/winston-tests.ts index 0fa3cb442..3bfd0d5a5 100644 --- a/winston/winston-tests.ts +++ b/winston/winston-tests.ts @@ -8,6 +8,8 @@ var num: number; var metadata: any; var obj: any = {}; +winston.level = 'debug'; + var queryOptions: winston.QueryOptions; var transportOptions: winston.TransportOptions; var loggerOptions: winston.LoggerOptions = { @@ -218,4 +220,4 @@ var logger: winston.LoggerInstance = new (winston.Logger)({ ssl: {}, }), ] -}); \ No newline at end of file +}); diff --git a/winston/winston.d.ts b/winston/winston.d.ts index 983f7cbbc..954e3358b 100644 --- a/winston/winston.d.ts +++ b/winston/winston.d.ts @@ -17,7 +17,7 @@ declare module "winston" { export var defaultLogger: LoggerInstance; export var exitOnError: boolean; - + export var level: string; export function log(level: string, msg: string, meta: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; export function log(level: string, msg: string, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; From 433ed3d130befb6f11aa0a172684c98eb1921931 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Tue, 12 May 2015 11:45:03 -0500 Subject: [PATCH 167/534] Added stack trace.js and node stack trace definitions --- node-stack-trace/node-stack-trace.d.ts | 20 ++++++++ node-stack-trace/node-stack-trace.ts | 8 ++++ stacktrace/stacktrace.d.ts | 64 ++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 node-stack-trace/node-stack-trace.d.ts create mode 100644 node-stack-trace/node-stack-trace.ts create mode 100644 stacktrace/stacktrace.d.ts diff --git a/node-stack-trace/node-stack-trace.d.ts b/node-stack-trace/node-stack-trace.d.ts new file mode 100644 index 000000000..c3684b3db --- /dev/null +++ b/node-stack-trace/node-stack-trace.d.ts @@ -0,0 +1,20 @@ +// Type definitions for node-stack-trace +// Project: https://github.com/felixge/node-stack-trace +// Definitions by: [Exceptionless] +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'stack-trace' { + export interface StackFrame { + getTypeName():string; + getFunctionName():string; + getMethodName():string; + getFileName():string; + getTypeName():string; + getLineNumber():number; + getColumnNumber():number; + isNative():boolean; + } + + export function get(belowFn:() => void): StackFrame[]; + export function parse(err:Error): StackFrame[]; +} diff --git a/node-stack-trace/node-stack-trace.ts b/node-stack-trace/node-stack-trace.ts new file mode 100644 index 000000000..a0b2f8d55 --- /dev/null +++ b/node-stack-trace/node-stack-trace.ts @@ -0,0 +1,8 @@ +import stackTrace = require('stack-trace'); + +var currentStackTrace = stackTrace.get(); + +var err = new Error('something went wrong'); +var trace = stackTrace.parse(err); + +var fileName = trace[0].getFileName(); diff --git a/stacktrace/stacktrace.d.ts b/stacktrace/stacktrace.d.ts new file mode 100644 index 000000000..a23216a95 --- /dev/null +++ b/stacktrace/stacktrace.d.ts @@ -0,0 +1,64 @@ +// Type definitions for stacktrace.js +// Project: https://github.com/stacktracejs/stacktrace.js +// Definitions by: [Exceptionless] +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module StackTrace { + export interface StackTraceOptions { + filter?: (stackFrame:StackFrame) => boolean; + sourceCache?: { URL:string }; + offline?: boolean; + } + + export interface StackFrame { + constructor(functionName:string, args:any, fileName:string, lineNumber:number, columnNumber:number); + + functionName?:string; + args?:any; + fileName?:string; + lineNumber?:number; + columnNumber?:number; + toString():string; + } + + /** + * Get a backtrace from invocation point. + * @param options Options Object + * @return Array[StackFrame] + */ + export function get(options: StackTraceOptions): Promise; + + /** + * Given an error object, parse it. + * @param error Error object + * @param options Object for options + * @return Array[StackFrame] + */ + export function fromError(error:Error, options?:StackTraceOptions): Promise; + + /** + * Use StackGenerator to generate a backtrace. + * @param options Object options + * @returns Array[StackFrame] + */ + export function generateArtificially(options: StackTraceOptions): Promise; + + /** + * Given a function, wrap it such that invocations trigger a callback that + * is called with a stack trace. + * + * @param {Function} fn to be instrumented + * @param {Function} callback function to call with a stack trace on invocation + * @param {Function} errorCallback optional function to call with error if unable to get stack trace. + * @param {Object} thisArg optional context object (e.g. window) + */ + export function instrument(fn:() => void, callback:(stackFrames:StackFrame[]) => void, errorCallback:() => void, thisArg:any): void; + + /** + * Given a function that has been instrumented, + * revert the function to it's original (non-instrumented) state. + * + * @param fn {Function} + */ + export function deinstrument(fn:() => void): void; +} From 6b54b0b58f23d95a9670a7f1c364459fb349f548 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Tue, 12 May 2015 11:45:17 -0500 Subject: [PATCH 168/534] Added stack trace.js tests --- stacktrace/stacktrace-tests.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 stacktrace/stacktrace-tests.ts diff --git a/stacktrace/stacktrace-tests.ts b/stacktrace/stacktrace-tests.ts new file mode 100644 index 000000000..39a968d61 --- /dev/null +++ b/stacktrace/stacktrace-tests.ts @@ -0,0 +1,25 @@ +import StackTrace = require('StackTrace'); + +function interestingFn() { + return 'https://github.com/exceptionless/Exceptionless'; +} + +var callback = function(stackframes) { + var stringifiedStack = stackframes.map(function(sf) { + return sf.toString(); + }).join('\n'); + console.log(stringifiedStack); +}; + +var errback = function(err) { console.log(err.message); }; + + +StackTrace.get(); + +// Somewhere else... +var error = new Error('BOOM!'); +StackTrace.fromError(error); +StackTrace.generateArtificially(); + +StackTrace.instrument(interestingFn, callback, errback); +StackTrace.deinstrument(interestingFn); From a07aca985c3842a22f2de49879ff25a44e37ef9a Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Tue, 12 May 2015 11:46:47 -0500 Subject: [PATCH 169/534] Added missing promise definition file. --- stacktrace/stacktrace.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stacktrace/stacktrace.d.ts b/stacktrace/stacktrace.d.ts index a23216a95..b54efe43e 100644 --- a/stacktrace/stacktrace.d.ts +++ b/stacktrace/stacktrace.d.ts @@ -3,6 +3,8 @@ // Definitions by: [Exceptionless] // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module StackTrace { export interface StackTraceOptions { filter?: (stackFrame:StackFrame) => boolean; From 3fc51aa130576f5260e35c2fb8ace3359000771a Mon Sep 17 00:00:00 2001 From: Sam Noedel Date: Tue, 12 May 2015 10:25:39 -0700 Subject: [PATCH 170/534] Added definitions for chai-subset --- chai-subset/chai-subset-tests.ts | 62 ++++++++++++++++++++++++++++++++ chai-subset/chai-subset.d.ts | 21 +++++++++++ 2 files changed, 83 insertions(+) create mode 100644 chai-subset/chai-subset-tests.ts create mode 100644 chai-subset/chai-subset.d.ts diff --git a/chai-subset/chai-subset-tests.ts b/chai-subset/chai-subset-tests.ts new file mode 100644 index 000000000..8b88e5c6a --- /dev/null +++ b/chai-subset/chai-subset-tests.ts @@ -0,0 +1,62 @@ +/// + +import chai = require('chai'); +import chaiSubset = require('chai-subset'); + +chai.use(chaiSubset); +var expect = chai.expect; +var assert = chai.assert; + +function test_containSubset() { + var obj: Object = { + a: 'b', + c: 'd', + e: { + foo: 'bar', + baz: { + qux: 'quux' + } + } + }; + + expect(obj).to.containSubset({ + a: 'b', + e: { + baz: { + qux: 'quux' + } + } + }); + + obj.should.containSubset({ a: 'b' }); +} + +function test_notContainSubset() { + var obj: Object = { + a: 'b', + c: 'd', + e: { + foo: 'bar', + baz: { + qux: 'quux' + } + } + }; + + expect(obj).to.not.containSubset({ g: 'whatever' }); + obj.should.not.containSubset({ g: 'whatever' }); +} + +function test_arrayContainSubset() { + var list: Array = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ]; + + expect(list).to.containSubset([{a:'a', b: 'b'}]); + list.should.containSubset([{a:'a', b: 'b'}]); +} + +function test_arrayNotContainSubset() { + var list: Array = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ]; + + expect(list).not.to.containSubset([{a:'a', b: 'bd'}]); + list.should.not.containSubset([{a:'a', b: 'bd'}]); +} diff --git a/chai-subset/chai-subset.d.ts b/chai-subset/chai-subset.d.ts new file mode 100644 index 000000000..44bbef9cc --- /dev/null +++ b/chai-subset/chai-subset.d.ts @@ -0,0 +1,21 @@ +// Type definitions for chai-subset 1.0.0 +// Project: https://github.com/e-conomic/chai-subset +// Definitions by: Sam Noedel +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Chai { + interface Assertion { + containSubset(obj: Object): Assertion; + } +} + +interface Object { + should: Chai.Assertion; +} + +declare module "chai-subset" { + function chaiSubset(chai: any, utils: any): void; + export = chaiSubset; +} From 372a2c4cd967a8a38b4e92cc5192a36dddfb0ffc Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Tue, 12 May 2015 11:56:55 -0700 Subject: [PATCH 171/534] Updating the mocha type definitions --- mocha/mocha.d.ts | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index 3f5d3e571..63ad66014 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -52,7 +52,7 @@ interface MochaDone { declare var mocha: Mocha; -declare var describe : { +declare var describe: { (description: string, spec: () => void): void; only(description: string, spec: () => void): void; skip(description: string, spec: () => void): void; @@ -60,12 +60,20 @@ declare var describe : { } // alias for `describe` -declare var context : { +declare var context: { (contextTitle: string, spec: () => void): void; only(contextTitle: string, spec: () => void): void; skip(contextTitle: string, spec: () => void): void; timeout(ms: number): void; -} +}; + +// alias for `describe` +declare var suite: { + (suiteTitle: string, spec: () => void): void; + only(suiteTitle: string, spec: () => void): void; + skip(suiteTitle: string, spec: () => void): void; + timeout(ms: number): void; +}; declare var it: { (expectation: string, assertion?: () => void): void; @@ -77,6 +85,17 @@ declare var it: { timeout(ms: number): void; }; +// alias for `it` +declare var test: { + (expectation: string, assertion?: () => void): void; + (expectation: string, assertion?: (done: MochaDone) => void): void; + only(expectation: string, assertion?: () => void): void; + only(expectation: string, assertion?: (done: MochaDone) => void): void; + skip(expectation: string, assertion?: () => void): void; + skip(expectation: string, assertion?: (done: MochaDone) => void): void; + timeout(ms: number): void; +}; + declare function before(action: () => void): void; declare function before(action: (done: MochaDone) => void): void; From 66d8808c98856feae7d5a2d5acfc955110fb126d Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Tue, 12 May 2015 11:57:21 -0700 Subject: [PATCH 172/534] Adding test for new mocha API --- mocha/mocha-tests.ts | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/mocha/mocha-tests.ts b/mocha/mocha-tests.ts index dffd86e44..f90fefaf9 100644 --- a/mocha/mocha-tests.ts +++ b/mocha/mocha-tests.ts @@ -24,6 +24,18 @@ function test_context() { }); } +function test_suite() { + suite('some context', () => { }); + + suite.only('some context', () => { }); + + suite.skip('some context', () => { }); + + suite('some context', function() { + this.timeout(2000); + }); +} + function test_it() { it('does something', () => { }); @@ -39,6 +51,21 @@ function test_it() { }); } +function test_test() { + + test('does something', () => { }); + + test('does something', (done) => { done(); }); + + test.only('does something', () => { }); + + test.skip('does something', () => { }); + + test('does something', function () { + this.timeout(2000); + }); +} + function test_before() { before(() => { }); @@ -221,4 +248,4 @@ function test_run_withOnComplete() { instance.run((failures: number): void => { console.log(failures); }); -} \ No newline at end of file +} From 3d26b455fbad55603589c4ddee9b27770a155e96 Mon Sep 17 00:00:00 2001 From: Ben Tesser Date: Wed, 13 May 2015 04:09:28 -0400 Subject: [PATCH 173/534] Typings for angularjs-toaster --- angularjs-toaster/angularjs-toaster-tests.ts | 42 +++++++ angularjs-toaster/angularjs-toaster.d.ts | 109 +++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 angularjs-toaster/angularjs-toaster-tests.ts create mode 100644 angularjs-toaster/angularjs-toaster.d.ts diff --git a/angularjs-toaster/angularjs-toaster-tests.ts b/angularjs-toaster/angularjs-toaster-tests.ts new file mode 100644 index 000000000..ffff32159 --- /dev/null +++ b/angularjs-toaster/angularjs-toaster-tests.ts @@ -0,0 +1,42 @@ +/// +class NgToasterTestController { + constructor(public $scope: ng.IScope, public $window: ng.IWindowService, public toaster: ngtoaster.IToasterService) { + this.bar = 'Hi'; + } + bar: string; + + pop(): void { + this.toaster.success({ title: "title", body: "text1" }); + this.toaster.error("title", "text2"); + this.toaster.pop({ type: 'wait', title: "title", body: "text" }); + this.toaster.pop('success', "title", '
    • Render html
    ', 5000, 'trustedHtml'); + this.toaster.pop('error', "title", '
    • Render html
    ', null, 'trustedHtml'); + this.toaster.pop('wait', "title", null, null, 'template'); + this.toaster.pop('warning', "title", "myTemplate.html", null, 'template'); + this.toaster.pop('note', "title", "text"); + this.toaster.pop('success', "title", 'Its address is https://google.com.', 5000, 'trustedHtml', (toaster: ngtoaster.IToast): boolean => { + var match = toaster.body.match(/http[s]?:\/\/[^\s]+/); + if (match) { + this.$window.open(match[0]); + } + return true; + }); + this.toaster.pop('warning', "Hi ", "{template: 'myTemplateWithData.html', data: 'MyData'}", 15000, 'templateWithData'); + } + + goToLink(toaster: ngtoaster.IToast): boolean { + var match = toaster.body.match(/http[s]?:\/\/[^\s]+/); + if (match) { + this.$window.open(match[0]); + } + return true; + } + + clear(): void { + this.toaster.clear(); + } +} + +angular + .module('main', ['ngAnimate', 'toaster']) + .controller('myController', NgToasterTestController); \ No newline at end of file diff --git a/angularjs-toaster/angularjs-toaster.d.ts b/angularjs-toaster/angularjs-toaster.d.ts new file mode 100644 index 000000000..398704514 --- /dev/null +++ b/angularjs-toaster/angularjs-toaster.d.ts @@ -0,0 +1,109 @@ +// Type definitions for angularjs-toaster v0.4.13 +// Project: https://github.com/jirikavi/AngularJS-Toaster +// Definitions by: Ben Tesser +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module ngtoaster { + interface IToasterService { + pop(params:IPopParams): void + /** + * @param {string} type Type of toaster -- 'error', 'info', 'wait', 'success', and 'warning' + */ + pop(type?:string, title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number, showCloseButton?:boolean): void + error(params: IPopParams): void + error(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + into(params: IPopParams): void + info(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + wait(params: IPopParams): void + wait(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + success(params: IPopParams): void + success(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + warning(params: IPopParams): void + warning(title?:string, body?:string, timeout?:number, bodyOutputType?:string, clickHandler?:EventListener, + toasterId?:number): void + clear(): void + toast:IToast; + } + + interface IToasterEventRegistry { + setup(): void + subscribeToNewToastEvent(onNewToast:IToastEventListener): void + subscribeToClearToastsEvent(onClearToasts:IToastEventListener): void + unsubscribeToNewToastEvent(onNewToast:IToastEventListener): void + unsubscribeToClearToastsEvent(onClearToasts:IToastEventListener): void + } + + interface IPopParams extends IToast{ + toasterId?: number; + } + + interface IToastEventListener { + (event:Event, toasterId: number): void; + } + + interface IToast { + /** + * Acceptable types are: + * 'error', 'info', 'wait', 'success', and 'warning' + */ + type?: string; + title?: string; + body?: string; + timeout?: number; + bodyOutputType?: string; + clickHandler?: EventListener; + showCloseButton?: boolean; + } + + interface IToasterConfig { + /** + * limits max number of toasts + */ + limit?: number; + 'tap-to-dismiss'?: boolean; + 'close-button'?: boolean; + 'newest-on-top'?: boolean; + 'time-out'?: number; + 'icon-classes'?: IIconClasses; + /** + * Options include: + * '', 'trustedHtml', 'template', 'templateWithData' + */ + 'body-output-type'?: string; + 'body-template'?: string; + 'icon-class'?: string; + /** + * Options include: + * 'toast-top-full-width', 'toast-bottom-full-width', 'toast-center', + * 'toast-top-left', 'toast-top-center', 'toast-top-rigt', + * 'toast-bottom-left', 'toast-bottom-center', 'toast-bottom-rigt', + */ + 'position-class'?: string; + 'title-class'?: string; + 'message-class'?: string; + 'prevent-duplicates'?: boolean; + /** + * stop timeout on mouseover and restart timer on mouseout + */ + 'mouseover-timer-stop'?: boolean; + } + + interface IIconClasses { + error: string; + info: string; + wait: string; + success: string; + warning: string; + } +} + +declare module "ngtoaster" { + export = ngtoaster +} From b0d1fa0b584ebdd8fa1f2455931565c4c4b1ba94 Mon Sep 17 00:00:00 2001 From: Alexander Shutov Date: Wed, 13 May 2015 16:46:45 +0300 Subject: [PATCH 174/534] Added missing AppWindow events. --- chrome/chrome-app-tests.ts | 8 ++++++++ chrome/chrome-app.d.ts | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/chrome/chrome-app-tests.ts b/chrome/chrome-app-tests.ts index de56bbac8..970e03517 100644 --- a/chrome/chrome-app-tests.ts +++ b/chrome/chrome-app-tests.ts @@ -28,6 +28,14 @@ var currentWindow: cwindow.AppWindow = chrome.app.window.current(); var otherWindow: cwindow.AppWindow = chrome.app.window.get('some-string'); var allWindows: cwindow.AppWindow[] = chrome.app.window.getAll(); +// listening to window events +currentWindow.onBoundsChanged.addListener(function () { return; }); +currentWindow.onClosed.addListener(function () { return; }); +currentWindow.onFullscreened.addListener(function () { return; }); +currentWindow.onMaximized.addListener(function () { return; }); +currentWindow.onMinimized.addListener(function () { return; }); +currentWindow.onRestored.addListener(function () { return; }); + // check platform capabilities var visibleEverywhere: boolean = chrome.app.window.canSetVisibleOnAllWorkspaces(); diff --git a/chrome/chrome-app.d.ts b/chrome/chrome-app.d.ts index 2f498ed28..5cfa0fbce 100644 --- a/chrome/chrome-app.d.ts +++ b/chrome/chrome-app.d.ts @@ -122,6 +122,12 @@ declare module chrome.app.window { id: string; innerBounds: Bounds; outerBounds: Bounds; + onBoundsChanged: WindowEvent; + onClosed: WindowEvent; + onFullscreened: WindowEvent; + onMaximized: WindowEvent; + onMinimized: WindowEvent; + onRestored: WindowEvent; } export function create(url: string, options?: CreateWindowOptions, callback?: (created_window: AppWindow) => void): void; From 4969fc2f1e1a24b859cb25de785dc6d738b63c52 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 12 May 2015 22:02:15 +0200 Subject: [PATCH 175/534] Added typings for knockout-paging library --- knockout-paging/knockout-paging-tests.ts | 90 ++++++++++++++++++++++++ knockout-paging/knockout-paging.d.ts | 67 ++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 knockout-paging/knockout-paging-tests.ts create mode 100644 knockout-paging/knockout-paging.d.ts diff --git a/knockout-paging/knockout-paging-tests.ts b/knockout-paging/knockout-paging-tests.ts new file mode 100644 index 000000000..eae5490bb --- /dev/null +++ b/knockout-paging/knockout-paging-tests.ts @@ -0,0 +1,90 @@ +/// + +// Different option formats +var emptyOptions = {}; +var pageNumberOptions = { pageNumber: 2 }; +var pageSizeOptions = { pageSize: 10 }; +var generatorOptions = { pageGenerator: 'sliding' }; +var allOptions = { pageNumber: 2, pageSize: 10, pageGenerator: 'sliding' }; + +function defaults() { + ko.paging.defaults.pageNumber = 1; + ko.paging.defaults.pageSize = 50; +} + +function pageGenerators() { + + // Allow to set the windowSize on sliding page generator + ko.paging.generators['sliding'].windowSize(5); + + // Add custom page generator + ko.paging.generators['custom'] = { + generate: function(pagedObservable: KnockoutObservable) { + return [0, 1]; + } + } +} + +function usingPagedObservableArrayFunctionOnKnockoutStatic() { + var simplePaged = ko.pagedObservableArray(); + var initializedPaged = ko.pagedObservableArray([1, 2, 3]); + var emptyOptionsPaged = ko.pagedObservableArray([1, 2, 3], emptyOptions); + var pageNumberOptionsPaged = ko.pagedObservableArray([1, 2, 3], pageNumberOptions); + var pageSizeOptionsPaged = ko.pagedObservableArray([1, 2, 3], pageSizeOptions); + var generatorOptionsPaged = ko.pagedObservableArray([1, 2, 3], generatorOptions); + var allOptionsPaged = ko.pagedObservableArray([1, 2, 3], allOptions); + + // Here we verify that the returned type is the paged observable array + simplePaged.pageSize(); + initializedPaged.pageSize(); + emptyOptionsPaged.pageSize(); + pageNumberOptionsPaged.pageSize(); + pageSizeOptionsPaged.pageSize(); + generatorOptionsPaged.pageSize(); + allOptionsPaged.pageSize(); +} + +function usingExtend() { + var emptyOptionsPaged = ko.observableArray([]).extend({ paged: emptyOptions }); + var pageNumberOptionsPaged = ko.observableArray([]).extend({ paged: pageNumberOptions }); + var pageSizeOptionsPaged = ko.observableArray([]).extend({ paged: pageSizeOptions }); + var generatorOptionsPaged = ko.observableArray([]).extend({ paged: generatorOptions }); + var allOptionsPaged = ko.observableArray([]).extend({ paged: allOptions }); + var withInitialArrayValue = ko.observableArray([1, 2, 3]).extend({ paged: emptyOptions }); + + // Here we verify that the returned type is the paged observable array + emptyOptionsPaged.pageSize(); + pageNumberOptionsPaged.pageSize(); + pageSizeOptionsPaged.pageSize(); + generatorOptionsPaged.pageSize(); + allOptionsPaged.pageSize(); +} + +function observables() { + var paged = ko.pagedObservableArray([]); + var pageSize = paged.pageSize(); + var pageNumber = paged.pageNumber(); +} + +function computed() { + var paged = ko.pagedObservableArray([]); + var pageItems = paged.pageItems(); + var pageCount = paged.pageCount(); + var itemCount = paged.itemCount(); + var firstItemOnPage = paged.firstItemOnPage(); + var lastItemOnPage = paged.lastItemOnPage(); + var hasPreviousPage = paged.hasPreviousPage(); + var hasNextPage = paged.hasNextPage(); + var isFirstPage = paged.isFirstPage(); + var isLastPage = paged.isLastPage(); + var pages = paged.pages(); +} + +function functions() { + var paged = ko.pagedObservableArray([]); + paged.toNextPage(); + paged.toLastPage(); + paged.toNextPage(); + paged.toPreviousPage(); + paged.toFirstPage(); +} \ No newline at end of file diff --git a/knockout-paging/knockout-paging.d.ts b/knockout-paging/knockout-paging.d.ts new file mode 100644 index 000000000..b5f7627a6 --- /dev/null +++ b/knockout-paging/knockout-paging.d.ts @@ -0,0 +1,67 @@ +// Type definitions for knockout-paging +// Project: https://github.com/ErikSchierboom/knockout-paging +// Definitions by: Erik Schierboom +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface KnockoutStatic { + paging: KnockoutPagingOptions; + pagedObservableArray(initialValue?: T[], options?: KnockoutPagedOptions): KnockoutPagedObservableArray; +} + +interface KnockoutPagingOptions { + defaults: KnockoutPagingDefaultOptions; + generators: { + [name: string]: KnockoutPageGenerator; + 'sliding': KnockoutSlidingPageGenerator + } +} + +interface KnockoutPagingDefaultOptions { + pageNumber: number; + pageSize: number; +} + +interface KnockoutPagedObservableArray extends KnockoutObservableArray { + pageSize: KnockoutObservable; + pageNumber: KnockoutObservable; + + pageItems: KnockoutComputed; + pageCount: KnockoutComputed; + itemCount: KnockoutComputed; + firstItemOnPage: KnockoutComputed; + lastItemOnPage: KnockoutComputed; + hasPreviousPage: KnockoutComputed; + hasNextPage: KnockoutComputed; + isFirstPage: KnockoutComputed; + isLastPage: KnockoutComputed; + pages: KnockoutComputed; + + toNextPage(): void; + toPreviousPage(): void; + toLastPage(): void; + toFirstPage(): void; +} + +interface KnockoutPagedOptions { + pageSize?: number; + pageNumber?: number; + pageGenerator?: string; +} + +interface KnockoutObservableArray { + extend(requestedExtenders: { 'paged': any; }): KnockoutPagedObservableArray; +} + +interface KnockoutPageGenerator { + generate(pagedObservable: KnockoutPagedObservableArray): number[]; +} + +interface KnockoutSlidingPageGenerator extends KnockoutPageGenerator { + windowSize: KnockoutObservable; +} + +interface KnockoutExtenders { + paged(target: KnockoutObservableArray, options: KnockoutPagedOptions): KnockoutObservableArray; +} \ No newline at end of file From c18e95ed4fd760a713f2e943b66af73fd1f757e6 Mon Sep 17 00:00:00 2001 From: jandic Date: Wed, 13 May 2015 19:15:07 +0200 Subject: [PATCH 176/534] Changed return type for registry.byId() --- dojo/dijit.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dojo/dijit.d.ts b/dojo/dijit.d.ts index 33144b9da..0bb2ab67d 100644 --- a/dojo/dijit.d.ts +++ b/dojo/dijit.d.ts @@ -34291,7 +34291,7 @@ declare module dijit { * * @param id */ - byId(id: String): any; + byId(id: String): dijit._WidgetBase; /** * A synthetic clone of array.every acting explicitly on this WidgetSet * @@ -105714,14 +105714,14 @@ declare module dijit { * * @param id */ - byId(id: String): String; + byId(id: String): dijit._WidgetBase; /** * Find a widget by it's id. * If passed a widget then just returns the widget. * * @param id */ - byId(id: dijit._WidgetBase): String; + byId(id: dijit._WidgetBase): dijit._WidgetBase; /** * Returns the widget corresponding to the given DOMNode * @@ -105956,14 +105956,14 @@ declare module dijit { * * @param id */ - byId(id: String): String; + byId(id: String): dijit._WidgetBase; /** * Find a widget by it's id. * If passed a widget then just returns the widget. * * @param id */ - byId(id: dijit._WidgetBase): String; + byId(id: dijit._WidgetBase): dijit._WidgetBase; /** * Returns the widget corresponding to the given DOMNode * From 45595b750957b4490d194f300594707c1b88f4c8 Mon Sep 17 00:00:00 2001 From: Alasdair Mercer Date: Wed, 13 May 2015 18:40:00 +0100 Subject: [PATCH 177/534] updated places sub-module for google.maps --- googlemaps/google.maps.d.ts | 76 +++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 15 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 3ba451c8a..81ee2594a 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -470,7 +470,7 @@ declare module google.maps { visible?: boolean; zIndex?: number; } - + export enum StrokePosition { CENTER, INSIDE, @@ -1414,8 +1414,19 @@ declare module google.maps { country: string; } + export interface PhotoOptions { + maxHeight?: number; + maxWidth?: number; + } + + export interface PlaceAspectRating { + rating: number; + type: string; + } + export interface PlaceDetailsRequest { - reference: string; + placeId: string; + reference?: string; } export interface PlaceGeometry { @@ -1423,29 +1434,53 @@ declare module google.maps { viewport: LatLngBounds; } + export interface PlacePhoto { + height: number; + html_attributions: string[]; + width: number; + getUrl(opts: PhotoOptions): string; + } + export interface PlaceResult { address_components: GeocoderAddressComponent[]; + aspects: PlaceAspectRating[]; formatted_address: string; formatted_phone_number: string; geometry: PlaceGeometry; html_attributions: string[]; icon: string; - id: string; + id?: string; international_phone_number: string; name: string; + permanently_closed: boolean; + photos: PlacePhoto[]; + place_id: string; + price_level: number; rating: number; - reference: string; + reference?: string; + reviews: PlaceReview[]; types: string[]; url: string; vicinity: string; website: string; } + export interface PlaceReview { + aspects: PlaceAspectRating[]; + author_name: string; + author_url: string; + language: string; + text: string; + } + export interface PlaceSearchRequest { bounds: LatLngBounds; keyword: string; location: LatLng; + maxPriceLevel?: number; + minPriceLevel?: number; name: string; + openNow: boolean; radius: number; rankBy: RankBy; types: string[]; @@ -1461,6 +1496,7 @@ declare module google.maps { constructor (attrContainer: Map); getDetails(request: PlaceDetailsRequest, callback: (result: PlaceResult, status: PlacesServiceStatus) => void ): void; nearbySearch(request: PlaceSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus, pagination: PlaceSearchPagination) => void ): void; + radarSearch(request: RadarSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void ): void; textSearch(request: TextSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void ): void; } @@ -1473,27 +1509,37 @@ declare module google.maps { ZERO_RESULTS } + export interface RadarSearchRequest { + bounds: LatLngBounds; + keyword: string; + location: LatLng; + name: string; + radius: number; + types: string[]; + } + export enum RankBy { DISTANCE, PROMINENCE } - - export class SearchBox { - constructor(inputField: HTMLInputElement, opts?: SearchBoxOptions); - getBounds(): LatLngBounds; - setBounds(bounds: LatLngBounds): void; - getPlaces(): PlaceResult[]; - } - export interface SearchBoxOptions { - bounds: LatLngBounds; - } + export class SearchBox extends MVCObject { + constructor(inputField: HTMLInputElement, opts?: SearchBoxOptions); + getBounds(): LatLngBounds; + setBounds(bounds: LatLngBounds): void; + getPlaces(): PlaceResult[]; + } + + export interface SearchBoxOptions { + bounds: LatLngBounds; + } export interface TextSearchRequest { bounds: LatLngBounds; location: LatLng; query: string; radius: number; + types: string[]; } } @@ -1643,6 +1689,6 @@ declare module google.maps { export class MapsEventListener { - } + } } } From 6aa0f25a1a3ca42cbc031d0633e7d66b561f6b3e Mon Sep 17 00:00:00 2001 From: Inez Korczynski Date: Wed, 13 May 2015 16:00:52 -0700 Subject: [PATCH 178/534] Ember.computed takes for instance string and a function --- ember/ember.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index e5300d967..a35d51eb9 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -2830,7 +2830,7 @@ declare module Ember { function compare(v: any, w: any): number; // ReSharper disable once DuplicatingLocalDeclaration var computed: { - (callback: Function): ComputedProperty; + (...args: any[]): ComputedProperty; alias(dependentKey: string): ComputedProperty; and(...args: string[]): ComputedProperty; any(...args: string[]): ComputedProperty; From 03286161b4021762ef638b6529f5e5c36a8cb4ec Mon Sep 17 00:00:00 2001 From: Inez Korczynski Date: Wed, 13 May 2015 16:03:49 -0700 Subject: [PATCH 179/534] Ember.observer takes as parameters for instance string and a function --- ember/ember.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index a35d51eb9..c47c4248c 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -2916,7 +2916,7 @@ declare module Ember { **/ var none: typeof deprecateFunc; function normalizeTuple(target: any, path: string): any[]; - function observer(func: Function, ...args: string[]): Function; + function observer(...args: any[]): Function; function observersFor(obj: any, path: string): any[]; function onLoad(name: string, callback: Function): void; function oneWay(obj: any, to: string, from: string): Binding; From fba82fdad1c7a24df7a4c4ab6a79f02741134496 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 14 May 2015 11:07:34 +0500 Subject: [PATCH 180/534] lodash: added now() method --- lodash/lodash-tests.ts | 6 ++++++ lodash/lodash.d.ts | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index b16f03b46..e87da2110 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -611,6 +611,12 @@ result = _.where(stoogesCombined, { 'quotes': ['Poifect!'] } result = _(stoogesCombined).where({ 'age': 40 }).value(); result = _(stoogesCombined).where({ 'quotes': ['Poifect!'] }).value(); +/******** + * Date * + ********/ + +result = _.now(); + /************* * Functions * *************/ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 84db97b2d..e2878d595 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -4795,6 +4795,20 @@ declare module _ { where(properties: U): LoDashArrayWrapper; } + /******** + * Date * + ********/ + + //_.now + interface LoDashStatic { + /** + * Gets the number of milliseconds that have elapsed since the Unix epoch + * (1 January 1970 00:00:00 UTC). + * @return The number of milliseconds. + **/ + now(): number; + } + /************* * Functions * *************/ From adf53d0cc0db2a468f3158719729626373fce12f Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Thu, 14 May 2015 18:00:13 +0900 Subject: [PATCH 181/534] add `node-gcm` type definition file --- node-gcm/node-gcm-tests.ts | 72 ++++++++++++++++++++++++++++++++++++++ node-gcm/node-gcm.d.ts | 62 ++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 node-gcm/node-gcm-tests.ts create mode 100644 node-gcm/node-gcm.d.ts diff --git a/node-gcm/node-gcm-tests.ts b/node-gcm/node-gcm-tests.ts new file mode 100644 index 000000000..b184949ed --- /dev/null +++ b/node-gcm/node-gcm-tests.ts @@ -0,0 +1,72 @@ +/// + +import gcm = require('node-gcm'); + +// Create a message +// ... with default values +var message = new gcm.Message(); + +// ... or some given values +var message = new gcm.Message({ + collapseKey: 'demo', + delayWhileIdle: true, + timeToLive: 3, + data: { + key1: 'message1', + key2: 'message2' + } +}); + +// Change the message data +// ... as key-value +message.addData('key1','message1'); +message.addData('key2','message2'); + +// ... or as a data object (overwrites previous data object) +message.addData({ + key1: 'message1', + key2: 'message2' +}); + +// Change the message variables +message.collapseKey = 'demo'; +message.delayWhileIdle = true; +message.timeToLive = 3; +message.dryRun = true; + +// Set up the sender with you API key +var sender = new gcm.Sender('insert Google Server API Key here'); + +// Add the registration IDs of the devices you want to send to +var registrationIds: string[] = []; +registrationIds.push('regId1'); +registrationIds.push('regId2'); + +// Send the message +// ... trying only once +sender.sendNoRetry(message, registrationIds, (err, result) => { + if (err) { + console.error(err); + } else { + console.log(result); + } +}); + +// ... or retrying +sender.send(message, registrationIds, (err, result) => { + if (err) { + console.error(err); + } else { + console.log(result); + } +}); + +// ... or retrying a specific number of times (10) +sender.send(message, registrationIds, 10, (err, result) => { + if (err) { + console.error(err); + } else { + console.log(result); + } +}); + diff --git a/node-gcm/node-gcm.d.ts b/node-gcm/node-gcm.d.ts new file mode 100644 index 000000000..3272acac4 --- /dev/null +++ b/node-gcm/node-gcm.d.ts @@ -0,0 +1,62 @@ +// Type definitions for node-gcm 0.9.15 +// Project: https://www.npmjs.org/package/node-gcm +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "node-gcm" { + + export interface IMessageOptions { + collapseKey?: string; + delayWhileIdle?: boolean; + timeToLive?: number; + dryRun?: boolean; + } + + export class Message { + constructor(options?: IMessageOptions); + collapseKey: string; + delayWhileIdle: boolean; + timeToLive: number; + dryRun: boolean; + + addData(key: string, value: string): void; + addData(data: any): void; + } + + + export interface ISenderOptions { + proxy?: any; + maxSockets?: number; + timeout?: number; + } + export interface ISenderSendOptions { + retries?: number; + backoff?: number; + } + + export class Sender { + constructor(key: string, options?: ISenderOptions); + key: string; + options: ISenderOptions; + + send(message: Message, registrationIds: string|string[], callback: (err: any, resJson: IResponseBody) => void): void; + send(message: Message, registrationIds: string|string[], retries: number, callback: (err: any, resJson: IResponseBody) => void): void; + send(message: Message, registrationIds: string|string[], options: ISenderSendOptions, callback: (err: any, resJson: IResponseBody) => void): void; + sendNoRetry(message: Message, registrationIds: string|string[], callback: (err: any, resJson: IResponseBody) => void): void; + } + + + export interface IResponseBody { + success: number; + failure: number; + canonical_ids: number; + multicast_id?: number; + results?: { + message_id?: string; + registration_id?: string; + error?: string; + }[]; + } + +} + From c52274c369d7f3d44d2de1a67260bfae5a9a9ce2 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 14 May 2015 11:02:31 +0200 Subject: [PATCH 182/534] Added typings for knockout-pre-rendered library --- .../knockout-pre-rendered-tests.ts | 15 +++++++++++++++ knockout-pre-rendered/knockout-pre-rendered.d.ts | 11 +++++++++++ 2 files changed, 26 insertions(+) create mode 100644 knockout-pre-rendered/knockout-pre-rendered-tests.ts create mode 100644 knockout-pre-rendered/knockout-pre-rendered.d.ts diff --git a/knockout-pre-rendered/knockout-pre-rendered-tests.ts b/knockout-pre-rendered/knockout-pre-rendered-tests.ts new file mode 100644 index 000000000..f3a011e95 --- /dev/null +++ b/knockout-pre-rendered/knockout-pre-rendered-tests.ts @@ -0,0 +1,15 @@ +/// + +function initBindingHandler() { + ko.bindingHandlers.init = { + init: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => {}, + update: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => {} + }; +} + +function foreachInitBindingHandler() { + ko.bindingHandlers.foreachInit = { + init: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => { }, + update: (element: any, valueAccessor: () => any, allBindingsAccessor: KnockoutAllBindingsAccessor, viewModel: any, bindingContext: KnockoutBindingContext) => { } + }; +} \ No newline at end of file diff --git a/knockout-pre-rendered/knockout-pre-rendered.d.ts b/knockout-pre-rendered/knockout-pre-rendered.d.ts new file mode 100644 index 000000000..8c3641aa9 --- /dev/null +++ b/knockout-pre-rendered/knockout-pre-rendered.d.ts @@ -0,0 +1,11 @@ +// Type definitions for knockout-pre-rendered +// Project: https://github.com/ErikSchierboom/knockout-pre-rendered +// Definitions by: Erik Schierboom +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface KnockoutBindingHandlers { + init: KnockoutBindingHandler; + foreachInit: KnockoutBindingHandler; +} \ No newline at end of file From f9996b4dda9790d89d5c8ebe5356dab22597f856 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Thu, 14 May 2015 10:14:44 -0500 Subject: [PATCH 183/534] Fixed unit tests and naming conventions. --- .../stack-trace-tests.ts | 0 .../stack-trace.d.ts | 4 ++-- .../stacktrace-js-tests.ts | 11 +++++------ .../stacktrace-js.d.ts | 8 ++++---- 4 files changed, 11 insertions(+), 12 deletions(-) rename node-stack-trace/node-stack-trace.ts => stack-trace/stack-trace-tests.ts (100%) rename node-stack-trace/node-stack-trace.d.ts => stack-trace/stack-trace.d.ts (79%) rename stacktrace/stacktrace-tests.ts => stacktrace-js/stacktrace-js-tests.ts (52%) rename stacktrace/stacktrace.d.ts => stacktrace-js/stacktrace-js.d.ts (86%) diff --git a/node-stack-trace/node-stack-trace.ts b/stack-trace/stack-trace-tests.ts similarity index 100% rename from node-stack-trace/node-stack-trace.ts rename to stack-trace/stack-trace-tests.ts diff --git a/node-stack-trace/node-stack-trace.d.ts b/stack-trace/stack-trace.d.ts similarity index 79% rename from node-stack-trace/node-stack-trace.d.ts rename to stack-trace/stack-trace.d.ts index c3684b3db..21c12f8f2 100644 --- a/node-stack-trace/node-stack-trace.d.ts +++ b/stack-trace/stack-trace.d.ts @@ -1,6 +1,6 @@ // Type definitions for node-stack-trace // Project: https://github.com/felixge/node-stack-trace -// Definitions by: [Exceptionless] +// Definitions by: Exceptionless // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module 'stack-trace' { @@ -15,6 +15,6 @@ declare module 'stack-trace' { isNative():boolean; } - export function get(belowFn:() => void): StackFrame[]; + export function get(belowFn?:() => void): StackFrame[]; export function parse(err:Error): StackFrame[]; } diff --git a/stacktrace/stacktrace-tests.ts b/stacktrace-js/stacktrace-js-tests.ts similarity index 52% rename from stacktrace/stacktrace-tests.ts rename to stacktrace-js/stacktrace-js-tests.ts index 39a968d61..c4c9bcf87 100644 --- a/stacktrace/stacktrace-tests.ts +++ b/stacktrace-js/stacktrace-js-tests.ts @@ -1,18 +1,17 @@ -import StackTrace = require('StackTrace'); +/// function interestingFn() { return 'https://github.com/exceptionless/Exceptionless'; } -var callback = function(stackframes) { - var stringifiedStack = stackframes.map(function(sf) { +var callback = function(stackframes:StackTrace.StackFrame[]) { + var stringifiedStack = stackframes.map(function(sf:StackTrace.StackFrame) { return sf.toString(); }).join('\n'); console.log(stringifiedStack); }; -var errback = function(err) { console.log(err.message); }; - +var errorCallback = function(err:Error) { console.log(err.message); }; StackTrace.get(); @@ -21,5 +20,5 @@ var error = new Error('BOOM!'); StackTrace.fromError(error); StackTrace.generateArtificially(); -StackTrace.instrument(interestingFn, callback, errback); +StackTrace.instrument(interestingFn, callback, errorCallback); StackTrace.deinstrument(interestingFn); diff --git a/stacktrace/stacktrace.d.ts b/stacktrace-js/stacktrace-js.d.ts similarity index 86% rename from stacktrace/stacktrace.d.ts rename to stacktrace-js/stacktrace-js.d.ts index b54efe43e..21ad6839e 100644 --- a/stacktrace/stacktrace.d.ts +++ b/stacktrace-js/stacktrace-js.d.ts @@ -13,7 +13,7 @@ declare module StackTrace { } export interface StackFrame { - constructor(functionName:string, args:any, fileName:string, lineNumber:number, columnNumber:number); + constructor(functionName:string, args:any, fileName:string, lineNumber:number, columnNumber:number): StackFrame; functionName?:string; args?:any; @@ -28,7 +28,7 @@ declare module StackTrace { * @param options Options Object * @return Array[StackFrame] */ - export function get(options: StackTraceOptions): Promise; + export function get(options?: StackTraceOptions): Promise; /** * Given an error object, parse it. @@ -43,7 +43,7 @@ declare module StackTrace { * @param options Object options * @returns Array[StackFrame] */ - export function generateArtificially(options: StackTraceOptions): Promise; + export function generateArtificially(options?: StackTraceOptions): Promise; /** * Given a function, wrap it such that invocations trigger a callback that @@ -54,7 +54,7 @@ declare module StackTrace { * @param {Function} errorCallback optional function to call with error if unable to get stack trace. * @param {Object} thisArg optional context object (e.g. window) */ - export function instrument(fn:() => void, callback:(stackFrames:StackFrame[]) => void, errorCallback:() => void, thisArg:any): void; + export function instrument(fn:() => void, callback:(stackFrames:StackFrame[]) => void, errorCallback:(error:Error) => void, thisArg?:any): void; /** * Given a function that has been instrumented, From bf147fd816ea0eef37b7c96489e140f29bee4cfb Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Thu, 14 May 2015 10:15:16 -0500 Subject: [PATCH 184/534] Fixed name on definition header. --- stacktrace-js/stacktrace-js.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stacktrace-js/stacktrace-js.d.ts b/stacktrace-js/stacktrace-js.d.ts index 21ad6839e..9f7ce5ea2 100644 --- a/stacktrace-js/stacktrace-js.d.ts +++ b/stacktrace-js/stacktrace-js.d.ts @@ -1,6 +1,6 @@ // Type definitions for stacktrace.js // Project: https://github.com/stacktracejs/stacktrace.js -// Definitions by: [Exceptionless] +// Definitions by: Exceptionless // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From 2dabe041c4ce0631a06209e5ff6b3b61e4d17a62 Mon Sep 17 00:00:00 2001 From: Mads Date: Thu, 14 May 2015 18:57:45 +0200 Subject: [PATCH 185/534] whoops, syntax error --- react/react-addons-global.d.ts | 2 +- react/react-addons.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/react/react-addons-global.d.ts b/react/react-addons-global.d.ts index 3e028f5f0..bccd3f427 100644 --- a/react/react-addons-global.d.ts +++ b/react/react-addons-global.d.ts @@ -79,7 +79,7 @@ declare module React { interface UpdateSpec { $set?: any; $merge?: {}; - $apply(value: any)?: any; + $apply?(value: any): any; // [key: string]: UpdateSpec; } diff --git a/react/react-addons.d.ts b/react/react-addons.d.ts index d61bf4221..c4e768f27 100644 --- a/react/react-addons.d.ts +++ b/react/react-addons.d.ts @@ -814,7 +814,7 @@ declare module "react/addons" { interface UpdateSpec { $set?: any; $merge?: {}; - $apply(value: any)?: any; + $apply?(value: any): any; // [key: string]: UpdateSpec; } From ccd672639b2c21ae8188ecb5164946ac8f9ea028 Mon Sep 17 00:00:00 2001 From: Matt Brooks Date: Thu, 14 May 2015 23:35:28 +0100 Subject: [PATCH 186/534] New definition for jQuery Succinct plugin Added definition for jQuery Succinct plugin with accompanying tests file. --- jquery.succinct/jquery.succinct-tests.ts | 31 ++++++++++++++++++++++++ jquery.succinct/jquery.succinct.d.ts | 18 ++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 jquery.succinct/jquery.succinct-tests.ts create mode 100644 jquery.succinct/jquery.succinct.d.ts diff --git a/jquery.succinct/jquery.succinct-tests.ts b/jquery.succinct/jquery.succinct-tests.ts new file mode 100644 index 000000000..7ca72048e --- /dev/null +++ b/jquery.succinct/jquery.succinct-tests.ts @@ -0,0 +1,31 @@ +/// + +// Call with no arguments (accepting defaults) +$(".truncate").succinct(); + +// Specify size +$(".truncate").succinct({ + size: 120 +}); + +// Specify ellipsis replacement +$(".truncate").succinct({ + omission: "→" +}); + +// Specify flag to leave trailing special characters +$(".truncate").succinct({ + ignore: false +}); + +// Combine options +$(".truncate").succinct({ + size: 120, + omission: '...', + ignore: false +}); + +// Can chain jQuery methods +$(".truncate") + .succinct() + .removeClass("truncate"); \ No newline at end of file diff --git a/jquery.succinct/jquery.succinct.d.ts b/jquery.succinct/jquery.succinct.d.ts new file mode 100644 index 000000000..489ee98d2 --- /dev/null +++ b/jquery.succinct/jquery.succinct.d.ts @@ -0,0 +1,18 @@ +// Type definitions for jQuery Succinct v1.1.0 +// Project: http://mikeking.io/succinct/ +// Definitions by: Matt Brooks +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQuerySuccinct { + interface Options { + size?: number; + omission?: string; + ignore?: boolean; + } +} + +interface JQuery { + succinct(settings?: JQuerySuccinct.Options): JQuery; +} \ No newline at end of file From fefe9f1de673efd12fadd16ea8577fdbbc8a4431 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 15 May 2015 09:30:41 +0100 Subject: [PATCH 187/534] angular.d.ts - added JSDoc for $broadcast and $emit --- angularjs/angular.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 1e62aa5f2..7d1f3140b 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -539,9 +539,29 @@ declare module angular { $applyAsync(exp: string): any; $applyAsync(exp: (scope: IScope) => any): any; + /** + * Dispatches an event name downwards to all child scopes (and their children) notifying the registered $rootScope.Scope listeners. + * + * The event life cycle starts at the scope on which $broadcast was called. All listeners listening for name event on this scope get notified. Afterwards, the event propagates to all direct and indirect scopes of the current scope and calls all registered listeners along the way. The event cannot be canceled. + * + * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. + * + * @param name Event name to broadcast. + * @param args Optional one or more arguments which will be passed onto the event listeners. + */ $broadcast(name: string, ...args: any[]): IAngularEvent; $destroy(): void; $digest(): void; + /** + * Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners. + * + * The event life cycle starts at the scope on which $emit was called. All listeners listening for name event on this scope get notified. Afterwards, the event traverses upwards toward the root scope and calls all registered listeners along the way. The event will stop propagating if one of the listeners cancels it. + * + * Any exception emitted from the listeners will be passed onto the $exceptionHandler service. + * + * @param name Event name to emit. + * @param args Optional one or more arguments which will be passed onto the event listeners. + */ $emit(name: string, ...args: any[]): IAngularEvent; $eval(): any; From a7ee9ec55f70644adc68dfe26434673e2834821f Mon Sep 17 00:00:00 2001 From: Simon Altschuler Date: Fri, 15 May 2015 11:13:34 +0200 Subject: [PATCH 188/534] Add module declaration for AMD compatability --- js-signals/js-signals.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js-signals/js-signals.d.ts b/js-signals/js-signals.d.ts index ebc8f72ae..c396bf490 100644 --- a/js-signals/js-signals.d.ts +++ b/js-signals/js-signals.d.ts @@ -5,6 +5,10 @@ declare var signals: SignalWrapper; +declare module "signals" { + export = signals; +} + interface SignalWrapper { Signal: Signal } From 6a55702abf51f13e5150c5aff6e8820c9b63864c Mon Sep 17 00:00:00 2001 From: Joseph Livecchi Date: Fri, 15 May 2015 09:50:34 -0400 Subject: [PATCH 189/534] Started updating fabric.d.ts Updating to be compatible with fabric v1.5 Reorganizing some of the methods to make it easier to find stuff in the definition file --- fabricjs/fabricjs.d.ts | 3930 +++++++++++++++++++++++++++++++--------- 1 file changed, 3039 insertions(+), 891 deletions(-) diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index f764d4768..2a13cac4e 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -5,895 +5,3043 @@ declare module fabric { - function createCanvasForNode(width: number, height: number): ICanvas; - function getCSSRules(doc: SVGElement); - function getGradientDefs(doc: SVGElement); - function loadSVGFromString(text: string, callback: (results: IObject[], options) => void , reviver?: (el, obj) => void ); - function loadSVGFromURL(url, callback: (results: IObject[], options) => void , reviver?: (el, obj) => void ); - function log(values); - function parseAttributes(element, attributes: any[]): any; - function parseElements(elements: any[], callback, options, reviver); - function parsePointsAttribute(points: string): any[]; - function parseStyleAttribute(element: SVGElement); - function parseSVGDocument(doc: SVGElement, callback: (results, options) => void , reviver?: (el, obj) => void ); - function parseTransformAttribute(attributeValue: string); - function warn(values); - - var isLikelyNode: boolean; - var isTouchSupported: boolean; - - export interface IObservable { - observe(eventCollection: IEventList); - on(eventCollection: IEventList); - - observe(eventName: string, handler: (e) => any); - on(eventName: string, handler: (e) => any); - - fire(eventName: string, options); - stopObserving(eventName: string, handler: (e) => any); - - off(eventName, handler); - } - - export interface IFilter { - new (): IFilter; - new (options: any): IFilter; - } - - export interface IEventList { - [index: string]: (e: Event) => void; - } - - export interface IObjectOptions { - angle?: number; - borderColor?: string; - borderOpacityWhenMoving?: number; - borderScaleFactor?: number; - cornerColor?: string; - cornersize?: number; - fill?: string; - fillRule?: string; - flipX?: boolean; - flipY?: boolean; - hasBorders?: boolean; - hasControls?: boolean; - hasRotatingPoint?: boolean; - height?: number; - includeDefaultValues?: boolean; - left?: number; - lockMovementX?: boolean; - lockMovementY?: boolean; - lockScalingX?: boolean; - lockScalingY?: boolean; - lockUniScaling?: boolean; - lockRotation?: boolean; - opacity?: number; - originX?: string; - originY?: string; - overlayFill?: string; - padding?: number; - perPixelTargetFind?: boolean; - rotatingPointOffset?: number; - scaleX?: number; - scaleY?: number; - selectable?: boolean; - stateProperties?: any[]; - stroke?: string; - strokeDashArray?: any[]; - strokeWidth?: number; - top?: number; - transformMatrix?: any[]; - transparentCorners?: boolean; - type?: string; - width?: number; - } - - export interface ITextOptions extends IObjectOptions { - fontSize?: number; - fontWeight?: any; - fontFamily?: string; - textDecoration?: string; - textShadow?: string; - textAlign?: string; - fontStyle?: string; - lineHeight?: number; - strokeStyle?: string; - strokeWidth?: number; - backgroundColor?: string; - textBackgroundColor?: string; - path?: string; - type?: string; - useNative?: Boolean; - } - - export interface ICircleOptions extends IObjectOptions { - radius?: number; - } - - export interface IPoint { - add(that: IPoint): IPoint; - addEquals(that: IPoint): IPoint; - distanceFrom(that: IPoint); - divide(scalar: number); - divideEquals(scalar: number); - eq(that: IPoint); - gt(that: IPoint); - gte(that: IPoint); - init(x, y); - lerp(that: IPoint, t); - lt(that: IPoint); - lte(that: IPoint); - max(that: IPoint); - min(that: IPoint); - multiply(scalar); - multiplyEquals(scalar); - scalarAdd(scalar): IPoint; - scalarAddEquals(scalar: number, thisArg: IPoint); - scalarSubtract(scalar: number); - scalarSubtractEquals(scalar); - setFromPoint(that: IPoint); - setXY(x, y); - subtract(that: IPoint): IPoint; - subtractEquals(that: IPoint): IPoint; - swap(that: IPoint); - tostring(): string; - } - - export interface IRect extends IObject { - x: number; - y: number; - rx: number; - ry: number; - - complexity(): number; - initialize(options: any); - initialize(points: number[], options: any): IRect; - toObject(propertiesToInclude: any[]): any; - toSVG(): string; - } - - export interface IText extends IObject { - fontSize: number; - fontWeight: any; - fontFamily: string; - text: string; - textDecoration: string; - textShadow?: string; - textAlign: string; - fontStyle: string; - lineHeight: number; - strokeStyle: string; - strokeWidth: number; - backgroundColor: string; - textBackgroundColor: string; - path?: string; - type: string; - useNative: Boolean; - - initialize(options: any); - initialize(text: string, options: any): IText; - toString(): string; - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - toObject(propertiesToInclude: any[]): IObject; - toSVG(): string; - setColor(value: string): IText; - setFontsize(value: number): IText; - getText(): string; - setText(value: string): IText; - } - - export interface ITriangle extends IObject { - complexity(): number; - initialize(options: any): ITriangle; - toSVG(): string; - } - - export interface IEllipse { - initialize(options: any): any; - toObject(propertiesToInclude: any[]): any; - toSVG(): string; - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - complexity(): number; - } - - export interface IGradient { - initialize(options): any; - toObject(): any; - toLiveGradient(ctx: CanvasRenderingContext2D): any; - } - - export interface IColor { - getSource(): any[]; - setSource(source: any[]): any; - toRgb(): string; - toRgba(): string; - toHex(): string; - getAlpha(): number; - setAlpha(alpha: number): IColor; - toGrayscale(): IColor; - toBlackWhite(threshold): IColor; - overlayWith(otherColor: string): IColor; - overlayWith(otherColor: IColor): IColor; - } - - export interface IElement { - } - - export interface IObject extends IObservable { - - // constraint properties - lockMovementX: boolean; - lockMovementY: boolean; - lockScalingX: boolean; - lockScalingY: boolean; - lockScaling: boolean; - lockUniScaling: boolean; - lockRotation: boolean; - - getCurrentWidth(): number; - getCurrentHeight(): number; - - originX: string; - originY: string; - - angle: number; - getAngle(): number; - setAngle(value: number): IObject; - - borderColor: string; - getBorderColor(): string; - setBorderColor(value: string): IObject; - - borderOpacityWhenMoving: number; - borderScaleFactor: number; - getBorderScaleFactor(): number; - - cornerColor: string; - - cornersize: number; - getCornersize(): number; - setCornersize(value: number): IObject; - - fill: string; - getFill(): string; - setFill(value: string): IObject; - - fillRule: string; - getFillRule(): string; - setFillRule(value: string): IObject; - - flipX: boolean; - getFlipX(): boolean; - setFlipX(value: boolean): IObject; - - flipY: boolean; - getFlipY(): boolean; - setFlipY(value: boolean): IObject; - - hasBorders: boolean; - - hasControls: boolean; - hasRotatingPoint: boolean; - - height: number; - getHeight(): number; - setHeight(value: number): IObject; - - includeDefaultValues: boolean; - - left: number; - getLeft(): number; - setLeft(value: number): IObject; - - opacity: number; - getOpacity(): number; - setOpacity(value: number): IObject; - - overlayFill: string; - getOverlayFill(): string; - setOverlayFill(value: string): IObject; - - padding: number; - perPixelTargetFind: boolean; - rotatingPointOffset: number; - - scaleX: number; - getScaleX(): number; - setScaleX(value: number): IObject; - - scaleY: number; - getScaleY(): number; - setScaleY(value: number): IObject; - - selectable: boolean; - stateProperties: any[]; - stroke: string; - strokeDashArray: any[]; - strokeWidth: number; - - top: number; - getTop(): number; - setTop(value: number): IObject; - - transformMatrix: any[]; - transparentCorners: boolean; - type: string; - - width: number; - getWidth(): number; - setWidth(value: number): IObject; - - // methods - bringForward(intersecting?: boolean): IObject; - bringToFront(): IObject; - center(): IObject; - centerH(): IObject; - centerV(): IObject; - clone(callback?, propertiesToInclude?): IObject; - cloneAsImage(callback): IObject; - complexity(): number; - drawBorders(context: CanvasRenderingContext2D): IObject; - drawCorners(context: CanvasRenderingContext2D): IObject; - get (property: string): any; - getBoundingRect(): {left:number; top:number; width:number; height:number}; - getBoundingRectHeight(): number; - getBoundingRectWidth(): number; - getSvgStyles(): string; - getSvgTransform(): string; - hasStateChanged(): boolean; - initialize(options: any); - intersectsWithObject(other: IObject): boolean; - intersectsWithRect(selectionTL: any, selectionBR: any): boolean; - isActive(): boolean; - isContainedWithinObject(other: IObject): boolean; - isContainedWithinRect(selectionTL: any, selectionBR: any): boolean; - isType(type: string): boolean; - remove(): IObject; - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - rotate(value: number): IObject; - saveState(): IObject; - scale(value: number): IObject; - scaleToHeight(value: number): IObject; - scaleToWidth(value: number): IObject; - sendBackwards(intersecting?: boolean): IObject; - sendToBack(): IObject; - - set (properties: IObjectOptions): IObject; - set (name: string, value: any): IObject; - setActive(active: boolean): IObject; - setCoords(); - setGradientFill(options); - setOptions(options: any); - setSourcePath(value: string): IObject; - toDatalessObject(propertiesToInclude): any; - toDataURL(callback): string; - toggle(property): IObject; - toGrayscale(): IObject; - toJSON(propertiesToInclude): string; - toObject(propertiesToInclude): any; - tostring(): string; - transform(ctx: CanvasRenderingContext2D); - } - - export interface IGroup extends IObject { - type: string; - - activateAllObjects(): IGroup; - add(object): IGroup; - addWithUpdate(object): IGroup; - complexity(): number; - contains(object): boolean; - containsPoint(point): boolean; - destroy(): IGroup; - getObjects(): IObject[]; - hasMoved(): boolean; - initialize(options: any); - initialize(objects, options): any; - item(index): IObject; - remove(object?): IGroup; - removeWithUpdate(object): IGroup; - render(ctx, noTransform): void; - saveCoords(): IGroup; - setObjectsCoords(): IGroup; - size(): number; - toGrayscale(): IGroup; - toObject(propertiesToInclude: any[]): any; - tostring(): string; - toSVG(): string; - } - - - export interface ILine extends IObject { - x1: number; - x2: number; - y1: number; - y2: number; - - complexity(): number; - initialize(options: any); - initialize(points: number[], options: any): ILine; - toObject(propertiesToInclude: any[]): any; - toSVG(): string; - } - - export interface IIntersection { - appendPoint(status: string); - appendPoints(status: string); - init(status: string); - } - - export interface IImage extends IObject { - filters: any; - - applyFilters(callback); - clone(callback?, propertiesToInclude?): IObject; - clone(propertiesToInclude, callback); - complexity(): number; - getElement(): HTMLImageElement; - getOriginalSize(): { width: number; height: number; }; - getSrc(): string; - initialize(options: any); - initialize(element: string, options: any); - initialize(element: HTMLImageElement, options: any); - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - setElement(element): IImage; - toObject(propertiesToInclude): any; - tostring(): string; - toSVG(): string; - } - - export interface ICircle extends IObject { - // methods - complexity(): number; - getRadiusX(): number; - getRadiusY(): number; - initialize(options: ICircleOptions): ICircle; - setRadius(value: number): number; - toObject(propertiesToInclude): any; - toSVG(): string; - } - - - - export interface IPath extends IObject { - complexity(): number; - initialize(options: any); - initialize(path, options); - render(ctx: CanvasRenderingContext2D, noTransform: boolean); - toDatalessObject(propertiesToInclude): any; - toObject(propertiesToInclude): any; - tostring(): string; - toSVG(): string; - } - - export interface IPolygon extends IObject { - complexity(): number; - initialize(options: any); - initialize(points, options); - toObject(propertiesToInclude): any; - toSVG(): string; - } - - export interface IPolyline extends IObject { - complexity(): number; - initialize(options: any); - initialize(points, options); - toObject(propertiesToInclude): any; - toSVG(): string; - } - - export interface IPathGroup extends IObject { - complexity(): number; - initialize(options: any); - initialize(paths, options); - isSameColor(): boolean; - render(ctx: CanvasRenderingContext2D); - toDatalessObject(propertiesToInclude): any; - toGrayscale(): IPathGroup; - toObject(propertiesToInclude): any; - tostring(): string; - toSVG(): string; - } - - export interface IStaticCanvas extends IObservable { - - // fields - backgroundColor: string; - backgroundImage: string; - backgroundImageOpacity: number; - backgroundImageStretch: number; - clipTo(clipFunction: (context: CanvasRenderingContext2D) => void ); - controlsAboveOverlay: boolean; - includeDefaultValues: boolean; - overlayImage: string; - overlayImageLeft: number; - overlayImageTop: number; - renderOnAddition: boolean; - stateful: boolean; - - // static - EMPTY_JSON: string; - supports(methodName: string): boolean; - - // methods - add(...object: IObject[]): ICanvas; - bringForward(object: IObject): ICanvas; - calcOffset(): ICanvas; - centerObject(object: IObject): ICanvas; - centerObjectH(object: IObject): ICanvas; - centerObjectV(object: IObject): ICanvas; - clear(): ICanvas; - clearContext(context: CanvasRenderingContext2D): ICanvas; - complexity(): number; - dispose(): ICanvas; - drawControls(); - forEachObject(callback: (object: IObject) => void , context?: CanvasRenderingContext2D): ICanvas; - getActiveGroup(): IGroup; - getActiveObject(): IObject; - getCenter(): IObject; - getContext(): CanvasRenderingContext2D; - getElement(): HTMLCanvasElement; - getHeight(): number; - getObjects(): IObject[]; - getWidth(): number; - insertAt(object: IObject, index: number, nonSplicing: boolean): ICanvas; - isEmpty(): boolean; - item(index: number): IObject; - onBeforeScaleRotate(target: IObject); - remove(object: IObject): IObject; - renderAll(allOnTop?: boolean): ICanvas; - renderTop(): ICanvas; - - sendBackwards(object: IObject): ICanvas; - sendToBack(object: IObject): ICanvas; - setBackgroundImage(image: any, callback: () => any, options?): ICanvas; - setDimensions(object: { width: number; height: number; }): ICanvas; - setHeight(height: number): ICanvas; - setOverlayImage(url: string, callback: () => any, options): ICanvas; - setWidth(width: number): ICanvas; - toDatalessJSON(propertiesToInclude?: any[]): string; - toDatalessObject(propertiesToInclude?: any[]): string; - toDataURL(format: string, quality?: number): string; - toDataURLWithMultiplier(propertiesToInclude: any[]): string; - toGrayscale(propertiesToInclude: any[]): string; - toJSON(propertiesToInclude: any[]): string; - toObject(propertiesToInclude: any[]): string; - tostring(): string; - toSVG(): string; - } - - export interface ICanvas extends IStaticCanvas { - - // constructors - (element: HTMLCanvasElement): ICanvas; - (element: string): ICanvas; - - _objects: IObject[]; - - // fields - containerClass: string; - defaultCursor: string; - freeDrawingColor: string; - freeDrawingLineWidth: number; - hoverCursor: string; - interactive: boolean; - moveCursor: string; - perPixelTargetFind: boolean; - rotationCursor: string; - selection: boolean; - selectionBorderColor: string; - selectionColor: string; - selectionDashArray: number[]; - selectionLineWidth: number; - targetFindTolerance: number; - - // methods - containsPoint(e: Event, target: IObject): boolean; - deactivateAll(): ICanvas; - deactivateAllWithDispatch(): ICanvas; - discardActiveGroup(): ICanvas; - discardActiveObject(): ICanvas; - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, dashArray: number[]): ICanvas; - findTarget(e: MouseEvent, skipGroup: boolean): ICanvas; - getActiveGroup(): IGroup; - getActiveObject(): IObject; - getPointer(e): { x: number; y: number; }; - getSelectionContext(): CanvasRenderingContext2D; - getSelectionElement(): HTMLCanvasElement; - setActiveGroup(group: IGroup): ICanvas; - setActiveObject(object: IObject, e?): ICanvas; - - loadFromJSON(json, callback: () => void): void; - loadFromDatalessJSON(json, callback: () => void): void; - } - - export interface IPattern { - (options: IPatternOptions): IPattern; - - initialise(options: IPatternOptions): IPattern; - - toLive(ctx: CanvasRenderingContext2D): IPattern; - toObject(): any; - toSVG(): string; - - offsetX: number; - offsetY: number; - repeat: string; - source: any; - } - - export interface IBrightnessFilter { - } - export interface IInvertFilter { - } - export interface IRemoveWhiteFilter { - } - export interface IGrayscaleFilter { - } - export interface ISepiaFilter { - } - export interface ISepia2Filter { - } - export interface INoiseFilter { - } - export interface IGradientTransparencyFilter { - } - export interface IPixelateFilter { - } - export interface IConvoluteFilter { - } - - export interface ICanvasOptions { - containerClass?: string; - defaultCursor?: string; - freeDrawingColor?: string; - freeDrawingLineWidth?: number; - hoverCursor?: string; - interactive?: boolean; - moveCursor?: string; - perPixelTargetFind?: boolean; - rotationCursor?: string; - selection?: boolean; - selectionBorderColor?: string; - selectionColor?: string; - selectionDashArray?: number[]; - selectionLineWidth?: number; - targetFindTolerance?: number; - - backgroundColor?: string; - backgroundImage?: string; - backgroundImageOpacity?: number; - backgroundImageStretch?: number; - controlsAboveOverlay?: boolean; - includeDefaultValues?: boolean; - overlayImage?: string; - overlayImageLeft?: number; - overlayImageTop?: number; - renderOnAddition?: boolean; - stateful?: boolean; - } - - export interface IPatternOptions { - source: any; - offsetX: number; - offsetY: number; - repeat: string; - } - - export interface IRectOptions extends IObjectOptions { - x?: number; - y?: number; - rx?: number; - ry?: number; - } - - export interface ITriangleOptions extends IObjectOptions { - } - - var Rect: { - fromElement(element: SVGElement, options: IRectOptions): IRect; - fromObject(object): IRect; - new (options?: IRectOptions): IRect; - prototype: any; - } - - var Triangle: { - new (options?: ITriangleOptions): ITriangle; - } - - var Canvas: { - new (element: HTMLCanvasElement, options?: ICanvasOptions): ICanvas; - new (element: string, options?: ICanvasOptions): ICanvas; - - EMPTY_JSON: string; - supports(methodName: string): boolean; - prototype: any; - } - - var StaticCanvas: { - new (element: HTMLCanvasElement, options?: ICanvasOptions): ICanvas; - new (element: string, options?: ICanvasOptions): ICanvas; - - EMPTY_JSON: string; - supports(methodName: string): boolean; - prototype: any; - } - - var Pattern: { - new (options: IPatternOptions): IPattern; - - prototype: any; - } - - var Circle: { - ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options: ICircleOptions): ICircle; - fromObject(object): ICircle; - new (options?: ICircleOptions): ICircle; - prototype: any; - } - - var Group: { - new (items?: any[], options?: IObjectOptions): IGroup; - } - - var Line: { - ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options): ILine; - fromObject(object): ILine; - prototype: any; - new (points: number[], objObjects?: IObjectOptions): ILine; - } - - var Intersection: { - intersectLineLine(a1, a2, b1, b2); - intersectLinePolygon(a1, a2, points); - intersectPolygonPolygon(points1, points2); - intersectPolygonRectangle(points, r1, r2); - } - - var Path: { - fromElement(element: SVGElement, options): IPath; - fromObject(object): IPath; - new (): IPath; - } - - var PathGroup: { - fromObject(object): IPathGroup; - new (): IPathGroup; - prototype: any; - } - - var Point: { - new (x, y): IPoint; - prototype: any; - } - - var Object: { - prototype: any; - } - - var Polygon: { - fromObject(object): IPolygon; - fromElement(element: SVGElement, options): IPolygon; - new (): IPolygon; - prototype: any; - } - - var Polyline: { - fromObject(object): IPolyline; - fromElement(element: SVGElement, options): IPolyline; - new (): IPolyline; - prototype: any; - } - - var Text: { - new (text: string, options?: ITextOptions): IText; - } - - var Image: { - fromURL(url: string): IImage; - fromURL(url: string, callback: (image: IImage) => any): IImage; - fromURL(url: string, callback: (image: IImage) => any, objObjects: IObjectOptions): IImage; - new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; - prototype: any; - - filters: - { - Grayscale: { - new (): IGrayscaleFilter; - }; - Brightness: { - new (options?: { brightness: number; }): IBrightnessFilter; - }; - RemoveWhite: { - new (options?: { - threshold?: string; // TODO: Check this - distance?: string; // TODO: Check this - }): IRemoveWhiteFilter; - }; - Invert: { - new (): IInvertFilter; - }; - Sepia: { - new (): ISepiaFilter; - }; - Sepia2: { - new (): ISepia2Filter; - }; - Noise: { - new (options?: { - noise?: number; - }): INoiseFilter; - }; - GradientTransparency: { - new (options?: { - threshold?: number; - }): IGradientTransparencyFilter; - }; - Pixelate: { - new (options?: { - color?: any; - }): IPixelateFilter; - }; - Convolute: { - new (options?: { - matrix: any; - }): IConvoluteFilter; - }; - }; - - } - - var util: { - addClass(element: HTMLElement, className: string); - addListener(element, eventName: string, handler); - animate(options: { - onChange?: (value: number) => void; - onComplete?: () => void; - startValue?: number; - endValue?: number; - byValue?: number; - easing?: (currentTime, startValue, byValue, duration) => number; - duration?: number; - }); - createClass(parent, properties); - degreesToRadians(degrees: number): number; - falseFunction(): () => boolean; - getById(id: HTMLElement): HTMLElement; - getById(id: string): HTMLElement; - getElementOffset(element): { left: number; top: number; }; - getPointer(event: Event); - getRandomInt(min: number, max: number); - getScript(url: string, callback); - groupSVGElements(elements: any[], options, path?: string); - loadImage(url, callback, context); - makeElement(tagName: string, attributes); - makeElementSelectable(element: HTMLElement); - makeElementUnselectable(element: HTMLElement); - populateWithProperties(source, destination, properties): any[]; - radiansToDegrees(radians: number): number; - removeFromArray(array: any[], value); - removeListener(element: HTMLElement, eventName, handler); - request(url, options); - requestAnimFrame(callback, element); - setStyle(element: HTMLElement, styles); - toArray(arrayLike): any[]; - toFixed(number, fractionDigits); - wrapElement(element: HTMLElement, wrapper, attributes); - rotatePoint(point: IPoint, origin: IPoint, radians: number); - transformPoint(p: IPoint, t: any[], ignoreOffset: boolean); - invertTransform(t: any[]); - parseUnit(value: number|string, fontSize?: number); - getKlass(type: string, namespace: string); - resolveNamespace(namespace: string); - enlivenObjects(objects: any[], callback: Function, namespace: string, reviver: Function); - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]); - createCanvasElement(canvasEl?: HTMLElement); - createImage(); - createAccessors(klass: Object); - clipContext(receiver: IObject, ctx: CanvasRenderingContext2D); - isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number); - - } + function createCanvasForNode(width: number, height: number): ICanvas; + function getCSSRules(doc: SVGElement); + function getGradientDefs(doc: SVGElement); + function loadSVGFromString(text: string, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + function loadSVGFromURL(url, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + + /** + * Wrapper around `console.log` (when available) + */ + function log(values); + function parseAttributes(element, attributes: any[]): any; + function parseElements(elements: any[], callback, options, reviver); + function parsePointsAttribute(points: string): any[]; + function parseStyleAttribute(element: SVGElement); + function parseSVGDocument(doc: SVGElement, callback: (results, options) => void, reviver?: (el, obj) => void); + function parseTransformAttribute(attributeValue: string); + /** + * Wrapper around `console.warn` (when available) + */ + function warn(values); + + var isLikelyNode: boolean; + var isTouchSupported: boolean; + + /////////////////////////////////////////////////////////////////////////////// + // Data Object Interfaces - These intrface are not specific part of fabric, + // They are just helpful for for defining function paramters + ////////////////////////////////////////////////////////////////////////////// + export interface IDataURLOptions { + /** + * The format of the output image. Either "jpeg" or "png" + */ + format?: string; + /** + * Quality level (0..1). Only used for jpeg + */ + quality?: number; + /** + * Multiplier to scale by + */ + multiplier?: number; + /** + * Cropping left offset. Introduced in v1.2.14 + */ + left?: number; + /** + * Cropping top offset. Introduced in v1.2.14 + */ + top?: number; + /** + * Cropping width. Introduced in v1.2.14 + */ + width?: number; + /** + * Cropping height. Introduced in v1.2.14 + */ + height?: number; + } + + export interface IEvent { + e: Event; + target?: fabric.IObject; + } + + export interface IFillOptions { + /** + * options.source Pattern source + */ + source: string|HTMLImageElement; + /** + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ + repeat?: string; + /** + * Pattern horizontal offset from object's left/top corner + */ + offsetX?: number; + /** + * Pattern vertical offset from object's left/top corner + */ + offsetY?: number; + } + + export interface IGradientOptions { + /** + * @param {String} [options.type] Type of gradient 'radial' or 'linear' + */ + type?: string; + /** + * x-coordinate of start point + */ + x1?: number; + /** + * y-coordinate of start point + */ + y1?: number; + /** + * x-coordinate of end point + */ + x2?: number; + /** + * y-coordinate of end point + */ + y2?: number; + /** + * Radius of start point (only for radial gradients) + */ + r1?: number; + /** + * Radius of end point (only for radial gradients) + */ + r2?: number; + /** + * Color stops object eg. {0:string; 1:string; + */ + colorStops?: any; + } + + export interface IToSVGOptions { + /** + * If true xml tag is not included + */ + suppressPreamble: boolean; + /** + * SVG viewbox object + */ + viewBox: IViewBox; + /** + * Encoding of SVG output + */ + encoding: string; + } + + export interface IViewBox { + /** + * x-cooridnate of viewbox + */ + x: number; + /** + * y-coordinate of viewbox + */ + y: number; + /** + * Width of viewbox + */ + width: number; + /**Height of viewbox */ + height: number; + } + + export interface IFilter { + new (): IFilter; + new (options: any): IFilter; + } + + export interface IEventList { + [index: string]: (e: Event) => void; + } + + export interface IAnimationOptions { + /** + * Allows to specify starting value of animatable property (if we don't want current value to be used). + */ + from?: string|number; + /** + * Defaults to 500 (ms). Can be used to change duration of an animation. + */ + duration?: number; + /** + * Callback that's invoked during the animation. + */ + onChange?: Function; + /** + * Callback that's invoked at the end of the animation. + */ + onComplete?: Function + /** + * Easing function. Default: fabric.util.ease.easeInSine + */ + easing?: Function; + } + + /////////////////////////////////////////////////////////////////////////////// + // Mixins Interfaces + ////////////////////////////////////////////////////////////////////////////// + export interface ICollection { + /** + * Adds objects to collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * Objects should be instances of (or inherit from) fabric.Object + * @param {...fabric.Object} object Zero or more fabric instances + */ + add(...object: IObject[]): T; + + /** + * Inserts an object into collection at specified index, then renders canvas (if `renderOnAddRemove` is not `false`) + * An object should be an instance of (or inherit from) fabric.Object + * @param {Object} object Object to insert + * @param {Number} index Index to insert object at + * @param {Boolean} nonSplicing When `true`, no splicing (shifting) of objects occurs + * @return {Self} thisArg + * @chainable + */ + insertAt(object: IObject, index: number, nonSplicing: boolean): T; + + /** + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ + remove(...object: IObject[]): T; + + /** + * Executes given function for each object in this group + * @param {Function} callback + * @param {Object} context Context (aka thisObject) + * @return {Self} thisArg + */ + forEachObject(callback: (element: IObject, index: number, array: IObject[]) => any, context?: any): T; + + /** + * Returns an array of children objects of this instance + * Type parameter introduced in 1.3.10 + * @param {String} [type] When specified, only objects of this type are returned + * @return {Array} + */ + getObjects(type?: string): IObject[]; + + + /** + * Returns object at specified index + * @param {Number} index + * @return {Self} thisArg + */ + item(index: number): T; + + /** + * Returns true if collection contains no objects + * @return {Boolean} true if collection is empty + */ + isEmpty(): boolean; + + /** + * Returns a size of a collection (i.e: length of an array containing its objects) + * @return {Number} Collection size + */ + size(): number; + + /** + * Returns true if collection contains an object + * @param {Object} object Object to check against + * @return {Boolean} `true` if collection contains an object + */ + contains(object: IObject): boolean; + + /** + * Returns number representation of a collection complexity + * @return {Number} complexity + */ + complexity(): number; + } + + export interface IObservable { + /** + * Observes specified event + * @deprecated `observe` deprecated since 0.8.34 (use `on` instead) + * @param {String|Object} eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) + * @param {Function} handler Function that receives a notification when an event of the specified type occurs + */ + on(eventName: string|any, handler: (e: IEvent) => any): T; + /** + * Fires event with an optional options object + * @deprecated `fire` deprecated since 1.0.7 (use `trigger` instead) + * @param {String} eventName Event name to fire + * @param {Object} [options] Options object + */ + trigger(eventName: string, options?: any): T; + /** + * Stops event observing for a particular event handler. Calling this method + * without arguments removes all handlers for all events + * @deprecated `stopObserving` deprecated since 0.8.34 (use `off` instead) + * @param {String|Object} eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) + * @param {Function} handler Function to be deleted from EventListeners + */ + off(eventName: string|any, handler: (e) => any): T; + } + + + + /////////////////////////////////////////////////////////////////////////////// + // General Fabric Interfaces + ////////////////////////////////////////////////////////////////////////////// + export interface IColor { + /** + * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + */ + getSource(): number[]; + + /** + * Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + */ + setSource(source: number[]); + + /** + * Returns color represenation in RGB format ex: rgb(0-255,0-255,0-255) + */ + toRgb(): string; + + /** + * Returns color represenation in RGBA format ex: rgba(0-255,0-255,0-255,0-1) + */ + toRgba(): string; + + /** + * Returns color represenation in HSL format ex: hsl(0-360,0%-100%,0%-100%) + */ + toHsl(): string; + + /** + * Returns color represenation in HSLA format ex: hsla(0-360,0%-100%,0%-100%,0-1) + */ + toHsla(): string; + + /** + * Returns color represenation in HEX format ex: FF5555 + */ + toHex(): string; + + /** + * Gets value of alpha channel for this color + */ + getAlpha(): number; + + /** + * Sets value of alpha channel for this color + * @param {Number} alpha Alpha value 0-1 + */ + setAlpha(alpha: number); + + /** + * Transforms color to its grayscale representation + */ + toGrayscale(): IColor; + + /** + * Transforms color to its black and white representation + * @param {Number} threshold + */ + toBlackWhite(threshold: number): IColor; + /** + * Overlays color with another color + * @param {String|fabric.Color} otherColor + */ + overlayWith(otherColor: string|IColor): IColor; + } + + export interface IGradient { + initialize(options): any; + toObject(): any; + toLiveGradient(ctx: CanvasRenderingContext2D): any; + } + + export interface IIntersection { + /** + * Appends a point to intersection + */ + appendPoint(point: fabric.IPoint); + /** + * Appends points to intersection + */ + appendPoints(point: fabric.IPoint); + + init(status?: string); + /** + * Checks if polygon intersects another polygon + */ + intersectPolygonPolygon(points1: IPoint[], points2: IPoint[]): IIntersection; + /** + * Checks if line intersects polygon + */ + intersectLinePolygon(a1: IPoint, a2: IPoint, points: IPoint[]): IIntersection + /** + * Checks if one line intersects another + */ + intersectLineLine(a1: IPoint, a2: IPoint, b1: IPoint, b2: IPoint): IIntersection + /** + * Checks if polygon intersects rectangle + */ + intersectPolygonRectangle(points: IPoint[], r1: number, r2: number): IIntersection; + } + + export interface IPoint { + x: number; + y: number; + /** + * Adds another point to this one and returns another one + * @param {fabric.Point} that + * @return {fabric.Point} new Point instance with added values + */ + add(that: IPoint): IPoint; + + /** + * Adds another point to this one + * @param {fabric.Point} that + * @return {fabric.Point} thisArg + */ + addEquals(that: IPoint): IPoint; + + /** + * Adds value to this point and returns a new one + * @param {Number} scalar + * @return {fabric.Point} new Point with added value + */ + scalarAdd(scalar: number): IPoint; + + /** + * Adds value to this point + * @param {Number} scalar + * @return {fabric.Point} thisArg + */ + scalarAddEquals(scalar: number): IPoint; + + /** + * Subtracts another point from this point and returns a new one + * @param {fabric.Point} that + * @return {fabric.Point} new Point object with subtracted values + */ + subtract(that: IPoint): IPoint + + /** + * Subtracts another point from this point + * @param {fabric.Point} that + * @return {fabric.Point} thisArg + */ + subtractEquals(that): IPoint; + + /** + * Subtracts value from this point and returns a new one + * @param {Number} scalar + * @return {fabric.Point} + */ + scalarSubtract(scalar: number): IPoint; + + /** + * Subtracts value from this point + * @param {Number} scalar + * @return {fabric.Point} thisArg + */ + scalarSubtractEquals(scalar: number): IPoint; + + /** + * Miltiplies this point by a value and returns a new one + * @param {Number} scalar + * @return {fabric.Point} + */ + multiply(scalar: number): IPoint; + + /** + * Miltiplies this point by a value + * @param {Number} scalar + * @return {fabric.Point} thisArg + */ + multiplyEquals(scalar): IPoint; + + /** + * Divides this point by a value and returns a new one + * @param {Number} scalar + * @return {fabric.Point} + */ + divide(scalar): IPoint; + + /** + * Divides this point by a value + * @param {Number} scalar + * @return {fabric.Point} thisArg + */ + divideEquals(scalar: number): IPoint; + + /** + * Returns true if this point is equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + eq(that: IPoint): IPoint; + + /** + * Returns true if this point is less than another one + * @param {fabric.Point} that + * @return {Boolean} + */ + lt(that: IPoint): IPoint; + + /** + * Returns true if this point is less than or equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + lte(that: IPoint): IPoint; + + /** + * Returns true if this point is greater another one + * @param {fabric.Point} that + * @return {Boolean} + */ + gt(that: IPoint): IPoint; + + /** + * Returns true if this point is greater than or equal to another one + * @param {fabric.Point} that + * @return {Boolean} + */ + gte(that: IPoint): IPoint; + + /** + * Returns new point which is the result of linear interpolation with this one and another one + * @param {fabric.Point} that + * @param {Number} t + * @return {fabric.Point} + */ + lerp(that, t: number): IPoint; + + /** + * Returns distance from this point and another one + * @param {fabric.Point} that + * @return {Number} + */ + distanceFrom(that: IPoint): number; + + /** + * Returns the point between this point and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + midPointFrom(that: IPoint): IPoint; + + /** + * Returns a new point which is the min of this and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + min(that: IPoint): IPoint; + + /** + * Returns a new point which is the max of this and another one + * @param {fabric.Point} that + * @return {fabric.Point} + */ + max(that: IPoint): IPoint; + + /** + * Returns string representation of this point + * @return {String} + */ + toString(): string; + + /** + * Sets x/y of this point + * @param {Number} x + * @param {Number} y + */ + setXY(x, y: IPoint): IPoint; + + /** + * Sets x/y of this point from another point + * @param {fabric.Point} that + */ + setFromPoint(that: IPoint): IPoint; + + /** + * Swaps x/y of this point and another point + * @param {fabric.Point} that + */ + swap(that: IPoint): IPoint; + } + + export interface IShadowOptions { + /** + * Whether the shadow should affect stroke operations + */ + affectStrike: boolean; + /** + * Shadow blur + */ + blur: number; + /** + * Shadow color + */ + color: string; + /** + * Indicates whether toObject should include default values + */ + includeDefaultValues: boolean; + /** + * Shadow horizontal offset + */ + offsetX: number; + /** + * Shadow vertical offset + */ + offsetY: number; + } + export interface IShadow extends IShadowOptions { + initialize(options?: IShadowOptions|string): IShadow; + /** + * Returns object representation of a shadow + */ + toObject(): IObject; + /** + * Returns a string representation of an instance, CSS3 text-shadow declaration + */ + toString(): string; + /** + * Returns SVG representation of a shadow + * @param {fabric.Object} object + */ + toSVG(object: IObject): string; + + /** + * Regex matching shadow offsetX, offsetY and blur, Static + */ + reOffsetsAndBlur: RegExp + } + + /////////////////////////////////////////////////////////////////////////////// + // Canvas Interfaces + ////////////////////////////////////////////////////////////////////////////// + export interface ICanvasDimensions { + /** + * Width of canvas element + */ + width: number; + /** + * Height of canvas element + */ + height: number; + } + + export interface ICanvasDimensionsOptions { + /** + * Set the given dimensions only as canvas backstore dimensions + */ + backstoreOnly?: boolean; + /** + * Set the given dimensions only as css dimensions + */ + cssOnly?: boolean; + } + + export interface IStaticCanvas extends IObservable, IStaticCanvasOptions, ICollection { + /** + * Calculates canvas element offset relative to the document + * This method is also attached as "resize" event handler of window + */ + calcOffset(): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#overlayImage|overlay image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set overlay to + * @param {Function} callback callback to invoke when image is loaded and set as an overlay + * @param {Object} [options] Optional options to set for the {@link fabric.Image|overlay image}. + */ + setOverlayImage(image: IImage | string, callback: Function, options?: IObjectOptions): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#backgroundImage|background image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set background to + * @param {Function} callback Callback to invoke when image is loaded and set as background + * @param {Object} [options] Optional options to set for the {@link fabric.Image|background image}. + */ + setBackgroundImage(image: IImage|string, callback: Function, options?: IObjectOptions): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#overlayColor|background color} for this canvas + * @param {(String|fabric.Pattern)} overlayColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + */ + setOverlayColor(overlayColor: string|IPattern, callback: Function): IStaticCanvas; + + /** + * Sets {@link fabric.StaticCanvas#backgroundColor|background color} for this canvas + * @param {(String|fabric.Pattern)} backgroundColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + */ + setBackgroundColor(backgroundColor: string|IPattern, callback: Function): IStaticCanvas; + + /** + * Returns canvas width (in px) + */ + getWidth(): number; + + /** + * Returns canvas height (in px) + */ + getHeight(): number; + + /** + * Sets width of this canvas instance + * @param {Number|String} value Value to set width to + * @param {Object} [options] Options object + */ + setWidth(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas + + /** + * Sets height of this canvas instance + * @param {Number|String} value Value to set height to + * @param {Object} [options] Options object + */ + setHeight(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas + + /** + * Sets dimensions (width, height) of this canvas instance. when options.cssOnly flag active you should also supply the unit of measure (px/%/em) + * @param {Object} dimensions Object with width/height properties + * @param {Object} [options] Options object + */ + setDimensions(dimensions: ICanvasDimensions, options?: ICanvasDimensionsOptions): IStaticCanvas; + + /** + * Returns canvas zoom level + */ + getZoom(): number; + + /** + * Sets viewport transform of this canvas instance + * @param {Array} vpt the transform in the form of context.transform + */ + setViewportTransform(vpt: number[]): IStaticCanvas; + + + /** + * Sets zoom level of this canvas instance, zoom centered around point + * @param {fabric.Point} point to zoom with respect to + * @param {Number} value to set zoom to, less than 1 zooms out + */ + zoomToPoint(point: IPoint, value: number): IStaticCanvas; + + /** + * Sets zoom level of this canvas instance + * @param {Number} value to set zoom to, less than 1 zooms out + */ + setZoom(value: number): IStaticCanvas; + + /** + * Pan viewport so as to place point at top left corner of canvas + * @param {fabric.Point} point to move to + */ + absolutePan(point: IPoint): IStaticCanvas; + + /** + * Pans viewpoint relatively + * @param {fabric.Point} point (position vector) to move by + */ + relativePan(point: IPoint): IStaticCanvas; + + /** + * Returns element corresponding to this instance + */ + getElement(): HTMLCanvasElement; + + /** + * Returns currently selected object, if any + */ + getActiveObject(): IObject; + + /** + * Returns currently selected group of object, if any + */ + getActiveGroup(): IGroup; + + /** + * Clears specified context of canvas element + * @param {CanvasRenderingContext2D} ctx Context to clear + * @chainable + */ + clearContext(ctx: CanvasRenderingContext2D): IStaticCanvas; + + /** + * Returns context of canvas where objects are drawn + */ + getContext(): CanvasRenderingContext2D; + + /** + * Clears all contexts (background, main, top) of an instance + */ + clear(): IStaticCanvas; + + /** + * Renders both the top canvas and the secondary container canvas. + * @param {Boolean} [allOnTop] Whether we want to force all images to be rendered on the top canvas + * @chainable + */ + renderAll(allOnTop?: boolean): IStaticCanvas; + + /** + * Method to render only the top canvas. + * Also used to render the group selection box. + * @chainable + */ + renderTop(): IStaticCanvas; + + /** + * Returns coordinates of a center of canvas. + * Returned value is an object with top and left properties + */ + getCenter(): { top: number; left: number; } + + /** + * Centers object horizontally. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center horizontally + */ + centerObjectH(object: IObject): IStaticCanvas; + + /** + * Centers object vertically. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center vertically + */ + centerObjectV(object: IObject): IStaticCanvas; + + /** + * Centers object vertically and horizontally. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center vertically and horizontally + */ + centerObject(object: IObject): IStaticCanvas; + + /** + * Returs dataless JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toDatalessJSON(propertiesToInclude?: any[]): string; + + /** + * Returns object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toObject(propertiesToInclude?: any[]): any; + + /** + * Returns dataless object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toDatalessObject(propertiesToInclude?: any[]): any; + + /** + * When true, getSvgTransform() will apply the StaticCanvas.viewportTransform to the SVG transformation. When true, + * a zoomed canvas will then produce zoomed SVG output. + */ + svgViewportTransformation: boolean; + + /** + * Returns SVG representation of canvas + * @param {Object} [options] Options object for SVG output + * @param {Function} [reviver] Method for further parsing of svg elements, called after each fabric object converted into svg representation. + */ + toSVG(options: IToSVGOptions, reviver?: Function): string; + + /** + * Moves an object to the bottom of the stack of drawn objects + * @param {fabric.Object} object Object to send to back + * @chainable + */ + sendToBack(object: IObject): IStaticCanvas; + + /** + * Moves an object to the top of the stack of drawn objects + * @param {fabric.Object} object Object to send + * @chainable + */ + bringToFront(object: IObject): IStaticCanvas; + + /** + * Moves an object down in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + * @chainable + */ + sendBackwards(object: IObject): IStaticCanvas; + + /** + * Moves an object up in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + * @chainable + */ + bringForward(object: IObject): IStaticCanvas; + /** + * Moves an object to specified level in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Number} index Position to move to + * @chainable + */ + moveTo(object: IObject, index: number): IStaticCanvas; + + /** + * Clears a canvas element and removes all event listeners + */ + dispose(): IStaticCanvas; + + /** + * Returns a string representation of an instance + */ + toString(): string; + + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * + * @param {String} methodName Method to check support for; + * Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" + * @return {Boolean | null} `true` if method is supported (or at least exists), + * `null` if canvas element or context can not be initialized + */ + supports(methodName: string): boolean; + EMPTY_JSON: string; + + // methods + onBeforeScaleRotate(target: IObject); + toGrayscale(propertiesToInclude: any[]): string; + } + + export interface ICanvas extends IStaticCanvas, ICanvasOptions { + // constructors + new (element: HTMLCanvasElement|string, options: ICanvasOptions): ICanvas; + + _objects: IObject[]; + + // fields + freeDrawingColor: string; + freeDrawingLineWidth: number; + + /** + * Checks if point is contained within an area of given object + * @param {Event} e Event object + * @param {fabric.Object} target Object to test against + */ + containsPoint(e: Event, target: IObject): boolean; + /** + * Deactivates all objects on canvas, removing any active group or object + * @return {fabric.Canvas} thisArg + */ + deactivateAll(): ICanvas; + /** + * Deactivates all objects and dispatches appropriate events + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + */ + deactivateAllWithDispatch(e?: Event): ICanvas; + /** + * Discards currently active group + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + */ + discardActiveGroup(e?: Event): ICanvas; + /** + * Discards currently active object + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + * @chainable + */ + discardActiveObject(e?: Event): ICanvas; + /** + * Draws objects' controls (borders/controls) + * @param {CanvasRenderingContext2D} ctx Context to render controls on + */ + drawControls(ctx: CanvasRenderingContext2D): void; + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, dashArray: number[]): ICanvas; + /** + * Method that determines what object we are clicking on + * @param {Event} e mouse event + * @param {Boolean} skipGroup when true, group is skipped and only objects are traversed through + */ + findTarget(e: MouseEvent, skipGroup: boolean): ICanvas; + /** + * Returns currently active group + * @return {fabric.Group} Current group + */ + getActiveGroup(): IGroup; + /** + * Returns currently active object + * @return {fabric.Object} active object + */ + getActiveObject(): IObject; + /** + * Returns pointer coordinates relative to canvas. + * @param {Event} e + * @return {Object} object with "x" and "y" number values + */ + getPointer(e: Event, ignoreZoom?: boolean, upperCanvasEl?: CanvasRenderingContext2D): { x: number; y: number; }; + /** + * Returns context of canvas where object selection is drawn + * @return {CanvasRenderingContext2D} + */ + getSelectionContext(): CanvasRenderingContext2D; + /** + * Returns element on which object selection is drawn + * @return {HTMLCanvasElement} + */ + getSelectionElement(): HTMLCanvasElement; + /** + * Returns true if object is transparent at a certain location + * @param {fabric.Object} target Object to check + * @param {Number} x Left coordinate + * @param {Number} y Top coordinate + */ + isTargetTransparent(target: IObject, x: number, y: number): boolean; + /** + * Sets active group to a speicified one + * @param {fabric.Group} group Group to set as a current one + * @param {Event} [e] Event (passed along when firing) + */ + setActiveGroup(group: IGroup, e?: Event): ICanvas; + /** + * Sets given object as the only active object on canvas + * @param {fabric.Object} object Object to set as an active one + * @param {Event} [e] Event (passed along when firing "object:selected") + */ + setActiveObject(object: IObject, e?: Event): ICanvas; + /** + * Set the cursor type of the canvas element + * @param {String} value Cursor type of the canvas element. + * @see http://www.w3.org/TR/css3-ui/#cursor + */ + setCursor(value: string): void; + + + loadFromJSON(json, callback: () => void): void; + loadFromDatalessJSON(json, callback: () => void): void; + } + + /////////////////////////////////////////////////////////////////////////////// + // Shape Interfaces + ////////////////////////////////////////////////////////////////////////////// + + export interface ICircleOptions extends IObjectOptions { + /** + * Radius of this circle + */ + radius?: number; + /** + * Start angle of the circle, moving clockwise + */ + startAngle?: number; + + /** + * End angle of the circle + */ + endAngle?: number; + } + export interface ICircle extends IObject, ICircleOptions { + initialize(options?: ICircleOptions): ICircle; + + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + /** + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRadiusX(): number; + /** + * Returns vertical radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRadiusY(): number; + /** + * Sets radius of an object (and updates width accordingly) + * @return {Number} + */ + setRadius(value: number): number; + + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IEllipseOptions extends IObjectOptions { + /** + * Horizontal radius + */ + rx?: number; + /** + * Vertical radius + */ + ry?: number; + } + export interface IEllipse extends IObject, IEllipseOptions { + initialize(options?: IEllipseOptions): IEllipse; + /** + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRx(): number; + + /** + * Returns Vertical radius of an object (according to how an object is scaled) + * @return {Number} + */ + getRy(): number; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity(): number; + } + + export interface IGroup extends IObject, ICollection { + initialize(objects?: IObject[], options?: IObjectOptions): any; + type: string; + + activateAllObjects(): IGroup; + /** + * Adds an object to a group; Then recalculates group's dimension, position. + * @param {Object} object + * @return {fabric.Group} thisArg + * @chainable + */ + addWithUpdate(object: IObject): IGroup; + containsPoint(point): boolean; + /** + * Destroys a group (restoring state of its objects) + * @return {fabric.Group} thisArg + * @chainable + */ + destroy(): IGroup; + /** + * Returns requested property + * @param {String} prop Property to get + * @return {Any} + */ + get(prop: string): any; + /** + * Checks whether this group was moved (since `saveCoords` was called last) + * @return {Boolean} true if an object was moved (since fabric.Group#saveCoords was called) + */ + hasMoved(): boolean; + /** + * Removes an object from a group; Then recalculates group's dimension, position. + * @param {Object} object + * @return {fabric.Group} thisArg + * @chainable + */ + removeWithUpdate(object: IObject): IGroup; + /** + * Renders instance on a given context + * @param {CanvasRenderingContext2D} ctx context to render instance on + */ + render(ctx: CanvasRenderingContext2D): void; + /** + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ + remove(...object: IObject[]): IGroup; + /** + * Saves coordinates of this instance (to be used together with `hasMoved`) + * @saveCoords + * @return {fabric.Group} thisArg + * @chainable + */ + saveCoords(): IGroup; + /** + * Sets coordinates of all group objects + * @return {fabric.Group} thisArg + * @chainable + */ + setObjectsCoords(): IGroup; + toGrayscale(): IGroup; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns string represenation of a group + * @return {String} + */ + toString(): string; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IImageOptions extends IObjectOptions { + /** + * crossOrigin value (one of "", "anonymous", "allow-credentials") + */ + crossOrigin: string; + + /** + * AlignX value, part of preserveAspectRatio (one of "none", "mid", "min", "max") + * This parameter defines how the picture is aligned to its viewport when image element width differs from image width. + */ + alignX: string; + + /** + * AlignY value, part of preserveAspectRatio (one of "none", "mid", "min", "max") + * This parameter defines how the picture is aligned to its viewport when image element height differs from image height. + */ + alignY: string; + + /** + * meetOrSlice value, part of preserveAspectRatio (one of "meet", "slice"). + * if meet the image is always fully visibile, if slice the viewport is always filled with image. + * @see http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute + */ + meetOrSlice: string; + + /** + * Image filter array + */ + filters: IFilter[]; + } + export interface IImage extends IObject, IImageOptions { + initialize(element?: string|HTMLImageElement, options?: IImageOptions); + /** + * Applies filters assigned to this image (from "filters" array) + * @param {Function} callback Callback is invoked when all filters have been applied and new image is generated + */ + applyFilters(callback: Function); + /** + * Returns a clone of an instance + * @param {Function} callback Callback is invoked with a clone as a first argument + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + clone(callback?: Function, propertiesToInclude?: any[]): IObject; + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + /** + * Returns image element which this instance if based on + * @return {HTMLImageElement} Image element + */ + getElement(): HTMLImageElement; + /** + * Returns original size of an image + * @return {Object} Object with "width" and "height" properties + */ + getOriginalSize(): { width: number; height: number; }; + /** + * Returns source of an image + * @return {String} Source of an image + */ + getSrc(): string; + render(ctx: CanvasRenderingContext2D, noTransform: boolean); + + /** + * Sets image element for this instance to a specified one. + * If filters defined they are applied to new image. + * You might need to call `canvas.renderAll` and `object.setCoords` after replacing, to render new image and update controls area. + * @param {HTMLImageElement} element + * @param {Function} [callback] Callback is invoked when all filters have been applied and new image is generated + * @param {Object} [options] Options object + */ + setElement(element: HTMLImageElement, callback: Function, options: IImageOptions): IImage; + /** + * Sets crossOrigin value (on an instance and corresponding image element) + */ + setCrossOrigin(value): IImage; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns string representation of an instance + * @return {String} String representation of an instance + */ + toString(): string; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + /** + * Sets source of an image + * @param {String} src Source string (URL) + * @param {Function} [callback] Callback is invoked when image has been loaded (and all filters have been applied) + * @param {Object} [options] Options object + */ + setSrc(src: string, callback: Function, options: IImageOptions): IImage; + } + + export interface ILineOptions extends IObjectOptions { + /** + * x value or first line edge + */ + x1: number; + /** + * x value or second line edge + */ + x2: number; + /** + * y value or first line edge + */ + y1: number; + /** + * y value or second line edge + */ + y2: number; + } + export interface ILine extends IObject, ILineOptions { + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity(): number; + initialize(points?: number[], options?: ILineOptions): ILine; + /** + * Returns object representation of an instance + * @methd toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude: any[]): any; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IObjectOptions { + /** + * Type of an object (rect, circle, path, etc.). + * Note that this property is meant to be read-only and not meant to be modified. + * If you modify, certain parts of Fabric (such as JSON loading) won't work correctly. + */ + type?: string; + + /** + * Horizontal origin of transformation of an object (one of "left", "right", "center") + */ + originX?: string; + + /** + * Vertical origin of transformation of an object (one of "top", "bottom", "center") + */ + originY?: string; + + /** + * Top position of an object. Note that by default it's relative to object center. You can change this by setting originY={top/center/bottom} + */ + top?: number; + + /** + * Left position of an object. Note that by default it's relative to object center. You can change this by setting originX={left/center/right} + */ + left?: number; + + /** + * Object width + */ + width?: number; + + /** + * Object height + */ + height?: number; + + /** + * Object scale factor (horizontal) + */ + scaleX?: number; + + /** + * Object scale factor (vertical) + */ + scaleY?: number; + + /** + * When true, an object is rendered as flipped horizontally + */ + flipX?: boolean; + + /** + * When true, an object is rendered as flipped vertically + */ + flipY?: boolean; + + /** + * Opacity of an object + */ + opacity?: number; + + /** + * Angle of rotation of an object (in degrees) + */ + angle?: number; + + /** + * Size of object's controlling corners (in pixels) + */ + cornerSize?: number; + + /** + * When true, object's controlling corners are rendered as transparent inside (i.e. stroke instead of fill) + */ + transparentCorners?: boolean; + + /** + * Default cursor value used when hovering over this object on canvas + */ + hoverCursor?: string; + + /** + * Padding between object and its controlling borders (in pixels) + */ + padding?: number; + + /** + * Color of controlling borders of an object (when it's active) + */ + borderColor?: string; + + /** + * Color of controlling corners of an object (when it's active) + */ + cornerColor?: string; + + /** + * When true, this object will use center point as the origin of transformation + * when being scaled via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredScaling?: boolean; + + /** + * When true, this object will use center point as the origin of transformation + * when being rotated via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredRotation?: boolean; + + /** + * Color of object's fill + */ + fill?: string; + + /** + * Fill rule used to fill an object + * accepted values are nonzero, evenodd + * Backwards incompatibility note: This property was used for setting globalCompositeOperation until v1.4.12 (use `fabric.Object#globalCompositeOperation` instead) + */ + fillRule?: string; + + /** + * Composite rule used for canvas globalCompositeOperation + */ + globalCompositeOperation?: string; + + /** + * Background color of an object. Only works with text objects at the moment. + */ + backgroundColor?: string; + + /** + * When defined, an object is rendered via stroke and this property specifies its color + */ + stroke?: string; + + /** + * Width of a stroke used to render this object + */ + strokeWidth?: number; + + /** + * Array specifying dash pattern of an object's stroke (stroke must be defined) + */ + strokeDashArray?: any[]; + + /** + * Line endings style of an object's stroke (one of "butt", "round", "square") + */ + strokeLineCap?: string; + + /** + * Corner style of an object's stroke (one of "bevil", "round", "miter") + */ + strokeLineJoin?: string; + + /** + * Maximum miter length (used for strokeLineJoin = "miter") of an object's stroke + */ + strokeMiterLimit?: number; + + /** + * Shadow object representing shadow of this shape + */ + shadow?: IShadow|string; + + /** + * Opacity of object's controlling borders when object is active and moving + */ + borderOpacityWhenMoving?: number; + + /** + * Scale factor of object's controlling borders + */ + borderScaleFactor?: number; + + /** + * Transform matrix (similar to SVG's transform matrix) + */ + transformMatrix?: any[]; + + /** + * Minimum allowed scale value of an object + */ + minScaleLimit?: number; + + /** + * When set to `false`, an object can not be selected for modification (using either point-click-based or group-based selection). + * But events still fire on it. + */ + selectable?: boolean; + + /** + * When set to `false`, an object can not be a target of events. All events propagate through it. Introduced in v1.3.4 + */ + evented?: boolean; + + /** + * When set to `false`, an object is not rendered on canvas + */ + visible?: boolean; + + /** + * When set to `false`, object's controls are not displayed and can not be used to manipulate object + */ + hasControls?: boolean; + + /** + * When set to `false`, object's controlling borders are not rendered + */ + hasBorders?: boolean; + + /** + * When set to `false`, object's controlling rotating point will not be visible or selectable + */ + hasRotatingPoint?: boolean; + + /** + * Offset for object's controlling rotating point (when enabled via `hasRotatingPoint`) + */ + rotatingPointOffset?: number; + + /** + * When set to `true`, objects are "found" on canvas on per-pixel basis rather than according to bounding box + */ + perPixelTargetFind?: boolean; + + /** + * When `false`, default object's values are not included in its serialization + */ + includeDefaultValues?: boolean; + + /** + * Function that determines clipping of an object (context is passed as a first argument) + * Note that context origin is at the object's center point (not left/top corner) + * @type Function + */ + clipTo?: Function; + + /** + * When `true`, object horizontal movement is locked + */ + lockMovementX?: boolean; + + /** + * When `true`, object vertical movement is locked + */ + lockMovementY?: boolean; + + /** + * When `true`, object rotation is locked + */ + lockRotation?: boolean; + + /** + * When `true`, object horizontal scaling is locked + */ + lockScalingX?: boolean; + + /** + * When `true`, object vertical scaling is locked + */ + lockScalingY?: boolean; + + /** + * When `true`, object non-uniform scaling is locked + */ + lockUniScaling?: boolean; + + /** + * When `true`, object cannot be flipped by scaling into negative values + */ + lockScalingFlip?: boolean; + + /** + * Not used by fabric, just for convenience + */ + name?: string; + + /** + * Not used by fabric, just for convenience + */ + data?: any; + } + export interface IObject extends IObservable, IObjectOptions { + /** + * Animates object's properties + * object.animate('left', ..., {duration: ...}); + * @param property Property to animate + * @param value Value to animate property + * @param options The animation options + */ + animate(property: string, value: number | string, options?: IAnimationOptions): IObject; + /** + * Animates object's properties + * object.animate({ left: ..., top: ... }, { duration: ... }); + * @param properties Properties to animate + * @param value Options object + */ + animate(properties: any, options?: IAnimationOptions): IObject; + + getCurrentWidth(): number; + getCurrentHeight(): number; + + getAngle(): number; + setAngle(value: number): IObject; + + getBorderColor(): string; + setBorderColor(value: string): IObject; + + getBorderScaleFactor(): number; + + + getCornersize(): number; + setCornersize(value: number): IObject; + + getFill(): string; + setFill(value: string): IObject; + + getFillRule(): string; + setFillRule(value: string): IObject; + + getFlipX(): boolean; + setFlipX(value: boolean): IObject; + + getFlipY(): boolean; + setFlipY(value: boolean): IObject; + + getHeight(): number; + setHeight(value: number): IObject; + + getLeft(): number; + setLeft(value: number): IObject; + + getOpacity(): number; + setOpacity(value: number): IObject; + + overlayFill: string; + getOverlayFill(): string; + setOverlayFill(value: string): IObject; + + getScaleX(): number; + setScaleX(value: number): IObject; + + getScaleY(): number; + setScaleY(value: number): IObject; + + setShadow(options: any): IObject; + getShadow(): IObject; + + stateProperties: any[]; + getTop(): number; + setTop(value: number): IObject; + + getWidth(): number; + setWidth(value: number): IObject; + + /* * Sets object's properties from options + * @param {Object} [options] Options object + */ + setOptions(options: any): void; + + /** + * Transforms context when rendering an object + * @param {CanvasRenderingContext2D} ctx Context + * @param {Boolean} fromLeft When true, context is transformed to object's top/left corner. This is used when rendering text on Node + */ + transform(ctx: CanvasRenderingContext2D, fromLeft: boolean): void; + + /** + * Returns an object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toObject(propertiesToInclude?: any[]): any; + + /** + * Returns (dataless) object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toDatalessObject(propertiesToInclude?: any[]): any; + + /** + * Returns a string representation of an instance + */ + toString(): string; + + /** + * Basic getter + * @param {String} property Property name + */ + get(property: string): any; + + /** + * Sets property to a given value. When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. + * If you need to update those, call `setCoords()`. + * @param {String|Object} key Property name or object (if object, iterate over the object properties) + * @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one) + */ + set(key: string|any, value: any|Function): IObject; + + /** + * Toggles specified property from `true` to `false` or from `false` to `true` + * @param {String} property Property to toggle + */ + toggle(property: string): IObject; + + /** + * Sets sourcePath of an object + * @param {String} value Value to set sourcePath to + */ + setSourcePath(value): IObject + + /** + * Retrieves viewportTransform from Object's canvas if possible + * @method getViewportTransform + * @memberOf fabric.Object.prototype + */ + getViewportTransform(): boolean; + + + /** + * Renders an object on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} [noTransform] When true, context is not transformed + */ + render(ctx: CanvasRenderingContext2D, noTransform?: boolean): void; + + /** + * Clones an instance + * @param {Function} callback Callback is invoked with a clone as a first argument + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + clone(callback: Function, propertiesToInclude?: any[]): IObject; + + /** + * Creates an instance of fabric.Image out of an object + * @param {Function} callback callback, invoked with an instance as a first argument + */ + cloneAsImage(callback: (image: IImage) => any): IObject; + + + /** + * Converts an object into a data-url-like string + * @param options Options object + */ + toDataURL(options: IDataURLOptions): string; + + /** + * Returns true if specified type is identical to the type of an instance + * @param {String} type Type to check against + */ + isType(type: string): boolean; + + /** + * Returns complexity of an instance + */ + complexity(): number; + + /** + * Returns a JSON representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toJSON(propertiesToInclude?: any[]): any; + + + + /** + * Sets gradient (fill or stroke) of an object + * Backwards incompatibility note: This method was named "setGradientFill" until v1.1.0 + * @param {String} property Property name 'stroke' or 'fill' + * @param {Object} [options] Options object + */ + setGradient(property: string, options: IGradientOptions): IObject; + + /** + * Sets pattern fill of an object + * @param {Object} options Options object + */ + setPatternFill(options: IFillOptions): IObject; + + /** + * Sets shadow of an object + * @param {String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") + */ + setShadow(options?: string): IObject; + /** + * Sets shadow of an object + * @param [options] Options object + */ + setShadow(options: IShadow): IObject; + + /** + * Sets "color" of an instance (alias of `set('fill', …)`) + * @param {String} color Color value + */ + setColor(color: string): IObject; + + /** + * Sets "angle" of an instance + * @param {Number} angle Angle value + */ + setAngle(angle: number): IObject + + /** + * Sets "angle" of an instance + * @param {Number} angle Angle value + */ + rotate(angle: number): IObject + + /** + * Centers object horizontally on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + */ + centerH(): void; + + /** + * Centers object vertically on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + */ + centerV(): void; + + /** + * Centers object vertically and horizontally on canvas to which is was added last + * You might need to call `setCoords` on an object after centering, to update controls area. + */ + center(): void; + + /** + * Removes object from canvas to which it was added last + */ + remove(): IObject; + + /** + * Returns coordinates of a pointer relative to an object + * @param {Event} e Event to operate upon + * @param {Object} [pointer] Pointer to operate upon (instead of event) + */ + getLocalPointer(e: Event, pointer: any): any; + + // methods + bringForward(intersecting?: boolean): IObject; + bringToFront(): IObject; + drawBorders(context: CanvasRenderingContext2D): IObject; + drawCorners(context: CanvasRenderingContext2D): IObject; + getBoundingRect(): { left: number; top: number; width: number; height: number }; + getBoundingRectHeight(): number; + getBoundingRectWidth(): number; + getSvgStyles(): string; + getSvgTransform(): string; + hasStateChanged(): boolean; + initialize(options: any); + intersectsWithObject(other: IObject): boolean; + intersectsWithRect(selectionTL: any, selectionBR: any): boolean; + isActive(): boolean; + isContainedWithinObject(other: IObject): boolean; + isContainedWithinRect(selectionTL: any, selectionBR: any): boolean; + saveState(): IObject; + scale(value: number): IObject; + scaleToHeight(value: number): IObject; + scaleToWidth(value: number): IObject; + sendBackwards(intersecting?: boolean): IObject; + sendToBack(): IObject; + + setActive(active: boolean): IObject; + setCoords(); + setOptions(options: any); + setSourcePath(value: string): IObject; + toGrayscale(): IObject; + } + + export interface IPathOptions extends IObjectOptions { + /** + * Array of path points + */ + path?: any[]; + + /** + * Minimum X from points values, necessary to offset points + */ + minX?: number; + + /** + * Minimum Y from points values, necessary to offset points + */ + minY?: number; + } + export interface IPath extends IObject, IPathOptions { + initialize(path?: any[], options?: IPathOptions): IPath; + + /** + * Returns number representation of an instance complexity + * @return {Number} complexity of this instance + */ + complexity(): number; + + /** + * Renders path on a specified context + * @param {CanvasRenderingContext2D} ctx context to render path on + * @param {Boolean} [noTransform] When true, context is not transformed + */ + render(ctx: CanvasRenderingContext2D, noTransform: boolean): void; + /** + * Returns dataless object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toDatalessObject(propertiesToInclude?: any[]): any; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns string representation of an instance + * @return {String} string representation of an instance + */ + toString(): string; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IPathGroup extends IObject { + initialize(paths: IPath[], options?: IObjectOptions); + /** + * Returns number representation of object's complexity + * @return {Number} complexity + */ + complexity(): number; + /** + * Returns true if all paths in this group are of same color + * @return {Boolean} true if all paths are of the same color (`fill`) + */ + isSameColor(): boolean; + /** + * Renders this group on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render this instance on + */ + render(ctx: CanvasRenderingContext2D); + /** + * Returns dataless object representation of this path group + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} dataless object representation of an instance + */ + toDatalessObject(propertiesToInclude?: any[]): any; + toGrayscale(): IPathGroup; + /** + * Returns object representation of this path group + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns a string representation of this path group + * @return {String} string representation of an object + */ + toString(): string; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + /** + * Returns all paths in this path group + * @return {Array} array of path objects included in this path group + */ + getObjects(): IPath[]; + } + + export interface IPolygonOptions extends IObjectOptions { + /** + * Points array + */ + points?: IPoint[] + + /** + * Minimum X from points values, necessary to offset points + */ + minX?: number; + + /** + * Minimum Y from points values, necessary to offset points + */ + minY?: number; + } + export interface IPolygon extends IObject, IPolygonOptions { + initialize(points?: IPoint[], options?: IPolygonOptions): IPolygon; + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IPolylineOptions extends IObjectOptions { + /** + * Points array + */ + points?: IPoint[] + + /** + * Minimum X from points values, necessary to offset points + */ + minX?: number; + + /** + * Minimum Y from points values, necessary to offset points + */ + minY?: number; + } + export interface IPolyline extends IObject, IPolylineOptions { + initialize(points: IPoint[], options?: IPolylineOptions); + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + complexity(): number; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} Object representation of an instance + */ + toObject(propertiesToInclude?: any[]): any; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface IRectOptions extends IObjectOptions { + x?: number; + y?: number; + /** + * Horizontal border radius + */ + rx?: number; + + /** + * Vertical border radius + */ + ry?: number; + + } + export interface IRect extends IObject, IRectOptions { + initialize(points?: number[], options?: any): IRect; + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity(): number; + /** + * Returns object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude: any[]): any; + /** + * Returns svg representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + export interface ITextOptions extends IObjectOptions { + /** + * Font size (in pixels) + */ + fontSize?: number; + /** + * Font weight (e.g. bold, normal, 400, 600, 800) + */ + fontWeight?: number|string; + /** + * Font family + */ + fontFamily?: string; + /** + * Text decoration Possible values?: "", "underline", "overline" or "line-through". + */ + textDecoration?: string; + /** + * Text alignment. Possible values?: "left", "center", or "right". + */ + textAlign?: string; + /** + * Font style . Possible values?: "", "normal", "italic" or "oblique". + */ + fontStyle?: string; + /** + * Line height + */ + lineHeight?: number; + /** + * When defined, an object is rendered via stroke and this property specifies its color. + * Backwards incompatibility note?: This property was named "strokeStyle" until v1.1.6 + */ + stroke?: string; + /** + * Shadow object representing shadow of this shape. + * Backwards incompatibility note?: This property was named "textShadow" (String) until v1.2.11 + */ + shadow?: IShadow|string; + /** + * Background color of text lines + * @type String + * @default + */ + textBackgroundColor?: string; + + path?: string; + useNative?: Boolean; + text?: string; + } + export interface IText extends IObject, ITextOptions { + + + initialize(text: string, options?: IITextOptions): IText; + /** + * Returns complexity of an instance + * @return {Number} complexity + */ + complexity(): number; + /** + * Returns string representation of an instance + * @return {String} String representation of text object + */ + toString(): string; + /** + * Renders text instance on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + render(ctx: CanvasRenderingContext2D, noTransform: boolean); + /** + * Returns object representation of an instance + * @method toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): IObject; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + /** + * Retrieves object's fontSize + */ + getFontSize(): number; + /** + * Sets object's fontSize + * @param {Number} fontSize Font size (in pixels) + */ + setFontSize(fontSize): IText; + /** + * Retrieves object's fontWeight + */ + getFontWeight(): number|string; + /** + * Sets object's fontWeight + * @method setFontWeight + * @param {(Number|String)} fontWeight Font weight + */ + setFontWeight(fontWeight: string|number): IText; + /** + * Retrieves object's fontFamily + */ + getFontFamily(): string; + /** + * Sets object's fontFamily + * @param {String} fontFamily Font family + */ + setFontFamily(fontFamily: string): IText; + /** + * Retrieves object's text + */ + getText(): string; + /** + * Sets object's text + * @param {String} text Text + */ + setText(text: string): IText; + /** + * Retrieves object's textDecoration + */ + getTextDecoration(): string; + /** + * Sets object's textDecoration + * @param {String} textDecoration Text decoration + */ + setTextDecoration(textDecoration: string): IText; + /** + * Retrieves object's fontStyle + */ + getFontStyle(): string; + /** + * Sets object's fontStyle + * @param {String} fontStyle Font style + */ + setFontStyle(fontStyle: string): IText; + /** + * Retrieves object's lineHeight + */ + getLineHeight(): number; + /** + * Sets object's lineHeight + * @param {Number} lineHeight Line height + */ + setLineHeight(lineHeight: number): IText; + /** + * Retrieves object's textAlign + */ + getTextAlign(): string; + /** + * Sets object's textAlign + * @param {String} textAlign Text alignment + */ + setTextAlign(textAlign: string): IText; + /** + * Retrieves object's textBackgroundColor + */ + getTextBackgroundColor(): string; + /** + * Sets object's textBackgroundColor + * @param {String} textBackgroundColor Text background color + */ + setTextBackgroundColor(textBackgroundColor: string): IText; + + } + + export interface IITextOptions extends IObjectOptions, ITextOptions { + /** + * Index where text selection starts (or where cursor is when there is no selection) + */ + selectionStart?: number; + + /** + * Index where text selection ends + */ + selectionEnd?: number; + + /** + * Color of text selection + */ + selectionColor?: string; + + /** + * Indicates whether text is in editing mode + */ + isEditing?: boolean; + + /** + * Indicates whether a text can be edited + */ + editable?: boolean; + + /** + * Border color of text object while it's in editing mode + */ + editingBorderColor?: string; + + /** + * Width of cursor (in px) + */ + cursorWidth?: number; + + /** + * Color of default cursor (when not overwritten by character style) + */ + cursorColor?: string; + + /** + * Delay between cursor blink (in ms) + */ + cursorDelay?: number; + + /** + * Duration of cursor fadein (in ms) + */ + cursorDuration?: number; + + /** + * Object containing character styles + * (where top-level properties corresponds to line number and 2nd-level properties -- to char number in a line) + */ + styles?: any; + + /** + * Indicates whether internal text char widths can be cached + */ + caching?: boolean; + } + export interface IIText extends IObject, IText, IITextOptions { + initialize(text?: string, options?: IITextOptions): IText; + + /** + * Returns true if object has no styling + */ + isEmptyStyles(): boolean; + render(ctx: CanvasRenderingContext2D, noTransform: boolean); + /** + * Returns object representation of an instance + * @method toObject + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ + toObject(propertiesToInclude?: any[]): IObject; + + setText(value: string): IText; + /** + * Sets selection start (left boundary of a selection) + * @param {Number} index Index to set selection start to + */ + setSelectionStart(index: number): void; + /** + * Sets selection end (right boundary of a selection) + * @param {Number} index Index to set selection end to + */ + setSelectionEnd(index: number): void; + /** + * Gets style of a current selection/cursor (at the start position) + * @param {Number} [startIndex] Start index to get styles at + * @param {Number} [endIndex] End index to get styles at + * @return {Object} styles Style object at a specified (or current) index + */ + getSelectionStyles(startIndex: number, endIndex: number): any; + /** + * Sets style of a current selection + * @param {Object} [styles] Styles object + * @return {fabric.IText} thisArg + * @chainable + */ + setSelectionStyles(styles: any): IText; + + /** + * Renders cursor or selection (depending on what exists) + */ + renderCursorOrSelection(): void; + + /** + * Returns 2d representation (lineIndex and charIndex) of cursor (or selection start) + * @param {Number} [selectionStart] Optional index. When not given, current selectionStart is used. + */ + get2DCursorLocation(selectionStart?: number): void; + /** + * Returns complete style of char at the current cursor + * @param {Number} lineIndex Line index + * @param {Number} charIndex Char index + * @return {Object} Character style + */ + getCurrentCharStyle(lineIndex: number, charIndex: number): any; + + /** + * Returns fontSize of char at the current cursor + * @param {Number} lineIndex Line index + * @param {Number} charIndex Char index + * @return {Number} Character font size + */ + getCurrentCharFontSize(lineIndex: number, charIndex: number): number; + + /** + * Returns color (fill) of char at the current cursor + * @param {Number} lineIndex Line index + * @param {Number} charIndex Char index + * @return {String} Character color (fill) + */ + getCurrentCharColor(lineIndex: number, charIndex: number): string; + /** + * Renders cursor + * @param {Object} boundaries + */ + renderCursor(boundaries): void; + + /** + * Renders text selection + * @param {Array} chars Array of characters + * @param {Object} boundaries Object with left/top/leftOffset/topOffset + */ + renderSelection(chars: string[], boundaries: any): void; + + } + + export interface ITriangleOptions extends IObjectOptions { } + export interface ITriangle extends IObject { + initialize(options: IObjectOptions): ITriangle; + + /** + * Returns complexity of an instance + * @return {Number} complexity of this instance + */ + + complexity(): number; + /** + * Returns SVG representation of an instance + * @param {Function} [reviver] Method for further parsing of svg representation. + * @return {String} svg representation of an instance + */ + toSVG(reviver?: Function): string; + } + + + + + + + + + + + + export interface IPatternOptions { + /** + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ + repeat: string; + + /** + * Pattern horizontal offset from object's left/top corner + */ + offsetX: number; + + /** + * Pattern vertical offset from object's left/top corner + */ + offsetY: number; + /** + * The source for the pattern + */ + source: string|HTMLImageElement; + } + + export interface IPattern extends IPatternOptions { + new (options?: IPatternOptions): IPattern; + + initialise(options?: IPatternOptions): IPattern; + /** + * Returns an instance of CanvasPattern + */ + toLive(ctx: CanvasRenderingContext2D): IPattern; + + /** + * Returns object representation of a pattern + */ + toObject(): any; + /** + * Returns SVG representation of a pattern + * @param {fabric.Object} object + */ + toSVG(object: IObject): string; + } + + export interface IBrightnessFilter { + } + export interface IInvertFilter { + } + export interface IRemoveWhiteFilter { + } + export interface IGrayscaleFilter { + } + export interface ISepiaFilter { + } + export interface ISepia2Filter { + } + export interface INoiseFilter { + } + export interface IGradientTransparencyFilter { + } + export interface IPixelateFilter { + } + export interface IConvoluteFilter { + } + export interface ICanvasOptions extends IStaticCanvasOptions { + /** + * When true, objects can be transformed by one side (unproportionally) + */ + uniScaleTransform?: boolean; + + /** + * When true, objects use center point as the origin of scale transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredScaling?: boolean; + + /** + * When true, objects use center point as the origin of rotate transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredRotation?: boolean; + + /** + * Indicates that canvas is interactive. This property should not be changed. + */ + interactive?: boolean; + + /** + * Indicates whether group selection should be enabled + */ + selection?: boolean; + + /** + * Color of selection + */ + selectionColor?: string; + + /** + * Default dash array pattern + * If not empty the selection border is dashed + */ + selectionDashArray?: any[]; + + /** + * Color of the border of selection (usually slightly darker than color of selection itself) + */ + selectionBorderColor?: string; + + /** + * Width of a line used in object/group selection + */ + selectionLineWidth?: number; + + /** + * Default cursor value used when hovering over an object on canvas + */ + hoverCursor?: string; + + /** + * Default cursor value used when moving an object on canvas + */ + moveCursor?: string; + + /** + * Default cursor value used for the entire canvas + */ + defaultCursor?: string; + + /** + * Cursor value used during free drawing + */ + freeDrawingCursor?: string; + + /** + * Cursor value used for rotation point + */ + rotationCursor?: string; + + /** + * Default element class that's given to wrapper (div) element of canvas + */ + containerClass?: string; + + /** + * When true, object detection happens on per-pixel basis rather than on per-bounding-box + */ + perPixelTargetFind?: boolean; + + /** + * Number of pixels around target pixel to tolerate (consider active) during object detection + */ + targetFindTolerance?: number; + + /** + * When true, target detection is skipped when hovering over canvas. This can be used to improve performance. + */ + skipTargetFind?: boolean; + + /** + * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. + * After mousedown, mousemove creates a shape, + * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. + */ + isDrawingMode?: boolean; + } + export interface IStaticCanvasOptions { + /** + * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas + */ + allowTouchScrolling?: boolean; + /** + * Indicates whether this canvas will use image smoothing, this is on by default in browsers + */ + imageSmoothingEnabled?: boolean; + + /** + * Indicates whether objects should remain in current stack position when selected. When false objects are brought to top and rendered as part of the selection group + */ + preserveObjectStacking?: boolean; + + /** + * The transformation (in the format of Canvas transform) which focuses the viewport + */ + viewportTransform?: number[]; + + + + freeDrawingColor?: string; + freeDrawingLineWidth?: number; + + /** + * Background color of canvas instance. + * Should be set via setBackgroundColor + */ + backgroundColor?: string | IPattern; + /** + * Background image of canvas instance. + * Should be set via setBackgroundImage + * Backwards incompatibility note: The "backgroundImageOpacity" and "backgroundImageStretch" properties are deprecated since 1.3.9. + */ + backgroundImage?: IImage; + backgroundImageOpacity?: number; + backgroundImageStretch?: number; + /** + * Function that determines clipping of entire canvas area + * Being passed context as first argument. See clipping canvas area + */ + clipTo?: (context: CanvasRenderingContext2D) => void; + + /** + * Indicates whether object controls (borders/controls) are rendered above overlay image + */ + controlsAboveOverlay?: boolean; + + /** + * Indicates whether toObject/toDatalessObject should include default values + */ + includeDefaultValues?: boolean; + /** + * Overlay color of canvas instance. + * Should be set via setOverlayColor + */ + overlayColor?: string | IPattern; + /** + * Overlay image of canvas instance. + * Should be set via setOverlayImage + * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. + */ + overlayImage?: fabric.IImage; + overlayImageLeft?: number; + overlayImageTop?: number; + /** + * Indicates whether add, insertAt and remove should also re-render canvas. + * Disabling this option could give a great performance boost when adding/removing a lot of objects to/from canvas at once + * (followed by a manual rendering after addition/deletion) + */ + renderOnAddRemove?: boolean; + /** + * Indicates whether objects' state should be saved + */ + stateful?: boolean; + } + + + + var Rect: { + fromElement(element: SVGElement, options: IRectOptions): IRect; + fromObject(object): IRect; + new (options?: IRectOptions): IRect; + prototype: any; + } + + var Triangle: { + new (options?: ITriangleOptions): ITriangle; + } + + var Canvas: { + /** + * Constructor + * @param {HTMLElement|String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; + + EMPTY_JSON: string; + supports(methodName: string): boolean; + prototype: any; + } + + var StaticCanvas: { + /** + * Constructor + * @param {HTMLElement | String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; + + EMPTY_JSON: string; + supports(methodName: string): boolean; + prototype: any; + } + + var Color: { + /** + * Color class + * The purpose of Color is to abstract and encapsulate common color operations; + * @param {String} color optional in hex or rgb(a) format + */ + new (color?: string): IColor; + + /** + * Returns new color object, when given a color in RGB format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgb(color): IColor + /** + * Returns new color object, when given a color in RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgba(color): IColor + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) + */ + sourceFromRgb(color: string): number[]; + /** + * Returns new color object, when given a color in HSL format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsl(color: string): IColor + /** + * Returns new color object, when given a color in HSLA format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsla(color: string): IColor + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. + * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) + */ + sourceFromHsl(color: string): number[]; + /** + * Returns new color object, when given a color in HEX format + * @param {String} color Color value ex: FF5555 + */ + fromHex(color: string): IColor + + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format + * @param {String} color ex: FF5555 + */ + sourceFromHex(color: string): number[]; + /** + * Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) + * @param {Array} source + */ + fromSource(source: number[]): IColor; + prototype: any; + } + var Pattern: { + new (options: IPatternOptions): IPattern; + + prototype: any; + } + + var Circle: { + ATTRIBUTE_NAMES: string[]; + fromElement(element: SVGElement, options: ICircleOptions): ICircle; + fromObject(object): ICircle; + new (options?: ICircleOptions): ICircle; + prototype: any; + } + + var Group: { + new (items?: any[], options?: IObjectOptions): IGroup; + } + + var Line: { + ATTRIBUTE_NAMES: string[]; + fromElement(element: SVGElement, options): ILine; + fromObject(object): ILine; + prototype: any; + new (points: number[], objObjects?: IObjectOptions): ILine; + } + + var Intersection: { + intersectLineLine(a1, a2, b1, b2); + intersectLinePolygon(a1, a2, points); + intersectPolygonPolygon(points1, points2); + intersectPolygonRectangle(points, r1, r2); + } + + var Path: { + fromElement(element: SVGElement, options): IPath; + fromObject(object): IPath; + new (): IPath; + } + + var PathGroup: { + fromObject(object): IPathGroup; + new (): IPathGroup; + prototype: any; + } + + var Point: { + new (x, y): IPoint; + prototype: any; + } + + var Object: { + prototype: any; + } + + var Polygon: { + fromObject(object): IPolygon; + fromElement(element: SVGElement, options): IPolygon; + new (points: any[], options?: IObjectOptions, skipOffset?: boolean): IPolygon; + prototype: any; + } + + var Polyline: { + fromObject(object): IPolyline; + fromElement(element: SVGElement, options): IPolyline; + new (): IPolyline; + prototype: any; + } + + var Text: { + new (text: string, options?: IITextOptions): IText; + } + + var Image: { + fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; + new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; + prototype: any; + + filters: + { + Grayscale: { + new (): IGrayscaleFilter; + }; + Brightness: { + new (options?: { brightness: number; }): IBrightnessFilter; + }; + RemoveWhite: { + new (options?: { + threshold?: string; // TODO: Check this + distance?: string; // TODO: Check this + }): IRemoveWhiteFilter; + }; + Invert: { + new (): IInvertFilter; + }; + Sepia: { + new (): ISepiaFilter; + }; + Sepia2: { + new (): ISepia2Filter; + }; + Noise: { + new (options?: { + noise?: number; + }): INoiseFilter; + }; + GradientTransparency: { + new (options?: { + threshold?: number; + }): IGradientTransparencyFilter; + }; + Pixelate: { + new (options?: { + color?: any; + }): IPixelateFilter; + }; + Convolute: { + new (options?: { + matrix: any; + }): IConvoluteFilter; + }; + }; + + } + /////////////////////////////////////////////////////////////////////////////// + // Fabric ulit Interface + ////////////////////////////////////////////////////////////////////////////// + var util: { + addClass(element: HTMLElement, className: string); + addListener(element, eventName: string, handler); + animate(options: { + onChange?: (value: number) => void; + onComplete?: () => void; + startValue?: number; + endValue?: number; + byValue?: number; + easing?: (currentTime, startValue, byValue, duration) => number; + duration?: number; + }); + createClass(parent, properties); + degreesToRadians(degrees: number): number; + falseFunction(): () => boolean; + getById(id: HTMLElement): HTMLElement; + getById(id: string): HTMLElement; + getElementOffset(element): { left: number; top: number; }; + getPointer(event: Event); + getRandomInt(min: number, max: number); + getScript(url: string, callback); + groupSVGElements(elements: any[], options?: any): IPathGroup; + loadImage(url: string, callback: (image: HTMLImageElement) => any, context?: any, crossOrigin?: any); + makeElement(tagName: string, attributes); + makeElementSelectable(element: HTMLElement); + makeElementUnselectable(element: HTMLElement); + populateWithProperties(source, destination, properties): any[]; + radiansToDegrees(radians: number): number; + removeFromArray(array: any[], value); + removeListener(element: HTMLElement, eventName, handler); + request(url, options); + requestAnimFrame(callback, element); + setStyle(element: HTMLElement, styles); + toArray(arrayLike): any[]; + toFixed(number, fractionDigits); + wrapElement(element: HTMLElement, wrapper, attributes); + rotatePoint(point: IPoint, origin: IPoint, radians: number); + transformPoint(p: IPoint, t: any[], ignoreOffset: boolean); + invertTransform(t: any[]); + parseUnit(value: number|string, fontSize?: number); + getKlass(type: string, namespace: string); + resolveNamespace(namespace: string); + enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function); + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]); + createCanvasElement(canvasEl?: HTMLElement); + createImage(); + createAccessors(klass: Object); + clipContext(receiver: IObject, ctx: CanvasRenderingContext2D); + isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number); + object: { + clone(object: any): any + extends(destination: any, source: any): any + }; + ease: { + easeInBack(): Function; + easeInBounce(): Function; + easeInCirc(): Function; + easeInCubic(): Function; + easeInElastic(): Function; + easeInExpo(): Function; + easeInOutBack(): Function; + easeInOutBounce(): Function; + easeInOutCirc(): Function; + easeInOutCubic(): Function; + easeInOutElastic(): Function; + easeInOutExpo(): Function; + easeInOutQuad(): Function; + easeInOutQuart(): Function; + easeInOutQuint(): Function; + easeInOutSine(): Function; + easeInQuad(): Function; + easeInQuart(): Function; + easeInQuint(): Function; + easeInSine(): Function; + easeOutBack(): Function; + easeOutBounce(): Function; + easeOutCirc(): Function; + easeOutCubic(): Function; + easeOutElastic(): Function; + easeOutExpo(): Function; + easeOutQuad(): Function; + easeOutQuart(): Function; + easeOutQuint(): Function; + easeOutSine(): Function; + + }; + + + } } From 79fe4ff37587e8f0e373df5980cec5ff43a2b958 Mon Sep 17 00:00:00 2001 From: Chris Wrench Date: Fri, 15 May 2015 14:50:38 +0100 Subject: [PATCH 190/534] Add missing Google Maps Data Layer API Fixes #2249. - Add a `data` property to the `Map` class. - Add Google Maps test file and Data Layer API tests. - Add the following classes and interfaces which form the Data Layer API: - `Data` - `Data.DataOptions` - `Data.GeoJsonOptions` - `Data.StyleOptions` - `Data.StylingFunction` - `Data.Feature` - `Data.FeatureOptions` - `Data.Geometry` - `Data.Point` - `Data.MultiPoint` - `Data.LineString` - `Data.MultiLineString` - `Data.LinearRing` - `Data.Polygon` - `Data.MultiPolygon` - `Data.GeometryCollection` - `Data.MouseEvent` - `Data.AddFeatureEvent` - `Data.RemoveFeatureEvent` - `Data.SetGeometryEvent` - `Data.SetPropertyEvent` - `Data.RemovePropertyEvent` --- googlemaps/google.maps-tests.ts | 107 +++++++++++++ googlemaps/google.maps.d.ts | 258 +++++++++++++++++++++++++------- 2 files changed, 313 insertions(+), 52 deletions(-) create mode 100644 googlemaps/google.maps-tests.ts diff --git a/googlemaps/google.maps-tests.ts b/googlemaps/google.maps-tests.ts new file mode 100644 index 000000000..1079f78b2 --- /dev/null +++ b/googlemaps/google.maps-tests.ts @@ -0,0 +1,107 @@ +// Test file for Google Maps JavaScript API Definition file +/// + +var map = new google.maps.Map(document.querySelector("☺")); + +/***** Data *****/ + +new google.maps.Data(); +new google.maps.Data({ map: map }); + +var latLng = new google.maps.LatLng(52.201203, -1.724370), + feature = new google.maps.Data.Feature(), + geometry = new google.maps.Data.Geometry(); + +var data = map.data; + +data.add(feature); + +data.add({ + geometry: latLng, + id: "Test feature", + properties: {} +}); + +var isIn: boolean = map.data.contains(feature); + +data.forEach((feature: google.maps.Data.Feature) => { + console.log(feature.getId()); +}); + +var map: google.maps.Map = data.getMap(); +data.setMap(map); + +var style = data.getStyle(); +data.setStyle(style); + +data.setStyle({ + clickable: true, + cursor: "pointer", + fillColor: "#79B55B", + fillOpacity: 1, + icon: {}, + shape: { coords: [1, 2, 3], type: "circle" }, + strokeColor: "#79B55B", + strokeOpacity: 1, + strokeWeight: 1, + title: "string", + visible: true, + zIndex: 1 +}); + +data.overrideStyle(feature, { visible: true }); + +data.revertStyle(feature); + +data.addGeoJson({}); +data.addGeoJson({}, { idPropertyName: "Test feature" }); + +data.loadGeoJson("http://magicGeoJsonSource.com"); + +data.loadGeoJson( + "http://magicGeoJsonSource.com", + { idPropertyName: "test" }); + +data.loadGeoJson( + "http://magicGeoJsonSource.com", + { idPropertyName: "test" }, + (features) => { + for (var i = 0, len = features.length; i < len; i++) { + console.log(features[i].getId()); + } + }); + +data.toGeoJson((feature) => { }); + +var dataMouseEvent: google.maps.Data.MouseEvent = { + feature: feature, + latLng: latLng, + stop: (): void => {} +}; + +var addFeatureEvent : google.maps.Data.AddFeatureEvent = { + feature: feature +}; + +var removeFeatureEvent: google.maps.Data.RemoveFeatureEvent = { + feature: feature +}; + +var setGeometryEvent: google.maps.Data.SetGeometryEvent = { + feature: feature, + newGeometry: geometry, + oldGeometry: geometry, +}; + +var setPropertyEvent: google.maps.Data.SetPropertyEvent = { + feature: feature, + name: "test", + newValue: {}, + oldValue: {} +}; + +var removePropertyEvent: google.maps.Data.RemovePropertyEvent = { + feature: feature, + name: "test", + oldValue: {} +}; \ No newline at end of file diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 81ee2594a..fa11a71ce 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Google Geolocation 0.4.8 +// Type definitions for Google Maps JavaScript API 3.19 // Project: https://developers.google.com/maps/ -// Definitions by: Folia A/S +// Definitions by: Folia A/S , Chris Wrench // Definitions: https://github.com/borisyankov/DefinitelyTyped /* @@ -80,9 +80,10 @@ declare module google.maps { setStreetView(panorama: StreetViewPanorama): void; setTilt(tilt: number): void; setZoom(zoom: number): void; - controls: MVCArray[]; //Array.> + controls: MVCArray[]; //Array> + data: Data; mapTypes: MapTypeRegistry; - overlayMapTypes: MVCArray; // MVCArray. + overlayMapTypes: MVCArray; // MVCArray } export interface MapOptions { @@ -206,6 +207,159 @@ declare module google.maps { ZOOM_PAN } + /***** Data *****/ + export class Data extends MVCObject { + constructor(options?: Data.DataOptions); + add(feature: Data.Feature|Data.FeatureOptions): Data.Feature; + addGeoJson(geoJson: Object, options?: Data.GeoJsonOptions): Data.Feature[]; + contains(feature: Data.Feature): boolean; + forEach(callback: (feature: Data.Feature) => void): void; + getFeatureById(id: number|string): Data.Feature; + getMap(): Map; + getStyle(): Data.StylingFunction|Data.StyleOptions; + loadGeoJson(url: string, options?: Data.GeoJsonOptions, callback?: (features: Data.Feature[]) => void): void; + overrideStyle(feature: Data.Feature, style: Data.StyleOptions): void; + remove(feature: Data.Feature): void; + revertStyle(feature?: Data.Feature): void; + setMap(map: Map): void; + setStyle(style: Data.StylingFunction|Data.StyleOptions): void; + toGeoJson(callback: (feature: Object) => void): void; + } + + export module Data { + export interface DataOptions { + map?: Map; + style?: Data.StylingFunction|Data.StyleOptions; + } + + export interface GeoJsonOptions { + idPropertyName?: string; + } + + export interface StyleOptions { + clickable?: boolean; + cursor?: string; + fillColor?: string; + fillOpacity?: number; + icon?: any; // TODO string|Icon|Symbol; + shape?: MarkerShape; + strokeColor?: string; + strokeOpacity?: number; + strokeWeight?: number; + title?: string; + visible?: boolean; + zIndex?: number; + } + + export type StylingFunction = (feature: Data.Feature) => Data.StyleOptions; + + export class Feature { + constructor(options?: Data.FeatureOptions); + forEachProperty(callback: (value: any, name: string) => void): void; + getGeometry(): Data.Geometry; + getId(): number|string; + getProperty(name: string): any; + removeProperty(name: string): void; + setGeometry(newGeometry: Data.Geometry|LatLng): void; // TODO LatLngLiteral + setProperty(name: string, newValue: any): void + toGeoJson(callback: (feature: Object) => void): void + } + + export interface FeatureOptions { + geometry?: Data.Geometry|LatLng; // TODO LatLngLiteral + id?: number|string; + properties?: Object; + } + + export class Geometry { + getType(): string; + } + + export class Point extends Data.Geometry { + constructor(latLng: LatLng); // TODO LatLngLiteral + get(): LatLng; + } + + export class MultiPoint extends Data.Geometry { + constructor(elements: LatLng[]); // TODO LatLngLiteral + getAt(n: number): LatLng; + getLength(): number; + } + + export class LineString extends Data.Geometry { + constructor(elements: LatLng[]); // TODO LatLngLiteral + getArray(): LatLng[]; + getAt(n: number): LatLng; + getLength(): number; + } + + export class MultiLineString extends Data.Geometry { + constructor(elements: Data.LineString[]|LatLng[]); // TODO LatLngLiteral + getArray(): Data.LineString[]; + getAt(n: number): Data.LineString; + getLength(): number; + } + + export class LinearRing extends Data.Geometry { + constructor(elements: LatLng[]); // TODO LatLngLiteral + getArray(): LatLng[]; + getAt(n: number): LatLng; + getLength(): number; + } + + export class Polygon extends Data.Geometry { + constructor(elements: LinearRing[]|LatLng[]); // TODO LatLngLiteral + getArray(): LinearRing[]; + getAt(n: number): LinearRing; + getLength(): number; + } + + export class MultiPolygon extends Data.Geometry { + constructor(elements: Data.Polygon[]|LinearRing[]|LatLng[][]); // TODO LatLngLiteral + getArray(): Data.Polygon[]; + getAt(n: number): Data.Polygon; + getLength(): number; + } + + export class GeometryCollection extends Data.Geometry { + constructor(elements: Data.Geometry[]|LatLng[]); // TODO LatLngLiteral + getArray(): Data.Geometry[]; + getAt(n: number): Data.Geometry; + getLength(): number; + } + + export interface MouseEvent extends google.maps.MouseEvent { + feature: Data.Feature; + } + + export interface AddFeatureEvent { + feature: Data.Feature; + } + + export interface RemoveFeatureEvent { + feature: Data.Feature; + } + + export interface SetGeometryEvent { + feature: Data.Feature; + newGeometry: Data.Geometry; + oldGeometry: Data.Geometry; + } + + export interface SetPropertyEvent { + feature: Data.Feature; + name: string; + newValue: any; + oldValue: any; + } + + export interface RemovePropertyEvent { + feature: Data.Feature; + name: string; + oldValue: any; + } + } + /***** Overlays *****/ export class Marker extends MVCObject { static MAX_ZINDEX: number; @@ -1345,54 +1499,54 @@ declare module google.maps { } export module places { - - export class AutocompleteService extends MVCObject { - constructor(); - getPlacePredictions(request: AutocompletionRequest, callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void): void; - getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void; - } - - export interface AutocompletionRequest { - input: string; - bounds?: LatLngBounds; - componentRestrictions?: ComponentRestrictions; - location?: LatLng; - offset?: number; - radius?: number; - types?: string[]; - } - - export interface QueryAutocompletionRequest { - input: string; - bounds?: LatLngBounds; - location?: LatLng; - offset?: number; - radius?: number; - } - - export interface AutocompletePrediction { - description: string; - matched_substrings: PredictionSubstring[]; - place_id: string; - terms: PredictionTerm[]; - types: string[] - } - - export interface PredictionTerm { - offset: number; - value: string; - } - - export interface PredictionSubstring { - length: number; - offset: number; - } - - export interface QueryAutocompletePrediction { - description: string; - matched_substrings: PredictionSubstring[]; - place_id: string; - terms: PredictionTerm[]; + + export class AutocompleteService extends MVCObject { + constructor(); + getPlacePredictions(request: AutocompletionRequest, callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void): void; + getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void; + } + + export interface AutocompletionRequest { + input: string; + bounds?: LatLngBounds; + componentRestrictions?: ComponentRestrictions; + location?: LatLng; + offset?: number; + radius?: number; + types?: string[]; + } + + export interface QueryAutocompletionRequest { + input: string; + bounds?: LatLngBounds; + location?: LatLng; + offset?: number; + radius?: number; + } + + export interface AutocompletePrediction { + description: string; + matched_substrings: PredictionSubstring[]; + place_id: string; + terms: PredictionTerm[]; + types: string[] + } + + export interface PredictionTerm { + offset: number; + value: string; + } + + export interface PredictionSubstring { + length: number; + offset: number; + } + + export interface QueryAutocompletePrediction { + description: string; + matched_substrings: PredictionSubstring[]; + place_id: string; + terms: PredictionTerm[]; } export class Autocomplete extends MVCObject { From 4df938d72948160e2e86befd38496e4605f9c558 Mon Sep 17 00:00:00 2001 From: Joseph Livecchi Date: Fri, 15 May 2015 12:57:49 -0400 Subject: [PATCH 191/534] More Modifications to fabric.d.ts * Added the AMD require statement * Created static interfaces as the TypeScript recommendations to clean of the definition file * Added interfaces for the fabric.util files --- fabricjs/fabricjs.d.ts | 1315 +++++++++++++++++++++++++++------------- 1 file changed, 884 insertions(+), 431 deletions(-) diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index 2a13cac4e..31b12db1e 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -1,39 +1,79 @@ -// Type definitions for FabricJS +// Type definitions for FabricJS v1.5.0 // Project: http://fabricjs.com/ -// Definitions by: Oliver Klemencic +// Definitions by: Oliver Klemencic , edited by Joseph Livecchi // Definitions: https://github.com/borisyankov/DefinitelyTyped +// Support AMD require +declare module "fabric" { + export = fabric; +} + declare module fabric { + var isLikelyNode: boolean; + var isTouchSupported: boolean; + + ///////////////////////////////////////////////////////////// + // Functions + ///////////////////////////////////////////////////////////// + function createCanvasForNode(width: number, height: number): ICanvas; function getCSSRules(doc: SVGElement); function getGradientDefs(doc: SVGElement); + + // Parser function loadSVGFromString(text: string, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); function loadSVGFromURL(url, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); - - /** - * Wrapper around `console.log` (when available) - */ - function log(values); function parseAttributes(element, attributes: any[]): any; function parseElements(elements: any[], callback, options, reviver); function parsePointsAttribute(points: string): any[]; function parseStyleAttribute(element: SVGElement); function parseSVGDocument(doc: SVGElement, callback: (results, options) => void, reviver?: (el, obj) => void); function parseTransformAttribute(attributeValue: string); + + // fabric Log + // --------------- + /** + * Wrapper around `console.log` (when available) + */ + function log(values); /** * Wrapper around `console.warn` (when available) */ function warn(values); - var isLikelyNode: boolean; - var isTouchSupported: boolean; + + //////////////////////////////////////////////////// + // Classes + //////////////////////////////////////////////////// + var Canvas: ICanvasStatic; + var StaticCanvas: IStaticCanvasStatic; + + var Color: IColorStatic; + var Pattern: IPatternStatic; + var Intersection: IIntersectionStatic; + var Point: IPointStatic + + var Circle: ICircleStatic; + var Group: IGroupStatic; + var Image: IImageStatic + var Line: ILineStatic; + var Object: IObjectStatic; + var Path: IPathStatic; + var PathGroup: IPathGroupStatic + var Polygon: IPolygonStatic + var Polyline: IPolylineStatic; + var Rect: IRectStatic; + var Text: ITextStatic; + var Triangle: ITriangleStatic + + var util: Util; /////////////////////////////////////////////////////////////////////////////// // Data Object Interfaces - These intrface are not specific part of fabric, // They are just helpful for for defining function paramters ////////////////////////////////////////////////////////////////////////////// - export interface IDataURLOptions { + interface IDataURLOptions { /** * The format of the output image. Either "jpeg" or "png" */ @@ -63,13 +103,13 @@ declare module fabric { */ height?: number; } - - export interface IEvent { + + interface IEvent { e: Event; - target?: fabric.IObject; + target?: IObject; } - export interface IFillOptions { + interface IFillOptions { /** * options.source Pattern source */ @@ -88,7 +128,7 @@ declare module fabric { offsetY?: number; } - export interface IGradientOptions { + interface IGradientOptions { /** * @param {String} [options.type] Type of gradient 'radial' or 'linear' */ @@ -123,7 +163,7 @@ declare module fabric { colorStops?: any; } - export interface IToSVGOptions { + interface IToSVGOptions { /** * If true xml tag is not included */ @@ -138,7 +178,7 @@ declare module fabric { encoding: string; } - export interface IViewBox { + interface IViewBox { /** * x-cooridnate of viewbox */ @@ -155,42 +195,20 @@ declare module fabric { height: number; } - export interface IFilter { + interface IFilter { new (): IFilter; new (options: any): IFilter; } - export interface IEventList { + interface IEventList { [index: string]: (e: Event) => void; } - export interface IAnimationOptions { - /** - * Allows to specify starting value of animatable property (if we don't want current value to be used). - */ - from?: string|number; - /** - * Defaults to 500 (ms). Can be used to change duration of an animation. - */ - duration?: number; - /** - * Callback that's invoked during the animation. - */ - onChange?: Function; - /** - * Callback that's invoked at the end of the animation. - */ - onComplete?: Function - /** - * Easing function. Default: fabric.util.ease.easeInSine - */ - easing?: Function; - } /////////////////////////////////////////////////////////////////////////////// // Mixins Interfaces ////////////////////////////////////////////////////////////////////////////// - export interface ICollection { + interface ICollection { /** * Adds objects to collection, then renders canvas (if `renderOnAddRemove` is not `false`) * Objects should be instances of (or inherit from) fabric.Object @@ -266,8 +284,8 @@ declare module fabric { */ complexity(): number; } - - export interface IObservable { + + interface IObservable { /** * Observes specified event * @deprecated `observe` deprecated since 0.8.34 (use `on` instead) @@ -292,12 +310,88 @@ declare module fabric { off(eventName: string|any, handler: (e) => any): T; } + // animation mixin + // ---------------------------------------------------- + interface ICanvasAnimation { + FX_DURATION: number; + /** + * Centers object horizontally with animation. + * @param {fabric.Object} object Object to center + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + */ + fxCenterObjectH(object: IObject, callbacks?: { onComplete: Function; onChange: Function; }): T; + /** + * Centers object vertically with animation. + * @param {fabric.Object} object Object to center + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + */ + fxCenterObjectV(object: IObject, callbacks?: { onComplete: Function; onChange: Function; }): T; + + /** + * Same as `fabric.Canvas#remove` but animated + * @param {fabric.Object} object Object to remove + * @param {Object} [callbacks] Callbacks object with optional "onComplete" and/or "onChange" properties + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + * @return {fabric.Canvas} thisArg + * @chainable + */ + fxRemove(object: IObject, callbacks?: { onComplete: Function; onChange: Function; }): T; + } + interface IObjectAnimation { + /** + * Animates object's properties + * object.animate('left', ..., {duration: ...}); + * @param property Property to animate + * @param value Value to animate property + * @param options The animation options + */ + animate(property: string, value: number | string, options?: IAnimationOptions): IObject; + /** + * Animates object's properties + * object.animate({ left: ..., top: ... }, { duration: ... }); + * @param properties Properties to animate + * @param value Options object + */ + animate(properties: any, options?: IAnimationOptions): IObject; + } + interface IAnimationOptions { + /** + * Allows to specify starting value of animatable property (if we don't want current value to be used). + */ + from?: string|number; + /** + * Defaults to 500 (ms). Can be used to change duration of an animation. + */ + duration?: number; + /** + * Callback; invoked on every value change + */ + onChange?: Function; + /** + * Callback; invoked when value change is completed + */ + onComplete?: Function + /** + * Easing function. Default: fabric.util.ease.easeInSine + */ + easing?: Function; + /** + * Value to modify the property by, default: end - start + */ + by?: number; + } + /////////////////////////////////////////////////////////////////////////////// // General Fabric Interfaces ////////////////////////////////////////////////////////////////////////////// - export interface IColor { + interface IColor { /** * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) */ @@ -360,24 +454,83 @@ declare module fabric { */ overlayWith(otherColor: string|IColor): IColor; } + interface IColorStatic { + /** + * Color class + * The purpose of Color is to abstract and encapsulate common color operations; + * @param {String} color optional in hex or rgb(a) format + */ + new (color?: string): IColor; - export interface IGradient { + /** + * Returns new color object, when given a color in RGB format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgb(color): IColor + /** + * Returns new color object, when given a color in RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgba(color): IColor + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) + */ + sourceFromRgb(color: string): number[]; + /** + * Returns new color object, when given a color in HSL format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsl(color: string): IColor + /** + * Returns new color object, when given a color in HSLA format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsla(color: string): IColor + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. + * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) + */ + sourceFromHsl(color: string): number[]; + /** + * Returns new color object, when given a color in HEX format + * @param {String} color Color value ex: FF5555 + */ + fromHex(color: string): IColor + + /** + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format + * @param {String} color ex: FF5555 + */ + sourceFromHex(color: string): number[]; + /** + * Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) + * @param {Array} source + */ + fromSource(source: number[]): IColor; + prototype: any; + } + + + interface IGradient { initialize(options): any; toObject(): any; toLiveGradient(ctx: CanvasRenderingContext2D): any; } - - export interface IIntersection { + + interface IIntersection { /** * Appends a point to intersection */ - appendPoint(point: fabric.IPoint); + appendPoint(point: IPoint); /** * Appends points to intersection */ - appendPoints(point: fabric.IPoint); + appendPoints(point: IPoint); init(status?: string); + } + interface IIntersectionStatic { /** * Checks if polygon intersects another polygon */ @@ -395,8 +548,8 @@ declare module fabric { */ intersectPolygonRectangle(points: IPoint[], r1: number, r2: number): IIntersection; } - - export interface IPoint { + + interface IPoint { x: number; y: number; /** @@ -579,8 +732,12 @@ declare module fabric { */ swap(that: IPoint): IPoint; } - - export interface IShadowOptions { + interface IPointStatic { + new (x, y): IPoint; + prototype: any; + } + + interface IShadowOptions { /** * Whether the shadow should affect stroke operations */ @@ -606,7 +763,7 @@ declare module fabric { */ offsetY: number; } - export interface IShadow extends IShadowOptions { + interface IShadow extends IShadowOptions { initialize(options?: IShadowOptions|string): IShadow; /** * Returns object representation of a shadow @@ -631,7 +788,7 @@ declare module fabric { /////////////////////////////////////////////////////////////////////////////// // Canvas Interfaces ////////////////////////////////////////////////////////////////////////////// - export interface ICanvasDimensions { + interface ICanvasDimensions { /** * Width of canvas element */ @@ -642,7 +799,7 @@ declare module fabric { height: number; } - export interface ICanvasDimensionsOptions { + interface ICanvasDimensionsOptions { /** * Set the given dimensions only as canvas backstore dimensions */ @@ -653,7 +810,7 @@ declare module fabric { cssOnly?: boolean; } - export interface IStaticCanvas extends IObservable, IStaticCanvasOptions, ICollection { + interface IStaticCanvas extends IObservable, IStaticCanvasOptions, ICollection, ICanvasAnimation { /** * Calculates canvas element offset relative to the document * This method is also attached as "resize" event handler of window @@ -925,8 +1082,20 @@ declare module fabric { onBeforeScaleRotate(target: IObject); toGrayscale(propertiesToInclude: any[]): string; } + interface IStaticCanvasStatic { + /** + * Constructor + * @param {HTMLElement | String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; - export interface ICanvas extends IStaticCanvas, ICanvasOptions { + EMPTY_JSON: string; + supports(methodName: string): boolean; + prototype: any; + } + + interface ICanvas extends IStaticCanvas, ICanvasOptions { // constructors new (element: HTMLCanvasElement|string, options: ICanvasOptions): ICanvas; @@ -1034,12 +1203,24 @@ declare module fabric { loadFromJSON(json, callback: () => void): void; loadFromDatalessJSON(json, callback: () => void): void; } + interface ICanvasStatic { + /** + * Constructor + * @param {HTMLElement|String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; + + EMPTY_JSON: string; + supports(methodName: string): boolean; + prototype: any; + } /////////////////////////////////////////////////////////////////////////////// // Shape Interfaces ////////////////////////////////////////////////////////////////////////////// - export interface ICircleOptions extends IObjectOptions { + interface ICircleOptions extends IObjectOptions { /** * Radius of this circle */ @@ -1054,7 +1235,7 @@ declare module fabric { */ endAngle?: number; } - export interface ICircle extends IObject, ICircleOptions { + interface ICircle extends IObject, ICircleOptions { initialize(options?: ICircleOptions): ICircle; /** @@ -1091,8 +1272,15 @@ declare module fabric { */ toSVG(reviver?: Function): string; } + interface ICircleStatic { + ATTRIBUTE_NAMES: string[]; + fromElement(element: SVGElement, options: ICircleOptions): ICircle; + fromObject(object): ICircle; + new (options?: ICircleOptions): ICircle; + prototype: any; + } - export interface IEllipseOptions extends IObjectOptions { + interface IEllipseOptions extends IObjectOptions { /** * Horizontal radius */ @@ -1102,7 +1290,7 @@ declare module fabric { */ ry?: number; } - export interface IEllipse extends IObject, IEllipseOptions { + interface IEllipse extends IObject, IEllipseOptions { initialize(options?: IEllipseOptions): IEllipse; /** * Returns horizontal radius of an object (according to how an object is scaled) @@ -1133,8 +1321,8 @@ declare module fabric { */ complexity(): number; } - - export interface IGroup extends IObject, ICollection { + + interface IGroup extends IObject, ICollection { initialize(objects?: IObject[], options?: IObjectOptions): any; type: string; @@ -1215,8 +1403,11 @@ declare module fabric { */ toSVG(reviver?: Function): string; } - - export interface IImageOptions extends IObjectOptions { + interface IGroupStatic { + new (items?: any[], options?: IObjectOptions): IGroup; + } + + interface IImageOptions extends IObjectOptions { /** * crossOrigin value (one of "", "anonymous", "allow-credentials") */ @@ -1246,7 +1437,7 @@ declare module fabric { */ filters: IFilter[]; } - export interface IImage extends IObject, IImageOptions { + interface IImage extends IObject, IImageOptions { initialize(element?: string|HTMLImageElement, options?: IImageOptions); /** * Applies filters assigned to this image (from "filters" array) @@ -1319,8 +1510,59 @@ declare module fabric { */ setSrc(src: string, callback: Function, options: IImageOptions): IImage; } + interface IImageStatic { + fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; + new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; + prototype: any; - export interface ILineOptions extends IObjectOptions { + filters: + { + Grayscale: { + new (): IGrayscaleFilter; + }; + Brightness: { + new (options?: { brightness: number; }): IBrightnessFilter; + }; + RemoveWhite: { + new (options?: { + threshold?: string; // TODO: Check this + distance?: string; // TODO: Check this + }): IRemoveWhiteFilter; + }; + Invert: { + new (): IInvertFilter; + }; + Sepia: { + new (): ISepiaFilter; + }; + Sepia2: { + new (): ISepia2Filter; + }; + Noise: { + new (options?: { + noise?: number; + }): INoiseFilter; + }; + GradientTransparency: { + new (options?: { + threshold?: number; + }): IGradientTransparencyFilter; + }; + Pixelate: { + new (options?: { + color?: any; + }): IPixelateFilter; + }; + Convolute: { + new (options?: { + matrix: any; + }): IConvoluteFilter; + }; + }; + + } + + interface ILineOptions extends IObjectOptions { /** * x value or first line edge */ @@ -1338,7 +1580,7 @@ declare module fabric { */ y2: number; } - export interface ILine extends IObject, ILineOptions { + interface ILine extends IObject, ILineOptions { /** * Returns complexity of an instance * @return {Number} complexity @@ -1359,8 +1601,15 @@ declare module fabric { */ toSVG(reviver?: Function): string; } + interface ILineStatic { + ATTRIBUTE_NAMES: string[]; + fromElement(element: SVGElement, options): ILine; + fromObject(object): ILine; + prototype: any; + new (points: number[], objObjects?: IObjectOptions): ILine; + } - export interface IObjectOptions { + interface IObjectOptions { /** * Type of an object (rect, circle, path, etc.). * Note that this property is meant to be read-only and not meant to be modified. @@ -1647,22 +1896,8 @@ declare module fabric { */ data?: any; } - export interface IObject extends IObservable, IObjectOptions { - /** - * Animates object's properties - * object.animate('left', ..., {duration: ...}); - * @param property Property to animate - * @param value Value to animate property - * @param options The animation options - */ - animate(property: string, value: number | string, options?: IAnimationOptions): IObject; - /** - * Animates object's properties - * object.animate({ left: ..., top: ... }, { duration: ... }); - * @param properties Properties to animate - * @param value Options object - */ - animate(properties: any, options?: IAnimationOptions): IObject; + interface IObject extends IObservable, IObjectOptions, IObjectAnimation { + getCurrentWidth(): number; getCurrentHeight(): number; @@ -1932,8 +2167,11 @@ declare module fabric { setSourcePath(value: string): IObject; toGrayscale(): IObject; } - - export interface IPathOptions extends IObjectOptions { + interface IObjectStatic { + prototype: any; + } + + interface IPathOptions extends IObjectOptions { /** * Array of path points */ @@ -1949,7 +2187,7 @@ declare module fabric { */ minY?: number; } - export interface IPath extends IObject, IPathOptions { + interface IPath extends IObject, IPathOptions { initialize(path?: any[], options?: IPathOptions): IPath; /** @@ -1988,8 +2226,13 @@ declare module fabric { */ toSVG(reviver?: Function): string; } - - export interface IPathGroup extends IObject { + interface IPathStatic { + fromElement(element: SVGElement, options): IPath; + fromObject(object): IPath; + new (): IPath; + } + + interface IPathGroup extends IObject { initialize(paths: IPath[], options?: IObjectOptions); /** * Returns number representation of object's complexity @@ -2036,8 +2279,13 @@ declare module fabric { */ getObjects(): IPath[]; } + interface IPathGroupStatic { + fromObject(object): IPathGroup; + new (): IPathGroup; + prototype: any; + } - export interface IPolygonOptions extends IObjectOptions { + interface IPolygonOptions extends IObjectOptions { /** * Points array */ @@ -2053,7 +2301,7 @@ declare module fabric { */ minY?: number; } - export interface IPolygon extends IObject, IPolygonOptions { + interface IPolygon extends IObject, IPolygonOptions { initialize(points?: IPoint[], options?: IPolygonOptions): IPolygon; /** * Returns complexity of an instance @@ -2074,8 +2322,14 @@ declare module fabric { */ toSVG(reviver?: Function): string; } + interface IPolygonStatic { + fromObject(object): IPolygon; + fromElement(element: SVGElement, options): IPolygon; + new (points: any[], options?: IObjectOptions, skipOffset?: boolean): IPolygon; + prototype: any; + } - export interface IPolylineOptions extends IObjectOptions { + interface IPolylineOptions extends IObjectOptions { /** * Points array */ @@ -2091,7 +2345,7 @@ declare module fabric { */ minY?: number; } - export interface IPolyline extends IObject, IPolylineOptions { + interface IPolyline extends IObject, IPolylineOptions { initialize(points: IPoint[], options?: IPolylineOptions); /** * Returns complexity of an instance @@ -2111,8 +2365,14 @@ declare module fabric { */ toSVG(reviver?: Function): string; } - - export interface IRectOptions extends IObjectOptions { + interface IPolylineStatic { + fromObject(object): IPolyline; + fromElement(element: SVGElement, options): IPolyline; + new (): IPolyline; + prototype: any; + } + + interface IRectOptions extends IObjectOptions { x?: number; y?: number; /** @@ -2126,7 +2386,7 @@ declare module fabric { ry?: number; } - export interface IRect extends IObject, IRectOptions { + interface IRect extends IObject, IRectOptions { initialize(points?: number[], options?: any): IRect; /** * Returns complexity of an instance @@ -2146,8 +2406,14 @@ declare module fabric { */ toSVG(reviver?: Function): string; } + interface IRectStatic { + fromElement(element: SVGElement, options: IRectOptions): IRect; + fromObject(object): IRect; + new (options?: IRectOptions): IRect; + prototype: any; + } - export interface ITextOptions extends IObjectOptions { + interface ITextOptions extends IObjectOptions { /** * Font size (in pixels) */ @@ -2197,7 +2463,7 @@ declare module fabric { useNative?: Boolean; text?: string; } - export interface IText extends IObject, ITextOptions { + interface IText extends IObject, ITextOptions { initialize(text: string, options?: IITextOptions): IText; @@ -2313,8 +2579,11 @@ declare module fabric { setTextBackgroundColor(textBackgroundColor: string): IText; } + interface ITextStatic { + new (text: string, options?: IITextOptions): IText; + } - export interface IITextOptions extends IObjectOptions, ITextOptions { + interface IITextOptions extends IObjectOptions, ITextOptions { /** * Index where text selection starts (or where cursor is when there is no selection) */ @@ -2376,7 +2645,7 @@ declare module fabric { */ caching?: boolean; } - export interface IIText extends IObject, IText, IITextOptions { + interface IIText extends IObject, IText, IITextOptions { initialize(text?: string, options?: IITextOptions): IText; /** @@ -2466,8 +2735,8 @@ declare module fabric { } - export interface ITriangleOptions extends IObjectOptions { } - export interface ITriangle extends IObject { + interface ITriangleOptions extends IObjectOptions { } + interface ITriangle extends IObject { initialize(options: IObjectOptions): ITriangle; /** @@ -2483,18 +2752,12 @@ declare module fabric { */ toSVG(reviver?: Function): string; } + interface ITriangleStatic { + new (options?: ITriangleOptions): ITriangle; + } - - - - - - - - - - export interface IPatternOptions { + interface IPatternOptions { /** * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) */ @@ -2514,8 +2777,7 @@ declare module fabric { */ source: string|HTMLImageElement; } - - export interface IPattern extends IPatternOptions { + interface IPattern extends IPatternOptions { new (options?: IPatternOptions): IPattern; initialise(options?: IPatternOptions): IPattern; @@ -2534,28 +2796,32 @@ declare module fabric { */ toSVG(object: IObject): string; } + interface IPatternStatic { + new (options: IPatternOptions): IPattern; + prototype: any; + } - export interface IBrightnessFilter { + interface IBrightnessFilter { } - export interface IInvertFilter { + interface IInvertFilter { } - export interface IRemoveWhiteFilter { + interface IRemoveWhiteFilter { } - export interface IGrayscaleFilter { + interface IGrayscaleFilter { } - export interface ISepiaFilter { + interface ISepiaFilter { } - export interface ISepia2Filter { + interface ISepia2Filter { } - export interface INoiseFilter { + interface INoiseFilter { } - export interface IGradientTransparencyFilter { + interface IGradientTransparencyFilter { } - export interface IPixelateFilter { + interface IPixelateFilter { } - export interface IConvoluteFilter { + interface IConvoluteFilter { } - export interface ICanvasOptions extends IStaticCanvasOptions { + interface ICanvasOptions extends IStaticCanvasOptions { /** * When true, objects can be transformed by one side (unproportionally) */ @@ -2656,7 +2922,7 @@ declare module fabric { */ isDrawingMode?: boolean; } - export interface IStaticCanvasOptions { + interface IStaticCanvasOptions { /** * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas */ @@ -2719,7 +2985,7 @@ declare module fabric { * Should be set via setOverlayImage * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. */ - overlayImage?: fabric.IImage; + overlayImage?: IImage; overlayImageLeft?: number; overlayImageTop?: number; /** @@ -2735,313 +3001,500 @@ declare module fabric { } - - var Rect: { - fromElement(element: SVGElement, options: IRectOptions): IRect; - fromObject(object): IRect; - new (options?: IRectOptions): IRect; - prototype: any; - } - - var Triangle: { - new (options?: ITriangleOptions): ITriangle; - } - - var Canvas: { - /** - * Constructor - * @param {HTMLElement|String} element element to initialize instance on - * @param {Object} [options] Options object - */ - new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; - - EMPTY_JSON: string; - supports(methodName: string): boolean; - prototype: any; - } - - var StaticCanvas: { - /** - * Constructor - * @param {HTMLElement | String} element element to initialize instance on - * @param {Object} [options] Options object - */ - new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; - - EMPTY_JSON: string; - supports(methodName: string): boolean; - prototype: any; - } - - var Color: { - /** - * Color class - * The purpose of Color is to abstract and encapsulate common color operations; - * @param {String} color optional in hex or rgb(a) format - */ - new (color?: string): IColor; - - /** - * Returns new color object, when given a color in RGB format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255) - */ - fromRgb(color): IColor - /** - * Returns new color object, when given a color in RGBA format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255) - */ - fromRgba(color): IColor - /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) - */ - sourceFromRgb(color: string): number[]; - /** - * Returns new color object, when given a color in HSL format - * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) - */ - fromHsl(color: string): IColor - /** - * Returns new color object, when given a color in HSLA format - * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) - */ - fromHsla(color: string): IColor - /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. - * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) - */ - sourceFromHsl(color: string): number[]; - /** - * Returns new color object, when given a color in HEX format - * @param {String} color Color value ex: FF5555 - */ - fromHex(color: string): IColor - - /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format - * @param {String} color ex: FF5555 - */ - sourceFromHex(color: string): number[]; - /** - * Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) - * @param {Array} source - */ - fromSource(source: number[]): IColor; - prototype: any; - } - var Pattern: { - new (options: IPatternOptions): IPattern; - - prototype: any; - } - - var Circle: { - ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options: ICircleOptions): ICircle; - fromObject(object): ICircle; - new (options?: ICircleOptions): ICircle; - prototype: any; - } - - var Group: { - new (items?: any[], options?: IObjectOptions): IGroup; - } - - var Line: { - ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options): ILine; - fromObject(object): ILine; - prototype: any; - new (points: number[], objObjects?: IObjectOptions): ILine; - } - - var Intersection: { - intersectLineLine(a1, a2, b1, b2); - intersectLinePolygon(a1, a2, points); - intersectPolygonPolygon(points1, points2); - intersectPolygonRectangle(points, r1, r2); - } - - var Path: { - fromElement(element: SVGElement, options): IPath; - fromObject(object): IPath; - new (): IPath; - } - - var PathGroup: { - fromObject(object): IPathGroup; - new (): IPathGroup; - prototype: any; - } - - var Point: { - new (x, y): IPoint; - prototype: any; - } - - var Object: { - prototype: any; - } - - var Polygon: { - fromObject(object): IPolygon; - fromElement(element: SVGElement, options): IPolygon; - new (points: any[], options?: IObjectOptions, skipOffset?: boolean): IPolygon; - prototype: any; - } - - var Polyline: { - fromObject(object): IPolyline; - fromElement(element: SVGElement, options): IPolyline; - new (): IPolyline; - prototype: any; - } - - var Text: { - new (text: string, options?: IITextOptions): IText; - } - - var Image: { - fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; - new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; - prototype: any; - - filters: - { - Grayscale: { - new (): IGrayscaleFilter; - }; - Brightness: { - new (options?: { brightness: number; }): IBrightnessFilter; - }; - RemoveWhite: { - new (options?: { - threshold?: string; // TODO: Check this - distance?: string; // TODO: Check this - }): IRemoveWhiteFilter; - }; - Invert: { - new (): IInvertFilter; - }; - Sepia: { - new (): ISepiaFilter; - }; - Sepia2: { - new (): ISepia2Filter; - }; - Noise: { - new (options?: { - noise?: number; - }): INoiseFilter; - }; - GradientTransparency: { - new (options?: { - threshold?: number; - }): IGradientTransparencyFilter; - }; - Pixelate: { - new (options?: { - color?: any; - }): IPixelateFilter; - }; - Convolute: { - new (options?: { - matrix: any; - }): IConvoluteFilter; - }; - }; - - } /////////////////////////////////////////////////////////////////////////////// - // Fabric ulit Interface + // Fabric util Interface ////////////////////////////////////////////////////////////////////////////// - var util: { - addClass(element: HTMLElement, className: string); - addListener(element, eventName: string, handler); - animate(options: { - onChange?: (value: number) => void; - onComplete?: () => void; - startValue?: number; - endValue?: number; - byValue?: number; - easing?: (currentTime, startValue, byValue, duration) => number; - duration?: number; - }); - createClass(parent, properties); + // animations + interface IUtilAnimationOptions { + /** + * Starting value + */ + startValue?: number; + /** + * Ending value + */ + endValue?: number; + /** + * Value to modify the property by + */ + byValue: number; + /** + * Duration of change (in ms) + */ + duration?: number; + /** + * Callback; invoked on every value change + */ + onChange?: Function; + /** + * Callback; invoked when value change is completed + */ + onComplete?: Function + /** + * Easing function + */ + easing?: Function; + } + interface IUtilAnimation { + /** + * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. + * @param {Object} [options] Animation options + */ + animate(options?: IUtilAnimationOptions): void; + /** + * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + * In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method + * @param {Function} callback Callback to invoke + */ + requestAnimFrame(callback: Function): void; + } + + // anim_ease + interface anim_ease { + easeInBack(): Function; + easeInBounce(): Function; + easeInCirc(): Function; + easeInCubic(): Function; + easeInElastic(): Function; + easeInExpo(): Function; + easeInOutBack(): Function; + easeInOutBounce(): Function; + easeInOutCirc(): Function; + easeInOutCubic(): Function; + easeInOutElastic(): Function; + easeInOutExpo(): Function; + easeInOutQuad(): Function; + easeInOutQuart(): Function; + easeInOutQuint(): Function; + easeInOutSine(): Function; + easeInQuad(): Function; + easeInQuart(): Function; + easeInQuint(): Function; + easeInSine(): Function; + easeOutBack(): Function; + easeOutBounce(): Function; + easeOutCirc(): Function; + easeOutCubic(): Function; + easeOutElastic(): Function; + easeOutExpo(): Function; + easeOutQuad(): Function; + easeOutQuart(): Function; + easeOutQuint(): Function; + easeOutSine(): Function; + } + + interface IUtilArc { + /** + * Draws arc + * @param {CanvasRenderingContext2D} ctx + * @param {Number} fx + * @param {Number} fy + * @param {Array} coords + */ + drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void; + /** + * Calculate bounding box of a elliptic-arc + * @param {Number} fx start point of arc + * @param {Number} fy + * @param {Number} rx horizontal radius + * @param {Number} ry vertical radius + * @param {Number} rot angle of horizontal axe + * @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points + * @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction + * @param {Number} tx end point of arc + * @param {Number} ty + */ + getBoundsOfArc(fx: number, fy: number, rx: number, ry: number, rot: number, large: number, sweep: number, tx: number, ty: number): IPoint[]; + /** + * Calculate bounding box of a beziercurve + * @param {Number} x0 starting point + * @param {Number} y0 + * @param {Number} x1 first control point + * @param {Number} y1 + * @param {Number} x2 secondo control point + * @param {Number} y2 + * @param {Number} x3 end of beizer + * @param {Number} y3 + */ + getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): IPoint[]; + + } + + interface IUtilDomEvent { + /** + * Cross-browser wrapper for getting event's coordinates + * @param {Event} event Event object + * @param {HTMLCanvasElement} upperCanvasEl <canvas> element on which object selection is drawn + */ + getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): IPoint; + + /** + * Adds an event listener to an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + addListener(element: HTMLElement, eventName: string, handler: Function): void; + + /** + * Removes an event listener from an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + removeListener(element: HTMLElement, eventName: string, handler: Function): void; + } + + interface IUtilDomMisc { + /** + * Takes id and returns an element with that id (if one exists in a document) + * @param {String|HTMLElement} id + */ + getById(id: string|HTMLElement): HTMLElement; + /** + * Converts an array-like object (e.g. arguments or NodeList) to an array + * @param {Object} arrayLike + */ + toArray(arrayLike: any): any[]; + /** + * Creates specified element with specified attributes + * @memberOf fabric.util + * @param {String} tagName Type of an element to create + * @param {Object} [attributes] Attributes to set on an element + * @return {HTMLElement} Newly created element + */ + makeElement(tagName: string, attributes?: any): HTMLElement; + /** + * Adds class to an element + * @param {HTMLElement} element Element to add class to + * @param {String} className Class to add to an element + */ + addClass(element: HTMLElement, classname: string): void; + /** + * Wraps element with another element + * @param {HTMLElement} element Element to wrap + * @param {HTMLElement|String} wrapper Element to wrap with + * @param {Object} [attributes] Attributes to set on a wrapper + */ + wrapElement(element: HTMLElement, wrapper: HTMLElement|string, attributes?: any): HTMLElement; + /** + * Returns element scroll offsets + * @param {HTMLElement} element Element to operate on + * @param {HTMLElement} upperCanvasEl Upper canvas element + */ + getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; } + /** + * Returns offset for a given element + * @param {HTMLElement} element Element to get offset for + */ + getElementOffset(element: HTMLElement): { left: number; right: number; } + /** + * Returns style attribute value of a given element + * @param {HTMLElement} element Element to get style attribute for + * @param {String} attr Style attribute to get for element + */ + getElementStyle(elment: HTMLElement, attr: string): string; + /** + * Inserts a script element with a given url into a document; invokes callback, when that script is finished loading + * @memberOf fabric.util + * @param {String} url URL of a script to load + * @param {Function} callback Callback to execute when script is finished loading + */ + getScript(url: string, callback: Function): void; + /** + * Makes element unselectable + * @param {HTMLElement} element Element to make unselectable + */ + makeElementUnselectable(element: HTMLElement): HTMLElement; + /** + * Makes element selectable + * @param {HTMLElement} element Element to make selectable + */ + makeElementSelectable(element: HTMLElement): HTMLElement; + } + + interface IUtilDomRequest { + /** + * Cross-browser abstraction for sending XMLHttpRequest + * @param {String} url URL to send XMLHttpRequest to + * @param {Object} [options] Options object + * @param {String} [options.method="GET"] + * @param {Function} options.onComplete Callback to invoke when request is completed + */ + request(url: string, options?: { method?: string; onComplete: Function }): XMLHttpRequest; + } + + interface IUtilDomStyle { + /** + * Cross-browser wrapper for setting element's style + * @param {HTMLElement} element + * @param {Object} styles + */ + setStyle(element: HTMLElement, styles: any): HTMLElement; + } + + interface IUtilArray { + /** + * Invokes method on all items in a given array + * @param {Array} array Array to iterate over + * @param {String} method Name of a method to invoke + */ + invoke(array: any[], method: string): any[]; + /** + * Finds minimum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + min(array: any[], byProperty: string): any; + /** + * Finds maximum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + max(array: any[], byProperty: string): any; + } + + interface IUtilClass { + /** + * Helper for creation of "classes". + * @param {Function} [parent] optional "Class" to inherit from + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(parent: Function, properties?: any); + /** + * Helper for creation of "classes". + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(properties?: any); + + } + + interface IUtilObject { + /** + * Copies all enumerable properties of one object to another + * @param {Object} destination Where to copy to + * @param {Object} source Where to copy from + */ + extend(destination: any, source: any): any; + + /** + * Creates an empty object and copies all enumerable properties of another object to it + * @memberOf fabric.util.object + * @param {Object} object Object to clone + * @return {Object} + */ + clone(object: any): any + } + + interface IUtilString { + /** + * Camelizes a string + * @param {String} string String to camelize + */ + camelize(string: string): string; + + /** + * Capitalizes a string + * @param {String} string String to capitalize + * @param {Boolean} [firstLetterOnly] If true only first letter is capitalized + * and other letters stay untouched, if false first letter is capitalized + * and other letters are converted to lowercase. + */ + capitalize(string: string, firstLetterOnly: boolean): string; + + /** + * Escapes XML in a string + * @param {String} string String to escape + */ + escapeXml(string: string): string; + } + + interface IUtilMisc { + /** + * Removes value from an array. + * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` + * @param {Array} array + * @param {Any} value + */ + removeFromArray(array: any[], value: any): any[]; + + /** + * Returns random number between 2 specified ones. + * @param {Number} min lower limit + * @param {Number} max upper limit + */ + getRandomInt(min: number, max: number): number; + + /** + * Transforms degrees to radians. + * @param {Number} degrees value in degrees + */ degreesToRadians(degrees: number): number; - falseFunction(): () => boolean; - getById(id: HTMLElement): HTMLElement; - getById(id: string): HTMLElement; - getElementOffset(element): { left: number; top: number; }; - getPointer(event: Event); - getRandomInt(min: number, max: number); - getScript(url: string, callback); - groupSVGElements(elements: any[], options?: any): IPathGroup; - loadImage(url: string, callback: (image: HTMLImageElement) => any, context?: any, crossOrigin?: any); - makeElement(tagName: string, attributes); - makeElementSelectable(element: HTMLElement); - makeElementUnselectable(element: HTMLElement); - populateWithProperties(source, destination, properties): any[]; + + /** + * Transforms radians to degrees. + * @memberOf fabric.util + * @param {Number} radians value in radians + */ radiansToDegrees(radians: number): number; - removeFromArray(array: any[], value); - removeListener(element: HTMLElement, eventName, handler); - request(url, options); - requestAnimFrame(callback, element); - setStyle(element: HTMLElement, styles); - toArray(arrayLike): any[]; - toFixed(number, fractionDigits); - wrapElement(element: HTMLElement, wrapper, attributes); - rotatePoint(point: IPoint, origin: IPoint, radians: number); - transformPoint(p: IPoint, t: any[], ignoreOffset: boolean); - invertTransform(t: any[]); - parseUnit(value: number|string, fontSize?: number); - getKlass(type: string, namespace: string); - resolveNamespace(namespace: string); - enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function); - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]); - createCanvasElement(canvasEl?: HTMLElement); - createImage(); - createAccessors(klass: Object); - clipContext(receiver: IObject, ctx: CanvasRenderingContext2D); - isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number); - object: { - clone(object: any): any - extends(destination: any, source: any): any - }; - ease: { - easeInBack(): Function; - easeInBounce(): Function; - easeInCirc(): Function; - easeInCubic(): Function; - easeInElastic(): Function; - easeInExpo(): Function; - easeInOutBack(): Function; - easeInOutBounce(): Function; - easeInOutCirc(): Function; - easeInOutCubic(): Function; - easeInOutElastic(): Function; - easeInOutExpo(): Function; - easeInOutQuad(): Function; - easeInOutQuart(): Function; - easeInOutQuint(): Function; - easeInOutSine(): Function; - easeInQuad(): Function; - easeInQuart(): Function; - easeInQuint(): Function; - easeInSine(): Function; - easeOutBack(): Function; - easeOutBounce(): Function; - easeOutCirc(): Function; - easeOutCubic(): Function; - easeOutElastic(): Function; - easeOutExpo(): Function; - easeOutQuad(): Function; - easeOutQuart(): Function; - easeOutQuint(): Function; - easeOutSine(): Function; - }; + /** + * Rotates `point` around `origin` with `radians` + * @param {fabric.Point} point The point to rotate + * @param {fabric.Point} origin The origin of the rotation + * @param {Number} radians The radians of the angle for the rotation + */ + rotatePoint(point: IPoint, origin: IPoint, radians: number): IPoint; + + /** + * Apply transform t to point p + * @param {fabric.Point} p The point to transform + * @param {Array} t The transform + * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied + */ + transformPoint(p: IPoint, t: any[], ignoreOffset?: boolean): IPoint + + /** + * Invert transformation t + * @param {Array} t The transform + */ + invertTransform(t: any[]): any[]; + + /** + * A wrapper around Number#toFixed, which contrary to native method returns number, not string. + * @param {Number|String} number number to operate on + * @param {Number} fractionDigits number of fraction digits to "leave" + */ + toFixed(number: number, fractionDigits: number): number; + + /** + * Converts from attribute value to pixel value if applicable. + * Returns converted pixels or original value not converted. + * @param {Number|String} value number to operate on + */ + parseUnit(value: number|string, fontSize?: number): number|string; + + /** + * Function which always returns `false`. + */ + falseFunction(): boolean + + /** + * Returns klass "Class" object of given namespace + * @param {String} type Type of object (eg. 'circle') + * @param {String} namespace Namespace to get klass "Class" object from + */ + getKlass(type: string, namespace: string): any; + + /** + * Returns object of given namespace + * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' + */ + resolveNamespace(namespace: string): any; + + /** + * Loads image element from given url and passes it to a callback + * @param {String} url URL representing an image + * @param {Function} callback Callback; invoked with loaded image + * @param {Any} [context] Context to invoke callback in + * @param {Object} [crossOrigin] crossOrigin value to set image element to + */ + loadImage(url: string, callback: (image: HTMLImageElement) => {}, context?: any, crossOrigin?: boolean): void; + + /** + * Creates corresponding fabric instances from their object representations + * @param {Array} objects Objects to enliven + * @param {Function} callback Callback to invoke when all objects are created + * @param {String} namespace Namespace to get klass "Class" object from + * @param {Function} reviver Method for further parsing of object elements, called after each fabric object created. + */ + enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void; + + /** + * Groups SVG elements (usually those retrieved from SVG document) + * @param {Array} elements SVG elements to group + * @param {Object} [options] Options object + */ + groupSVGElements(elements: any[], options?: any, path?: any): IPathGroup + + /** + * Populates an object with properties of another object + * @param {Object} source Source object + * @param {Object} destination Destination object + * @param {Array} properties Propertie names to include + */ + populateWithProperties(source: any, destination: any, properties: any): void; + + /** + * Draws a dashed line between two points + * + * This method is used to draw dashed line around selection area. + * + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x start x coordinate + * @param {Number} y start y coordinate + * @param {Number} x2 end x coordinate + * @param {Number} y2 end y coordinate + * @param {Array} da dash array pattern + */ + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void; + + /** + * Creates canvas element and initializes it via excanvas if necessary + * @param {CanvasElement} [canvasEl] optional canvas element to initialize; + * when not given, element is created implicitly + */ + createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement; + + /** + * Creates image element (works on client and node) + */ + createImage(): HTMLImageElement; + + /** + * Creates accessors (getXXX, setXXX) for a "class", based on "stateProperties" array + * @param {Object} klass "Class" to create accessors for + */ + createAccessors(klass: any): any; + + /** + * @param {fabric.Object} receiver Object implementing `clipTo` method + * @param {CanvasRenderingContext2D} ctx Context to clip + */ + clipContext(receiver: IObject, ctx: CanvasRenderingContext2D): void; + + /** + * Multiply matrix A by matrix B to nest transformations + * @param {Array} a First transformMatrix + * @param {Array} b Second transformMatrix + */ + multiplyTransformMatrices(a: any[], b: any[]): any[] + + /** + * Returns string representation of function body + * @param {Function} fn Function to get body of + */ + getFunctionBody(fn: Function): string; + + /** + * Returns true if context has transparent pixel + * at specified location (taking tolerance into account) + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x x coordinate + * @param {Number} y y coordinate + * @param {Number} tolerance Tolerance + */ + isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; + } + interface Util extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, + IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { + ease: anim_ease; + array: IUtilArray; + object: IUtilObject; + string: IUtilString; } } From 334c6d982d8aa021ef2f727c323eb6d59e298fb3 Mon Sep 17 00:00:00 2001 From: Aleksey Blokhin Date: Fri, 15 May 2015 20:49:11 +0300 Subject: [PATCH 192/534] Fixed character case. --- angular-translate/angular-translate.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index bfc573dcc..1785fc37a 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -26,7 +26,7 @@ declare module angular.translate { set(name: string, value: string): void; } - interface ISTaticFilesLoaderOptions { + interface IStaticFilesLoaderOptions { prefix: string; suffix: string; key?: string; @@ -78,7 +78,7 @@ declare module angular.translate { storageKey(): string; storageKey(key: string): void; // JeroMiya - the library should probably return ITranslateProvider but it doesn't here useUrlLoader(url: string): ITranslateProvider; - useStaticFilesLoader(options: ISTaticFilesLoaderOptions): ITranslateProvider; + useStaticFilesLoader(options: IStaticFilesLoaderOptions): ITranslateProvider; useLoader(loaderFactory: string, options: any): ITranslateProvider; useLocalStorage(): ITranslateProvider; useCookieStorage(): ITranslateProvider; From c512d9c0c2edce37a57932ad0dc5276471b7afb5 Mon Sep 17 00:00:00 2001 From: Aleksey Blokhin Date: Fri, 15 May 2015 20:51:21 +0300 Subject: [PATCH 193/534] Updated and added interfaces. - added common interface IPartialLoader; - updated for ITranslatePartialLoaderService; - added interface for ITranslatePartialLoaderProvider. --- angular-translate/angular-translate.d.ts | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 1785fc37a..c32ba59b7 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -6,13 +6,7 @@ /// declare module angular.translate { - - interface ITranslatePartialLoaderService { - addPart(name: string): ITranslatePartialLoaderService; - deletePart(name: string, removeData?: boolean): ITranslatePartialLoaderService; - isPartAvailable(name: string): boolean; - } - + interface ITranslationTable { [key: string]: string; } @@ -32,6 +26,21 @@ declare module angular.translate { key?: string; } + interface IPartialLoader { + addPart(name : string, priority : number) : T; + setPart(lang : string, part : string, table : ITranslationTable) + deletePart(name : string) : T; + isPartAvailable(name : string) : boolean; + } + + interface ITranslatePartialLoaderService extends IPartialLoader { + getRegisteredParts() : Array; + isPartLoaded(name : string, lang : string) : boolean; + } + + interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader { + } + interface ITranslateService { (translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise; (translationId: string[], interpolateParams?: any, interpolationId?: string): angular.IPromise<{ [key: string]: string }>; From 0faae8ebf7f8e4c3cab38ef35ffd4a814b811c7b Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Fri, 15 May 2015 13:00:47 -0500 Subject: [PATCH 194/534] Collapse createChildren and rename as 'VChild' --- virtual-dom/virtual-dom.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/virtual-dom/virtual-dom.d.ts b/virtual-dom/virtual-dom.d.ts index 70166515f..7023d38fd 100644 --- a/virtual-dom/virtual-dom.d.ts +++ b/virtual-dom/virtual-dom.d.ts @@ -86,7 +86,8 @@ declare module VirtualDOM { key?: string; namespace?: string; } - type createChildren = Array; + + type VChild = VTree[] | VTree | string[] | string; /** create() calls either document.createElement() or document.createElementNS(), @@ -94,8 +95,8 @@ declare module VirtualDOM { */ function create(vnode: VText, opts?: {document?: Document, warn?: boolean}): Text; function create(vnode: VNode | Widget | Thunk, opts?: {document?: Document, warn?: boolean}): Element; - function h(tagName: string, properties: createProperties, ...children: createChildren): VNode; - function h(tagName: string, ...children: createChildren): VNode; + function h(tagName: string, properties: createProperties, ...children: VChild[]): VNode; + function h(tagName: string, ...children: VChild[]): VNode; function diff(left: VTree, right: VTree): VPatch[]; /** patch() usually just returns rootNode after doing stuff to it, so we want From f03d80a83b1cc57726fd9545f97281bf35774bf7 Mon Sep 17 00:00:00 2001 From: Aleksey Blokhin Date: Fri, 15 May 2015 21:01:26 +0300 Subject: [PATCH 195/534] Fixed missing return type. --- angular-translate/angular-translate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index c32ba59b7..b191bf455 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -28,7 +28,7 @@ declare module angular.translate { interface IPartialLoader { addPart(name : string, priority : number) : T; - setPart(lang : string, part : string, table : ITranslationTable) + setPart(lang : string, part : string, table : ITranslationTable) : T; deletePart(name : string) : T; isPartAvailable(name : string) : boolean; } From 1e2a1e22e5c44adb10667dc5bd91a2367f3af288 Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Fri, 15 May 2015 13:07:19 -0500 Subject: [PATCH 196/534] Fix h() signatures to reflect virtual-hyperscript readme (I must have misread the jsig file) --- virtual-dom/virtual-dom.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virtual-dom/virtual-dom.d.ts b/virtual-dom/virtual-dom.d.ts index 7023d38fd..10575e8ca 100644 --- a/virtual-dom/virtual-dom.d.ts +++ b/virtual-dom/virtual-dom.d.ts @@ -95,8 +95,8 @@ declare module VirtualDOM { */ function create(vnode: VText, opts?: {document?: Document, warn?: boolean}): Text; function create(vnode: VNode | Widget | Thunk, opts?: {document?: Document, warn?: boolean}): Element; - function h(tagName: string, properties: createProperties, ...children: VChild[]): VNode; - function h(tagName: string, ...children: VChild[]): VNode; + function h(tagName: string, properties: createProperties, children: string | VChild[]): VNode; + function h(tagName: string, children: string | VChild[]): VNode; function diff(left: VTree, right: VTree): VPatch[]; /** patch() usually just returns rootNode after doing stuff to it, so we want From 7521e83e3d73c60d159fe1c687a898e04adab7a8 Mon Sep 17 00:00:00 2001 From: Joseph Livecchi Date: Fri, 15 May 2015 17:30:20 -0400 Subject: [PATCH 197/534] checked and updated static func on fabric.d.ts * Edit and Modified the static functions for fabric and shaes namespaces * Added more JSDoc comments * Started filters rewrite --- fabricjs/fabricjs.d.ts | 2014 +++++++++++++++++++++++----------------- 1 file changed, 1175 insertions(+), 839 deletions(-) diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index 31b12db1e..048c915df 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -5,7 +5,7 @@ // Support AMD require declare module "fabric" { - export = fabric; + export = fabric; } declare module fabric { @@ -14,22 +14,92 @@ declare module fabric { var isTouchSupported: boolean; ///////////////////////////////////////////////////////////// - // Functions + // farbic Functions ///////////////////////////////////////////////////////////// function createCanvasForNode(width: number, height: number): ICanvas; - function getCSSRules(doc: SVGElement); - function getGradientDefs(doc: SVGElement); - // Parser - function loadSVGFromString(text: string, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + // Parse + // ---------------------------------------------------------- + /** + * Creates markup containing SVG referenced elements like patterns, gradients etc. + * @param {fabric.Canvas} canvas instance of fabric.Canvas + */ + function createSVGRefElementsMarkup(canvas: IStaticCanvas): string; + /** + * Creates markup containing SVG font faces + * @param {Array} objects Array of fabric objects + */ + function createSVGFontFacesMarkup(objects: IObject[]): string; + /** + * Takes string corresponding to an SVG document, and parses it into a set of fabric objects + * @param {String} string + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function loadSVGFromString(string: string, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + /** + * Takes url corresponding to an SVG document, and parses it into a set of fabric objects. Note that SVG is fetched via XMLHttpRequest, so it needs to conform to SOP (Same Origin Policy) + * @param {String} url + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ function loadSVGFromURL(url, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); - function parseAttributes(element, attributes: any[]): any; + /** + * Returns CSS rules for a given SVG document + * @param {SVGDocument} doc SVG document to parse + */ + function getCSSRules(doc: SVGElement): any; + function parseElements(elements: any[], callback, options, reviver); + /** + * Parses "points" attribute, returning an array of values + * @param {String} points points attribute string + */ function parsePointsAttribute(points: string): any[]; - function parseStyleAttribute(element: SVGElement); + /** + * Parses "style" attribute, retuning an object with values + * @param {SVGElement} element Element to parse + */ + function parseStyleAttribute(element: SVGElement): any; + /** + * Transforms an array of svg elements to corresponding fabric.* instances + * @param {Array} elements Array of elements to parse + * @param {Function} callback Being passed an array of fabric instances (transformed from SVG elements) + * @param {Object} [options] Options object + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function parseElements(elements: any[], callback: Function, options?: any, reviver?: Function): void; + /** + * Returns an object of attributes' name/value, given element and an array of attribute names; + * Parses parent "g" nodes recursively upwards. + * @param {DOMElement} element Element to parse + * @param {Array} attributes Array of attributes to parse + */ + function parseAttributes(elemen: HTMLElement, attributes: string[], svgUid?: string): { [key: string]: string } + /** + * Parses an SVG document, returning all of the gradient declarations found in it + * @param {SVGDocument} doc SVG document to parse + */ + function getGradientDefs(doc: SVGElement): { [key: string]: any }; + /** + * Parses a short font declaration, building adding its properties to a style object + * @param {String} value font declaration + * @param {Object} oStyle definition + */ + function parseFontDeclaration(value: string, oStyle: any): void; + /** + * Parses an SVG document, converts it to an array of corresponding fabric.* instances and passes them to a callback + * @param {SVGDocument} doc SVG document to parse + * @param {Function} callback Callback to call when parsing is finished; It's being passed an array of elements (parsed from a document). + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ function parseSVGDocument(doc: SVGElement, callback: (results, options) => void, reviver?: (el, obj) => void); - function parseTransformAttribute(attributeValue: string); + /** + * Parses "transform" attribute, returning an array of values + * @param {String} attributeValue String containing attribute value + */ + function parseTransformAttribute(attributeValue: string): number[]; // fabric Log // --------------- @@ -55,6 +125,7 @@ declare module fabric { var Point: IPointStatic var Circle: ICircleStatic; + var Ellipse: IEllipseStatic; var Group: IGroupStatic; var Image: IImageStatic var Line: ILineStatic; @@ -64,7 +135,9 @@ declare module fabric { var Polygon: IPolygonStatic var Polyline: IPolylineStatic; var Rect: IRectStatic; + var Shadow: IShadowStatic; var Text: ITextStatic; + var IText: IITextStatic; var Triangle: ITriangleStatic var util: Util; @@ -128,40 +201,6 @@ declare module fabric { offsetY?: number; } - interface IGradientOptions { - /** - * @param {String} [options.type] Type of gradient 'radial' or 'linear' - */ - type?: string; - /** - * x-coordinate of start point - */ - x1?: number; - /** - * y-coordinate of start point - */ - y1?: number; - /** - * x-coordinate of end point - */ - x2?: number; - /** - * y-coordinate of end point - */ - y2?: number; - /** - * Radius of start point (only for radial gradients) - */ - r1?: number; - /** - * Radius of end point (only for radial gradients) - */ - r2?: number; - /** - * Color stops object eg. {0:string; 1:string; - */ - colorStops?: any; - } interface IToSVGOptions { /** @@ -511,11 +550,78 @@ declare module fabric { prototype: any; } - - interface IGradient { - initialize(options): any; + interface IGradientOptions { + /** + * @param {String} [options.type] Type of gradient 'radial' or 'linear' + */ + type?: string; + /** + * x-coordinate of start point + */ + x1?: number; + /** + * y-coordinate of start point + */ + y1?: number; + /** + * x-coordinate of end point + */ + x2?: number; + /** + * y-coordinate of end point + */ + y2?: number; + /** + * Radius of start point (only for radial gradients) + */ + r1?: number; + /** + * Radius of end point (only for radial gradients) + */ + r2?: number; + /** + * Color stops object eg. {0:string; 1:string; + */ + colorStops?: any; + } + interface IGradient extends IGradientOptions { + /** + * Adds another colorStop + * @param {Object} colorStop Object with offset and color + */ + addColorStop(colorStop: any): IGradient; + /** + * Returns object representation of a gradient + */ toObject(): any; - toLiveGradient(ctx: CanvasRenderingContext2D): any; + /** + * Returns SVG representation of an gradient + * @param {Object} object Object to create a gradient for + * @param {Boolean} normalize Whether coords should be normalized + * @return {String} SVG representation of an gradient (linear/radial) + */ + toSVG(object: IObject, normalize?: boolean): string; + + /** + * Returns an instance of CanvasGradient + * @param {CanvasRenderingContext2D} ctx Context to render on + */ + toLive(ctx: CanvasRenderingContext2D, object?: IPathGroup): CanvasGradient; + } + interface IGrandientStatic { + new (options?: IGradientOptions): IGradient; + /** + * Returns instance from an SVG element + * @param {SVGGradientElement} el SVG gradient element + * @param {fabric.Object} instance + */ + fromElement(el: SVGGradientElement, instance: IObject): IGradient; + /** + * Returns instance from its object representation + * @param {Object} obj + * @param {Object} [options] Options object + */ + fromObject(obj: any, options: any[]): IGradient; } interface IIntersection { @@ -526,11 +632,13 @@ declare module fabric { /** * Appends points to intersection */ - appendPoints(point: IPoint); - - init(status?: string); + appendPoints(points: IPoint[]); } interface IIntersectionStatic { + /** + * Intersection class + */ + new (status?: string); /** * Checks if polygon intersects another polygon */ @@ -549,6 +657,50 @@ declare module fabric { intersectPolygonRectangle(points: IPoint[], r1: number, r2: number): IIntersection; } + interface IPatternOptions { + /** + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ + repeat: string; + + /** + * Pattern horizontal offset from object's left/top corner + */ + offsetX: number; + + /** + * Pattern vertical offset from object's left/top corner + */ + offsetY: number; + /** + * The source for the pattern + */ + source: string|HTMLImageElement; + } + interface IPattern extends IPatternOptions { + new (options?: IPatternOptions): IPattern; + + initialise(options?: IPatternOptions): IPattern; + /** + * Returns an instance of CanvasPattern + */ + toLive(ctx: CanvasRenderingContext2D): IPattern; + + /** + * Returns object representation of a pattern + */ + toObject(): any; + /** + * Returns SVG representation of a pattern + * @param {fabric.Object} object + */ + toSVG(object: IObject): string; + } + interface IPatternStatic { + new (options?: IPatternOptions): IPattern; + prototype: any; + } + interface IPoint { x: number; y: number; @@ -784,6 +936,10 @@ declare module fabric { */ reOffsetsAndBlur: RegExp } + interface IShadowStatic { + new (options?: IShadowOptions): IShadow + reOffsetsAndBlur: RegExp; + } /////////////////////////////////////////////////////////////////////////////// // Canvas Interfaces @@ -798,7 +954,6 @@ declare module fabric { */ height: number; } - interface ICanvasDimensionsOptions { /** * Set the given dimensions only as canvas backstore dimensions @@ -810,6 +965,83 @@ declare module fabric { cssOnly?: boolean; } + interface IStaticCanvasOptions { + /** + * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas + */ + allowTouchScrolling?: boolean; + /** + * Indicates whether this canvas will use image smoothing, this is on by default in browsers + */ + imageSmoothingEnabled?: boolean; + + /** + * Indicates whether objects should remain in current stack position when selected. When false objects are brought to top and rendered as part of the selection group + */ + preserveObjectStacking?: boolean; + + /** + * The transformation (in the format of Canvas transform) which focuses the viewport + */ + viewportTransform?: number[]; + + + + freeDrawingColor?: string; + freeDrawingLineWidth?: number; + + /** + * Background color of canvas instance. + * Should be set via setBackgroundColor + */ + backgroundColor?: string | IPattern; + /** + * Background image of canvas instance. + * Should be set via setBackgroundImage + * Backwards incompatibility note: The "backgroundImageOpacity" and "backgroundImageStretch" properties are deprecated since 1.3.9. + */ + backgroundImage?: IImage; + backgroundImageOpacity?: number; + backgroundImageStretch?: number; + /** + * Function that determines clipping of entire canvas area + * Being passed context as first argument. See clipping canvas area + */ + clipTo?: (context: CanvasRenderingContext2D) => void; + + /** + * Indicates whether object controls (borders/controls) are rendered above overlay image + */ + controlsAboveOverlay?: boolean; + + /** + * Indicates whether toObject/toDatalessObject should include default values + */ + includeDefaultValues?: boolean; + /** + * Overlay color of canvas instance. + * Should be set via setOverlayColor + */ + overlayColor?: string | IPattern; + /** + * Overlay image of canvas instance. + * Should be set via setOverlayImage + * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. + */ + overlayImage?: IImage; + overlayImageLeft?: number; + overlayImageTop?: number; + /** + * Indicates whether add, insertAt and remove should also re-render canvas. + * Disabling this option could give a great performance boost when adding/removing a lot of objects to/from canvas at once + * (followed by a manual rendering after addition/deletion) + */ + renderOnAddRemove?: boolean; + /** + * Indicates whether objects' state should be saved + */ + stateful?: boolean; + } interface IStaticCanvas extends IObservable, IStaticCanvasOptions, ICollection, ICanvasAnimation { /** * Calculates canvas element offset relative to the document @@ -1085,16 +1317,127 @@ declare module fabric { interface IStaticCanvasStatic { /** * Constructor - * @param {HTMLElement | String} element element to initialize instance on + * @param {HTMLElement|String} element element to initialize instance on * @param {Object} [options] Options object */ - new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; + new (element: HTMLCanvasElement | string, options?: ICanvasOptions): IStaticCanvas; EMPTY_JSON: string; + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * @param {String} methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" + */ supports(methodName: string): boolean; prototype: any; + /** + * Returns JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toJSON(propertiesToInclude?: any[]): string; } + interface ICanvasOptions extends IStaticCanvasOptions { + /** + * When true, objects can be transformed by one side (unproportionally) + */ + uniScaleTransform?: boolean; + + /** + * When true, objects use center point as the origin of scale transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredScaling?: boolean; + + /** + * When true, objects use center point as the origin of rotate transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ + centeredRotation?: boolean; + + /** + * Indicates that canvas is interactive. This property should not be changed. + */ + interactive?: boolean; + + /** + * Indicates whether group selection should be enabled + */ + selection?: boolean; + + /** + * Color of selection + */ + selectionColor?: string; + + /** + * Default dash array pattern + * If not empty the selection border is dashed + */ + selectionDashArray?: any[]; + + /** + * Color of the border of selection (usually slightly darker than color of selection itself) + */ + selectionBorderColor?: string; + + /** + * Width of a line used in object/group selection + */ + selectionLineWidth?: number; + + /** + * Default cursor value used when hovering over an object on canvas + */ + hoverCursor?: string; + + /** + * Default cursor value used when moving an object on canvas + */ + moveCursor?: string; + + /** + * Default cursor value used for the entire canvas + */ + defaultCursor?: string; + + /** + * Cursor value used during free drawing + */ + freeDrawingCursor?: string; + + /** + * Cursor value used for rotation point + */ + rotationCursor?: string; + + /** + * Default element class that's given to wrapper (div) element of canvas + */ + containerClass?: string; + + /** + * When true, object detection happens on per-pixel basis rather than on per-bounding-box + */ + perPixelTargetFind?: boolean; + + /** + * Number of pixels around target pixel to tolerate (consider active) during object detection + */ + targetFindTolerance?: number; + + /** + * When true, target detection is skipped when hovering over canvas. This can be used to improve performance. + */ + skipTargetFind?: boolean; + + /** + * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. + * After mousedown, mousemove creates a shape, + * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. + */ + isDrawingMode?: boolean; + } interface ICanvas extends IStaticCanvas, ICanvasOptions { // constructors new (element: HTMLCanvasElement|string, options: ICanvasOptions): ICanvas; @@ -1212,10 +1555,22 @@ declare module fabric { new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; EMPTY_JSON: string; + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * @param {String} methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" + */ supports(methodName: string): boolean; prototype: any; + /** + * Returns JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toJSON(propertiesToInclude?: any[]): string; } + + /////////////////////////////////////////////////////////////////////////////// // Shape Interfaces ////////////////////////////////////////////////////////////////////////////// @@ -1273,9 +1628,24 @@ declare module fabric { toSVG(reviver?: Function): string; } interface ICircleStatic { + /** + * List of attribute names to account for when parsing SVG element (used by {@link fabric.Circle.fromElement}) + */ ATTRIBUTE_NAMES: string[]; + /** + * Returns Circle instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ fromElement(element: SVGElement, options: ICircleOptions): ICircle; - fromObject(object): ICircle; + /** + * Returns Circle instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ICircle; + /** + * Circle class + */ new (options?: ICircleOptions): ICircle; prototype: any; } @@ -1321,6 +1691,26 @@ declare module fabric { */ complexity(): number; } + interface IEllipseStatic { + new (options?: IEllipseOptions): IEllipse; + /** + * List of attribute names to account for when parsing SVG element (used by {@link fabric.Ellipse.fromElement}) + */ + ATTRIBUTE_NAMES: string[]; + + /** + * Returns Ellipse instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IEllipseOptions): IEllipse + + /** + * Returns Ellipse instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IEllipse; + } interface IGroup extends IObject, ICollection { initialize(objects?: IObject[], options?: IObjectOptions): any; @@ -1404,7 +1794,18 @@ declare module fabric { toSVG(reviver?: Function): string; } interface IGroupStatic { + /** + * Constructor + * @param {Object} objects Group objects + * @param {Object} [options] Options object + */ new (items?: any[], options?: IObjectOptions): IGroup; + /** + * Returns {@link fabric.Group} instance from an object representation + * @param {Object} object Object to create a group from + * @param {Function} [callback] Callback to invoke when an group instance is created + */ + fromObject(object: any, callback: (group: IGroup) => any): void; } interface IImageOptions extends IObjectOptions { @@ -1511,55 +1912,40 @@ declare module fabric { setSrc(src: string, callback: Function, options: IImageOptions): IImage; } interface IImageStatic { - fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; + /** + * Constructor + * @param {HTMLImageElement | String} element Image element + * @param {Object} [options] Options object + */ new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; + /** + * Creates an instance of fabric.Image from an URL string + * @param {String} url URL to create an image from + * @param {Function} [callback] Callback to invoke when image is created (newly created image is passed as a first argument) + * @param {Object} [imgOptions] Options object + */ + fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; + /** + * Creates an instance of fabric.Image from its object representation + * @static + * @param {Object} object Object to create an instance from + * @param {Function} [callback] Callback to invoke when an image instance is created + */ + fromObject(object: any, callback: (image: IImage) => {}): void; + /** + * Returns Image instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Function} callback Callback to execute when fabric.Image object is created + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, callback: Function, options?: IImageOptions): void; prototype: any; + /** + * Default CSS class name for canvas + */ + CSS_CANVAS: string; - filters: - { - Grayscale: { - new (): IGrayscaleFilter; - }; - Brightness: { - new (options?: { brightness: number; }): IBrightnessFilter; - }; - RemoveWhite: { - new (options?: { - threshold?: string; // TODO: Check this - distance?: string; // TODO: Check this - }): IRemoveWhiteFilter; - }; - Invert: { - new (): IInvertFilter; - }; - Sepia: { - new (): ISepiaFilter; - }; - Sepia2: { - new (): ISepia2Filter; - }; - Noise: { - new (options?: { - noise?: number; - }): INoiseFilter; - }; - GradientTransparency: { - new (options?: { - threshold?: number; - }): IGradientTransparencyFilter; - }; - Pixelate: { - new (options?: { - color?: any; - }): IPixelateFilter; - }; - Convolute: { - new (options?: { - matrix: any; - }): IConvoluteFilter; - }; - }; - + filters: IAllFilters } interface ILineOptions extends IObjectOptions { @@ -1603,10 +1989,24 @@ declare module fabric { } interface ILineStatic { ATTRIBUTE_NAMES: string[]; - fromElement(element: SVGElement, options): ILine; + /** + * Returns fabric.Line instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: ILineOptions): ILine; + /** + * Returns fabric.Line instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object): ILine; prototype: any; - new (points: number[], objObjects?: IObjectOptions): ILine; + /** + * Constructor + * @param {Array} [points] Array of points + * @param {Object} [options] Options object + */ + new (points?: number[], objObjects?: IObjectOptions): ILine; } interface IObjectOptions { @@ -2227,9 +2627,25 @@ declare module fabric { toSVG(reviver?: Function): string; } interface IPathStatic { - fromElement(element: SVGElement, options): IPath; - fromObject(object): IPath; - new (): IPath; + /** + * Creates an instance of fabric.Path from an SVG element + * @param {SVGElement} element to parse + * @param {Function} callback Callback to invoke when an fabric.Path instance is created + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, callback: (path: IPath) => any, options?: IPathOptions): void; + /** + * Creates an instance of fabric.Path from an object + * @param {Object} object + * @param {Function} callback Callback to invoke when an fabric.Path instance is created + */ + fromObject(object: any, callback: (path: IPath) => any): void; + /** + * Constructor + * @param {Array|String} path Path data (sequence of coordinates and corresponding "command" tokens) + * @param {Object} [options] Options object + */ + new (path?: string|any[], options?: IPathOptions): IPath; } interface IPathGroup extends IObject { @@ -2281,7 +2697,20 @@ declare module fabric { } interface IPathGroupStatic { fromObject(object): IPathGroup; - new (): IPathGroup; + /** + * Constructor + * @param {Array} paths + * @param {Object} [options] Options object + */ + new (paths: IPath[], options?: IObjectOptions): IPathGroup; + /** + * Creates fabric.PathGroup instance from an object representation + * @static + * @memberOf fabric.PathGroup + * @param {Object} object Object to create an instance from + * @param {Function} callback Callback to invoke when an fabric.PathGroup instance is created + */ + fromObject(object: any, callback: (group: IPathGroup) => any): void; prototype: any; } @@ -2302,7 +2731,6 @@ declare module fabric { minY?: number; } interface IPolygon extends IObject, IPolygonOptions { - initialize(points?: IPoint[], options?: IPolygonOptions): IPolygon; /** * Returns complexity of an instance * @return {Number} complexity of this instance @@ -2323,9 +2751,28 @@ declare module fabric { toSVG(reviver?: Function): string; } interface IPolygonStatic { - fromObject(object): IPolygon; - fromElement(element: SVGElement, options): IPolygon; - new (points: any[], options?: IObjectOptions, skipOffset?: boolean): IPolygon; + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + + /** + * Returns Polygon instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IPolygonOptions): IPolygon; + /** + * Returns fabric.Polygon instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IPolygon; + /** + * Constructor + * @param {Array} points Array of points + * @param {Object} [options] Options object + */ + new (points: { x: number; y: number }[], options?: IObjectOptions, skipOffset?: boolean): IPolygon; prototype: any; } @@ -2366,9 +2813,29 @@ declare module fabric { toSVG(reviver?: Function): string; } interface IPolylineStatic { - fromObject(object): IPolyline; - fromElement(element: SVGElement, options): IPolyline; - new (): IPolyline; + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + + /** + * Returns Polyline instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IPolylineOptions): IPolyline; + /** + * Returns fabric.Polyline instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IPolyline; + /** + * Constructor + * @param {Array} points Array of points (where each point is an object with x and y) + * @param {Object} [options] Options object + * @param {Boolean} [skipOffset] Whether points offsetting should be skipped + */ + new (points: { x: number; y: number }[], options?: IPolylineOptions): IPolyline; prototype: any; } @@ -2407,8 +2874,25 @@ declare module fabric { toSVG(reviver?: Function): string; } interface IRectStatic { - fromElement(element: SVGElement, options: IRectOptions): IRect; - fromObject(object): IRect; + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Rect.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + /** + * Returns Rect instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: IRectOptions): IRect; + /** + * Returns Rect instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IRect; + /** + * Constructor + * @param {Object} [options] Options object + */ new (options?: IRectOptions): IRect; prototype: any; } @@ -2580,7 +3064,33 @@ declare module fabric { } interface ITextStatic { - new (text: string, options?: IITextOptions): IText; + /** + * List of attribute names to account for when parsing SVG element (used by `fabric.Text.fromElement`) + */ + ATTRIBUTE_NAMES: string[]; + /** + * Default SVG font size + */ + DEFAULT_SVG_FONT_SIZE: number; + /** + * Constructor + * @param {String} text Text string + * @param {Object} [options] Options object + */ + new (text: string, options?: ITextOptions): IText; + + /** + * Returns fabric.Text instance from an SVG element (not yet implemented) + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ + fromElement(element: SVGElement, options?: ITextOptions): IText + + /** + * Returns fabric.Text instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IText; } interface IITextOptions extends IObjectOptions, ITextOptions { @@ -2734,6 +3244,19 @@ declare module fabric { renderSelection(chars: string[], boundaries: any): void; } + interface IITextStatic extends ITextStatic { + /** + * Constructor + * @param {String} text Text string + * @param {Object} [options] Options object + */ + new (text: string, options?: IITextOptions): IIText; + /** + * Returns fabric.IText instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IIText; + } interface ITriangleOptions extends IObjectOptions { } interface ITriangle extends IObject { @@ -2753,748 +3276,561 @@ declare module fabric { toSVG(reviver?: Function): string; } interface ITriangleStatic { - new (options?: ITriangleOptions): ITriangle; - } - - - interface IPatternOptions { /** - * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) - */ - repeat: string; - - /** - * Pattern horizontal offset from object's left/top corner - */ - offsetX: number; - - /** - * Pattern vertical offset from object's left/top corner - */ - offsetY: number; - /** - * The source for the pattern - */ - source: string|HTMLImageElement; - } - interface IPattern extends IPatternOptions { - new (options?: IPatternOptions): IPattern; - - initialise(options?: IPatternOptions): IPattern; - /** - * Returns an instance of CanvasPattern - */ - toLive(ctx: CanvasRenderingContext2D): IPattern; - - /** - * Returns object representation of a pattern - */ - toObject(): any; - /** - * Returns SVG representation of a pattern - * @param {fabric.Object} object - */ - toSVG(object: IObject): string; - } - interface IPatternStatic { - new (options: IPatternOptions): IPattern; - prototype: any; - } - - interface IBrightnessFilter { - } - interface IInvertFilter { - } - interface IRemoveWhiteFilter { - } - interface IGrayscaleFilter { - } - interface ISepiaFilter { - } - interface ISepia2Filter { - } - interface INoiseFilter { - } - interface IGradientTransparencyFilter { - } - interface IPixelateFilter { - } - interface IConvoluteFilter { - } - interface ICanvasOptions extends IStaticCanvasOptions { - /** - * When true, objects can be transformed by one side (unproportionally) - */ - uniScaleTransform?: boolean; - - /** - * When true, objects use center point as the origin of scale transformation. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ - centeredScaling?: boolean; - - /** - * When true, objects use center point as the origin of rotate transformation. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ - centeredRotation?: boolean; - - /** - * Indicates that canvas is interactive. This property should not be changed. - */ - interactive?: boolean; - - /** - * Indicates whether group selection should be enabled - */ - selection?: boolean; - - /** - * Color of selection - */ - selectionColor?: string; - - /** - * Default dash array pattern - * If not empty the selection border is dashed - */ - selectionDashArray?: any[]; - - /** - * Color of the border of selection (usually slightly darker than color of selection itself) - */ - selectionBorderColor?: string; - - /** - * Width of a line used in object/group selection - */ - selectionLineWidth?: number; - - /** - * Default cursor value used when hovering over an object on canvas - */ - hoverCursor?: string; - - /** - * Default cursor value used when moving an object on canvas - */ - moveCursor?: string; - - /** - * Default cursor value used for the entire canvas - */ - defaultCursor?: string; - - /** - * Cursor value used during free drawing - */ - freeDrawingCursor?: string; - - /** - * Cursor value used for rotation point - */ - rotationCursor?: string; - - /** - * Default element class that's given to wrapper (div) element of canvas - */ - containerClass?: string; - - /** - * When true, object detection happens on per-pixel basis rather than on per-bounding-box - */ - perPixelTargetFind?: boolean; - - /** - * Number of pixels around target pixel to tolerate (consider active) during object detection - */ - targetFindTolerance?: number; - - /** - * When true, target detection is skipped when hovering over canvas. This can be used to improve performance. - */ - skipTargetFind?: boolean; - - /** - * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. - * After mousedown, mousemove creates a shape, - * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. - */ - isDrawingMode?: boolean; - } - interface IStaticCanvasOptions { - /** - * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas - */ - allowTouchScrolling?: boolean; - /** - * Indicates whether this canvas will use image smoothing, this is on by default in browsers - */ - imageSmoothingEnabled?: boolean; - - /** - * Indicates whether objects should remain in current stack position when selected. When false objects are brought to top and rendered as part of the selection group - */ - preserveObjectStacking?: boolean; - - /** - * The transformation (in the format of Canvas transform) which focuses the viewport - */ - viewportTransform?: number[]; - - - - freeDrawingColor?: string; - freeDrawingLineWidth?: number; - - /** - * Background color of canvas instance. - * Should be set via setBackgroundColor - */ - backgroundColor?: string | IPattern; - /** - * Background image of canvas instance. - * Should be set via setBackgroundImage - * Backwards incompatibility note: The "backgroundImageOpacity" and "backgroundImageStretch" properties are deprecated since 1.3.9. - */ - backgroundImage?: IImage; - backgroundImageOpacity?: number; - backgroundImageStretch?: number; - /** - * Function that determines clipping of entire canvas area - * Being passed context as first argument. See clipping canvas area - */ - clipTo?: (context: CanvasRenderingContext2D) => void; - - /** - * Indicates whether object controls (borders/controls) are rendered above overlay image - */ - controlsAboveOverlay?: boolean; - - /** - * Indicates whether toObject/toDatalessObject should include default values - */ - includeDefaultValues?: boolean; - /** - * Overlay color of canvas instance. - * Should be set via setOverlayColor - */ - overlayColor?: string | IPattern; - /** - * Overlay image of canvas instance. - * Should be set via setOverlayImage - * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. - */ - overlayImage?: IImage; - overlayImageLeft?: number; - overlayImageTop?: number; - /** - * Indicates whether add, insertAt and remove should also re-render canvas. - * Disabling this option could give a great performance boost when adding/removing a lot of objects to/from canvas at once - * (followed by a manual rendering after addition/deletion) - */ - renderOnAddRemove?: boolean; - /** - * Indicates whether objects' state should be saved - */ - stateful?: boolean; - } - - - /////////////////////////////////////////////////////////////////////////////// - // Fabric util Interface - ////////////////////////////////////////////////////////////////////////////// - // animations - interface IUtilAnimationOptions { - /** - * Starting value - */ - startValue?: number; - /** - * Ending value - */ - endValue?: number; - /** - * Value to modify the property by + * Constructor + * @param {Object} [options] Options object */ - byValue: number; + new (options?: ITriangleOptions): ITriangle; /** - * Duration of change (in ms) - */ - duration?: number; - /** - * Callback; invoked on every value change - */ - onChange?: Function; - /** - * Callback; invoked when value change is completed - */ - onComplete?: Function - /** - * Easing function - */ - easing?: Function; - } - interface IUtilAnimation { - /** - * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. - * @param {Object} [options] Animation options - */ - animate(options?: IUtilAnimationOptions): void; - /** - * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ - * In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method - * @param {Function} callback Callback to invoke + * Returns Triangle instance from an object representation + * @param {Object} object Object to create an instance from */ - requestAnimFrame(callback: Function): void; + fromObject(object: any): ITriangle; } - // anim_ease - interface anim_ease { - easeInBack(): Function; - easeInBounce(): Function; - easeInCirc(): Function; - easeInCubic(): Function; - easeInElastic(): Function; - easeInExpo(): Function; - easeInOutBack(): Function; - easeInOutBounce(): Function; - easeInOutCirc(): Function; - easeInOutCubic(): Function; - easeInOutElastic(): Function; - easeInOutExpo(): Function; - easeInOutQuad(): Function; - easeInOutQuart(): Function; - easeInOutQuint(): Function; - easeInOutSine(): Function; - easeInQuad(): Function; - easeInQuart(): Function; - easeInQuint(): Function; - easeInSine(): Function; - easeOutBack(): Function; - easeOutBounce(): Function; - easeOutCirc(): Function; - easeOutCubic(): Function; - easeOutElastic(): Function; - easeOutExpo(): Function; - easeOutQuad(): Function; - easeOutQuart(): Function; - easeOutQuint(): Function; - easeOutSine(): Function; + //////////////////////////////////////////////////////////// + // Filters + //////////////////////////////////////////////////////////// + interface IAllFilters { + BaseFilter: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IBaseFilter; + } } + interface IBaseFilter { + /** + * Sets filter's properties from options + * @param {Object} [options] Options object + */ + setOptions(options?: any): void; + /** + * Returns object representation of an instance + */ + toObject(): any; - interface IUtilArc { /** - * Draws arc - * @param {CanvasRenderingContext2D} ctx - * @param {Number} fx - * @param {Number} fy - * @param {Array} coords + * Returns a JSON representation of an instance */ - drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void; - /** - * Calculate bounding box of a elliptic-arc - * @param {Number} fx start point of arc - * @param {Number} fy - * @param {Number} rx horizontal radius - * @param {Number} ry vertical radius - * @param {Number} rot angle of horizontal axe - * @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points - * @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction - * @param {Number} tx end point of arc - * @param {Number} ty - */ - getBoundsOfArc(fx: number, fy: number, rx: number, ry: number, rot: number, large: number, sweep: number, tx: number, ty: number): IPoint[]; - /** - * Calculate bounding box of a beziercurve - * @param {Number} x0 starting point - * @param {Number} y0 - * @param {Number} x1 first control point - * @param {Number} y1 - * @param {Number} x2 secondo control point - * @param {Number} y2 - * @param {Number} x3 end of beizer - * @param {Number} y3 - */ - getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): IPoint[]; - + toJSON(): string; } +} +interface IBrightnessFilter { +} +interface IInvertFilter { +} +interface IRemoveWhiteFilter { +} +interface IGrayscaleFilter { +} +interface ISepiaFilter { +} +interface ISepia2Filter { +} +interface INoiseFilter { +} +interface IGradientTransparencyFilter { +} +interface IPixelateFilter { +} +interface IConvoluteFilter { +} - interface IUtilDomEvent { - /** - * Cross-browser wrapper for getting event's coordinates - * @param {Event} event Event object - * @param {HTMLCanvasElement} upperCanvasEl <canvas> element on which object selection is drawn + +/////////////////////////////////////////////////////////////////////////////// +// Fabric util Interface +////////////////////////////////////////////////////////////////////////////// +interface IUtilAnimationOptions { + /** + * Starting value + */ + startValue?: number; + /** + * Ending value + */ + endValue?: number; + /** + * Value to modify the property by */ - getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): IPoint; + byValue: number; + /** + * Duration of change (in ms) + */ + duration?: number; + /** + * Callback; invoked on every value change + */ + onChange?: Function; + /** + * Callback; invoked when value change is completed + */ + onComplete?: Function + /** + * Easing function + */ + easing?: Function; +} +interface IUtilAnimation { + /** + * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. + * @param {Object} [options] Animation options + */ + animate(options?: IUtilAnimationOptions): void; + /** + * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + * In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method + * @param {Function} callback Callback to invoke + */ + requestAnimFrame(callback: Function): void; +} - /** - * Adds an event listener to an element +interface IUtilAnimEase { + easeInBack(): Function; + easeInBounce(): Function; + easeInCirc(): Function; + easeInCubic(): Function; + easeInElastic(): Function; + easeInExpo(): Function; + easeInOutBack(): Function; + easeInOutBounce(): Function; + easeInOutCirc(): Function; + easeInOutCubic(): Function; + easeInOutElastic(): Function; + easeInOutExpo(): Function; + easeInOutQuad(): Function; + easeInOutQuart(): Function; + easeInOutQuint(): Function; + easeInOutSine(): Function; + easeInQuad(): Function; + easeInQuart(): Function; + easeInQuint(): Function; + easeInSine(): Function; + easeOutBack(): Function; + easeOutBounce(): Function; + easeOutCirc(): Function; + easeOutCubic(): Function; + easeOutElastic(): Function; + easeOutExpo(): Function; + easeOutQuad(): Function; + easeOutQuart(): Function; + easeOutQuint(): Function; + easeOutSine(): Function; +} + +interface IUtilArc { + /** + * Draws arc + * @param {CanvasRenderingContext2D} ctx + * @param {Number} fx + * @param {Number} fy + * @param {Array} coords + */ + drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void; + /** + * Calculate bounding box of a elliptic-arc + * @param {Number} fx start point of arc + * @param {Number} fy + * @param {Number} rx horizontal radius + * @param {Number} ry vertical radius + * @param {Number} rot angle of horizontal axe + * @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points + * @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction + * @param {Number} tx end point of arc + * @param {Number} ty + */ + getBoundsOfArc(fx: number, fy: number, rx: number, ry: number, rot: number, large: number, sweep: number, tx: number, ty: number): IPoint[]; + /** + * Calculate bounding box of a beziercurve + * @param {Number} x0 starting point + * @param {Number} y0 + * @param {Number} x1 first control point + * @param {Number} y1 + * @param {Number} x2 secondo control point + * @param {Number} y2 + * @param {Number} x3 end of beizer + * @param {Number} y3 + */ + getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): IPoint[]; + +} + +interface IUtilDomEvent { + /** + * Cross-browser wrapper for getting event's coordinates + * @param {Event} event Event object + * @param {HTMLCanvasElement} upperCanvasEl <canvas> element on which object selection is drawn + */ + getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): IPoint; + + /** + * Adds an event listener to an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + addListener(element: HTMLElement, eventName: string, handler: Function): void; + + /** + * Removes an event listener from an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + removeListener(element: HTMLElement, eventName: string, handler: Function): void; +} + +interface IUtilDomMisc { + /** + * Takes id and returns an element with that id (if one exists in a document) + * @param {String|HTMLElement} id + */ + getById(id: string|HTMLElement): HTMLElement; + /** + * Converts an array-like object (e.g. arguments or NodeList) to an array + * @param {Object} arrayLike + */ + toArray(arrayLike: any): any[]; + /** + * Creates specified element with specified attributes + * @memberOf fabric.util + * @param {String} tagName Type of an element to create + * @param {Object} [attributes] Attributes to set on an element + * @return {HTMLElement} Newly created element + */ + makeElement(tagName: string, attributes?: any): HTMLElement; + /** + * Adds class to an element + * @param {HTMLElement} element Element to add class to + * @param {String} className Class to add to an element + */ + addClass(element: HTMLElement, classname: string): void; + /** + * Wraps element with another element + * @param {HTMLElement} element Element to wrap + * @param {HTMLElement|String} wrapper Element to wrap with + * @param {Object} [attributes] Attributes to set on a wrapper + */ + wrapElement(element: HTMLElement, wrapper: HTMLElement|string, attributes?: any): HTMLElement; + /** + * Returns element scroll offsets + * @param {HTMLElement} element Element to operate on + * @param {HTMLElement} upperCanvasEl Upper canvas element + */ + getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; } + /** + * Returns offset for a given element + * @param {HTMLElement} element Element to get offset for + */ + getElementOffset(element: HTMLElement): { left: number; right: number; } + /** + * Returns style attribute value of a given element + * @param {HTMLElement} element Element to get style attribute for + * @param {String} attr Style attribute to get for element + */ + getElementStyle(elment: HTMLElement, attr: string): string; + /** + * Inserts a script element with a given url into a document; invokes callback, when that script is finished loading + * @memberOf fabric.util + * @param {String} url URL of a script to load + * @param {Function} callback Callback to execute when script is finished loading + */ + getScript(url: string, callback: Function): void; + /** + * Makes element unselectable + * @param {HTMLElement} element Element to make unselectable + */ + makeElementUnselectable(element: HTMLElement): HTMLElement; + /** + * Makes element selectable + * @param {HTMLElement} element Element to make selectable + */ + makeElementSelectable(element: HTMLElement): HTMLElement; +} + +interface IUtilDomRequest { + /** + * Cross-browser abstraction for sending XMLHttpRequest + * @param {String} url URL to send XMLHttpRequest to + * @param {Object} [options] Options object + * @param {String} [options.method="GET"] + * @param {Function} options.onComplete Callback to invoke when request is completed + */ + request(url: string, options?: { method?: string; onComplete: Function }): XMLHttpRequest; +} + +interface IUtilDomStyle { + /** + * Cross-browser wrapper for setting element's style * @param {HTMLElement} element - * @param {String} eventName - * @param {Function} handler + * @param {Object} styles */ - addListener(element: HTMLElement, eventName: string, handler: Function): void; + setStyle(element: HTMLElement, styles: any): HTMLElement; +} - /** - * Removes an event listener from an element - * @param {HTMLElement} element - * @param {String} eventName - * @param {Function} handler +interface IUtilArray { + /** + * Invokes method on all items in a given array + * @param {Array} array Array to iterate over + * @param {String} method Name of a method to invoke */ - removeListener(element: HTMLElement, eventName: string, handler: Function): void; - } - - interface IUtilDomMisc { - /** - * Takes id and returns an element with that id (if one exists in a document) - * @param {String|HTMLElement} id - */ - getById(id: string|HTMLElement): HTMLElement; - /** - * Converts an array-like object (e.g. arguments or NodeList) to an array - * @param {Object} arrayLike - */ - toArray(arrayLike: any): any[]; - /** - * Creates specified element with specified attributes - * @memberOf fabric.util - * @param {String} tagName Type of an element to create - * @param {Object} [attributes] Attributes to set on an element - * @return {HTMLElement} Newly created element - */ - makeElement(tagName: string, attributes?: any): HTMLElement; - /** - * Adds class to an element - * @param {HTMLElement} element Element to add class to - * @param {String} className Class to add to an element - */ - addClass(element: HTMLElement, classname: string): void; - /** - * Wraps element with another element - * @param {HTMLElement} element Element to wrap - * @param {HTMLElement|String} wrapper Element to wrap with - * @param {Object} [attributes] Attributes to set on a wrapper - */ - wrapElement(element: HTMLElement, wrapper: HTMLElement|string, attributes?: any): HTMLElement; - /** - * Returns element scroll offsets - * @param {HTMLElement} element Element to operate on - * @param {HTMLElement} upperCanvasEl Upper canvas element - */ - getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; } - /** - * Returns offset for a given element - * @param {HTMLElement} element Element to get offset for - */ - getElementOffset(element: HTMLElement): { left: number; right: number; } - /** - * Returns style attribute value of a given element - * @param {HTMLElement} element Element to get style attribute for - * @param {String} attr Style attribute to get for element - */ - getElementStyle(elment: HTMLElement, attr: string): string; - /** - * Inserts a script element with a given url into a document; invokes callback, when that script is finished loading - * @memberOf fabric.util - * @param {String} url URL of a script to load - * @param {Function} callback Callback to execute when script is finished loading - */ - getScript(url: string, callback: Function): void; - /** - * Makes element unselectable - * @param {HTMLElement} element Element to make unselectable - */ - makeElementUnselectable(element: HTMLElement): HTMLElement; - /** - * Makes element selectable - * @param {HTMLElement} element Element to make selectable - */ - makeElementSelectable(element: HTMLElement): HTMLElement; - } - - interface IUtilDomRequest { - /** - * Cross-browser abstraction for sending XMLHttpRequest - * @param {String} url URL to send XMLHttpRequest to - * @param {Object} [options] Options object - * @param {String} [options.method="GET"] - * @param {Function} options.onComplete Callback to invoke when request is completed - */ - request(url: string, options?: { method?: string; onComplete: Function }): XMLHttpRequest; - } - - interface IUtilDomStyle { - /** - * Cross-browser wrapper for setting element's style - * @param {HTMLElement} element - * @param {Object} styles - */ - setStyle(element: HTMLElement, styles: any): HTMLElement; - } - - interface IUtilArray { - /** - * Invokes method on all items in a given array - * @param {Array} array Array to iterate over - * @param {String} method Name of a method to invoke - */ - invoke(array: any[], method: string): any[]; - /** - * Finds minimum value in array (not necessarily "first" one) - * @param {Array} array Array to iterate over - * @param {String} byProperty - */ - min(array: any[], byProperty: string): any; - /** - * Finds maximum value in array (not necessarily "first" one) + invoke(array: any[], method: string): any[]; + /** + * Finds minimum value in array (not necessarily "first" one) * @param {Array} array Array to iterate over * @param {String} byProperty */ - max(array: any[], byProperty: string): any; - } - - interface IUtilClass { - /** - * Helper for creation of "classes". - * @param {Function} [parent] optional "Class" to inherit from - * @param {Object} [properties] Properties shared by all instances of this class - * (be careful modifying objects defined here as this would affect all instances) - */ - createClass(parent: Function, properties?: any); - /** - * Helper for creation of "classes". - * @param {Object} [properties] Properties shared by all instances of this class - * (be careful modifying objects defined here as this would affect all instances) - */ - createClass(properties?: any); - - } - - interface IUtilObject { - /** - * Copies all enumerable properties of one object to another - * @param {Object} destination Where to copy to - * @param {Object} source Where to copy from - */ - extend(destination: any, source: any): any; - - /** - * Creates an empty object and copies all enumerable properties of another object to it - * @memberOf fabric.util.object - * @param {Object} object Object to clone - * @return {Object} - */ - clone(object: any): any - } - - interface IUtilString { - /** - * Camelizes a string - * @param {String} string String to camelize - */ - camelize(string: string): string; - - /** - * Capitalizes a string - * @param {String} string String to capitalize - * @param {Boolean} [firstLetterOnly] If true only first letter is capitalized - * and other letters stay untouched, if false first letter is capitalized - * and other letters are converted to lowercase. - */ - capitalize(string: string, firstLetterOnly: boolean): string; - - /** - * Escapes XML in a string - * @param {String} string String to escape - */ - escapeXml(string: string): string; - } - - interface IUtilMisc { - /** - * Removes value from an array. - * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` - * @param {Array} array - * @param {Any} value - */ - removeFromArray(array: any[], value: any): any[]; - - /** - * Returns random number between 2 specified ones. - * @param {Number} min lower limit - * @param {Number} max upper limit - */ - getRandomInt(min: number, max: number): number; - - /** - * Transforms degrees to radians. - * @param {Number} degrees value in degrees - */ - degreesToRadians(degrees: number): number; - - /** - * Transforms radians to degrees. - * @memberOf fabric.util - * @param {Number} radians value in radians - */ - radiansToDegrees(radians: number): number; - - /** - * Rotates `point` around `origin` with `radians` - * @param {fabric.Point} point The point to rotate - * @param {fabric.Point} origin The origin of the rotation - * @param {Number} radians The radians of the angle for the rotation - */ - rotatePoint(point: IPoint, origin: IPoint, radians: number): IPoint; - - /** - * Apply transform t to point p - * @param {fabric.Point} p The point to transform - * @param {Array} t The transform - * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied - */ - transformPoint(p: IPoint, t: any[], ignoreOffset?: boolean): IPoint - - /** - * Invert transformation t - * @param {Array} t The transform - */ - invertTransform(t: any[]): any[]; - - /** - * A wrapper around Number#toFixed, which contrary to native method returns number, not string. - * @param {Number|String} number number to operate on - * @param {Number} fractionDigits number of fraction digits to "leave" - */ - toFixed(number: number, fractionDigits: number): number; - - /** - * Converts from attribute value to pixel value if applicable. - * Returns converted pixels or original value not converted. - * @param {Number|String} value number to operate on - */ - parseUnit(value: number|string, fontSize?: number): number|string; - - /** - * Function which always returns `false`. - */ - falseFunction(): boolean - - /** - * Returns klass "Class" object of given namespace - * @param {String} type Type of object (eg. 'circle') - * @param {String} namespace Namespace to get klass "Class" object from - */ - getKlass(type: string, namespace: string): any; - - /** - * Returns object of given namespace - * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' - */ - resolveNamespace(namespace: string): any; - - /** - * Loads image element from given url and passes it to a callback - * @param {String} url URL representing an image - * @param {Function} callback Callback; invoked with loaded image - * @param {Any} [context] Context to invoke callback in - * @param {Object} [crossOrigin] crossOrigin value to set image element to - */ - loadImage(url: string, callback: (image: HTMLImageElement) => {}, context?: any, crossOrigin?: boolean): void; - - /** - * Creates corresponding fabric instances from their object representations - * @param {Array} objects Objects to enliven - * @param {Function} callback Callback to invoke when all objects are created - * @param {String} namespace Namespace to get klass "Class" object from - * @param {Function} reviver Method for further parsing of object elements, called after each fabric object created. - */ - enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void; - - /** - * Groups SVG elements (usually those retrieved from SVG document) - * @param {Array} elements SVG elements to group - * @param {Object} [options] Options object - */ - groupSVGElements(elements: any[], options?: any, path?: any): IPathGroup - - /** - * Populates an object with properties of another object - * @param {Object} source Source object - * @param {Object} destination Destination object - * @param {Array} properties Propertie names to include - */ - populateWithProperties(source: any, destination: any, properties: any): void; - - /** - * Draws a dashed line between two points - * - * This method is used to draw dashed line around selection area. - * - * @param {CanvasRenderingContext2D} ctx context - * @param {Number} x start x coordinate - * @param {Number} y start y coordinate - * @param {Number} x2 end x coordinate - * @param {Number} y2 end y coordinate - * @param {Array} da dash array pattern - */ - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void; - - /** - * Creates canvas element and initializes it via excanvas if necessary - * @param {CanvasElement} [canvasEl] optional canvas element to initialize; - * when not given, element is created implicitly - */ - createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement; - - /** - * Creates image element (works on client and node) - */ - createImage(): HTMLImageElement; - - /** - * Creates accessors (getXXX, setXXX) for a "class", based on "stateProperties" array - * @param {Object} klass "Class" to create accessors for - */ - createAccessors(klass: any): any; - - /** - * @param {fabric.Object} receiver Object implementing `clipTo` method - * @param {CanvasRenderingContext2D} ctx Context to clip - */ - clipContext(receiver: IObject, ctx: CanvasRenderingContext2D): void; - - /** - * Multiply matrix A by matrix B to nest transformations - * @param {Array} a First transformMatrix - * @param {Array} b Second transformMatrix - */ - multiplyTransformMatrices(a: any[], b: any[]): any[] - - /** - * Returns string representation of function body - * @param {Function} fn Function to get body of - */ - getFunctionBody(fn: Function): string; - - /** - * Returns true if context has transparent pixel - * at specified location (taking tolerance into account) - * @param {CanvasRenderingContext2D} ctx context - * @param {Number} x x coordinate - * @param {Number} y y coordinate - * @param {Number} tolerance Tolerance - */ - isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; - } - - - interface Util extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, - IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { - ease: anim_ease; - array: IUtilArray; - object: IUtilObject; - string: IUtilString; - } + min(array: any[], byProperty: string): any; + /** + * Finds maximum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + max(array: any[], byProperty: string): any; +} + +interface IUtilClass { + /** + * Helper for creation of "classes". + * @param {Function} [parent] optional "Class" to inherit from + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(parent: Function, properties?: any); + /** + * Helper for creation of "classes". + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(properties?: any); + +} + +interface IUtilObject { + /** + * Copies all enumerable properties of one object to another + * @param {Object} destination Where to copy to + * @param {Object} source Where to copy from + */ + extend(destination: any, source: any): any; + + /** + * Creates an empty object and copies all enumerable properties of another object to it + * @memberOf fabric.util.object + * @param {Object} object Object to clone + * @return {Object} + */ + clone(object: any): any +} + +interface IUtilString { + /** + * Camelizes a string + * @param {String} string String to camelize + */ + camelize(string: string): string; + + /** + * Capitalizes a string + * @param {String} string String to capitalize + * @param {Boolean} [firstLetterOnly] If true only first letter is capitalized + * and other letters stay untouched, if false first letter is capitalized + * and other letters are converted to lowercase. + */ + capitalize(string: string, firstLetterOnly: boolean): string; + + /** + * Escapes XML in a string + * @param {String} string String to escape + */ + escapeXml(string: string): string; +} + +interface IUtilMisc { + /** + * Removes value from an array. + * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` + * @param {Array} array + * @param {Any} value + */ + removeFromArray(array: any[], value: any): any[]; + + /** + * Returns random number between 2 specified ones. + * @param {Number} min lower limit + * @param {Number} max upper limit + */ + getRandomInt(min: number, max: number): number; + + /** + * Transforms degrees to radians. + * @param {Number} degrees value in degrees + */ + degreesToRadians(degrees: number): number; + + /** + * Transforms radians to degrees. + * @memberOf fabric.util + * @param {Number} radians value in radians + */ + radiansToDegrees(radians: number): number; + + /** + * Rotates `point` around `origin` with `radians` + * @param {fabric.Point} point The point to rotate + * @param {fabric.Point} origin The origin of the rotation + * @param {Number} radians The radians of the angle for the rotation + */ + rotatePoint(point: IPoint, origin: IPoint, radians: number): IPoint; + + /** + * Apply transform t to point p + * @param {fabric.Point} p The point to transform + * @param {Array} t The transform + * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied + */ + transformPoint(p: IPoint, t: any[], ignoreOffset?: boolean): IPoint + + /** + * Invert transformation t + * @param {Array} t The transform + */ + invertTransform(t: any[]): any[]; + + /** + * A wrapper around Number#toFixed, which contrary to native method returns number, not string. + * @param {Number|String} number number to operate on + * @param {Number} fractionDigits number of fraction digits to "leave" + */ + toFixed(number: number, fractionDigits: number): number; + + /** + * Converts from attribute value to pixel value if applicable. + * Returns converted pixels or original value not converted. + * @param {Number|String} value number to operate on + */ + parseUnit(value: number|string, fontSize?: number): number|string; + + /** + * Function which always returns `false`. + */ + falseFunction(): boolean + + /** + * Returns klass "Class" object of given namespace + * @param {String} type Type of object (eg. 'circle') + * @param {String} namespace Namespace to get klass "Class" object from + */ + getKlass(type: string, namespace: string): any; + + /** + * Returns object of given namespace + * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' + */ + resolveNamespace(namespace: string): any; + + /** + * Loads image element from given url and passes it to a callback + * @param {String} url URL representing an image + * @param {Function} callback Callback; invoked with loaded image + * @param {Any} [context] Context to invoke callback in + * @param {Object} [crossOrigin] crossOrigin value to set image element to + */ + loadImage(url: string, callback: (image: HTMLImageElement) => {}, context?: any, crossOrigin?: boolean): void; + + /** + * Creates corresponding fabric instances from their object representations + * @param {Array} objects Objects to enliven + * @param {Function} callback Callback to invoke when all objects are created + * @param {String} namespace Namespace to get klass "Class" object from + * @param {Function} reviver Method for further parsing of object elements, called after each fabric object created. + */ + enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void; + + /** + * Groups SVG elements (usually those retrieved from SVG document) + * @param {Array} elements SVG elements to group + * @param {Object} [options] Options object + */ + groupSVGElements(elements: any[], options?: any, path?: any): IPathGroup + + /** + * Populates an object with properties of another object + * @param {Object} source Source object + * @param {Object} destination Destination object + * @param {Array} properties Propertie names to include + */ + populateWithProperties(source: any, destination: any, properties: any): void; + + /** + * Draws a dashed line between two points + * + * This method is used to draw dashed line around selection area. + * + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x start x coordinate + * @param {Number} y start y coordinate + * @param {Number} x2 end x coordinate + * @param {Number} y2 end y coordinate + * @param {Array} da dash array pattern + */ + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void; + + /** + * Creates canvas element and initializes it via excanvas if necessary + * @param {CanvasElement} [canvasEl] optional canvas element to initialize; + * when not given, element is created implicitly + */ + createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement; + + /** + * Creates image element (works on client and node) + */ + createImage(): HTMLImageElement; + + /** + * Creates accessors (getXXX, setXXX) for a "class", based on "stateProperties" array + * @param {Object} klass "Class" to create accessors for + */ + createAccessors(klass: any): any; + + /** + * @param {fabric.Object} receiver Object implementing `clipTo` method + * @param {CanvasRenderingContext2D} ctx Context to clip + */ + clipContext(receiver: IObject, ctx: CanvasRenderingContext2D): void; + + /** + * Multiply matrix A by matrix B to nest transformations + * @param {Array} a First transformMatrix + * @param {Array} b Second transformMatrix + */ + multiplyTransformMatrices(a: any[], b: any[]): any[] + + /** + * Returns string representation of function body + * @param {Function} fn Function to get body of + */ + getFunctionBody(fn: Function): string; + + /** + * Returns true if context has transparent pixel + * at specified location (taking tolerance into account) + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x x coordinate + * @param {Number} y y coordinate + * @param {Number} tolerance Tolerance + */ + isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; +} + + +interface Util extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, + IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { + ease: IUtilAnimEase; + array: IUtilArray; + object: IUtilObject; + string: IUtilString; +} } From d82b89617e3fa912bae7c8e5d472342d375b48c0 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Fri, 15 May 2015 18:52:06 -0600 Subject: [PATCH 198/534] Update tcomb.d.ts --- tcomb/tcomb.d.ts | 551 ++++++++++++++++++++++++----------------------- 1 file changed, 278 insertions(+), 273 deletions(-) diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index 3c9197d86..91c004160 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -1,420 +1,425 @@ -// Type definitions for tcomb v0.4 +// Type definitions for tcomb v1.0.3 // Project: http://gcanti.github.io/tcomb/guide/index.html -// Definitions by: Jed Mao +// Definitions by: Jed Mao and Hans Windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module tcomb { +declare module TComb { - export var options: { - onFail: (message: string) => void; - }; + export interface tcomb { + format: (format: string, ...values: any[]) => string; + getFunctionName: (fn: Function) => string; + getTypeName: (type: TCombBase) => string; + mixin: (target: {}, source: {}, overwrite?: boolean) => any; + slice: typeof Array.prototype.slice; + shallowCopy: (x: TCombBase) => TCombBase; + update: (instance: any, spec: {}) => TCombBase; + assert: (condition: boolean, message?: string, ...values: any[]) => void; + fail: (message?: string) => void; + Any: Any_Static; + Nil: Str_Static; + Str: Str_Static; + Num: Num_Static; + Bool: Bool_Static; + Arr: Arr_Static; + Obj: Obj_Static; - /** - * Like util.format in Node. - */ - export function format(format: string, ...values: any[]): string; - export function getKind(type: T): string; - /** - * Returns a function's name or displayName if specified; otherwise, - * fallbacks on '>'. - */ - export function getFunctionName(fn: Function): string; - export function getTypeName(type: T): string; - /** - * Safe version of mixin, properties can be overwritten. - */ - export function mixin(target: {}, source: {}, overwrite?: boolean): any; - export var slice: typeof Array.prototype.slice; - export function shallowCopy(x: T): T; - export function update(instance: any, spec: {}): T; - /** - * If an assert fails the debugger kicks in so you can inspect the stack - * and quickly find out what's wrong. - * @param message - Useful for debugging. Formatted with values like util.format in Node. - * @param values - Sequentially inserted into the message. - */ - export function assert(condition: boolean, message?: string, ...values: any[]): void; - export function fail(message?: string): void; + Func: Func_Static; + func: { (domain: TCombBase[], codomain: TCombBase, name?: string) : Func_Static; + (domain: TCombBase, codomain: TCombBase, name?: string) : Func_Static; + } + Err: Err_Static; + Re: Re_Static; + Dat: Dat_Static; + Type: Type_Static; + irreducible: (name: string, is: TypePredicate) => TCombBase; + struct: (props: Object, name?: string) => Struct_Static; - interface T { - meta: { + Union: Union_Static; + Maybe: Maybe_Static; + + enums(map: Object, name?: string): TCombBase; + union(types: TCombBase[], name?: string): Union_Static; + maybe(type: TCombBase, name?: string): Maybe_Static; + + Tuple: Tuple_Static; + tuple:(types: TCombBase[], name?: string)=> Tuple_Static; + + Subtype: Subtype_Static; + + List: List_Static; + list:(type: TCombBase, name?: string)=> List_Static; + + Dict: Dict_Static; + dict:(domain: TCombBase, codomain: TCombBase, name?: string)=> Dict_Static; + + subtype(type: TCombBase, predicate: TypePredicate, name?: string): Subtype_Static; + + } + + + + + export interface TCombBase { + meta: { /** * The type kind, equal to "irreducible" for irreducible types. */ - kind: string; + kind: string; /** * The type name. */ - name: string; - }; - displayName: string; - is(value: any): boolean; - update(instance: any, spec: {}): T; - } + name: string; + }; + displayName: string; + is(value: any): boolean; + update(instance: any, spec: {}): TCombBase; + } - interface TypePredicate { - (x: any): Bool_Instance; - } + export interface TypePredicate { + (x: any): Bool_Instance; + } - interface Any_Instance { - } + export interface Any_Instance { + } - interface Any_Static extends T { - new (value: any): Any_Instance; - (value: any): Any_Instance; - } + export interface Any_Static extends TCombBase { + + new (value: any): Any_Instance; + (value: any): Any_Instance; + } - export var Any: Any_Static; - interface Nil_Instance { - } - interface Nil_Static extends T { - new (value: any): Nil_Instance; - (value: any): Nil_Instance; - } + export interface Nil_Instance { + } - export var Nil: Str_Static; + export interface Nil_Static extends TCombBase { + new (value: any): Nil_Instance; + (value: any): Nil_Instance; + } - interface Str_Instance extends String { - } - interface Str_Static extends T { - new (value: string): Str_Instance; - (value: string): Str_Instance; - meta: { + + export interface Str_Instance extends String { + } + + export interface Str_Static extends TCombBase { + new (value: string): Str_Instance; + (value: string): Str_Instance; + meta: { /** * The type kind, equal to "irreducible" for irreducible types. */ - kind: string; + kind: string; /** * The type name. */ - name: string; + name: string; /** * The type predicate. */ - is: TypePredicate; - }; - } + is: TypePredicate; + }; + } - export var Str: Str_Static; - interface Num_Instance extends Number { - } - interface Num_Static extends T { - new (value: number): Num_Instance; - (value: number): Num_Instance; - } + export interface Num_Instance extends Number { + } - export var Num: Num_Static; + export interface Num_Static extends TCombBase { + new (value: number): Num_Instance; + (value: number): Num_Instance; + } - interface Bool_Instance extends Boolean { - } - interface Bool_Static extends T { - new (value: boolean): Bool_Instance; - (value: boolean): Bool_Instance; - } - export var Bool: Bool_Static; + export interface Bool_Instance extends Boolean { + } - interface Arr_Instance extends Array { - } + export interface Bool_Static extends TCombBase { + new (value: boolean): Bool_Instance; + (value: boolean): Bool_Instance; + } - interface Arr_Static extends T { - new (value: any[]): Arr_Instance; - (value: any[]): Arr_Instance; - } - export var Arr: Arr_Static; - interface Obj_Instance extends Object { - } + export interface Arr_Instance extends Array { + } - interface Obj_Static extends T { - new (value: Object): Obj_Instance; - (value: Object): Obj_Instance; - } + export interface Arr_Static extends TCombBase { + new (value: any[]): Arr_Instance; + (value: any[]): Arr_Instance; + } - export var Obj: Obj_Static; - interface Func_Instance extends Function { - } - interface Func_Static extends T { - new (value: Function): Func_Instance; - (value: Function): Func_Instance; - } + export interface Obj_Instance extends Object { + } - export var Func: Func_Static; + export interface Obj_Static extends TCombBase { - interface Err_Instance extends Error { - } + new (value: Object): Obj_Instance; + (value: Object): Obj_Instance; + } - interface Err_Static extends T { - new (value: Error): Err_Instance; - (value: Error): Err_Instance; - } - export var Err: Err_Static; - interface Re_Instance extends RegExp { - } + export interface Func_Instance extends Function { + } - interface Re_Static extends T { - new (value: RegExp): Re_Instance; - (value: RegExp): Re_Instance; - } + export interface Func_Static extends TCombBase { + new (value: Function): Func_Instance; + (value: Function): Func_Instance; + } - export var Re: Re_Static; - interface Dat_Instance extends Date { - } + export interface Err_Instance extends Error { + } - interface Dat_Static extends T { - new (value: Date): Dat_Instance; - (value: Date): Dat_Instance; - } + export interface Err_Static extends TCombBase { + new (value: Error): Err_Instance; + (value: Error): Err_Instance; + } - export var Dat: Dat_Static; - interface Type_Instance { - } + export interface Re_Instance extends RegExp { + } + + export interface Re_Static extends TCombBase { + new (value: RegExp): Re_Instance; + (value: RegExp): Re_Instance; + } + + + export interface Dat_Instance extends Date { + } + + export interface Dat_Static extends TCombBase { + new (value: Date): Dat_Instance; + (value: Date): Dat_Instance; + } + + export interface Type_Instance { + } + + export interface Type_Static extends TCombBase { + new (value: any): Type_Instance; + (value: any): Type_Instance; + } - interface Type_Static extends T { - new (value: any): Type_Instance; - (value: any): Type_Instance; - } - export var Type: Type_Static; /** * @param name - The type name. * @param is - A predicate. */ - export function irreducible(name: string, is: TypePredicate): T; + /** * @param props - A hash whose keys are the field names and the values are the fields types. * @param name - Useful for debugging purposes. */ - export function struct(props: Object, name?: string): typeof Struct; - export interface Struct_Static extends T { - new (value: any, mutable?: boolean): Struct_Instance; - (value: any, mutable?: boolean): Struct_Instance; - meta: { - kind: string; - name: string; - props: any[]; - }; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Object, name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Struct_Static, name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Object[], name?: string): Struct_Static; - /** - * @param mixins - Contains the new props. - * @param name - Useful for debugging purposes. - */ - extend(mixins: Struct_Static[], name?: string): Struct_Static; - } - interface Struct_Instance { - } + export interface Struct_Static extends TCombBase { + new (value: any, mutable?: boolean): Struct_Instance; + (value: any, mutable?: boolean): Struct_Instance; + meta: { + kind: string; + name: string; + props: any[]; + }; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Object, name?: string): Struct_Static; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Struct_Static, name?: string): Struct_Static; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Object[], name?: string): Struct_Static; + /** + * @param mixins - Contains the new props. + * @param name - Useful for debugging purposes. + */ + extend(mixins: Struct_Static[], name?: string): Struct_Static; + } - export var Struct: Struct_Static; + interface Struct_Instance { + } /** * @param map - A hash whose keys are the enums (values are free). * @param name - Useful for debugging purposes. */ - export function enums(map: Object, name?: string): T; - export module enums { + + export module enums { /** * @param keys - Array of enums. * @param name - Useful for debugging purposes. */ - export function of(keys: string[], name?: string): T; + export function of(keys: string[], name?: string): TCombBase; /** * @param keys - String of enums separated by spaces. * @param name - Useful for debugging purposes. */ - export function of(keys: string, name?: string): T; - } + export function of(keys: string, name?: string): TCombBase; + } /** * @param name - Useful for debugging purposes. */ - export function union(types: T[], name?: string): Union_Static; - interface Union_Static extends T { - new (value: any, mutable?: boolean): Union_Instance; - (value: any, mutable?: boolean): Union_Instance; - meta: { - kind: string; - name: string; - types: T[]; - }; - dispatch(x: any): T; - } + export interface Union_Static extends TCombBase { + new (value: any, mutable?: boolean): Union_Instance; + (value: any, mutable?: boolean): Union_Instance; + meta: { + kind: string; + name: string; + types: TCombBase[]; + }; + dispatch(x: any): TCombBase; + } - interface Union_Instance { - } + export interface Union_Instance { + } - export var Union: Union_Static; /** * @param type - The wrapped type. * @param name - Useful for debugging purposes. */ - export function maybe(type: T, name?: string): Maybe_Static; - export interface Maybe_Static extends T { - new (value: any, mutable?: boolean): Maybe_Instance; - (value: any, mutable?: boolean): Maybe_Instance; - meta: { - kind: string; - name: string; - typee: T; - }; - } - interface Maybe_Instance { - } - export var Maybe: Maybe_Static; + export interface Maybe_Static extends TCombBase { + new (value: any, mutable?: boolean): Maybe_Instance; + (value: any, mutable?: boolean): Maybe_Instance; + meta: { + kind: string; + name: string; + typee: TCombBase; + }; + } + + interface Maybe_Instance { + } + /** * @param name - Useful for debugging purposes. */ - export function tuple(types: T[], name?: string): Tuple_Static; - interface Tuple_Static extends T { - new (value: any, mutable?: boolean): Tuple_Instance; - (value: any, mutable?: boolean): Tuple_Instance; - meta: { - kind: string; - name: string; - types: T[]; - }; - } + interface Tuple_Static extends TCombBase { + new (value: any, mutable?: boolean): Tuple_Instance; + (value: any, mutable?: boolean): Tuple_Instance; + meta: { + kind: string; + name: string; + types: TCombBase[]; + }; + } - interface Tuple_Instance { - } + interface Tuple_Instance { + } - export var Tuple: Tuple_Static; - /** * Combines old types into a new one. * @param type - A type already defined. * @param name - Useful for debugging purposes. */ - export function subtype(type: T, predicate: TypePredicate, name?: string): typeof Subtype; - interface Subtype_Static extends T { - new (value: any, mutable?: boolean): Subtype_Instance; - (value: any, mutable?: boolean): Subtype_Instance; - meta: { - kind: string; - name: string; - type: T; - predicate: TypePredicate; - }; - } - interface Subtype_Instance { - } + export interface Subtype_Static extends TCombBase { + new (value: any, mutable?: boolean): Subtype_Instance; + (value: any, mutable?: boolean): Subtype_Instance; + meta: { + kind: string; + name: string; + type: TCombBase; + predicate: TypePredicate; + }; + } - export var Subtype: Subtype_Static; + interface Subtype_Instance { + } /** * @param type - The type of list items. * @param name - Useful for debugging purposes. */ - export function list(type: T, name?: string): List_Static; + export function list(type: TCombBase, name?: string): List_Static; - interface List_Static extends T { - new (value: any, mutable?: boolean): List_Instance; - (value: any, mutable?: boolean): List_Instance; - meta: { - kind: string; - name: string; - 'type': T; - }; - } + interface List_Static extends TCombBase { + new (value: any, mutable?: boolean): List_Instance; + (value: any, mutable?: boolean): List_Instance; + meta: { + kind: string; + name: string; + 'type': TCombBase; + }; + } - interface List_Instance { - } - - export var List: List_Static; + interface List_Instance { + } /** * @param domain - The type of keys. * @param codomain - The type of values. * @param name - Useful for debugging purposes. */ - export function dict(domain: T, codomain: T, name?: string): Dict_Static; - interface Dict_Static extends T { - new (value: any, mutable?: boolean): Dict_Instance; - (value: any, mutable?: boolean): Dict_Instance; - meta: { - kind: string; - name: string; - domain: T; - codomain: T; - }; - } - interface Dict_Instance { - } + interface Dict_Static extends TCombBase { + new (value: any, mutable?: boolean): Dict_Instance; + (value: any, mutable?: boolean): Dict_Instance; + meta: { + kind: string; + name: string; + domain: TCombBase; + codomain: TCombBase; + }; + } - export var Dict: Dict_Static; + interface Dict_Instance { + } /** * @param type - The type of the function's argument. * @param codomain - The type of the function's return value. * @param name - Useful for debugging purposes. */ - export function func(domain: T, codomain: T, name?: string): Func_Static; /** * @param type - The list of types of the function's arguments. * @param codomain - The type of the function's return value. * @param name - Useful for debugging purposes. */ - export function func(domain: T[], codomain: T, name?: string): Func_Static; - interface Func_Static extends T { - new (value: any, mutable?: boolean): Func_Instance; - (value: any, mutable?: boolean): Func_Instance; - meta: { - kind: string; - name: string; - domain: any; - codomain: T; - }; - of(fn: Function): Function; - } + interface Func_Static extends TCombBase { + new (value: any, mutable?: boolean): Func_Instance; + (value: any, mutable?: boolean): Func_Instance; + meta: { + kind: string; + name: string; + domain: any; + codomain: TCombBase; + }; + of(fn: Function): Function; + } - interface Func_Instance { - } - - export var Func: Func_Static; + interface Func_Instance { + } } +declare var t: TComb.tcomb; + declare module "tcomb" { - export = tcomb; + export = t; } From 0ac773404b92aa2cf124a5ddffef07f4467d3591 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Fri, 15 May 2015 18:58:34 -0600 Subject: [PATCH 199/534] update defs to v1.0 of tcomb http://gcanti.github.io/tcomb/ --- tcomb/tcomb-tests.ts | 1944 +++++++++++++++++++++++++++++++++++++----- tcomb/tcomb.d.ts | 2 +- 2 files changed, 1725 insertions(+), 221 deletions(-) diff --git a/tcomb/tcomb-tests.ts b/tcomb/tcomb-tests.ts index aeecdcb31..19ca39b3a 100644 --- a/tcomb/tcomb-tests.ts +++ b/tcomb/tcomb-tests.ts @@ -1,288 +1,1792 @@ // ReSharper disable InconsistentNaming // ReSharper disable WrongExpressionStatement +/// +/// +/// -import t = require("tcomb"); +// tests adapted from/for tcomb's test folder -var Str = t.Str; -var Num = t.Num; +'use strict'; +import assert = require('assert'); +var t = require('../index'); + +var Any = t.Any; +var Nil = t.Nil; var Bool = t.Bool; +var Num = t.Num; +var Str = t.Str; var Arr = t.Arr; var Obj = t.Obj; var Func = t.Func; var Err = t.Err; var Re = t.Re; var Dat = t.Dat; -var Nil = t.Nil; -var Any = t.Any; -var Type = t.Type; - var struct = t.struct; +var enums = t.enums; +var union = t.union; var tuple = t.tuple; +var maybe = t.maybe; +var subtype = t.subtype; var list = t.list; var dict = t.dict; -var union = t.union; -var maybe = t.maybe; var func = t.func; -var subtype = t.subtype; +var getTypeName = t.getTypeName; +var mixin = t.mixin; +var format = t.format; -Str.is("a string"); // => true -Str.is(1); // => false +// +// setup +// -Num.is("a string"); // => true -Num.is(1); // => false +var ok = function (x:any) { assert.strictEqual(true, x); }; +var ko = function (x:any) { assert.strictEqual(false, x); }; +var eq = assert.deepEqual; +var throwsWithMessage = function (f:any, message:any) { + assert.throws(f, function (err:any) { + ok(err instanceof Error); + eq(err.message, message); + return true; + }); +}; +var doesNotThrow = assert.doesNotThrow; -Bool.is("a string"); // => true -Bool.is(1); // => false - -Arr.is("a string"); // => true -Arr.is(1); // => false - -Obj.is("a string"); // => true -Obj.is(1); // => false - -Func.is("a string"); // => true -Func.is(1); // => false - -Err.is("a string"); // => true -Err.is(1); // => false - -Re.is("a string"); // => true -Re.is(1); // => false - -Dat.is("a string"); // => true -Dat.is(1); // => false - -Nil.is("a string"); // => true -Nil.is(1); // => false - -Any.is("a string"); // => true -Any.is(1); // => false - -Type.is("a string"); // => true -Type.is(1); // => false - -var assert = t.assert; - -assert(t.Str.is("a string")); // => ok -assert(t.Str.is(1)); // => fail! - -var x = -2; -var min = 0; -// throws "-2 should be greater then 0" -assert(x > min, "%s should be greater then %s", x, min); - -Str("a string"); // => ok - -class Point1 { - x: number; - y: number; - constructor(x: number, y: number) { - this.x = Num(x); - this.y = Num(y); - } -} - -var Foo = t.irreducible("Foo", x => { - return t.Bool(x.hasOwnProperty("bar")); -}); - -Foo.is({ bar: "baz" }); // => true - -// defines a type representing positive numbers -var Positive = t.subtype(t.Num, n => { - return n >= 0; -}, "Positive"); - -Positive.is(1); // => true -Positive.is(-1); // => false - -var Country = t.enums({ - IT: "Italy", - US: "United States" -}, "Country"); - -Country.is("IT"); // => true -Country.is("FR"); // => false - -// values will mirror the keys -Country = t.enums.of("IT US", "Country"); - -// same as - -Country = t.enums(["IT", "US"], "Country"); - -// same as - -Country = t.enums({ - IT: "IT", - US: "US" -}, "Country"); - -var Point = t.struct({ +var noop = function () {}; +var Point = struct({ x: Num, y: Num -}, "Point"); - -// constructor usage, `p` is immutable, new is optional -var p2 = new Point({ x: 1, y: 2 }); - -Point.is(p2); // => true - -// now p is mutable -new Point({ x: 1, y: 2 }, true); - -Point.extend({ z: Num }, "Point3D"); - -// multiple inheritance -var A = struct({}); -var B = struct({}); -var MixinC = {}; -var MixinD = {}; -A.extend([B, MixinC, MixinD]); - -var Rectangle = struct({ - width: Num, - height: Num }); -Rectangle.prototype.getArea = function() { - return this.width * this.height; -}; +describe('update', function () { + + var update = t.update; + var Tuple = tuple([Str, Num]); + var List = list(Num); + var Dict = dict(Str, Num); + + it('should handle $set command', function () { + var instance = 1; + var actual = update(instance, {$set: 2}); + eq(actual, 2); + var instance2 = [1, 2, 3]; + actual = update(instance2, {1: {'$set': 4}}); + eq(instance2, [1, 2, 3]); + eq(actual, [1, 4, 3]); + }); + + it('$set and null value, fix #65', function () { + var NullStruct = struct({a: Num, b: maybe(Num)}); + var instance = new NullStruct({a: 1}); + var updated = update(instance, {b: {$set: 2}}); + eq(instance, {a: 1, b: null}); + eq(updated, {a: 1, b: 2}); + }); + + it('should handle $apply command', function () { + var $apply = function (n:any) { return n + 1; }; + var instance = 1; + var actual = update(instance, {$apply: $apply}); + eq(actual, 2); + var instance2 = [1, 2, 3]; + actual = update(instance2, {1: {'$apply': $apply}}); + eq(instance2, [1, 2, 3]); + eq(actual, [1, 3, 3]); + }); + + it('should handle $unshift command', function () { + var actual = update([1, 2, 3], {'$unshift': [4]}); + eq(actual, [4, 1, 2, 3]); + actual = update([1, 2, 3], {'$unshift': [4, 5]}); + eq(actual, [4, 5, 1, 2, 3]); + actual = update([1, 2, 3], {'$unshift': [[4, 5]]}); + eq(actual, [[4, 5], 1, 2, 3]); + }); + + it('should handle $push command', function () { + var actual = update([1, 2, 3], {'$push': [4]}); + eq(actual, [1, 2, 3, 4]); + actual = update([1, 2, 3], {'$push': [4, 5]}); + eq(actual, [1, 2, 3, 4, 5]); + actual = update([1, 2, 3], {'$push': [[4, 5]]}); + eq(actual, [1, 2, 3, [4, 5]]); + }); + + it('should handle $splice command', function () { + var instance = [1, 2, {a: [12, 17, 15]}]; + var actual = update(instance, {2: {a: {$splice: [[1, 1, 13, 14]]}}}); + eq(instance, [1, 2, {a: [12, 17, 15]}]); + eq(actual, [1, 2, {a: [12, 13, 14, 15]}]); + }); + + it('should handle $remove command', function () { + var instance = {a: 1, b: 2}; + var actual = update(instance, {'$remove': ['a']}); + eq(instance, {a: 1, b: 2}); + eq(actual, {b: 2}); + }); + + it('should handle $swap command', function () { + var instance = [1, 2, 3, 4]; + var actual = update(instance, {'$swap': {from: 1, to: 2}}); + eq(instance, [1, 2, 3, 4]); + eq(actual, [1, 3, 2, 4]); + }); + + describe('structs', function () { + + var instance = new Point({x: 0, y: 1}); + + it('should handle $set command', function () { + var updated = update(instance, {x: {$set: 1}}); + eq(instance, {x: 0, y: 1}); + eq(updated, {x: 1, y: 1}); + }); + + it('should handle $apply command', function () { + var updated = update(instance, {x: {$apply: function (x:any) { + return x + 2; + }}}); + eq(instance, {x: 0, y: 1}); + eq(updated, {x: 2, y: 1}); + }); + + it('should handle $merge command', function () { + var updated = update(instance, {'$merge': {x: 2, y: 2}}); + eq(instance, {x: 0, y: 1}); + eq(updated, {x: 2, y: 2}); + var Nested = struct({ + a: Num, + b: struct({ + c: Num, + d: Num, + e: Num + }) + }); + instance = new Nested({a: 1, b: {c: 2, d: 3, e: 4}}); + updated = update(instance, {b: {'$merge': {c: 5, e: 6}}}); + eq(instance, {a: 1, b: {c: 2, d: 3, e: 4}}); + eq(updated, {a: 1, b: {c: 5, d: 3, e: 6}}); + }); + + }); + + describe('tuples', function () { + + var instance = Tuple(['a', 1]); + + it('should handle $set command', function () { + var updated = update(instance, {0: {$set: 'b'}}); + eq(updated, ['b', 1]); + }); + + }); + + describe('lists', function () { + + var instance = List([1, 2, 3, 4]); + + it('should handle $set command', function () { + var updated = update(instance, {2: {$set: 5}}); + eq(updated, [1, 2, 5, 4]); + }); + + it('should handle $splice command', function () { + var updated = update(instance, {$splice: [[1, 2, 5, 6]]}); + eq(updated, [1, 5, 6, 4]); + }); + + it('should handle $concat command', function () { + var updated = update(instance, {$push: [5]}); + eq(updated, [1, 2, 3, 4, 5]); + updated = update(instance, {$push: [5, 6]}); + eq(updated, [1, 2, 3, 4, 5, 6]); + }); + + it('should handle $prepend command', function () { + var updated = update(instance, {$unshift: [5]}); + eq(updated, [5, 1, 2, 3, 4]); + updated = update(instance, {$unshift: [5, 6]}); + eq(updated, [5, 6, 1, 2, 3, 4]); + }); + + it('should handle $swap command', function () { + var updated = update(instance, {$swap: {from: 1, to: 2}}); + eq(updated, [1, 3, 2, 4]); + }); + + }); + + describe('dicts', function () { + + var instance = Dict({a: 1, b: 2}); + + it('should handle $set command', function () { + var updated = update(instance, {a: {$set: 2}}); + eq(updated, {a: 2, b: 2}); + }); + + it('should handle $remove command', function () { + var updated = update(instance, {$remove: ['a']}); + eq(updated, {b: 2}); + }); + + }); + + describe('memory saving', function () { + + it('should reuse members that are not updated', function () { + var Struct = struct({ + a: Num, + b: Str, + c: tuple([Num, Num]), + }); + var List = list(Struct); + var instance = List([{ + a: 1, + b: 'one', + c: [1000, 1000000] + },{ + a: 2, + b: 'two', + c: [2000, 2000000] + }]); + + var updated = update(instance, { + 1: { + a: {$set: 119} + } + }); + + assert.strictEqual(updated[0], instance[0]); + assert.notStrictEqual(updated[1], instance[1]); + assert.strictEqual(updated[1].c, instance[1].c); + }); + }); + + describe('all together now', function () { + + it('should handle mixed commands', function () { + var Struct = struct({ + a: Num, + b: Tuple, + c: List, + d: Dict + }); + var instance = new Struct({ + a: 1, + b: ['a', 1], + c: [1, 2, 3, 4], + d: {a: 1, b: 2} + }); + var updated = update(instance, { + a: {$set: 1}, + b: {0: {$set: 'b'}}, + c: {2: {$set: 5}}, + d: {$remove: ['a']} + }); + eq(updated, { + a: 1, + b: ['b', 1], + c: [1, 2, 5, 4], + d: {b: 2} + }); + }); + + it('should handle nested structures', function () { + var Struct = struct({ + a: struct({ + b: tuple([ + Str, + list(Num) + ]) + }) + }); + var instance = new Struct({ + a: { + b: ['a', [1, 2, 3]] + } + }); + var updated = update(instance, { + a: {b: {1: {2: {$set: 4}}}} + }); + eq(updated, { + a: { + b: ['a', [1, 2, 4]] + } + }); + }); + + }); -var Cube = Rectangle.extend({ - thickness: Num }); -// typeof Cube.prototype.getArea === 'function' -Cube.prototype.getVolume = function() { - return this.getArea() * this.thickness; -}; +// +// assert +// -var Area = tuple([Num, Num]); +describe('assert', function () { -// constructor usage, `area` is immutable -Area([1, 2]); + var assert = t.assert; -var Path = list(Point); + it('should nor throw when guard is true', function () { + assert(true); + }); -// costructor usage, `path` is immutable -Path([ - { x: 0, y: 0 }, // tcomb hydrates automatically using the `Point` constructor - { x: 1, y: 1 } -]); + it('should throw a default message', function () { + throwsWithMessage(function () { + assert(1 === 2); + }, 'assert failed'); + }); -var Tel = dict(Str, Num); + it('should throw the specified message', function () { + throwsWithMessage(function () { + assert(1 === 2, 'my message'); + }, 'my message'); + }); -// costructor usage, `tel` is immutable -Tel({ jack: 4098, sape: 4139 }); + it('should format the specified message', function () { + throwsWithMessage(function () { + assert(1 === 2, '%s !== %s', 1, 2); + }, '1 !== 2'); + }); -var ReactKey = union([Str, Num]); + it('should handle custom fail behaviour', function () { + var fail = t.fail; + t.fail = function (message) { + try { + throw new Error(message); + } catch (e) { + eq(e.message, 'report error'); + } + }; + doesNotThrow(function () { + assert(1 === 2, 'report error'); + }); + t.fail = fail; + }); -ReactKey.is("a"); // => true -ReactKey.is(1); // => true -ReactKey.is(true); // => false +}); -ReactKey.dispatch = x => { - if (Str.is(x)) return Str; - if (Num.is(x)) return Num; - return Any; -}; +// +// utils +// -// now you can do this without a fail -ReactKey("a"); +describe('format(str, [...])', function () { -// the value of a radio input where null = no selection -var Radio = maybe(Str); + it('should format strings', function () { + eq(format('%s', 'a'), 'a'); + eq(format('%s', 2), '2'); + eq(format('%s === %s', 1, 1), '1 === 1'); + }); -Radio.is("a"); // => true -Radio.is(null); // => true -Radio.is(1); // => false + it('should format JSON', function () { + eq(format('%j', {a: 1}), '{"a":1}'); + }); -// add takes two `Num`s and returns a `Num` -var add = func([Num, Num], Num) - .of((x: number, y: number) => { return x + y; }); + it('should handle undefined formatters', function () { + eq(format('%o', 'a'), '%o a'); + }); -add("Hello", 2); // Raises error: Invalid `Hello` supplied to `Num` -add("Hello"); // Raises error: Invalid `Hello` supplied to `Num` + it('should handle escaping %', function () { + eq(format('%%s'), '%s'); + }); -add(1, 2); // Returns: 3 -add(1)(2); // Returns: 3 + it('should not consume an argument with a single %', function () { + eq(format('%s%', '100'), '100%'); + }); -// An `A` takes a `Str` and returns an `Num` -func(Str, Num); + it('should handle less arguments than placeholders', function () { + eq(format('%s %s', 'a'), 'a %s'); + }); -// A `B` takes a `Func` (which takes a `Str` and returns a `Num`) and returns a `Str`. -func(func(Str, Num), Str); + it('should handle more arguments than placeholders', function () { + eq(format('%s', 'a', 'b', 'c'), 'a b c'); + }); -// An `ExcitedStr` is a `Str` containing an exclamation mark -var ExcitedStr = subtype(Str, s => { return s.indexOf("!") !== -1; }, "ExcitedStr"); + it('should be extensible', function () { + (format).formatters.l = function (x:any) { return x.length; }; + eq(format('%l', ['a', 'b', 'c']), '3'); + }); -// An `Exciter` takes a `Str` and returns an `ExcitedStr` -var Exciter = func(Str, ExcitedStr); +}); -// A `C` takes an `A`, a `B` and a `Str` and returns a `Num` -func([A, B, Str], Num); +describe('mixin(x, y, [overwrite])', function () { -func(A, B).of(() => {}); + it('should mix two objects', function () { + var o1 = {a: 1}; + var o2 = {b: 2}; + var o3 = mixin(o1, o2); + ok(o3 === o1); + eq(o3.a, 1); + eq(o3.b, 2); + }); -var simpleQuestionator = Exciter.of((s: string) => { return s + "?"; }); -var simpleExciter = Exciter.of((s: string) => { return s + "!"; }); + it('should throw if a property already exists', function () { + throwsWithMessage(function () { + var o1 = {a: 1}; + var o2 = {a: 2, b: 2}; + mixin(o1, o2); + }, 'Cannot overwrite property a'); + }); -// Raises error: -// Invalid `Hello?` supplied to `ExcitedStr`, insert a valid value for the subtype -simpleQuestionator("Hello"); + it('should not throw if a property already exists but overwrite = true', function () { + var o1 = {a: 1}; + var o2 = {a: 2, b: 2}; + var o3 = mixin(o1, o2, true); + eq(o3.a, 2); + eq(o3.b, 2); + }); -// Raises error: Invalid `1` supplied to `Str` -simpleExciter(1); + it('should not mix prototype properties', function () { + function F() {} + F.prototype.method = noop; + var source = new (F)(); + var target = {}; + mixin(target, source); + eq((target).method, undefined); + }); -// Returns: "Hello!" -simpleExciter("Hello"); +}); -// We can reasonably suggest that add has the following type signature -// add : Num -> Num -> Num -add = func([Num, Num], Num) - .of((x: number, y: number) => { return x + y }); +describe('getFunctionName(f, [defaultName])', function () { -add("Hello"); // As this raises: "Error: Invalid `Hello` supplied to `Num`" + var getFunctionName = t.getFunctionName; -var add2 = add(2); -add2(1); // And this returns: 3 + it('should return the name of a named function', function () { + eq(getFunctionName(function myfunc(){}), 'myfunc'); + }); -func(A, B).is(x); + it('should return the value of `displayName` if specified', function () { + var f = function myfunc(){}; + (f).displayName = 'mydisplayname'; + eq(getFunctionName(f), 'mydisplayname'); + }); -Exciter.is(simpleExciter); // Returns: true -Exciter.is(simpleQuestionator); // Returns: true + it('should fallback on function arity if nothing is specified', function () { + eq(getFunctionName(function (a:any, b:any, c:any) { return a + b + c; }), ''); + }); -var id = (x: number) => { return x; }; +}); -func([Num, Num], Num).is(func([Num, Num], Num).of(id)); // Returns: true -func([Num, Num], Num).is(func(Num, Num).of(id)); // Returns: false +describe('getTypeName(type)', function () { -var p4 = new Point({x: 1, y: 2}); + var UnnamedStruct = struct({}); + var NamedStruct = struct({}, 'NamedStruct'); + var UnnamedUnion = union([Str, Num]); + var NamedUnion = union([Str, Num], 'NamedUnion'); + var UnnamedMaybe = maybe(Str); + var NamedMaybe = maybe(Str, 'NamedMaybe'); + var UnnamedEnums = enums({a: 'A', b: 'B'}); + var NamedEnums = enums({}, 'NamedEnums'); + var UnnamedTuple = tuple([Str, Num]); + var NamedTuple = tuple([Str, Num], 'NamedTuple'); + var UnnamedSubtype = subtype(Str, function notEmpty(x) { return x !== ''; }); + var NamedSubtype = subtype(Str, function (x) { return x !== ''; }, 'NamedSubtype'); + var UnnamedList = list(Str); + var NamedList = list(Str, 'NamedList'); + var UnnamedDict = dict(Str, Str); + var NamedDict = dict(Str, Str, 'NamedDict'); + var UnnamedFunc = func(Str, Str); + var NamedFunc = func(Str, Str, 'NamedFunc'); -p4 = Point.update(p4, { x: { "$set": 3 } }); // => {x: 3, y: 2} + it('should return the name of a named type', function () { + eq(getTypeName(NamedStruct), 'NamedStruct'); + eq(getTypeName(NamedUnion), 'NamedUnion'); + eq(getTypeName(NamedMaybe), 'NamedMaybe'); + eq(getTypeName(NamedEnums), 'NamedEnums'); + eq(getTypeName(NamedTuple), 'NamedTuple'); + eq(getTypeName(NamedSubtype), 'NamedSubtype'); + eq(getTypeName(NamedList), 'NamedList'); + eq(getTypeName(NamedDict), 'NamedDict'); + eq(getTypeName(NamedFunc), 'NamedFunc'); + }); -var Type2 = dict(Str, Num); -var instance = Type2({ a: 1, b: 2 }); -Type2.update(instance, { $remove: ["a"] }); // => {b: 2} + it('should return a meaningful name of a unnamed type', function () { + eq(getTypeName(UnnamedStruct), '{}'); + eq(getTypeName(UnnamedUnion), 'Str | Num'); + eq(getTypeName(UnnamedMaybe), '?Str'); + eq(getTypeName(UnnamedEnums), '"a" | "b"'); + eq(getTypeName(UnnamedTuple), '[Str, Num]'); + eq(getTypeName(UnnamedSubtype), '{Str | notEmpty}'); + eq(getTypeName(UnnamedList), 'Array'); + eq(getTypeName(UnnamedDict), '{[key:Str]: Str}'); + eq(getTypeName(UnnamedFunc), '(Str) => Str'); + }); -var Type3 = list(Num); -var instance2 = Type3([1, 2, 3, 4]); -Type3.update(instance2, { "$swap": { from: 1, to: 2 } }); // => [1, 3, 2, 4] +}); -t.options.onFail = message => { - return message; -}; +// +// Any +// -t.format("Invalid argument `name` = `%s` supplied to `%s`", 1, "MyType"); +describe('Any', function () { -t.getKind(Str); // => 'irreducible' -t.getKind(list(Str)); // => 'list' + var T = Any; -t.getFunctionName(t.getKind); // => 'getKind' -t.getFunctionName(() => { }); // => '' + describe('constructor', function () { -t.getTypeName(Str); + it('should behave like identity', function () { + eq(Any('a'), 'a'); + }); -t.mixin({ a: 1 }, { b: 2 }); // => {a: 1, b: 2} -t.mixin({ a: 1 }, { a: 2 }); // => fail! + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var x = new (T)(); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `Any`'); + }); + + }); + + describe('#is(x)', function () { + + it('should always return true', function () { + ok(T.is(null)); + ok(T.is(undefined)); + ok(T.is(0)); + ok(T.is(true)); + ok(T.is('')); + ok(T.is([])); + ok(T.is({})); + ok(T.is(noop)); + ok(T.is(/a/)); + ok(T.is(new RegExp('a'))); + ok(T.is(new Error())); + }); + + }); + +}); + +// +// irreducible types +// + +describe('irreducible types constructors', function () { + + [ + {T: Nil, x: null}, + {T: Str, x: 'a'}, + {T: Num, x: 1}, + {T: Bool, x: true}, + {T: Arr, x: []}, + {T: Obj, x: {}}, + {T: Func, x: noop}, + {T: Err, x: new Error()}, + {T: Re, x: /a/}, + {T: Dat, x: new Date()} + ].forEach(function (o) { + + var T = o.T; + var x = o.x; + + it('should accept only valid values', function () { + eq(T(x), x); + }); + + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var x = new (T) (); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `' + getTypeName(T) + '`'); + }); + + }); + +}); + +describe('Nil', function () { + + describe('#is(x)', function () { + + it('should return true when x is null or undefined', function () { + ok(Nil.is(null)); + ok(Nil.is(undefined)); + }); + + it('should return false when x is neither null nor undefined', function () { + ko(Nil.is(0)); + ko(Nil.is(true)); + ko(Nil.is('')); + ko(Nil.is([])); + ko(Nil.is({})); + ko(Nil.is(noop)); + ko(Nil.is(new Error())); + ko(Nil.is(new Date())); + ko(Nil.is(/a/)); + ko(Nil.is(new RegExp('a'))); + }); + + }); + +}); + +describe('Bool', function () { + + describe('#is(x)', function () { + + it('should return true when x is true or false', function () { + ok(Bool.is(true)); + ok(Bool.is(false)); + }); + + it('should return false when x is neither true nor false', function () { + ko(Bool.is(null)); + ko(Bool.is(undefined)); + ko(Bool.is(0)); + ko(Bool.is('')); + ko(Bool.is([])); + ko(Bool.is({})); + ko(Bool.is(noop)); + ko(Bool.is(/a/)); + ko(Bool.is(new RegExp('a'))); + ko(Bool.is(new Error())); + ko(Bool.is(new Date())); + }); + + }); + +}); + +describe('Num', function () { + + describe('#is(x)', function () { + + it('should return true when x is a number', function () { + ok(Num.is(0)); + ok(Num.is(1)); + /* jshint ignore:start */ + ko(Num.is(new Number(1))); + /* jshint ignore:end */ + }); + + it('should return false when x is not a number', function () { + ko(Num.is(NaN)); + ko(Num.is(Infinity)); + ko(Num.is(-Infinity)); + ko(Num.is(null)); + ko(Num.is(undefined)); + ko(Num.is(true)); + ko(Num.is('')); + ko(Num.is([])); + ko(Num.is({})); + ko(Num.is(noop)); + ko(Num.is(/a/)); + ko(Num.is(new RegExp('a'))); + ko(Num.is(new Error())); + ko(Num.is(new Date())); + }); + + }); + +}); + +describe('Str', function () { + + describe('#is(x)', function () { + + it('should return true when x is a string', function () { + ok(Str.is('')); + ok(Str.is('a')); + /* jshint ignore:start */ + ko(Str.is(new String('a'))); + /* jshint ignore:end */ + }); + + it('should return false when x is not a string', function () { + ko(Str.is(NaN)); + ko(Str.is(Infinity)); + ko(Str.is(-Infinity)); + ko(Str.is(null)); + ko(Str.is(undefined)); + ko(Str.is(true)); + ko(Str.is(1)); + ko(Str.is([])); + ko(Str.is({})); + ko(Str.is(noop)); + ko(Str.is(/a/)); + ko(Str.is(new RegExp('a'))); + ko(Str.is(new Error())); + ko(Str.is(new Date())); + }); + + }); + +}); + +describe('Arr', function () { + + describe('#is(x)', function () { + + it('should return true when x is an array', function () { + ok(Arr.is([])); + }); + + it('should return false when x is not an array', function () { + ko(Arr.is(NaN)); + ko(Arr.is(Infinity)); + ko(Arr.is(-Infinity)); + ko(Arr.is(null)); + ko(Arr.is(undefined)); + ko(Arr.is(true)); + ko(Arr.is(1)); + ko(Arr.is('a')); + ko(Arr.is({})); + ko(Arr.is(noop)); + ko(Arr.is(/a/)); + ko(Arr.is(new RegExp('a'))); + ko(Arr.is(new Error())); + ko(Arr.is(new Date())); + }); + + }); + +}); + +describe('Obj', function () { + + describe('#is(x)', function () { + + it('should return true when x is an object', function () { + function A() {} + ok(Obj.is({})); + ok(Obj.is(new (A)())); + }); + + it('should return false when x is not an object', function () { + ko(Obj.is(null)); + ko(Obj.is(undefined)); + ko(Obj.is(0)); + ko(Obj.is('')); + ko(Obj.is([])); + ko(Obj.is(noop)); + }); + + }); + +}); + +describe('Func', function () { + + describe('#is(x)', function () { + + it('should return true when x is a function', function () { + ok(Func.is(noop)); + /* jshint ignore:start */ + ok(Func.is(new Function())); + /* jshint ignore:end */ + }); + + it('should return false when x is not a function', function () { + ko(Func.is(null)); + ko(Func.is(undefined)); + ko(Func.is(0)); + ko(Func.is('')); + ko(Func.is([])); + /* jshint ignore:start */ + ko(Func.is(new String('1'))); + ko(Func.is(new Number(1))); + ko(Func.is(new Boolean())); + /* jshint ignore:end */ + ko(Func.is(/a/)); + ko(Func.is(new RegExp('a'))); + ko(Func.is(new Error())); + ko(Func.is(new Date())); + }); + + }); + +}); + +describe('Err', function () { + + describe('#is(x)', function () { + + it('should return true when x is an error', function () { + ok(Err.is(new Error())); + }); + + it('should return false when x is not an error', function () { + ko(Err.is(null)); + ko(Err.is(undefined)); + ko(Err.is(0)); + ko(Err.is('')); + ko(Err.is([])); + /* jshint ignore:start */ + ko(Err.is(new String('1'))); + ko(Err.is(new Number(1))); + ko(Err.is(new Boolean())); + /* jshint ignore:end */ + ko(Err.is(/a/)); + ko(Err.is(new RegExp('a'))); + ko(Err.is(new Date())); + }); + + }); + +}); + +describe('Re', function () { + + describe('#is(x)', function () { + + it('should return true when x is a regexp', function () { + ok(Re.is(/a/)); + ok(Re.is(new RegExp('a'))); + }); + + it('should return false when x is not a regexp', function () { + ko(Re.is(null)); + ko(Re.is(undefined)); + ko(Re.is(0)); + ko(Re.is('')); + ko(Re.is([])); + /* jshint ignore:start */ + ko(Re.is(new String('1'))); + ko(Re.is(new Number(1))); + ko(Re.is(new Boolean())); + /* jshint ignore:end */ + ko(Re.is(new Error())); + ko(Re.is(new Date())); + }); + + }); + +}); + +describe('Dat', function () { + + describe('#is(x)', function () { + + it('should return true when x is a Dat', function () { + ok(Dat.is(new Date())); + }); + + it('should return false when x is not a Dat', function () { + ko(Dat.is(null)); + ko(Dat.is(undefined)); + ko(Dat.is(0)); + ko(Dat.is('')); + ko(Dat.is([])); + /* jshint ignore:start */ + ko(Dat.is(new String('1'))); + ko(Dat.is(new Number(1))); + ko(Dat.is(new Boolean())); + /* jshint ignore:end */ + ko(Dat.is(new Error())); + ko(Dat.is(/a/)); + ko(Dat.is(new RegExp('a'))); + }); + + }); + +}); + +// +// struct +// + +describe('struct', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (struct)(); + }, 'Invalid argument `props` = `undefined` supplied to `struct` combinator'); + + throwsWithMessage(function () { + struct({a: null}); + }, 'Invalid argument `props` = `[object Object]` supplied to `struct` combinator'); + + throwsWithMessage(function () { + (struct)({}, 1); + }, 'Invalid argument `name` = `1` supplied to `struct` combinator'); + + }); + + }); + describe('constructor', function () { + + it('should be idempotent', function () { + var T = Point; + var p1 = T({x: 0, y: 0}); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + it('should accept only valid values', function () { + throwsWithMessage(function () { + Point(1); + }, 'Invalid argument `value` = `1` supplied to struct type `{x: Num, y: Num}`'); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the struct', function () { + var p = new Point({ x: 1, y: 2 }); + ok(Point.is(p)); + }); + + }); + + describe('#update()', function () { + + var Type = struct({name: Str}); + var instance = new Type({name: 'Giulio'}); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {name: {$set: 'Canti'}}); + ok(Type.is(newInstance)); + eq( ( instance).name, 'Giulio'); + eq(( newInstance).name, 'Canti'); + }); + + }); + + describe('#extend(props, [name])', function () { + + it('should extend an existing struct', function () { + var Point = struct({ + x: Num, + y: Num + }, 'Point'); + var Point3D = Point.extend({z: Num}, 'Point3D'); + eq(getTypeName(Point3D), 'Point3D'); + eq((Point3D).meta.props.x, Num); + eq((Point3D).meta.props.y, Num); + eq((Point3D).meta.props.z, Num); + }); + + it('should handle an array as argument', function () { + var Type = struct({a: Str}, 'Type'); + var Mixin = [{b: Num, c: Bool}]; + var NewType = Type.extend(Mixin, 'NewType'); + eq(getTypeName(NewType), 'NewType'); + eq((NewType).meta.props.a, Str); + eq((NewType).meta.props.b, Num); + eq((NewType).meta.props.c, Bool); + }); + + it('should handle a struct (or list of structs) as argument', function () { + var A = struct({a: Str}, 'A'); + var B = struct({b: Str}, 'B'); + var C = struct({c: Str}, 'C'); + var MixinD = {d: Str}; + var E = A.extend([B, C, MixinD]); + eq(E.meta.props, { + a: Str, + b: Str, + c: Str, + d: Str + }); + }); + + it('should support prototypal inheritance', function () { + var Rectangle = struct({ + w: Num, + h: Num + }, 'Rectangle'); + Rectangle.prototype.area = function () { + return this.w * this.h; + }; + var Cube = Rectangle.extend({ + l: Num + }); + Cube.prototype.volume = function () { + return this.area() * this.l; + }; + + assert('function' === typeof Rectangle.prototype.area); + assert('function' === typeof Cube.prototype.area); + assert(undefined === Rectangle.prototype.volume); + assert('function' === typeof Cube.prototype.volume); + assert(Cube.prototype.constructor === Cube); + + var c = new Cube({w:2, h:2, l:2}); + eq((c).volume(), 8); + }); + + }); + +}); + +// +// enums +// + +describe('enums', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (enums)(); + }, 'Invalid argument `map` = `undefined` supplied to `enums` combinator'); + + throwsWithMessage(function () { + (enums)({}, 1); + }, 'Invalid argument `name` = `1` supplied to `enums` combinator'); + + }); + + }); + + describe('constructor', function () { + + var T = enums({a: 0}, 'T'); + + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var x = new (T)('a'); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should accept only valid values', function () { + eq((T)('a'), 'a'); + throwsWithMessage(function () { + (T)('b'); + }, 'Invalid argument `value` = `b` supplied to enums type `T`, expected one of ["a"]'); + }); + + }); + + describe('#is(x)', function () { + + var Direction = enums({ + North: 0, + East: 1, + South: 2, + West: 3, + 1: 'North-East', + 2.5: 'South-East' + }); + + it('should return true when x is an instance of the enum', function () { + ok(Direction.is('North')); + ok(Direction.is(1)); + ok(Direction.is('1')); + ok(Direction.is(2.5)); + }); + + it('should return false when x is not an instance of the enum', function () { + ko(Direction.is('North-East')); + ko(Direction.is(2)); + }); + + }); + + describe('#of(keys)', function () { + + it('should return an enum', function () { + var Size = (enums).of(['large', 'small', 1, 10.9]); ///!!! + ok(Size.meta.map.large === 'large'); + ok(Size.meta.map.small === 'small'); + ok(Size.meta.map['1'] === 1); + ok(Size.meta.map[10.9] === 10.9); + }); + + it('should handle a string', function () { + var Size = (enums).of('large small 10'); + ok(Size.meta.map.large === 'large'); + ok(Size.meta.map.small === 'small'); + ok(Size.meta.map['10'] === '10'); + ok(Size.meta.map[10] === '10'); + }); + + }); + +}); + +// +// union +// + +describe('union', function () { + + var Circle = struct({ + center: Point, + radius: Num + }, 'Circle'); + + var Rectangle = struct({ + a: Point, + b: Point + }); + + var Shape = union([Circle, Rectangle], 'Shape'); + + Shape.dispatch = function (values) { + assert(Obj.is(values)); + return values.hasOwnProperty('center') ? + Circle : + Rectangle; + }; + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (union)(); + }, 'Invalid argument `types` = `undefined` supplied to `union` combinator'); + + throwsWithMessage(function () { + union([]); + }, 'Invalid argument `types` = `` supplied to `union` combinator, provide at least two types'); + + throwsWithMessage(function () { + union([Circle]); + }, 'Invalid argument `types` = `Circle` supplied to `union` combinator, provide at least two types'); + + throwsWithMessage(function () { + (union)([Circle, Point], 1); + }, 'Invalid argument `name` = `1` supplied to `union` combinator'); + + }); + + }); + + describe('constructor', function () { + + it('should throw when dispatch() is not implemented', function () { + throwsWithMessage(function () { + var T = union([Str, Num], 'T'); + T.dispatch = null; + T(1); + }, 'Unimplemented `dispatch()` function for union type `T`'); + }); + + it('should have a default dispatch() implementation', function () { + var T = union([Str, Num], 'T'); + eq(T(1), 1); + }); + + it('should throw when dispatch() does not return a type', function () { + throwsWithMessage(function () { + var T = union([Str, Num], 'T'); + T(true); + }, 'The `dispatch()` function of union type `T` returns no type constructor'); + }); + + it('should build instances when dispatch() is implemented', function () { + var circle = Shape({center: {x: 0, y: 0}, radius: 10}); + ok(Circle.is(circle)); + }); + + it('should throw if used with new and union types are not instantiables with new', function () { + throwsWithMessage(function () { + var T = union([Str, Num], 'T'); + T.dispatch = function () { return Str; }; + /* jshint ignore:start */ + var x = new T('a'); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should not throw if used with new and union types are instantiables with new', function () { + doesNotThrow(function () { + Shape({center: {x: 0, y: 0}, radius: 10}); + }); + }); + + it('should be idempotent', function () { + var p1 = Shape({center: {x: 0, y: 0}, radius: 10}); + var p2 = Shape(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the union', function () { + var p = new Circle({center: { x: 0, y: 0 }, radius: 10}); + ok(Shape.is(p)); + }); + + }); + +}); + +// +// maybe +// + +describe('maybe', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (maybe)(); + }, 'Invalid argument `type` = `undefined` supplied to `maybe` combinator'); + + throwsWithMessage(function () { + (maybe)(Point, 1); + }, 'Invalid argument `name` = `1` supplied to `maybe` combinator'); + + }); + + it('should be idempotent', function () { + var MaybeStr = maybe(Str); + ok(maybe(MaybeStr) === MaybeStr); + }); + + it('should be noop with Any', function () { + ok(maybe(Any) === Any); + }); + + it('should be noop with Nil', function () { + ok((maybe)(Nil) === Nil); + }); + + }); + + describe('constructor', function () { + + it('should throw if used with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var T = maybe(Str, 'T'); + var x = new (T)(); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should coerce values', function () { + var T = maybe(Point); + eq(T(null), null); + eq(T(undefined), null); + ok(Point.is(T({x: 0, y: 0}))); + }); + + it('should be idempotent', function () { + var T = maybe(Point); + var p1 = T({x: 0, y: 0}); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the maybe', function () { + var Radio = maybe(Str); + ok(Radio.is('a')); + ok(Radio.is(null)); + ok(Radio.is(undefined)); + }); + + }); + +}); + +// +// tuple +// + +describe('tuple', function () { + + var Area = tuple([Num, Num], 'Area'); + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (tuple)(); + }, 'Invalid argument `types` = `undefined` supplied to `tuple` combinator'); + + throwsWithMessage(function () { + (tuple)([Point, Point], 1); + }, 'Invalid argument `name` = `1` supplied to `tuple` combinator'); + + }); + + }); + + describe('constructor', function () { + + var S = struct({}, 'S'); + var T = tuple([S, S], 'T'); + + it('should coerce values', function () { + var t = T([{}, {}]); + ok(S.is(t[0])); + ok(S.is(t[1])); + }); + + it('should accept only valid values', function () { + + throwsWithMessage(function () { + T(1); + }, 'Invalid argument `value` = `1` supplied to tuple type `T`, expected an `Arr` of length `2`'); + + throwsWithMessage(function () { + T([1, 1]); + }, 'Invalid argument `value` = `1` supplied to struct type `S`'); + + }); + + it('should be idempotent', function () { + var T = tuple([Str, Num]); + var p1 = T(['a', 1]); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + it('should return true when x is an instance of the tuple', function () { + ok(Area.is([1, 2])); + }); + + it('should return false when x is not an instance of the tuple', function () { + ko(Area.is([1])); + ko(Area.is([1, 2, 3])); + ko(Area.is([1, 'a'])); + }); + + it('should not depend on `this`', function () { + ok([[1, 2]].every(Area.is)); + }); + + }); + + describe('#update()', function () { + + var Type = tuple([Str, Num]); + var instance = Type(['a', 1]); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {0: {$set: 'b'}}); + assert(Type.is(newInstance)); + assert(instance[0] === 'a'); + assert(newInstance[0] === 'b'); + }); + + }); + +}); + +// +// list +// + +describe('list', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (list)(); + }, 'Invalid argument `type` = `undefined` supplied to `list` combinator'); + + throwsWithMessage(function () { + (list)(Point, 1); + }, 'Invalid argument `name` = `1` supplied to `list` combinator'); + + }); + + }); + + describe('constructor', function () { + + var S = struct({}, 'S'); + var T = list(S, 'T'); + + it('should coerce values', function () { + var t = T([{}]); + ok(S.is(t[0])); + }); + + it('should accept only valid values', function () { + + throwsWithMessage(function () { + T(1); + }, 'Invalid argument `value` = `1` supplied to list type `T`'); + + throwsWithMessage(function () { + T([1]); + }, 'Invalid argument `value` = `1` supplied to struct type `S`'); + + }); + + it('should be idempotent', function () { + var T = list(Num); + var p1 = T([1, 2]); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + var Path = list(Point); + var p1 = new Point({x: 0, y: 0}); + var p2 = new Point({x: 1, y: 1}); + + it('should return true when x is a list', function () { + ok(Path.is([p1, p2])); + }); + + it('should not depend on `this`', function () { + ok([[p1, p2]].every(Path.is)); + }); + + }); + + describe('#update()', function () { + + var Type = list(Str); + var instance = Type(['a', 'b']); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {'$push': ['c']}); + assert(Type.is(newInstance)); + assert((instance).length === 2); + assert((newInstance).length === 3); + }); + + }); + +}); + +// +// subtype +// + +describe('subtype', function () { + + var True = function () { return true; }; + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (subtype)(); + }, 'Invalid argument `type` = `undefined` supplied to `subtype` combinator'); + + throwsWithMessage(function () { + subtype(Point, null); + }, 'Invalid argument `predicate` = `null` supplied to `subtype` combinator'); + + throwsWithMessage(function () { + (subtype)(Point, True, 1); + }, 'Invalid argument `name` = `1` supplied to `subtype` combinator'); + + }); + + }); + + describe('constructor', function () { + + it('should throw if used with new and a type that is not instantiable with new', function () { + throwsWithMessage(function () { + /* jshint ignore:start */ + var T = subtype(Str, function () { return true; }, 'T'); + var x = new( T)(); + /* jshint ignore:end */ + }, 'Operator `new` is forbidden for type `T`'); + }); + + it('should coerce values', function () { + var T = subtype(Point, function () { return true; }); + var p = T({x: 0, y: 0}); + ok(Point.is(p)); + }); + + it('should accept only valid values', function () { + var predicate = function (p:any) { return p.x > 0; }; + var T = subtype(Point, predicate, 'T'); + throwsWithMessage(function () { + T({x: 0, y: 0}); + }, 'Invalid argument `value` = `[object Object]` supplied to subtype type `T`'); + }); + + }); + + describe('#is(x)', function () { + + var Positive = subtype(Num, function (n) { + return n >= 0; + }); + + it('should return true when x is a subtype', function () { + ok(Positive.is(1)); + }); + + it('should return false when x is not a subtype', function () { + ko(Positive.is(-1)); + }); + + }); + + describe('#update()', function () { + + var Type = subtype(Str, function (s) { return s.length > 2; }); + var instance = Type('abc'); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {'$set': 'bca'}); + assert(Type.is(newInstance)); + eq(newInstance, 'bca'); + }); + + }); + +}); + +// +// dict +// + +describe('dict', function () { + + describe('combinator', function () { + + it('should throw if used with wrong arguments', function () { + + throwsWithMessage(function () { + (dict)(); + }, 'Invalid argument `domain` = `undefined` supplied to `dict` combinator'); + + throwsWithMessage(function () { + (dict)(Str); + }, 'Invalid argument `codomain` = `undefined` supplied to `dict` combinator'); + + throwsWithMessage(function () { + (dict)(Str, Point, 1); + }, 'Invalid argument `name` = `1` supplied to `dict` combinator'); + + }); + + }); + + describe('constructor', function () { + + var S = struct({}, 'S'); + var Domain = subtype(Str, function (x) { + return x !== 'forbidden'; + }, 'Domain'); + var T = dict(Domain, S, 'T'); + + it('should coerce values', function () { + var t = T({a: {}}); + ok(S.is((t).a)); + }); + + it('should accept only valid values', function () { + + throwsWithMessage(function () { + T(1); + }, 'Invalid argument `value` = `1` supplied to dict type `T`'); + + throwsWithMessage(function () { + T({a: 1}); + }, 'Invalid argument `value` = `1` supplied to struct type `S`'); + + throwsWithMessage(function () { + T({forbidden: {}}); + }, 'Invalid argument `value` = `forbidden` supplied to subtype type `Domain`'); + + }); + + it('should be idempotent', function () { + var T = dict(Str, Str); + var p1 = T({a: 'a', b: 'b'}); + var p2 = T(p1); + eq(Object.isFrozen(p1), true); + eq(Object.isFrozen(p2), true); + eq(p2 === p1, true); + }); + + }); + + describe('#is(x)', function () { + + var T = dict(Str, Point); + var p1 = new Point({x: 0, y: 0}); + var p2 = new Point({x: 1, y: 1}); + + it('should return true when x is a list', function () { + ok(T.is({a: p1, b: p2})); + }); + + it('should not depend on `this`', function () { + ok([{a: p1, b: p2}].every(T.is)); + }); + + }); + + describe('#update()', function () { + + var Type = dict(Str, Str); + var instance = Type({p1: 'a', p2: 'b'}); + + it('should return a new instance', function () { + var newInstance = Type.update(instance, {p2: {$set: 'c'}}); + ok(Type.is(newInstance)); + eq((instance).p2, 'b'); + eq((newInstance).p2, 'c'); + }); + + }); + +}); + +// +// func +// + +describe('func', function () { + + it('should handle a no types', function () { + var T = func([], Str); + eq(T.meta.domain.length, 0); + var getGreeting = T.of(function () { return 'Hi'; }); + eq(getGreeting(), 'Hi'); + }); + + it('should handle a single type', function () { + var T = func(Num, Num); + eq(T.meta.domain.length, 1); + ok(T.meta.domain[0] === Num); + }); + + it('should automatically instrument a function', function () { + var T = func(Num, Num); + var f = function () { return 'hi'; }; + ok(T.is(T(f))); + }); + + describe('of', function () { + + it('should check the arguments', function () { + + var T = func([Num, Num], Num); + var sum = T.of(function (a:any, b:any) { + return a + b; + }); + eq(sum(1, 2), 3); + + throwsWithMessage(function () { + sum(1, 2, 3); + }, 'Invalid argument `value` = `1,2,3` supplied to tuple type `[Num, Num]`, expected an `Arr` of length `2`'); + + throwsWithMessage(function () { + sum('a', 2); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + }); + + it('should check the return value', function () { + + var T = func([Num, Num], Num); + var sum = T.of(function () { + return 'a'; + }); + + throwsWithMessage(function () { + sum(1, 2); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + }); + + it('should preserve `this`', function () { + var o = {name: 'giulio'}; + (o).getTypeName = func([], Str).of(function () { + return this.name; + }); + eq((o).getTypeName(), 'giulio'); + }); + + it('should handle function types', function () { + var A = func([Str], Str); + var B = func([Str, A], Str); + + var f = A.of(function (s:any) { + return s + '!'; + }); + var g = B.of(function (str:any, strAction:any) { + return strAction(str); + }); + + eq(g('hello', f), 'hello!'); + }); + + it('should be idempotent', function () { + var f = function (s:any) { return s; }; + var g = func([Str], Str).of(f); + var h = func([Str], Str).of(g); + ok(h === g); + }); + + }); + + describe('currying', function () { + + it('should curry functions', function () { + var Type = func([Num, Num, Num], Num); + var sum = Type.of(function (a:any, b:any, c:any) { + return a + b + c; + }); + eq(sum(1, 2, 3), 6); + eq(sum(1, 2)(3), 6); + eq(sum(1)(2, 3), 6); + eq(sum(1)(2)(3), 6); + + // important: the curried function must be of the correct type + var CurriedType = func([Num, Num], Num); + var sum1 = sum(1); + eq(sum1(2, 3), 6); + eq(sum1(2)(3), 6); + ok(CurriedType.is(sum1)); + }); + + it('should throw if partial arguments are wrong', function () { + + var T = func([Num, Num], Num); + var sum = T.of(function (a:any, b:any) { + return a + b; + }); + + throwsWithMessage(function () { + sum('a'); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + throwsWithMessage(function () { + var sum1 = sum(1); + sum1('a'); + }, 'Invalid argument `value` = `a` supplied to irreducible type `Num`'); + + }); + + }); + +}); diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index 91c004160..91add803a 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -83,7 +83,7 @@ declare module TComb { } export interface Any_Static extends TCombBase { - + new (value: any): Any_Instance; (value: any): Any_Instance; } From 4f5c7c2d00aad3b37cd115536087d22e56c38d65 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Fri, 15 May 2015 23:26:09 -0600 Subject: [PATCH 200/534] fix travis errors --- tcomb/tcomb-tests.ts | 16 ++++++++-------- tcomb/tcomb.d.ts | 9 ++++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tcomb/tcomb-tests.ts b/tcomb/tcomb-tests.ts index 19ca39b3a..3a27ffc7f 100644 --- a/tcomb/tcomb-tests.ts +++ b/tcomb/tcomb-tests.ts @@ -256,9 +256,9 @@ describe('update', function () { } }); - assert.strictEqual(updated[0], instance[0]); - assert.notStrictEqual(updated[1], instance[1]); - assert.strictEqual(updated[1].c, instance[1].c); + assert.strictEqual(( updated)[0], ( instance)[0]); + assert.notStrictEqual(( updated)[1], ( instance)[1]); + assert.strictEqual(( updated)[1].c, ( instance)[1].c); }); }); @@ -1328,8 +1328,8 @@ describe('tuple', function () { it('should coerce values', function () { var t = T([{}, {}]); - ok(S.is(t[0])); - ok(S.is(t[1])); + ok(S.is(( t)[0])); + ok(S.is(( t)[1])); }); it('should accept only valid values', function () { @@ -1381,8 +1381,8 @@ describe('tuple', function () { it('should return a new instance', function () { var newInstance = Type.update(instance, {0: {$set: 'b'}}); assert(Type.is(newInstance)); - assert(instance[0] === 'a'); - assert(newInstance[0] === 'b'); + assert(( instance)[0] === 'a'); + assert(( newInstance)[0] === 'b'); }); }); @@ -1418,7 +1418,7 @@ describe('list', function () { it('should coerce values', function () { var t = T([{}]); - ok(S.is(t[0])); + ok(S.is(( t)[0])); }); it('should accept only valid values', function () { diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index 91add803a..1c8825061 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -1,10 +1,13 @@ // Type definitions for tcomb v1.0.3 // Project: http://gcanti.github.io/tcomb/guide/index.html -// Definitions by: Jed Mao and Hans Windhoff +// Definitions by: Jed Mao +// and Hans Windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped - declare module TComb { + export interface NumbersOnly { + [idx:number]:string; + } export interface tcomb { format: (format: string, ...values: any[]) => string; getFunctionName: (fn: Function) => string; @@ -12,7 +15,7 @@ declare module TComb { mixin: (target: {}, source: {}, overwrite?: boolean) => any; slice: typeof Array.prototype.slice; shallowCopy: (x: TCombBase) => TCombBase; - update: (instance: any, spec: {}) => TCombBase; + update: (instance: any, spec: {} ) => TCombBase; assert: (condition: boolean, message?: string, ...values: any[]) => void; fail: (message?: string) => void; Any: Any_Static; From c1a834f1298899f1546416ac5568dd0df8d6d12b Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Fri, 15 May 2015 23:28:56 -0600 Subject: [PATCH 201/534] only one line for definitions by --- tcomb/tcomb.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index 1c8825061..fcee4d48c 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -1,7 +1,6 @@ // Type definitions for tcomb v1.0.3 // Project: http://gcanti.github.io/tcomb/guide/index.html -// Definitions by: Jed Mao -// and Hans Windhoff +// Definitions by: Hans Windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module TComb { From 0335eae167b77bb95a6119a3f41770f3fc4cda79 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Fri, 15 May 2015 23:47:02 -0600 Subject: [PATCH 202/534] lines --- tcomb/tcomb.d.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index fcee4d48c..8af914ab5 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -3,10 +3,6 @@ // Definitions by: Hans Windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module TComb { - - export interface NumbersOnly { - [idx:number]:string; - } export interface tcomb { format: (format: string, ...values: any[]) => string; getFunctionName: (fn: Function) => string; From 14e5d8e09df6ab514c7179afe08adf91c243b965 Mon Sep 17 00:00:00 2001 From: Tat Date: Sat, 16 May 2015 12:45:11 +0530 Subject: [PATCH 203/534] adding the type definitions for the DataStream.js library --- DataStream.js/DataStream.js-tests.ts | 180 +++++ DataStream.js/DataStream.js.d.ts | 937 +++++++++++++++++++++++++++ 2 files changed, 1117 insertions(+) create mode 100644 DataStream.js/DataStream.js-tests.ts create mode 100644 DataStream.js/DataStream.js.d.ts diff --git a/DataStream.js/DataStream.js-tests.ts b/DataStream.js/DataStream.js-tests.ts new file mode 100644 index 000000000..71bb08537 --- /dev/null +++ b/DataStream.js/DataStream.js-tests.ts @@ -0,0 +1,180 @@ +/// + +var buf = new ArrayBuffer(100); +var ds = new DataStream(buf); +ds = new DataStream(buf, 10); +ds = new DataStream(buf, 10, DataStream.BIG_ENDIAN); + +ds.save('somefile.ext'); +ds.dynamicSize = true; + +for (var i=0; i +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class DataStream { + + /** + Big-endian const to use as default endianness. + */ + static BIG_ENDIAN: boolean; + + /** + Little-endian const to use as default endianness. + */ + static LITTLE_ENDIAN: boolean; + + /** + DataStream reads scalars, arrays and structs of data from an ArrayBuffer. + It's like a file-like DataView on steroids. + + @param {ArrayBuffer} arrayBuffer ArrayBuffer to read from. + */ + constructor(arrayBuffer: ArrayBuffer); + + /** + DataStream reads scalars, arrays and structs of data from an ArrayBuffer. + It's like a file-like DataView on steroids. + + @param arrayBuffer ArrayBuffer to read from. + @param byteOffset Offset from arrayBuffer beginning for the DataStream. + */ + constructor(arrayBuffer: ArrayBuffer, byteOffset: number); + + /** + DataStream reads scalars, arrays and structs of data from an ArrayBuffer. + It's like a file-like DataView on steroids. + + @param arrayBuffer ArrayBuffer to read from. + @param byteOffset Offset from arrayBuffer beginning for the DataStream. + @param endianness DataStream.BIG_ENDIAN or DataStream.LITTLE_ENDIAN (the default). + */ + constructor(arrayBuffer: ArrayBuffer, byteOffset: number, endianness: boolean); + + /** + Saves the DataStream contents to the given filename. + Uses Chrome's anchor download property to initiate download. + * + @param filename Filename to save as. + @return nothing + */ + save(filename: string): void; + + /** + Whether to extend DataStream buffer when trying to write beyond its size. + If set, the buffer is reallocated to twice its current size until the + requested write fits the buffer. + */ + dynamicSize: boolean; + + /** + Returns the byte length of the DataStream object. + */ + byteLength: number; + + /** + Set/get the backing ArrayBuffer of the DataStream object. + The setter updates the DataView to point to the new buffer. + */ + buffer: ArrayBuffer; + + /** + Set/get the byteOffset of the DataStream object. + The setter updates the DataView to point to the new byteOffset. + */ + byteOffset: number; + + /** + Set/get the backing DataView of the DataStream object. + The setter updates the buffer and byteOffset to point to the DataView values. + */ + dataView: Object; + + /** + Sets the DataStream read/write position to given position. + Clamps between 0 and DataStream length. + * + @param pos Position to seek to. + @return nothing + */ + seek(pos: number): void; + + /** + Returns true if the DataStream seek pointer is at the end of buffer and + there's no more data to read. + * + @return true if the seek pointer is at the end of the buffer. + */ + isEof(): boolean; + + /** + Maps an Int32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Int32Array to the DataStream backing buffer. + */ + mapInt32Array(length: number): Int32Array; + + /** + Maps an Int32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Int32Array to the DataStream backing buffer. + */ + mapInt32Array(length: number, e: boolean): Int32Array; + + /** + Maps an Int16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Int16Array to the DataStream backing buffer. + */ + mapInt16Array(length: number): Int16Array; + + /** + Maps an Int16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Int16Array to the DataStream backing buffer. + */ + mapInt16Array(length: number, e: boolean): Int16Array; + + /** + Maps an Int8Array into the DataStream buffer. + * + Nice for quickly reading in data. + * + @param length Number of elements to map. + @return Int8Array to the DataStream backing buffer. + */ + mapInt8Array(length: number): Int8Array; + + /** + Maps a Uint32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Uint32Array to the DataStream backing buffer. + */ + mapUint32Array(length: number): Uint32Array; + + /** + Maps a Uint32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Uint32Array to the DataStream backing buffer. + */ + mapUint32Array(length: number, e: boolean): Uint32Array; + + /** + Maps a Uint16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Uint16Array to the DataStream backing buffer. + */ + mapUint16Array(length: number): Uint16Array; + + /** + Maps a Uint16Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Uint16Array to the DataStream backing buffer. + */ + mapUint16Array(length: number, e: boolean): Uint16Array; + + /** + Maps a Uint8Array into the DataStream buffer. + * + Nice for quickly reading in data. + * + @param length Number of elements to map. + @return Uint8Array to the DataStream backing buffer. + */ + mapUint8Array(length: number): Uint8Array; + + /** + Maps a Float64Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Float64Array to the DataStream backing buffer. + */ + mapFloat64Array(length: number): Float64Array; + + /** + Maps a Float64Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Float64Array to the DataStream backing buffer. + */ + mapFloat64Array(length: number, e: boolean): Float64Array; + + /** + Maps a Float32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @return Float32Array to the DataStream backing buffer. + */ + mapFloat32Array(length: number): Float32Array; + + /** + Maps a Float32Array into the DataStream buffer, swizzling it to native + endianness in-place. The current offset from the start of the buffer needs to + be a multiple of element size, just like with typed array views. + * + Nice for quickly reading in data. Warning: potentially modifies the buffer + contents. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return Float32Array to the DataStream backing buffer. + */ + mapFloat32Array(length: number, e: boolean): Float32Array; + + /** + Reads an Int32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Int32Array. + */ + readInt32Array(length: number): Int32Array; + + /** + Reads an Int32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Int32Array. + */ + readInt32Array(length: number, e: boolean): Int32Array; + + /** + Reads an Int16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Int16Array. + */ + readInt16Array(length: number): Int16Array; + + /** + Reads an Int16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Int16Array. + */ + readInt16Array(length: number, e: boolean): Int16Array; + + /** + Reads an Int8Array of desired length from the DataStream. + * + @param length Number of elements to map. + @return The read Int8Array. + */ + readInt8Array(length: number): Int8Array; + + /** + Reads an Uint32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Uint32Array. + */ + readUint32Array(length: number): Uint32Array; + + /** + Reads an Uint32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Uint32Array. + */ + readUint32Array(length: number, e: boolean): Uint32Array; + + /** + Reads an Uint16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Uint16Array. + */ + readUint16Array(length: number): Uint16Array; + + /** + Reads an Uint16Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Uint16Array. + */ + readUint16Array(length: number, e: boolean): Uint16Array; + + /** + Reads an Uint8Array of desired length from the DataStream. + * + @param length Number of elements to map. + @return The read Uint8Array. + */ + readUint8Array(length: number): Uint8Array; + + /** + Reads a Float64Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Float64Array. + */ + readFloat64Array(length: number, e: boolean): Float64Array; + + /** + Reads a Float64Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Float64Array. + */ + readFloat64Array(length: number): Float64Array; + + /** + Reads a Float32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @param e Endianness of the data to read. + @return The read Float32Array. + */ + readFloat32Array(length: number, e: boolean): Float32Array; + + /** + Reads a Float32Array of desired length and endianness from the DataStream. + * + @param length Number of elements to map. + @return The read Float32Array. + */ + readFloat32Array(length: number): Float32Array; + + /** + Writes an Int32Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeInt32Array(arr: Int32Array, e: boolean): void; + + /** + Writes an Int32Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeInt32Array(arr: Int32Array): void; + + /** + Writes an Int16Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeInt16Array(arr: Int16Array, e: boolean): void; + + /** + Writes an Int16Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeInt16Array(arr: Int16Array): void; + + /** + Writes an Int8Array to the DataStream. + * + @param arr The array to write. + */ + writeInt8Array(arr: Int8Array): void; + + /** + Writes an Uint32Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeUint32Array(arr: Uint32Array, e: boolean): void; + + /** + Writes an Uint32Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeUint32Array(arr: Uint32Array): void; + + /** + Writes an Uint16Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeUint16Array(arr: Uint16Array, e: boolean): void; + + /** + Writes an Uint16Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeUint16Array(arr: Uint16Array): void; + + /** + Writes an Uint8Array to the DataStream. + * + @param arr The array to write. + */ + writeUint8Array(arr: Uint8Array): void; + + /** + Writes a Float64Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeFloat64Array(arr: Float64Array): void; + + /** + Writes a Float64Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeFloat64Array(arr: Float64Array, e: boolean): void; + + /** + Writes a Float32Array of specified endianness to the DataStream. + * + @param arr The array to write. + */ + writeFloat32Array(arr: Float32Array): void; + + /** + Writes a Float32Array of specified endianness to the DataStream. + * + @param arr The array to write. + @param e Endianness of the data to write. + */ + writeFloat32Array(arr: Float32Array, e: boolean): void; + + /** + Reads a 32-bit int from the DataStream with the desired endianness. + * + @return The read number. + */ + readInt32(): number; + + /** + Reads a 32-bit int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readInt32(e: boolean): number; + + /** + Reads a 16-bit int from the DataStream with the desired endianness. + * + @return The read number. + */ + readInt16(): number; + + /** + Reads a 16-bit int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readInt16(e: boolean): number; + + /** + Reads an 8-bit int from the DataStream. + * + @return The read number. + */ + readInt8(): number; + + /** + Reads a 32-bit unsigned int from the DataStream with the desired endianness. + * + @return The read number. + */ + readUint32(): number; + + /** + Reads a 32-bit unsigned int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readUint32(e: boolean): number; + + /** + Reads a 16-bit unsigned int from the DataStream with the desired endianness. + * + @return The read number. + */ + readUint16(): number; + + /** + Reads a 16-bit unsigned int from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readUint16(e: boolean): number; + + /** + Reads an 8-bit unsigned intfrom the DataStream. + * + @return The read number. + */ + readUint8(): number; + + /** + Reads a 32-bit float from the DataStream with the desired endianness. + * + @return The read number. + */ + readFloat32(): number; + + /** + Reads a 32-bit float from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readFloat32(e: boolean): number; + + /** + Reads a 64-bit float from the DataStream with the desired endianness. + * + @return The read number. + */ + readFloat64(): number; + + /** + Reads a 64-bit float from the DataStream with the desired endianness. + * + @param e Endianness of the number. + @return The read number. + */ + readFloat64(e: boolean): number; + + /** + Writes a 32-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeInt32(v: number): void; + + /** + Writes a 32-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeInt32(v: number, e: boolean): void; + + /** + Writes a 16-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeInt16(v: number): void; + + /** + Writes a 16-bit int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeInt16(v: number, e: boolean): void; + + /** + Writes an 8-bit int to the DataStream. + * + @param v Number to write. + */ + writeInt8(v: number): void; + + /** + Writes a 32-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeUint32(v: number): void; + + /** + Writes a 32-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeUint32(v: number, e: boolean): void; + + /** + Writes a 16-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeUint16(v: number): void; + + /** + Writes a 16-bit undigned int to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeUint16(v: number, e: boolean): void; + + /** + Writes an 8-bit undigned int to the DataStream. + * + @param v Number to write. + */ + writeUint8(v: number): void; + + /** + Writes a 32-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeFloat32(v: number): void; + + /** + Writes a 32-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeFloat32(v: number, e: boolean): void; + + /** + Writes a 64-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + */ + writeFloat64(v: number): void; + + /** + Writes a 64-bit float to the DataStream with the desired endianness. + * + @param v Number to write. + @param e Endianness of the number. + */ + writeFloat64(v: number, e: boolean): void; + + /** + Reads a struct of data from the DataStream. The struct is defined as + a flat array of [name, type]-pairs. See the example below: + * + ds.readStruct([ + 'headerTag', 'uint32', // Uint32 in DataStream endianness. + 'headerTag2', 'uint32be', // Big-endian Uint32. + 'headerTag3', 'uint32le', // Little-endian Uint32. + 'array', ['[]', 'uint32', 16], // Uint32Array of length 16. + 'array2Length', 'uint32', + 'array2', ['[]', 'uint32', 'array2Length'] // Uint32Array of length array2Length + ]); + * + The possible values for the type are as follows: + * + // Number types + // Unsuffixed number types use DataStream endianness. + // To explicitly specify endianness, suffix the type with + // 'le' for little-endian or 'be' for big-endian, + // e.g. 'int32be' for big-endian int32. + 'uint8' -- 8-bit unsigned int + 'uint16' -- 16-bit unsigned int + 'uint32' -- 32-bit unsigned int + 'int8' -- 8-bit int + 'int16' -- 16-bit int + 'int32' -- 32-bit int + 'float32' -- 32-bit float + 'float64' -- 64-bit float + * + // String types + 'cstring' -- ASCII string terminated by a zero byte. + 'string:N' -- ASCII string of length N, where N is a literal integer. + 'string:variableName' -- ASCII string of length $variableName, + where 'variableName' is a previously parsed number in the current struct. + 'string,CHARSET:N' -- String of byteLength N encoded with given CHARSET. + 'u16string:N' -- UCS-2 string of length N in DataStream endianness. + 'u16stringle:N' -- UCS-2 string of length N in little-endian. + 'u16stringbe:N' -- UCS-2 string of length N in big-endian. + * + // Complex types + [name, type, name_2, type_2, ..., name_N, type_N] -- Struct + function(dataStream, struct) {} -- Callback function to read and return data. + {get: function(dataStream, struct) {}, + set: function(dataStream, struct) {}} + -- Getter/setter functions to read and return data, handy for using the same + struct definition for reading and writing structs. + ['[]', type, length] -- Array of given type and length. The length can be either + a number, a string that references a previously-read + field, or a callback function(struct, dataStream, type){}. + If length is '*', reads in as many elements as it can. + * + @param structDefinition Struct definition object. + @return The read struct. Null if failed to read struct. + */ + readStruct(structDefinition: any[]): Object; + + /** + Writes a struct to the DataStream. Takes a structDefinition that gives the + types and a struct object that gives the values. Refer to readStruct for the + structure of structDefinition. + * + @param structDefinition Type definition of the struct. + @param struct The struct data object. + */ + writeStruct(structDefinition: Object, struct: Object): void; + + /** + Read UCS-2 string of desired length and endianness from the DataStream. + * + @param length The length of the string to read. + @return The read string. + */ + readUCS2String(length: number): string; + + /** + Read UCS-2 string of desired length and endianness from the DataStream. + * + @param length The length of the string to read. + @param endianness The endianness of the string data in the DataStream. + @return The read string. + */ + readUCS2String(length: number, endianness: boolean): string; + + /** + Write a UCS-2 string of desired endianness to the DataStream. The + lengthOverride argument lets you define the number of characters to write. + If the string is shorter than lengthOverride, the extra space is padded with + zeroes. + * + @param str The string to write. + */ + writeUCS2String(str: string): void; + + /** + Write a UCS-2 string of desired endianness to the DataStream. The + lengthOverride argument lets you define the number of characters to write. + If the string is shorter than lengthOverride, the extra space is padded with + zeroes. + * + @param str The string to write. + @param endianness The endianness to use for the written string data. + */ + writeUCS2String(str: string, endianness: boolean): void; + + /** + Write a UCS-2 string of desired endianness to the DataStream. The + lengthOverride argument lets you define the number of characters to write. + If the string is shorter than lengthOverride, the extra space is padded with + zeroes. + * + @param str The string to write. + @param endianness The endianness to use for the written string data. + @param lengthOverride The number of characters to write. + */ + writeUCS2String(str: string, endianness: boolean, lengthOverride: number): void; + + /** + Read a string of desired length and encoding from the DataStream. + * + @param length The length of the string to read in bytes. + @return The read string. + */ + readString(length: number): string; + + /** + Read a string of desired length and encoding from the DataStream. + * + @param length The length of the string to read in bytes. + @param encoding The encoding of the string data in the DataStream. Defaults to ASCII. + @return The read string. + */ + readString(length: number, encoding: string): string; + + /** + Writes a string of desired length and encoding to the DataStream. + * + @param s The string to write. + */ + writeString(s: string): void; + + /** + Writes a string of desired length and encoding to the DataStream. + * + @param s The string to write. + @param encoding The encoding for the written string data. Defaults to ASCII. + */ + writeString(s: string, encoding: string): void; + + /** + Writes a string of desired length and encoding to the DataStream. + * + @param s The string to write. + @param encoding The encoding for the written string data. Defaults to ASCII. + @param length The number of characters to write. + */ + writeString(s: string, encoding: string, length: number): void; + + /** + Read null-terminated string of desired length from the DataStream. Truncates + the returned string so that the null byte is not a part of it. + * + @return The read string. + */ + readCString(): string; + + /** + Read null-terminated string of desired length from the DataStream. Truncates + the returned string so that the null byte is not a part of it. + * + @param length The length of the string to read. + @return The read string. + */ + readCString(length: number): string; + + /** + Writes a null-terminated string to DataStream and zero-pads it to length + bytes. If length is not given, writes the string followed by a zero. + If string is longer than length, the written part of the string does not have + a trailing zero. + * + @param s The string to write. + */ + writeCString(s: string): void; + + /** + Writes a null-terminated string to DataStream and zero-pads it to length + bytes. If length is not given, writes the string followed by a zero. + If string is longer than length, the written part of the string does not have + a trailing zero. + * + @param s The string to write. + @param length The number of characters to write. + */ + writeCString(s: string, length: number): void; + + /** + Reads an object of type t from the DataStream, passing struct as the thus-far + read struct to possible callbacks that refer to it. Used by readStruct for + reading in the values, so the type is one of the readStruct types. + * + @param t Type of the object to read. + @return Returns the object on successful read, null on unsuccessful. + */ + readType(t: Object): Object; + + /** + Reads an object of type t from the DataStream, passing struct as the thus-far + read struct to possible callbacks that refer to it. Used by readStruct for + reading in the values, so the type is one of the readStruct types. + * + @param t Type of the object to read. + @param struct Struct to refer to when resolving length references and for calling callbacks. + @return Returns the object on successful read, null on unsuccessful. + */ + readType(t: Object, struct: Object): Object; + + /** + Writes object v of type t to the DataStream. + * + @param t Type of data to write. + @param v Value of data to write. + @param struct Struct to pass to write callback functions. + */ + writeType(t: Object, v: Object, struct: Object): void; +} From 1c92de76a28d1703bdccb9a5a515f3be005d39a8 Mon Sep 17 00:00:00 2001 From: satoru kimura Date: Sat, 16 May 2015 18:58:05 +0900 Subject: [PATCH 204/534] Updated to three.js r71. --- threejs/three.d.ts | 185 ++++++++++++++++++++++++++++++--------------- 1 file changed, 123 insertions(+), 62 deletions(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 7c4aca592..d87541145 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1,4 +1,4 @@ -// Type definitions for three.js r70 +// Type definitions for three.js r71 // Project: http://mrdoob.github.com/three.js/ // Definitions by: Kon , Satoru Kimura // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -129,6 +129,7 @@ declare module THREE { export var IntType: TextureDataType; export var UnsignedIntType: TextureDataType; export var FloatType: TextureDataType; + export var HalfFloatType: TextureDataType; // Pixel types export enum PixelType { } @@ -159,6 +160,12 @@ declare module THREE { export var RGBA_PVRTC_4BPPV1_Format: CompressedPixelFormat; export var RGBA_PVRTC_2BPPV1_Format: CompressedPixelFormat; + // log handlers + export function warn(message?: any, ...optionalParams: any[]): void; + export function error(message?: any, ...optionalParams: any[]): void; + export function log(message?: any, ...optionalParams: any[]): void; + + // Cameras //////////////////////////////////////////////////////////////////////////////////////// /** @@ -364,7 +371,7 @@ declare module THREE { length: number; copyAt(index1: number, attribute: BufferAttribute, index2: number): void; - set(value: number): BufferAttribute; + set(value: number, offset?: number): BufferAttribute; setX(index: number, x: number): BufferAttribute; setY(index: number, y: number): BufferAttribute; setZ(index: number, z: number): BufferAttribute; @@ -456,8 +463,7 @@ declare module THREE { */ applyMatrix(matrix: Matrix4): void; - // this method is currently empty. - center(): void; + center(): Vector3; fromGeometry( geometry: Geometry, settings?: any ): BufferGeometry; @@ -488,7 +494,7 @@ declare module THREE { */ computeTangents(): void; - computeOffsets(indexBufferSize: number): void; + computeOffsets(size: number): void; merge(geometry: BufferGeometry, offset: number): BufferGeometry; normalizeNormals(): void; reorderBuffers(indexBuffer: number, indexMap: number[], vertexCount: number): void; @@ -569,6 +575,17 @@ declare module THREE { getDelta(): number; } + export class DynamicBufferAttribute extends BufferAttribute{ + constructor(array: any, itemSize: number); + + updateRange: { + offset: number; + count: number; + } + + clone(): DynamicBufferAttribute; + } + /** * JavaScript events for custom objects * @@ -1065,6 +1082,8 @@ declare module THREE { */ frustumCulled: boolean; + renderOrder: number; + /** * An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned. */ @@ -1193,23 +1212,21 @@ declare module THREE { remove(object: Object3D): void; /* deprecated */ - getChildByName( name: string, recursive?: boolean ): Object3D; + getChildByName( name: string ): Object3D; /** * Searches through the object's children and returns the first with a matching id, optionally recursive. * @param id Unique number of the object instance - * @param recursive Boolean whether to search through the children's children. Default is false. */ - getObjectById(id: string, recursive: boolean): Object3D; + getObjectById(id: string): Object3D; /** * Searches through the object's children and returns the first with a matching name, optionally recursive. * @param name String to match to the children's Object3d.name property. - * @param recursive Boolean whether to search through the children's children. Default is false. */ - getObjectByName(name: string, recursive?: boolean): Object3D; + getObjectByName(name: string): Object3D; - getObjectByProperty( name: string, value: string, recursive?: boolean ): Object3D; + getObjectByProperty( name: string, value: string ): Object3D; getWorldPosition(optionalTarget?: Vector3): Vector3; getWorldQuaternion(optionalTarget?: Quaternion): Quaternion; @@ -1521,7 +1538,7 @@ declare module THREE { * scene.add( light ); */ export class PointLight extends Light { - constructor(hex?: number, intensity?: number, distance?: number); + constructor(hex?: number, intensity?: number, distance?: number, decay?: number); /* * Light's intensity. @@ -1535,6 +1552,8 @@ declare module THREE { */ distance: number; + decay: number; + clone(): PointLight; } @@ -1554,7 +1573,7 @@ declare module THREE { * scene.add( spotLight ); */ export class SpotLight extends Light { - constructor(hex?: number, intensity?: number, distance?: number, angle?: number, exponent?: number); + constructor(hex?: number, intensity?: number, distance?: number, angle?: number, exponent?: number, decay?: number); /** * Spotlight focus points at target.position. @@ -1586,6 +1605,8 @@ declare module THREE { */ exponent: number; + decay: number; + /** * If set to true light will cast dynamic shadows. Warning: This is expensive and requires tweaking to get shadows looking right. * Default — false. @@ -1744,9 +1765,7 @@ declare module THREE { parse(json: any): BufferGeometry; } - export class Cache{ - constructor(); - + export interface Cache{ files: any[]; add(key: string, file: any): void; @@ -1754,6 +1773,7 @@ declare module THREE { remove(key: string): void; clear(): void; } + export var Cache:Cache; export class CompressedTextureLoader{ constructor(); @@ -1856,14 +1876,18 @@ declare module THREE { constructor(manager?: LoadingManager); manager: LoadingManager; - crossOrigin: string; + texturePass: string; - load(url: string, onLoad: (object: Object3D) => void): void; + load(url: string, onLoad?: (object: Object3D) => void): void; + setTexturePath( value: string ): void; setCrossOrigin(crossOrigin: string): void; - parse(json: any): T; + parse(json: any, onLoad?: (object: Object3D) => void): T; parseGeometries(json: any): any[]; // Array of BufferGeometry or Geometry or Geometry2. - parseMaterials(json: any): Material[]; // Array of Classes that inherits from Matrial. + parseMaterials(json: any, textures: Texture[]): Material[]; // Array of Classes that inherits from Matrial. + parseImages( json: any, onLoad: () => void ): any[]; + parseTextures( json: any, images: any ): Texture[]; parseObject(data: any, geometries: any[], materials: Material[]): T; + } /** @@ -1976,6 +2000,10 @@ declare module THREE { */ blendEquation: BlendingEquation; + blendSrcAlpha: number; + blendDstAlpha: number; + blendEquationAlpha: number; + /** * Whether to have depth test enabled when rendering this material. Default is true. */ @@ -1987,6 +2015,8 @@ declare module THREE { */ depthWrite: boolean; + colorWrite: boolean; + /** * Whether to use polygon offset. Default is false. This corresponds to the POLYGON_OFFSET_FILL WebGL feature. */ @@ -2026,6 +2056,7 @@ declare module THREE { setValues(values: Object): void; toJSON(): any; clone(material?:Material): Material; + update(): void; dispose(): void; // EventDispatcher mixins @@ -2156,7 +2187,6 @@ declare module THREE { export interface MeshLambertMaterialParameters extends MaterialParameters{ color?: number; - ambient?: number; emissive?: number; wrapAround?: boolean; wrapRGB?: Vector3; @@ -2183,7 +2213,6 @@ declare module THREE { export class MeshLambertMaterial extends Material { constructor(parameters?: MeshLambertMaterialParameters); color: Color; - ambient: Color; emissive: Color; wrapAround: boolean; wrapRGB: Vector3; @@ -2210,7 +2239,6 @@ declare module THREE { } export interface MeshNormalMaterialParameters extends MaterialParameters{ - shading?: Shading; wireframe?: boolean; wireframeLinewidth?: number; morphTargets?: boolean; @@ -2219,7 +2247,6 @@ declare module THREE { export class MeshNormalMaterial extends Material { constructor(parameters?: MeshNormalMaterialParameters); - shading: Shading; wireframe: boolean; wireframeLinewidth: number; morphTargets: boolean; @@ -2229,7 +2256,6 @@ declare module THREE { export interface MeshPhongMaterialParameters extends MaterialParameters{ color?: number; // diffuse - ambient?: number; emissive?: number; specular?: number; shininess?: number; @@ -2264,7 +2290,6 @@ declare module THREE { constructor(parameters?: MeshPhongMaterialParameters); color: Color; // diffuse - ambient: Color; emissive: Color; specular: Color; shininess: number; @@ -2531,13 +2556,13 @@ declare module THREE { * Copies given color making conversion from gamma to linear space. * @param color Color to copy. */ - copyGammaToLinear(color: Color): Color; + copyGammaToLinear(color: Color, gammaFactor?: number): Color; /** * Copies given color making conversion from linear to gamma space. * @param color Color to copy. */ - copyLinearToGamma(color: Color): Color; + copyLinearToGamma(color: Color, gammaFactor?: number): Color; /** * Converts this color from gamma to linear space. @@ -2577,7 +2602,7 @@ declare module THREE { lerp(color: Color, alpha: number): Color; equals(color: Color): boolean; fromArray(rgb: number[]): Color; - toArray(): number[]; + toArray(array?: number[], offset?: number): number[]; /** * Clones this color. @@ -2751,7 +2776,7 @@ declare module THREE { reorder(newOrder: string): Euler; equals(euler: Euler): boolean; fromArray(xyzo: any[]): Euler; - toArray(): any[]; + toArray(array?: number[], offset?: number): number[]; toVector3(optionalResult?: Vector3): Vector3; onChange: () => void; @@ -2860,6 +2885,8 @@ declare module THREE { radToDeg(radians: number): number; isPowerOfTwo(value: number): boolean; + + nextPowerOfTwo(value: number): number; } /** @@ -3558,8 +3585,8 @@ declare module THREE { /** * Sets this vector to a + b. */ - addVectors(a: Vector2, b: Vector2): Vector2; addScalar(s: number): Vector2; + addVectors(a: Vector2, b: Vector2): Vector2; /** * Subtracts v from this vector. @@ -3635,6 +3662,9 @@ declare module THREE { setLength(l: number): Vector2; lerp(v: Vector2, alpha: number): Vector2; + + lerpVectors(v1: Vector2, v2: Vector2, alpha: number): Vector2; + /** * Checks for strict equality of this vector and v. */ @@ -3717,6 +3747,8 @@ declare module THREE { */ sub(a: Vector3): Vector3; + subScalar( s: number ): Vector3; + /** * Sets this vector to a - b. */ @@ -3790,6 +3822,8 @@ declare module THREE { setLength(l: number): Vector3; lerp(v: Vector3, alpha: number): Vector3; + lerpVectors(v1: Vector3, v2: Vector3, alpha: number): Vector3; + /** * Sets this vector to cross product of itself and v. */ @@ -3896,6 +3930,8 @@ declare module THREE { */ sub(v: Vector4): Vector4; + subScalar(s: number): Vector4; + /** * Sets this vector to a - b. */ @@ -3969,6 +4005,8 @@ declare module THREE { */ lerp(v: Vector4, alpha: number): Vector4; + lerpVectors(v1: Vector4, v2: Vector4, alpha: number): Vector4; + /** * Checks for strict equality of this vector and v. */ @@ -3989,7 +4027,7 @@ declare module THREE { // Objects ////////////////////////////////////////////////////////////////////////////////// export class Bone extends Object3D { - constructor(belongsToSkin: SkinnedMesh); + constructor(skin: SkinnedMesh); skin: SkinnedMesh; } @@ -4291,6 +4329,8 @@ declare module THREE { */ sortObjects: boolean; + gammaFactor: number; + /** * Default is false. */ @@ -4480,7 +4520,7 @@ declare module THREE { uploadTexture(texture: Texture): void; setTexture(texture: Texture, slot: number): void; setRenderTarget(renderTarget: RenderTarget): void; - + readRenderTargetPixels( renderTarget: RenderTarget, x: number, y: number, width: number, height: number, buffer: any ): void; } export interface RenderTarget { @@ -4539,6 +4579,7 @@ declare module THREE { export interface ShaderChunk { [name: string]: string; + common: string; alphamap_fragment: string; alphamap_pars_fragment: string; alphatest_fragment: string; @@ -4613,6 +4654,7 @@ declare module THREE { normal: Shader; normalmap: Shader; cube: Shader; + equirect: Shader; depthRGBA: Shader; }; @@ -4655,6 +4697,40 @@ declare module THREE { constructor(gl: any, type: string, string: string); } + interface WebGLStateInstance{ + new ( gl: any, paramThreeToGL: Function ): void; + initAttributes(): void; + enableAttribute(attribute: string): void; + disableUnusedAttributes(): void; + setBlending( blending: number, blendEquation: number, blendSrc: number, blendDst: number, blendEquationAlpha: number, blendSrcAlpha: number, blendDstAlpha: number ): void; + setDepthTest( depthTest: number ): void; + setDepthWrite( depthWrite: number ): void; + setColorWrite( colorWrite: number ): void; + setDoubleSided( doubleSided: number ): void; + setFlipSided( flipSided: number ): void; + setLineWidth( width: number ): void; + setPolygonOffset(polygonoffset: number, factor: number, units: number): void; + reset(): void; + } + interface WebGLStateStatic{ + ( gl: any, paramThreeToGL: Function ): WebGLStateInstance; + } + export var WebGLState: WebGLStateStatic; + + + interface WebGLTexturesInstance{ + new (webgglcontext: any): WebGLTexturesInstance; + + get(texture: Texture): any; // it will return result of gl.createTexture(). + create(texture: Texture): any; // it will return result of gl.createTexture(). + delete(texture: Texture): void; + } + interface WebGLTexturesStatic{ + (webgglcontext: any): WebGLTexturesInstance; + } + export var WebGLTextures: WebGLTexturesStatic; + + // Renderers / WebGL / Plugins ///////////////////////////////////////////////////////////////////// export interface RendererPlugin { init(renderer: WebGLRenderer): void; @@ -4821,29 +4897,7 @@ declare module THREE { export class Texture { constructor( - image: any, // HTMLImageElement or HTMLCanvasElement ( or HTMLVideoElement) - mapping?: Mapping, - wrapS?: Wrapping, - wrapT?: Wrapping, - magFilter?: TextureFilter, - minFilter?: TextureFilter, - format?: PixelFormat, - type?: TextureDataType, - anisotropy?: number - ); - constructor( - image: HTMLCanvasElement, - mapping?: Mapping, - wrapS?: Wrapping, - wrapT?: Wrapping, - magFilter?: TextureFilter, - minFilter?: TextureFilter, - format?: PixelFormat, - type?: TextureDataType, - anisotropy?: number - ); - constructor( - image: HTMLImageElement, + image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, mapping?: Mapping, wrapS?: Wrapping, wrapT?: Wrapping, @@ -4857,6 +4911,7 @@ declare module THREE { id: number; uuid: string; name: string; + sourceFile: string; image: any; // HTMLImageElement or ImageData ; mipmaps: ImageData[]; mapping: Mapping; @@ -4992,14 +5047,13 @@ declare module THREE { isPlaying: boolean; loop: boolean; weight: number; - keyTypes: string[]; interpolationType: number; play(startTime?: number, weight?: number): void; stop(): void; reset(): void; resetBlendWeights(): void; - update(deltaTimeMS: number): void; + update(delta: number): void; getNextKeyWith(type: string, h: number, key: number): KeyFrame; getPrevKeyWith(type: string, h: number, key: number): KeyFrame; } @@ -5022,7 +5076,7 @@ declare module THREE { constructor(data: any); root: Mesh; - data: Object; + data: AnimationData; hierarchy: KeyFrames[]; currentTime: number; timeScale: number; @@ -5051,7 +5105,7 @@ declare module THREE { play(): void; pause(): void; - update(deltaTimeMS: number): void; + update(delta: number): void; } // Extras / Audio ///////////////////////////////////////////////////////////////////// @@ -5063,11 +5117,18 @@ declare module THREE { source: AudioBufferSourceNode; gain: GainNode; panner: PannerNode; + autoplay: boolean; + startTime: number; + isPlaying: boolean; load(file: string): Audio; + play(): void; + pause(): void; + stop(): void; setLoop(value: boolean): void; setRefDistance(value: number): void; setRolloffFactor(value: number): void; + setVolume(value: number): void; updateMatrixWorld(force?: boolean): void; } @@ -5646,7 +5707,7 @@ declare module THREE { } export class EdgesHelper extends Line { - constructor(object: Object3D, hex?: number); + constructor(object: Object3D, hex?: number, thresholdAngle?: number); } @@ -5669,7 +5730,7 @@ declare module THREE { setColors(colorCenterLine: number, colorGrid: number): void; } export class HemisphereLightHelper extends Object3D { - constructor(light: Light, sphereSize: number, arrowLength: number, domeSize: number); + constructor(light: Light, sphereSize: number); light: Light; colors: Color[]; From 64097df03eb0a3491e2eb2886aed77481f0dfa44 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Sat, 16 May 2015 08:07:10 -0600 Subject: [PATCH 205/534] mention Jed Mao in header --- tcomb/tcomb.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tcomb/tcomb.d.ts b/tcomb/tcomb.d.ts index 8af914ab5..c189a6a0f 100644 --- a/tcomb/tcomb.d.ts +++ b/tcomb/tcomb.d.ts @@ -2,6 +2,8 @@ // Project: http://gcanti.github.io/tcomb/guide/index.html // Definitions by: Hans Windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped + +// Original Definitions by: Jed Mao declare module TComb { export interface tcomb { format: (format: string, ...values: any[]) => string; From 36e72c193f73c23e9d2762bb256b32a9df659297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Eichler?= Date: Sat, 16 May 2015 16:31:13 +0200 Subject: [PATCH 206/534] added missing ObjectId methods, changed Document _id property from string to ObjectId --- mongoose/mongoose-tests.ts | 11 ++++++++++- mongoose/mongoose.d.ts | 10 ++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index 1c8b804d6..9c221b5ca 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -364,5 +364,14 @@ schema.virtual('display_name') .get(function(): string { return this.name; }) .set((value: string): void => {}); -var id : mongoose.Types.ObjectId; +var id: mongoose.Types.ObjectId = new mongoose.Types.ObjectId('foo'); +var id2: mongoose.Types.ObjectId = new mongoose.Types.ObjectId(123); +var id2: mongoose.Types.ObjectId = mongoose.Types.ObjectId.createFromTime(123); +var id2: mongoose.Types.ObjectId = mongoose.Types.ObjectId.createFromHexString('foo'); var s = id.toHexString(); +var valid = id.isValid(); +var eq = id.equals(id2); + +var kitty1 = new Kitty({}); +var kitty2 = new Kitty({}); +var kittyEq = kitty1._id.equals(kitty2._id); \ No newline at end of file diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index fedd8fec6..33fa66aba 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -79,7 +79,13 @@ declare module "mongoose" { } export module Types { export class ObjectId { - toHexString(): string; + constructor(id: string|number); + toHexString(): string; + equals(other: ObjectId): boolean; + getTimestamp(): Date; + isValid(): boolean; + static createFromTime(time: number): ObjectId; + static createFromHexString(hexString: string): ObjectId; } } @@ -374,7 +380,7 @@ declare module "mongoose" { export interface Document { id?: string; - _id: string; + _id: Types.ObjectId; equals(doc: Document): boolean; get(path: string, type?: new(...args: any[]) => any): any; From 12b79812d6cdff92d863c07f78dce39b57a73772 Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 09:45:40 +0000 Subject: [PATCH 207/534] Update localForage to 1.2 localForage has been Changed since last year.So, I update localforage.d.ts to 1.3. --- localForage/localForage-tests.ts | 86 +++++++++++++++++++++---------- localForage/localForage.d.ts | Bin 834 -> 4444 bytes 2 files changed, 60 insertions(+), 26 deletions(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index f1a416dcf..5267dc798 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -1,34 +1,68 @@ /// -declare var localForage: lf.ILocalForage -declare var callback: lf.ICallback -declare var promise: lf.IPromise +declare var localForage: lf.ILocalForage; +declare var callback: lf.ICallback; +declare var iterateCallback: lf.IIterateCallback; +declare var errorCallback: lf.IErrorCallback; +declare var keyCallback: lf.IKeyCallback; +declare var keysCallback: lf.IKeysCallback; +declare var numberCallback: lf.INumberCallback; +declare var promise: lf.IPromise; () => { - localForage.clear() - localForage.length - localForage.key(0) + localForage.clear((err: any) => { + var newError: any = err; + }); + + localforage.iterate((str: string, key: string, num: number) => { + var newStr: string = str; + var newKey: string = key; + var newNum: number = num; + }); + + localForage.length((err: any, num: number) => { + var newError: any = err; + var newNumber: number = num; + }); + + localForage.key(0,(err: any, value: string) => { + var newError: any = err; + var newValue: string = value; + }); + + localforage.keys((err: any, keys: Array) => { + var newError: any = err; + var newArray: Array = keys; + }); + + localForage.getItem("key",(err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); + + localForage.getItem("key").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); - localForage.getItem("key", (str: string) => { - var newStr: string = str - }) - localForage.getItem("key").then((str: string) => { - var newStr: string = str - }) + localForage.setItem("key", "value",(err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); + + localForage.setItem("key", "value").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str; + }); - localForage.setItem("key", "value", (str: string) => { - var newStr: string = str - }) - localForage.setItem("key", "value").then((str: string) => { - var newStr: string = str - }) + localForage.removeItem("key",(err: any) => { + var newError: any = err; + }); + + localForage.removeItem("key").then((err: any, str: string) => { + var newError: any = err; + var newStr: string = str + }); - localForage.removeItem("key", (str: string) => { - var newStr: string = str - }) - localForage.removeItem("key").then((str: string) => { - var newStr: string = str - }) - - promise.then(callback) + promise.then(callback); } diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index c3d0371d005f4eb662bc972e63364bf9e0796eff..6cef3a9ea7ee22b54b15c43b5f6dff793ce9b361 100644 GIT binary patch literal 4444 zcmb_fU2oGs5ZoUE(!G%&REtjus45{SC@K_G`og1=IBmdjB0DV&sDB-px%KrN$5-qo zirhP&?c3Se+1=~kKaoUYkm;}Z4?-0__=YwKJtWGH)hYc4aa&M+^17&LOQpDQGZ@g(R@<%l&I}=zM*|!Gr@g^SCsPDtp0lukz@Air0 zA%1>ew{Ea%vE#&QX@-?0qNI9_F^{2~*v6Cm)2k)?$$^{L z&#*={^Q$@j#<+&of3jxq9komk_X6mmhIKNS;JaLU;DqW=Es7ELWE2N-h-cJ(E^lkk z`}U1XJfk8v8M&RQfyJ7am`%wUvr|zRFvr;i@I^P=EwDBP7II5gG$+U%wNI4Y{3oN# z7-gs*eo#nBioJx@PR1nw(}>6Ika|CFEy-Eb5{K z-LY5hJiuPeu`3(p3~`u28RUlQY}U#Vp09SSlR6hEV#HW`E~r_@hu1|tx9+A7<)jE^ zhk9K6$LH6bvqQb6H_nf01f1^$uCE6fn8#`|vI$rP$!mUyMyGpquvG2G$4 z>37mi_1jPtVgGRYsb|bCa)nH>f2dEa!R+>|Th%)2c+jqEEJH(^{aT^91M{c=+68`O zQ0us3mi2{C(=tC@C9dZ~DDRk+%wV^lMvzr(URug9qq>=Ss&wWX&mv2F%W5@44EtF7 ziRY^QYOgTxf%wu+F|6;exLEJV89Ox95zhR2Oxsn#c2-p%1JN_s%(9Y5X~FpZtFzm? z&R3|!^=6)?*g1ShrGCP>6N+h5U*)N+8m};)zRQvA)17mCcO<*y{lx0lpNpLSz4xxB zReRfJ2Ja?1%ole`^EnlcQ9Zl2JsEYe-!2N*=rH~S#%$d@>o(_T^C`CnhIsCyr>u%A zt4kj()oQ46w?Wh96cxf&$HBT3j^4E7g4wSB3s$=kJ*oEAZG1YkoHd=5L!Q)G-p2Y7 zVzznuYHQhZc#Meiv`J>F)xQsoxoX=c!is0}Y}6eQ|Hn4+#22k3^~kX7Sf m&x$VSs=E1%zV1BUrKXy?UNc6mshNb%V0BM#@6n9#wfqC2gQyw+ literal 834 zcmbV}-AcqT5QXpi6mw?R4i*!7m)qIZY<_cbJzoyiiO!^bX`S>v zGi%$Cu@_Z8#1mO2kSpd8v=yyFP!+sp5RWv`yP%TFnER*F3} zysoj&r4hKLU|LmrlJPZ#;&!~o4}A8U zKx0c07ow%d2pmlOlu5@_i}8nlwfj-z8)JvscKF|b)AWSZF55>w! T$*=5jfC(BJH2Lp)*=4&o+j9m8 From 33cc02c18267117df0978f2b18e3a131bbf75e40 Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 10:10:13 +0000 Subject: [PATCH 208/534] modified a few bug --- localForage/localForage-tests.ts | 4 ++-- localForage/localForage.d.ts | Bin 4444 -> 4468 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index 5267dc798..1e1ab4dd5 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -14,7 +14,7 @@ declare var promise: lf.IPromise; var newError: any = err; }); - localforage.iterate((str: string, key: string, num: number) => { + localForage.iterate((str: string, key: string, num: number) => { var newStr: string = str; var newKey: string = key; var newNum: number = num; @@ -30,7 +30,7 @@ declare var promise: lf.IPromise; var newValue: string = value; }); - localforage.keys((err: any, keys: Array) => { + localForage.keys((err: any, keys: Array) => { var newError: any = err; var newArray: Array = keys; }); diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 6cef3a9ea7ee22b54b15c43b5f6dff793ce9b361..42c738d1f29b1864d09568abd06aba9ae8110d22 100644 GIT binary patch delta 39 xcmV+?0NDTBBJ?7#Y7dj(3 Date: Sun, 17 May 2015 10:55:38 +0000 Subject: [PATCH 209/534] change --- localForage/localForage-tests.ts | 2 +- localForage/localForage.d.ts | Bin 4468 -> 2384 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index 1e1ab4dd5..15638c1cb 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -1,4 +1,4 @@ -/// +/// declare var localForage: lf.ILocalForage; declare var callback: lf.ICallback; diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 42c738d1f29b1864d09568abd06aba9ae8110d22..e6ccdfd59b4054fc3883858a60425e62b7233d27 100644 GIT binary patch literal 2384 zcmb7FZEn**5WUL$BdwxX1&V~JDj^EUDij3$!_T!nPL`~9quq6=K}bCa9DpBA?-r&IV;Q38jHYRPL>vW8C&dXQ79G&ePqOSO*LSQNFZIwt^n z=a>nm5lWR;0znk;js69CaY?iamLVi>wlbVto^B#sRCIXQ#=8?7!UrtX8V%qYbq!0b zq0p)XyC9vJWhpZ_1&y}SlFK=83swPxR1irpf?1pefKl(131oUgEfFcpmN6tRwO0B? zdp?L^t+=bpQ=zXr(z1sJ)>3 zhtwLu>NS!Gq>p4JQ7cFdN60CagOVhXf#htrDil1SPa<=?ia}Ooih2q?mCmv52>k~e zL38QZkW2*cwduNek3KHE-zFkpZZUYauT3O~X%z9rI2L^dswf1P2%ZH@_zY)Wq?_v> z0_EH;ZmxeG?AEJ^>GQkr*W6-wFG1#7gXMO<9UoeH5Ioh4hM&nCOto4GPW#}b(`YKu z4t&?2kS8RCkEC)TSCl4|1-znGOks|e#;cqhz!$Qoc893nLWCIojp=d-FDAV-tz0k~ zUCo1oI*?5BlaL3N+#sdwljtLJF5p()FSw*8_PVy4v1zLe82dGi;c`6py)fge=-kY8 z&y(2h=f>7X7N)&1`VI!Qb%Sufoed)l7W182({`ulRWyyMoH2OPbRd;@gD|kZI;+-z9s~a~JjdKOPq@!2kdN literal 4468 zcmb_fU2oGs5ZoUE(!G%&REtjus45{SC@K_G`og1=IBmdoA}1{ksDB-px%Ks&i(Tv{ zvK*h!_TKF5?C$07pGYDxaw;pCOM=lDzZ02Cj&q4~hS37^6O0O6KjHcd^C^y49@u9o z=0>j z5v;pa6wCT5?;3Cq;ThK)1K%aq8Dl)hbp#X(e3N6H1osOdO00+bE%7~-D|sx>a6Xrp z@3FF}+@7By_$VxLTF$Y?3?4?ZZZ`pMtDE?a zv3lPy#v>cQ0wZIY9s^}+?^49t$Zx!9aOFWYC_59ZG_r3EZmU#u&#?PHf{z{^`{c{uIDX z>}Qyxn)%fXzcJ3C^`ER6d`B(Q!@UM{QO!IVOz>SHJ#a$xrxwKsHW|f%9O4r6?u`3(p9C65?401zt)@$Vm&sRIvNytTt7%|qK3u@N!;dK$_*4^}>oGco% zLp@&n$LH6bvqQb6H_nf01f1^$uCE6fn8#`|vI$rP$!mUyMyGpquvF|=^s z^gHRM`fXDcVgGRY2{UFFxk9GcKh!7IV0L@ft!kZhJZRT7mZ71|eyz~7z&u(2?HmUg z)H?2%Wqsk(w9HReiNkzo$~$HyGuYYF2(pUJ%9V1AsBUJSDxLYpy~q;ZvRY+`VIOlp z@m#fE?G*+-5MSCUhM|4M#d=51*rBP8=FAUc+O7(=TUGTj5Z!}imX$=x6^!q{I=a2< ze1%F}Z{}`_ox^uj>Zdt(nqpelSGg;z#;ci6-{r{m>CQR6JCa@Ueqwd&_eD(=LJ{Vul$hPdyer>u%A zt4kj()oN4aZiA-HE~*Jzh=X;hIeOEQ3ue3i7p!(8dQ$DJ+xT>7Ijh?%H+d4Wyv^!I zh}q`utL@63!(&98yG=4vt^V6%+uSF0N5}u$M&4MaWB9wjhVcNMk Date: Sun, 17 May 2015 11:00:04 +0000 Subject: [PATCH 210/534] fix linefield --- localForage/localForage.d.ts | 74 +++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index e6ccdfd59..14bd6aedb 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1 +1,73 @@ -// Type definitions for Mozilla's localForage
// Project: https://github.com/mozilla/localforage
// Definitions by: david pichsenmeister , Yuichi Nukiyama
// Definitions: https://github.com/borisyankov/DefinitelyTyped

declare module lf {
 interface ILocalForage {
 /**
 * Removes every key from the database, returning it to a blank slate.
 */
 clear(callback: IErrorCallback): void
 /**
 * Iterate over all value/key pairs in datastore.
 */
 iterate(iterateCallback: IIterateCallback): void
 /**
 * Get the name of a key based on its ID.
 */
 key(keyIndex: number, callback: IKeyCallback): void
 /**
 * Get the list of all keys in the datastore.
 */
 keys(callback: IKeysCallback): void;
 /**
 * Gets the number of keys in the offline store (i.e. its “lengthâ€).
 */
 length(callback: INumberCallback): void
 /**
 * Gets an item from the storage library and supplies the result to a callback.
 * If the key does not exist, getItem() will return null.
 */
 getItem(key: string, callback: ICallback): void
 getItem(key: string): IPromise
 /**
 * Saves data to an offline store.
 */
 setItem(key: string, value: T, callback: ICallback): void
 setItem(key: string, value: T): IPromise
 /**
 * Removes the value of a key from the offline store.
 */
 removeItem(key: string, callback: IErrorCallback): void
 removeItem(key: string): IPromise
 }

 interface ICallback {
 (err: any, value: T): void
 }

 interface IIterateCallback {
 (value: T, key: string, iterationNumber: number): void
 }

 interface IErrorCallback {
 (err: any): void
 }

 interface IKeyCallback {
 (err: any, keyName: string): void
 }

 interface IKeysCallback {
 (err: any, keys: Array): void
 }

 interface INumberCallback {
 (err: any, numberOfKeys: number): void
 }

 interface IPromise {
 then(callback: ICallback): void
 }
} \ No newline at end of file +// Type definitions for Mozilla's localForage +// Project: https://github.com/mozilla/localforage +// Definitions by: david pichsenmeister , Yuichi Nukiyama +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module lf { + interface ILocalForage { + /** + * Removes every key from the database, returning it to a blank slate. + */ + clear(callback: IErrorCallback): void + /** + * Iterate over all value/key pairs in datastore. + */ + iterate(iterateCallback: IIterateCallback): void + /** + * Get the name of a key based on its ID. + */ + key(keyIndex: number, callback: IKeyCallback): void + /** + * Get the list of all keys in the datastore. + */ + keys(callback: IKeysCallback): void; + /** + * Gets the number of keys in the offline store (i.e. its “lengthâ€). + */ + length(callback: INumberCallback): void + /** + * Gets an item from the storage library and supplies the result to a callback. + * If the key does not exist, getItem() will return null. + */ + getItem(key: string, callback: ICallback): void + getItem(key: string): IPromise + /** + * Saves data to an offline store. + */ + setItem(key: string, value: T, callback: ICallback): void + setItem(key: string, value: T): IPromise + /** + * Removes the value of a key from the offline store. + */ + removeItem(key: string, callback: IErrorCallback): void + removeItem(key: string): IPromise + } + + interface ICallback { + (err: any, value: T): void + } + + interface IIterateCallback { + (value: T, key: string, iterationNumber: number): void + } + + interface IErrorCallback { + (err: any): void + } + + interface IKeyCallback { + (err: any, keyName: string): void + } + + interface IKeysCallback { + (err: any, keys: Array): void + } + + interface INumberCallback { + (err: any, numberOfKeys: number): void + } + + interface IPromise { + then(callback: ICallback): void + } +} \ No newline at end of file From 6500933c82b4e8c48feb6f7069d3093eff31a948 Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 11:02:48 +0000 Subject: [PATCH 211/534] fix2 --- localForage/localForage.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index 14bd6aedb..e39ec73c6 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1,6 +1,6 @@ // Type definitions for Mozilla's localForage // Project: https://github.com/mozilla/localforage -// Definitions by: david pichsenmeister , Yuichi Nukiyama +// Definitions by: david pichsenmeister ,Yuichi Nukiyama // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module lf { From ef5547827ca46d0b62f718fc3fe5f80666c7bd6a Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 11:05:24 +0000 Subject: [PATCH 212/534] fix3 --- localForage/localForage.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index e39ec73c6..cb518a70e 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1,6 +1,6 @@ // Type definitions for Mozilla's localForage // Project: https://github.com/mozilla/localforage -// Definitions by: david pichsenmeister ,Yuichi Nukiyama +// Definitions by: yuichi,david pichsenmeister // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module lf { From c1e3d3654997f36dd063e4035582cd445081f25d Mon Sep 17 00:00:00 2001 From: YuichiNukiyama Date: Sun, 17 May 2015 11:08:11 +0000 Subject: [PATCH 213/534] FIX4 --- localForage/localForage.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index cb518a70e..b5c40dd61 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -1,6 +1,6 @@ // Type definitions for Mozilla's localForage // Project: https://github.com/mozilla/localforage -// Definitions by: yuichi,david pichsenmeister +// Definitions by: yuichi david pichsenmeister // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module lf { From 241e3f2fc7609a8de1d343862ae48fe779c1281b Mon Sep 17 00:00:00 2001 From: Chris Wrench Date: Mon, 18 May 2015 08:35:03 +0100 Subject: [PATCH 214/534] Fix issue with Polygon and MultiPolygon contructors --- googlemaps/google.maps.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index fa11a71ce..fe4e7459c 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -208,7 +208,7 @@ declare module google.maps { } /***** Data *****/ - export class Data extends MVCObject { + export class Data extends MVCObject { constructor(options?: Data.DataOptions); add(feature: Data.Feature|Data.FeatureOptions): Data.Feature; addGeoJson(geoJson: Object, options?: Data.GeoJsonOptions): Data.Feature[]; @@ -308,14 +308,14 @@ declare module google.maps { } export class Polygon extends Data.Geometry { - constructor(elements: LinearRing[]|LatLng[]); // TODO LatLngLiteral + constructor(elements: LinearRing[]|LatLng[][]); // TODO LatLngLiteral getArray(): LinearRing[]; getAt(n: number): LinearRing; getLength(): number; } export class MultiPolygon extends Data.Geometry { - constructor(elements: Data.Polygon[]|LinearRing[]|LatLng[][]); // TODO LatLngLiteral + constructor(elements: Data.Polygon[]|LinearRing[][]|LatLng[][][]); // TODO LatLngLiteral getArray(): Data.Polygon[]; getAt(n: number): Data.Polygon; getLength(): number; From 4f0c99114ff344aa5637b20bf681c521ec9bef92 Mon Sep 17 00:00:00 2001 From: Aleksey Blokhin Date: Mon, 18 May 2015 10:57:53 +0300 Subject: [PATCH 215/534] Method signature fixed. --- angular-translate/angular-translate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index b191bf455..141804791 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -27,7 +27,7 @@ declare module angular.translate { } interface IPartialLoader { - addPart(name : string, priority : number) : T; + addPart(name : string, priority? : number) : T; setPart(lang : string, part : string, table : ITranslationTable) : T; deletePart(name : string) : T; isPartAvailable(name : string) : boolean; From b0289ac7a3657dbe8babf7691eabf9f404c832d3 Mon Sep 17 00:00:00 2001 From: Guillaume Mouron Date: Mon, 18 May 2015 12:07:28 +0200 Subject: [PATCH 216/534] Insert and append can take functions returning a DOM element This is specified in the d3 documentation : - append : https://github.com/mbostock/d3/wiki/Selections#append - insert : https://github.com/mbostock/d3/wiki/Selections#insert Also visible in the code : https://github.com/mbostock/d3/blob/master/d3.js#L802 and https://github.com/mbostock/d3/blob/master/d3.js#L818 --- d3/d3.d.ts | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index e1d501e0b..0bf3d599d 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -787,8 +787,18 @@ declare module D3 { (valueFunction: (data: T, index: number) => any): _Selection; }; - append: (name: string) => _Selection; - insert: (name: string, before: string) => _Selection; + append: { + (name: string): _Selection; + (elementFunction: (data: T, index: number) => any): _Selection; + } + + insert: { + (name: string, before: string): _Selection; + (insertElementFunction: (data: T, index: number) => any, before: string): _Selection; + (name: string, beforeElementFunction: (data: T, index: number) => any): _Selection; + (insertElementFunction: (data: T, index: number) => any, beforeElementFunction: (data: T, index: number) => any): _Selection; + } + remove: () => _Selection; empty: () => boolean; @@ -874,8 +884,18 @@ declare module D3 { export interface Selection extends _Selection { } export interface _EnterSelection { - append: (name: string) => _Selection; - insert: (name: string, before?: string) => _Selection; + append: { + (name: string): _Selection; + (elementFunction: (data: T, index: number) => any): _Selection; + } + + insert: { + (name: string, before?: string): _Selection; + (insertElementFunction: (data: T, index: number) => any, before?: string): _Selection; + (name: string, beforeElementFunction?: (data: T, index: number) => any): _Selection; + (insertElementFunction: (data: T, index: number) => any, beforeElementFunction?: (data: T, index: number) => any): _Selection; + } + select: (selector: string) => _Selection; empty: () => boolean; node: () => Element; From 708a29cbf53e29996c8dfcdccabb2b7bad153534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Eichler?= Date: Mon, 18 May 2015 14:49:55 +0200 Subject: [PATCH 217/534] fixed Model.create method returned Promise type --- mongoose/mongoose.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index 33fa66aba..29e167dcd 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -143,7 +143,7 @@ declare module "mongoose" { aggregate(aggregation1: Object, aggregation2: Object, aggregation3: Object, callback: (err: any, res: T[]) => void): Promise; count(conditions: Object, callback?: (err: any, count: number) => void): Query; - create(doc: Object, fn?: (err: any, res: T) => void): Promise; + create(doc: Object, fn?: (err: any, res: T) => void): Promise; create(doc1: Object, doc2: Object, fn?: (err: any, res1: T, res2: T) => void): Promise; create(doc1: Object, doc2: Object, doc3: Object, fn?: (err: any, res1: T, res2: T, res3: T) => void): Promise; discriminator(name: string, schema: Schema): Model; From c8d056a361f9d4e77ce40950e6088bf064bdcf16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Eichler?= Date: Mon, 18 May 2015 14:53:28 +0200 Subject: [PATCH 218/534] added test for fixed create method --- mongoose/mongoose-tests.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mongoose/mongoose-tests.ts b/mongoose/mongoose-tests.ts index 9c221b5ca..de68f006a 100644 --- a/mongoose/mongoose-tests.ts +++ b/mongoose/mongoose-tests.ts @@ -146,6 +146,9 @@ Model.remove((err: any, res: IActor[]) => {}); Model.save((err: any, res: IActor, numberAffected: number) => {}); Model.create({ type: 'jelly bean' }, { type: 'snickers' }, (err: any, res1: IActor, res2: IActor) => {}); Model.create({ type: 'jawbreaker' }); +Model.create({ type: 'muffin' }).then(function (res) { + res.name; +}); Model.distinct('url', { clicks: {$gt: 100}}, (err: any, result: IActor[]) => {}); Model.distinct('url'); From 639337b32bed76f70e1e7918c4ad076c4492e1ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Eichler?= Date: Mon, 18 May 2015 14:57:14 +0200 Subject: [PATCH 219/534] fixed *withMatch methods incorrectly requiring SinonMatcher type arguments --- sinon/sinon-tests.ts | 13 +++++++++++++ sinon/sinon.d.ts | 14 +++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/sinon/sinon-tests.ts b/sinon/sinon-tests.ts index ccc9819e5..ca916788d 100644 --- a/sinon/sinon-tests.ts +++ b/sinon/sinon-tests.ts @@ -76,6 +76,18 @@ function testEight() { sinon.match.typeOf("object").and(sinon.match.has("pages")); } +function testNine() { + var callback = sinon.stub().returns(42); + callback({ x: 5, y: 5 }); + callback.calledWithMatch({ x: 5 }); + callback.alwaysCalledWithMatch({ y: 5 }); + callback.neverCalledWithMatch({ x: 6 }); + callback.notCalledWithMatch({ x: 6 }); + sinon.assert.calledWithMatch(callback, { x: 5 }); + sinon.assert.alwaysCalledWithMatch(callback, { y: 5 }); + sinon.assert.neverCalledWithMatch(callback, { x: 6 }); +} + function testSandbox() { var sandbox = sinon.sandbox.create(); if (sandbox.spy().called) { @@ -96,3 +108,4 @@ testFive(); testSix(); testSeven(); testEight(); +testNine(); diff --git a/sinon/sinon.d.ts b/sinon/sinon.d.ts index 7dc5bc1d6..6440dda90 100644 --- a/sinon/sinon.d.ts +++ b/sinon/sinon.d.ts @@ -15,9 +15,9 @@ declare module Sinon { calledOn(obj: any): boolean; calledWith(...args: any[]): boolean; calledWithExactly(...args: any[]): boolean; - calledWithMatch(...args: SinonMatcher[]): boolean; + calledWithMatch(...args: any[]): boolean; notCalledWith(...args: any[]): boolean; - notCalledWithMatch(...args: SinonMatcher[]): boolean; + notCalledWithMatch(...args: any[]): boolean; returned(value: any): boolean; threw(): boolean; threw(type: string): boolean; @@ -64,9 +64,9 @@ declare module Sinon { alwaysCalledOn(obj: any): boolean; alwaysCalledWith(...args: any[]): boolean; alwaysCalledWithExactly(...args: any[]): boolean; - alwaysCalledWithMatch(...args: SinonMatcher[]): boolean; + alwaysCalledWithMatch(...args: any[]): boolean; neverCalledWith(...args: any[]): boolean; - neverCalledWithMatch(...args: SinonMatcher[]): boolean; + neverCalledWithMatch(...args: any[]): boolean; alwaysThrew(): boolean; alwaysThrew(type: string): boolean; alwaysThrew(obj: any): boolean; @@ -307,9 +307,9 @@ declare module Sinon { neverCalledWith(spy: SinonSpy, ...args: any[]): void; calledWithExactly(spy: SinonSpy, ...args: any[]): void; alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void; - calledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; - alwaysCalledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; - neverCalledWithMatch(spy: SinonSpy, ...args: SinonMatcher[]): void; + calledWithMatch(spy: SinonSpy, ...args: any[]): void; + alwaysCalledWithMatch(spy: SinonSpy, ...args: any[]): void; + neverCalledWithMatch(spy: SinonSpy, ...args: any[]): void; threw(spy: SinonSpy): void; threw(spy: SinonSpy, exception: string): void; threw(spy: SinonSpy, exception: any): void; From 0be19e02aaf6dd73b990e87eff159934728609dc Mon Sep 17 00:00:00 2001 From: Joseph Livecchi Date: Mon, 18 May 2015 11:27:02 -0400 Subject: [PATCH 220/534] Finished converting fabric.d.ts to version 1.5.x * Finished converting all of the fabric.d.ts file to the latest version, 1.5.x * Updated the fabricjs-tests.ts with the new api changes --- fabricjs/fabricjs-tests.ts | 1910 +++++++++-------- fabricjs/fabricjs.d.ts | 4126 +++++++++++++++++++++--------------- 2 files changed, 3397 insertions(+), 2639 deletions(-) diff --git a/fabricjs/fabricjs-tests.ts b/fabricjs/fabricjs-tests.ts index e59212d80..c3dfd8d6d 100644 --- a/fabricjs/fabricjs-tests.ts +++ b/fabricjs/fabricjs-tests.ts @@ -1,1065 +1,1063 @@ /// function sample1() { - var canvas = new fabric.Canvas('c', { - hoverCursor: 'pointer', - selection: false, + var canvas = new fabric.Canvas('c', { + hoverCursor: 'pointer', + selection: false, + }); + + canvas.on('object:moving', function(e: fabric.IEvent) { + e.target.opacity = 0.5; + }); + canvas.on('object:modified', function(e: fabric.IEvent) { + e.target.opacity = 1; + }); + + for (var i = 0, len = 15; i < len; i++) { + fabric.Image.fromURL('../assets/ladybug.png', function(img) { + img.set({ + left: fabric.util.getRandomInt(0, 600), + top: fabric.util.getRandomInt(0, 500), + angle: fabric.util.getRandomInt(0, 90) + }); + + img.perPixelTargetFind = true; + // img.targetFindTolerance = 4; + img.hasControls = img.hasBorders = false; + + img.scale(fabric.util.getRandomInt(50, 100) / 100); + + canvas.add(img); }); - - canvas.on({ - 'object:moving': function (e) { - (e.target).opacity = 0.5; - }, - 'object:modified': function (e) { - (e.target).opacity = 1; - } - }); - - for (var i = 0, len = 15; i < len; i++) { - fabric.Image.fromURL('../assets/ladybug.png', function (img) { - img.set({ - left: fabric.util.getRandomInt(0, 600), - top: fabric.util.getRandomInt(0, 500), - angle: fabric.util.getRandomInt(0, 90) - }); - - img.perPixelTargetFind = true; - // img.targetFindTolerance = 4; - img.hasControls = img.hasBorders = false; - - img.scale(fabric.util.getRandomInt(50, 100) / 100); - - canvas.add(img); - }); - } + } } function sample2() { - var dot, i, - t1, t2, - startTimer = function () { - t1 = new Date().getTime(); - return t1; - }, - stopTimer = function () { - t2 = new Date().getTime(); - return t2 - t1; - }, - getRandomInt = fabric.util.getRandomInt, - rainbow = ["#ffcc66", "#ccff66", "#66ccff", "#ff6fcf", "#ff6666"], - rainbowEnd = rainbow.length - 1; + var dot, i, + t1, t2, + startTimer = function() { + t1 = new Date().getTime(); + return t1; + }, + stopTimer = function() { + t2 = new Date().getTime(); + return t2 - t1; + }, + getRandomInt = fabric.util.getRandomInt, + rainbow = ["#ffcc66", "#ccff66", "#66ccff", "#ff6fcf", "#ff6666"], + rainbowEnd = rainbow.length - 1; - // - // Rendering canvas #1 - // - var canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" }), - results1 = document.getElementById('results-c1'); + // + // Rendering canvas #1 + // + var canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" }), + results1 = document.getElementById('results-c1'); - startTimer(); - for (i = 100; i >= 0; i--) { - dot = new fabric.Circle({ - left: getRandomInt(0, 400), - top: getRandomInt(0, 350), - radius: 3, - fill: rainbow[getRandomInt(0, rainbowEnd)] - }); - canvas1.add(dot); - } - results1.innerHTML = 'Regular rendering of 100 elements in ' + stopTimer() + 'ms'; + startTimer(); + for (i = 100; i >= 0; i--) { + dot = new fabric.Circle({ + left: getRandomInt(0, 400), + top: getRandomInt(0, 350), + radius: 3, + fill: rainbow[getRandomInt(0, rainbowEnd)] + }); + canvas1.add(dot); + } + results1.innerHTML = 'Regular rendering of 100 elements in ' + stopTimer() + 'ms'; - // - // Rendering canvas #2 - // - var canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddition: false }), - results2 = document.getElementById('results-c2'); + // + // Rendering canvas #2 + // + var canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddition: false }), + results2 = document.getElementById('results-c2'); - startTimer(); - for (i = 1000; i >= 0; i--) { - dot = new fabric.Circle({ - left: getRandomInt(0, 400), - top: getRandomInt(0, 350), - radius: 3, - fill: rainbow[getRandomInt(0, rainbowEnd)] - }); - canvas2.add(dot); - } - canvas2.renderAll(); // Note, calling renderAll() is important in this case - results2.innerHTML = 'Rendering 1000 elements using canvas.renderOnAddition = false in ' + stopTimer() + 'ms'; + startTimer(); + for (i = 1000; i >= 0; i--) { + dot = new fabric.Circle({ + left: getRandomInt(0, 400), + top: getRandomInt(0, 350), + radius: 3, + fill: rainbow[getRandomInt(0, rainbowEnd)] + }); + canvas2.add(dot); + } + canvas2.renderAll(); // Note, calling renderAll() is important in this case + results2.innerHTML = 'Rendering 1000 elements using canvas.renderOnAddition = false in ' + stopTimer() + 'ms'; } function sample3() { - var $ = function (id) {return document.getElementById(id) }; + var $ = function(id) { return document.getElementById(id) }; - function applyFilter(index, filter) { - var obj = canvas.getActiveObject(); - obj.filters[index] = filter; - obj.applyFilters(canvas.renderAll.bind(canvas)); - } - - function applyFilterValue(index, prop, value) { - var obj = canvas.getActiveObject(); - if (obj.filters[index]) { - obj.filters[index][prop] = value; - obj.applyFilters(canvas.renderAll.bind(canvas)); - } - } - - var canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' }), - f = fabric.Image.filters; - - canvas.on({ - 'object:selected': function () { - fabric.util.toArray(document.getElementsByTagName('input')).forEach(function (el) { el.disabled = false; }) - - var filters = ['grayscale', 'invert', 'remove-white', 'sepia', 'sepia2', 'brightness', - 'noise', 'gradient-transparency', 'pixelate', 'blur', 'sharpen']; - - for (var i = 0; i < filters.length; i++) { - var checkBox = $(filters[i]); - var image = canvas.getActiveObject(); - checkBox.checked = !!image.filters[i]; - } - }, - 'selection:cleared': function () { - fabric.util.toArray(document.getElementsByTagName('input')).forEach(function (el) { el.disabled = true; }) + function applyFilter(index, filter) { + var obj = canvas.getActiveObject(); + obj.filters[index] = filter; + obj.applyFilters(canvas.renderAll.bind(canvas)); } - }); - fabric.Image.fromURL('../assets/printio.png', function (img) { - var oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9); - canvas.add(oImg).renderAll(); - canvas.setActiveObject(oImg); - }); + function applyFilterValue(index, prop, value) { + var obj = canvas.getActiveObject(); + if (obj.filters[index]) { + obj.filters[index][prop] = value; + obj.applyFilters(canvas.renderAll.bind(canvas)); + } + } - $('grayscale').onclick = function () { - applyFilter(0, this.checked && new f.Grayscale()); - }; - $('invert').onclick = function () { - applyFilter(1, this.checked && new f.Invert()); - }; - $('remove-white').onclick = function () { - applyFilter(2, this.checked && new f.RemoveWhite({ - threshold: ($('remove-white-threshold')).value, - distance: ($('remove-white-distance')).value - })); - }; - $('remove-white-threshold').onchange = function () { - applyFilterValue(2, 'threshold', this.value); - }; - $('remove-white-distance').onchange = function () { - applyFilterValue(2, 'distance', this.value); - }; - $('sepia').onclick = function () { - applyFilter(3, this.checked && new f.Sepia()); - }; - $('sepia2').onclick = function () { - applyFilter(4, this.checked && new f.Sepia2()); - }; - $('brightness').onclick = function () { - applyFilter(5, this.checked && new f.Brightness({ - brightness: parseInt(($('brightness-value')).value, 10) - })); - }; - $('brightness-value').onchange = function () { - applyFilterValue(5, 'brightness', parseInt(this.value, 10)); - }; - $('noise').onclick = function () { - applyFilter(6, this.checked && new f.Noise({ - noise: parseInt(($('noise-value')).value, 10) - })); - }; - $('noise-value').onchange = function () { - applyFilterValue(6, 'noise', parseInt(this.value, 10)); - }; - $('gradient-transparency').onclick = function () { - applyFilter(7, this.checked && new f.GradientTransparency({ - threshold: parseInt(($('gradient-transparency-value')).value, 10) - })); - }; - $('gradient-transparency-value').onchange = function () { - applyFilterValue(7, 'threshold', parseInt(this.value, 10)); - }; - $('pixelate').onclick = function () { - applyFilter(8, this.checked && new f.Pixelate({ - blocksize: parseInt(($('pixelate-value')).value, 10) - })); - }; - $('pixelate-value').onchange = function () { - applyFilterValue(8, 'blocksize', parseInt(this.value, 10)); - }; - $('blur').onclick = function () { - applyFilter(9, this.checked && new f.Convolute({ - matrix: [1 / 9, 1 / 9, 1 / 9, - 1 / 9, 1 / 9, 1 / 9, - 1 / 9, 1 / 9, 1 / 9] - })); - }; - $('sharpen').onclick = function () { - applyFilter(10, this.checked && new f.Convolute({ - matrix: [0, -1, 0, - -1, 5, -1, - 0, -1, 0] - })); - }; - $('emboss').onclick = function () { - applyFilter(11, this.checked && new f.Convolute({ - matrix: [1, 1, 1, - 1, 0.7, -1, - -1, -1, -1] - })); - }; + var canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' }), + f = fabric.Image.filters; + + canvas.on({ + 'object:selected': function() { + fabric.util.toArray(document.getElementsByTagName('input')).forEach(function(el) { el.disabled = false; }) + + var filters = ['grayscale', 'invert', 'remove-white', 'sepia', 'sepia2', 'brightness', + 'noise', 'gradient-transparency', 'pixelate', 'blur', 'sharpen']; + + for (var i = 0; i < filters.length; i++) { + var checkBox = $(filters[i]); + var image = canvas.getActiveObject(); + checkBox.checked = !!image.filters[i]; + } + }, + 'selection:cleared': function() { + fabric.util.toArray(document.getElementsByTagName('input')).forEach(function(el) { el.disabled = true; }) + } + }); + + fabric.Image.fromURL('../assets/printio.png', function(img) { + var oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9); + canvas.add(oImg).renderAll(); + canvas.setActiveObject(oImg); + }); + + $('grayscale').onclick = function() { + applyFilter(0, this.checked && new f.Grayscale()); + }; + $('invert').onclick = function() { + applyFilter(1, this.checked && new f.Invert()); + }; + $('remove-white').onclick = function() { + applyFilter(2, this.checked && new f.RemoveWhite({ + threshold: parseInt(($('remove-white-threshold')).value), + distance: parseInt(($('remove-white-distance')).value) + })); + }; + $('remove-white-threshold').onchange = function() { + applyFilterValue(2, 'threshold', this.value); + }; + $('remove-white-distance').onchange = function() { + applyFilterValue(2, 'distance', this.value); + }; + $('sepia').onclick = function() { + applyFilter(3, this.checked && new f.Sepia()); + }; + $('sepia2').onclick = function() { + applyFilter(4, this.checked && new f.Sepia2()); + }; + $('brightness').onclick = function() { + applyFilter(5, this.checked && new f.Brightness({ + brightness: parseInt(($('brightness-value')).value, 10) + })); + }; + $('brightness-value').onchange = function() { + applyFilterValue(5, 'brightness', parseInt(this.value, 10)); + }; + $('noise').onclick = function() { + applyFilter(6, this.checked && new f.Noise({ + noise: parseInt(($('noise-value')).value, 10) + })); + }; + $('noise-value').onchange = function() { + applyFilterValue(6, 'noise', parseInt(this.value, 10)); + }; + $('gradient-transparency').onclick = function() { + applyFilter(7, this.checked && new f.GradientTransparency({ + threshold: parseInt(($('gradient-transparency-value')).value, 10) + })); + }; + $('gradient-transparency-value').onchange = function() { + applyFilterValue(7, 'threshold', parseInt(this.value, 10)); + }; + $('pixelate').onclick = function() { + applyFilter(8, this.checked && new f.Pixelate({ + blocksize: parseInt(($('pixelate-value')).value, 10) + })); + }; + $('pixelate-value').onchange = function() { + applyFilterValue(8, 'blocksize', parseInt(this.value, 10)); + }; + $('blur').onclick = function() { + applyFilter(9, this.checked && new f.Convolute({ + matrix: [1 / 9, 1 / 9, 1 / 9, + 1 / 9, 1 / 9, 1 / 9, + 1 / 9, 1 / 9, 1 / 9] + })); + }; + $('sharpen').onclick = function() { + applyFilter(10, this.checked && new f.Convolute({ + matrix: [0, -1, 0, + -1, 5, -1, + 0, -1, 0] + })); + }; + $('emboss').onclick = function() { + applyFilter(11, this.checked && new f.Convolute({ + matrix: [1, 1, 1, + 1, 0.7, -1, + -1, -1, -1] + })); + }; } function sample4() { - var canvas = new fabric.Canvas('c'); - var $ = function (id) { return document.getElementById(id); }; + var canvas = new fabric.Canvas('c'); + var $ = function(id) { return document.getElementById(id); }; - var rect = new fabric.Rect({ - width: 100, - height: 100, - top: 150, - left: 150, - fill: 'rgba(255,0,0,0.5)' - }); + var rect = new fabric.Rect({ + width: 100, + height: 100, + top: 150, + left: 150, + fill: 'rgba(255,0,0,0.5)' + }); - canvas.add(rect); + canvas.add(rect); - var angleControl = $('angle-control'); - angleControl.onchange = function () { - rect.setAngle(this.value).setCoords(); - canvas.renderAll(); - }; + var angleControl = $('angle-control'); + angleControl.onchange = function() { + rect.setAngle(this.value).setCoords(); + canvas.renderAll(); + }; - var scaleControl = $('scale-control'); - scaleControl.onchange = function () { - rect.scale(this.value).setCoords(); - canvas.renderAll(); - }; + var scaleControl = $('scale-control'); + scaleControl.onchange = function() { + rect.scale(this.value).setCoords(); + canvas.renderAll(); + }; - var topControl = $('top-control'); - topControl.onchange = function () { - rect.setTop(this.value).setCoords(); - canvas.renderAll(); - }; + var topControl = $('top-control'); + topControl.onchange = function() { + rect.setTop(this.value).setCoords(); + canvas.renderAll(); + }; - var leftControl = $('left-control'); - leftControl.onchange = function () { - rect.setLeft(this.value).setCoords(); - canvas.renderAll(); - }; + var leftControl = $('left-control'); + leftControl.onchange = function() { + rect.setLeft(this.value).setCoords(); + canvas.renderAll(); + }; - function updateControls() { + function updateControls() { - scaleControl.value = rect.getScaleX().toString(); - angleControl.value = rect.getAngle().toString(); - leftControl.value = rect.getLeft().toString(); - topControl.value = rect.getTop().toString(); - } - canvas.on({ - 'object:moving': updateControls, - 'object:scaling': updateControls, - 'object:resizing': updateControls - }); + scaleControl.value = rect.getScaleX().toString(); + angleControl.value = rect.getAngle().toString(); + leftControl.value = rect.getLeft().toString(); + topControl.value = rect.getTop().toString(); + } + canvas.on({ + 'object:moving': updateControls, + 'object:scaling': updateControls, + 'object:resizing': updateControls + }); } module fabric { - export interface CircleWithLineInfos extends ICircle { - line1?: ILine; - line2?: ILine; - line3?: ILine; - line4?: ILine; - } + export interface CircleWithLineInfos extends ICircle { + line1?: ILine; + line2?: ILine; + line3?: ILine; + line4?: ILine; + } } function sample5() { - var makeCircle = function (left: number, top: number, line1?: fabric.ILine, line2?: fabric.ILine, line3?: fabric.ILine, line4?: fabric.ILine): fabric.ICircle { - var c = new fabric.Circle({ - left: left, - top: top, - strokeWidth: 5, - radius: 12, - fill: '#fff', - stroke: '#666' - }); - - c.line1 = line1; - c.line2 = line2; - c.line3 = line3; - c.line4 = line4; - c.hasControls = c.hasBorders = false; - return c; - } - -function makeLine(coords: number[]) { - return new fabric.Line(coords, { - fill: 'red', - strokeWidth: 5, - selectable: false - }); - } - - var canvas = new fabric.Canvas('c', { selection: false }); - - var line = makeLine([250, 125, 250, 175]), - line2 = makeLine([250, 175, 250, 250]), - line3 = makeLine([250, 250, 300, 350]), - line4 = makeLine([250, 250, 200, 350]), - line5 = makeLine([250, 175, 175, 225]), - line6 = makeLine([250, 175, 325, 225]); - - canvas.add(line, line2, line3, line4, line5, line6); - - canvas.add( - makeCircle(line.x1, line.y1, null, line), - makeCircle(line.x2, line.y2, line, line2, line5, line6), - makeCircle(line2.x2, line2.y2, line2, line3, line4), - makeCircle(line3.x2, line3.y2, line3), - makeCircle(line4.x2, line4.y2, line4), - makeCircle(line5.x2, line5.y2, line5), - makeCircle(line6.x2, line6.y2, line6) - ); - - canvas.on('object:moving', function (e) { - var p = e.target; - p.line1 && p.line1.set({ 'x2': p.left, 'y2': p.top }); - p.line2 && p.line2.set({ 'x1': p.left, 'y1': p.top }); - p.line3 && p.line3.set({ 'x1': p.left, 'y1': p.top }); - p.line4 && p.line4.set({ 'x1': p.left, 'y1': p.top }); - canvas.renderAll(); + var makeCircle = function(left: number, top: number, line1?: fabric.ILine, line2?: fabric.ILine, line3?: fabric.ILine, line4?: fabric.ILine): fabric.ICircle { + var c = new fabric.Circle({ + left: left, + top: top, + strokeWidth: 5, + radius: 12, + fill: '#fff', + stroke: '#666' }); + + c.line1 = line1; + c.line2 = line2; + c.line3 = line3; + c.line4 = line4; + c.hasControls = c.hasBorders = false; + return c; + } + + function makeLine(coords: number[]) { + return new fabric.Line(coords, { + fill: 'red', + strokeWidth: 5, + selectable: false + }); + } + + var canvas = new fabric.Canvas('c', { selection: false }); + + var line = makeLine([250, 125, 250, 175]), + line2 = makeLine([250, 175, 250, 250]), + line3 = makeLine([250, 250, 300, 350]), + line4 = makeLine([250, 250, 200, 350]), + line5 = makeLine([250, 175, 175, 225]), + line6 = makeLine([250, 175, 325, 225]); + + canvas.add(line, line2, line3, line4, line5, line6); + + canvas.add( + makeCircle(line.x1, line.y1, null, line), + makeCircle(line.x2, line.y2, line, line2, line5, line6), + makeCircle(line2.x2, line2.y2, line2, line3, line4), + makeCircle(line3.x2, line3.y2, line3), + makeCircle(line4.x2, line4.y2, line4), + makeCircle(line5.x2, line5.y2, line5), + makeCircle(line6.x2, line6.y2, line6) + ); + + canvas.on('object:moving', function(e) { + var p = e.target; + p.line1 && p.line1.set({ 'x2': p.left, 'y2': p.top }); + p.line2 && p.line2.set({ 'x1': p.left, 'y1': p.top }); + p.line3 && p.line3.set({ 'x1': p.left, 'y1': p.top }); + p.line4 && p.line4.set({ 'x1': p.left, 'y1': p.top }); + canvas.renderAll(); + }); } function sample6() { - var canvas = new fabric.Canvas('c'); - fabric.loadSVGFromURL('../assets/135.svg', function (objects) { - var obj = objects[0].scale(0.25); - canvas.centerObject(obj); - canvas.add(obj); + var canvas = new fabric.Canvas('c'); + fabric.loadSVGFromURL('../assets/135.svg', function(objects) { + var obj = objects[0].scale(0.25); + canvas.centerObject(obj); + canvas.add(obj); - canvas.add(obj.clone().set({ left: 100, top: 100, angle: -15 })); - canvas.add(obj.clone().set({ left: 480, top: 100, angle: 15 })); - canvas.add(obj.clone().set({ left: 100, top: 400, angle: -15 })); - canvas.add(obj.clone().set({ left: 480, top: 400, angle: 15 })); + canvas.add(obj.clone(() => {}).set({ left: 100, top: 100, angle: -15 })); + canvas.add(obj.clone(() => {}).set({ left: 480, top: 100, angle: 15 })); + canvas.add(obj.clone(() => {}).set({ left: 100, top: 400, angle: -15 })); + canvas.add(obj.clone(() => {}).set({ left: 480, top: 400, angle: 15 })); - canvas.on('mouse:move', function (options) { - var p = canvas.getPointer(options.e); + canvas.on('mouse:move', function(options) { + var p = canvas.getPointer(options.e); - canvas.forEachObject(function (obj) { - var distX = Math.abs(p.x - obj.left), - distY = Math.abs(p.y - obj.top), - dist = Math.round(Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2))); - obj.setOpacity(1 / (dist / 20)); - }); - - }); + canvas.forEachObject(function(obj) { + var distX = Math.abs(p.x - obj.left), + distY = Math.abs(p.y - obj.top), + dist = Math.round(Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2))); + obj.setOpacity(1 / (dist / 20)); + }); }); + + }); } module fabric { - export interface ImageWithInfo extends IImage { - movingLeft: boolean; - } + export interface ImageWithInfo extends IImage { + movingLeft: boolean; + } } function sample7() { - var canvas = new fabric.Canvas('c', { selection: false }); + var canvas = new fabric.Canvas('c', { selection: false }); - setInterval(function () { - fabric.Image.fromURL('../assets/ladybug.png', function (obj) { - var img = obj; - img.set('left', fabric.util.getRandomInt(200, 600)).set('top', -50); - img.movingLeft = !!Math.round(Math.random()); - canvas.add(img); - }); - }, 1000); - - - var animate = (function animate() { - canvas.forEachObject(function (obj) { - var img = obj; - img.left += (img.movingLeft ? -1 : 1); - img.top += 1; - if (img.left > 900 || img.top > 500) { - canvas.remove(img); - } - else { - img.setAngle(img.getAngle() + 2); - } - }); - canvas.renderAll(); - window.requestAnimationFrame(animate); + setInterval(function() { + fabric.Image.fromURL('../assets/ladybug.png', function(obj) { + var img = obj; + img.set('left', fabric.util.getRandomInt(200, 600)).set('top', -50); + img.movingLeft = !!Math.round(Math.random()); + canvas.add(img); }); + }, 1000); - animate(); + + var animate = (function animate() { + canvas.forEachObject(function(obj) { + var img = obj; + img.left += (img.movingLeft ? -1 : 1); + img.top += 1; + if (img.left > 900 || img.top > 500) { + canvas.remove(img); + } + else { + img.setAngle(img.getAngle() + 2); + } + }); + canvas.renderAll(); + window.requestAnimationFrame(animate); + }); + + animate(); } function sample8() { - function pad(str: string, length: number): string { - while (str.length < length) { - str = '0' + str; - } - return str; - }; + function pad(str: string, length: number): string { + while (str.length < length) { + str = '0' + str; + } + return str; + }; - var getRandomInt = fabric.util.getRandomInt; + var getRandomInt = fabric.util.getRandomInt; - function getRandomColor() { - return ( - pad(getRandomInt(0, 255).toString(16), 2) + - pad(getRandomInt(0, 255).toString(16), 2) + - pad(getRandomInt(0, 255).toString(16), 2) - ); + function getRandomColor() { + return ( + pad(getRandomInt(0, 255).toString(16), 2) + + pad(getRandomInt(0, 255).toString(16), 2) + + pad(getRandomInt(0, 255).toString(16), 2) + ); + } + + function getRandomNum(min: number, max: number): number { + return Math.random() * (max - min) + min; + } + + if (/(iPhone|iPod|iPad)/i.test(navigator.userAgent)) { + fabric.Object.prototype.cornersize = 30; + } + + var canvas = new fabric.Canvas('canvas'); + // canvas.controlsAboveOverlay = true; + + function updateComplexity() { + setTimeout(function() { + var element = document.getElementById('complexity').childNodes[1]; + element.innerHTML = ' ' + canvas.complexity(); + }, 100); + } + + document.getElementById('commands').onclick = function(ev: any) { + var ev: any = ev || window.event; + + if (ev.preventDefault) { + ev.preventDefault() + } + else if (ev.returnValue) { + ev.returnValue = false; } - function getRandomNum(min: number, max: number): number { - return Math.random() * (max - min) + min; + var element: any = ev.target || ev.srcElement; + if (element.nodeName.toLowerCase() === 'strong') { + element = element.parentNode; } - if (/(iPhone|iPod|iPad)/i.test(navigator.userAgent)) { - fabric.Object.prototype.cornersize = 30; - } - - var canvas = new fabric.Canvas('canvas'); - // canvas.controlsAboveOverlay = true; - - function updateComplexity() { - setTimeout(function () { - var element = document.getElementById('complexity').childNodes[1]; - element.innerHTML = ' ' + canvas.complexity(); - }, 100); - } - - document.getElementById('commands').onclick = function (ev: any) { - var ev: any = ev || window.event; - - if (ev.preventDefault) { - ev.preventDefault() - } - else if (ev.returnValue) { - ev.returnValue = false; - } - - var element: any = ev.target || ev.srcElement; - if (element.nodeName.toLowerCase() === 'strong') { - element = element.parentNode; - } - - var className = element.className, - offset = 50, - left = fabric.util.getRandomInt(0 + offset, 700 - offset), - top = fabric.util.getRandomInt(0 + offset, 500 - offset), - angle = fabric.util.getRandomInt(-20, 40), - width = fabric.util.getRandomInt(30, 50), - opacity = (function (min, max) { return Math.random() * (max - min) + min; })(0.5, 1); + var className = element.className, + offset = 50, + left = fabric.util.getRandomInt(0 + offset, 700 - offset), + top = fabric.util.getRandomInt(0 + offset, 500 - offset), + angle = fabric.util.getRandomInt(-20, 40), + width = fabric.util.getRandomInt(30, 50), + opacity = (function(min, max) { return Math.random() * (max - min) + min; })(0.5, 1); - switch (className) { - case 'rect': - canvas.add(new fabric.Rect({ - left: left, - top: top, - fill: '#' + getRandomColor(), - width: 50, - height: 50, - opacity: 0.8 - })); - break; + switch (className) { + case 'rect': + canvas.add(new fabric.Rect({ + left: left, + top: top, + fill: '#' + getRandomColor(), + width: 50, + height: 50, + opacity: 0.8 + })); + break; - case 'circle': - canvas.add(new fabric.Circle({ - left: left, - top: top, - fill: '#' + getRandomColor(), - radius: 50, - opacity: 0.8 - })); - break; + case 'circle': + canvas.add(new fabric.Circle({ + left: left, + top: top, + fill: '#' + getRandomColor(), + radius: 50, + opacity: 0.8 + })); + break; - case 'triangle': - canvas.add(new fabric.Triangle({ - left: left, - top: top, - fill: '#' + getRandomColor(), - width: 50, - height: 50, - opacity: 0.8 - })); - break; + case 'triangle': + canvas.add(new fabric.Triangle({ + left: left, + top: top, + fill: '#' + getRandomColor(), + width: 50, + height: 50, + opacity: 0.8 + })); + break; - case 'image1': - fabric.Image.fromURL('../assets/pug.jpg', function (image) { - image.set({ - left: left, - top: top, - angle: angle, - padding: 10, - cornersize: 10 - }); - image.scale(getRandomNum(0.1, 0.25)).setCoords(); - canvas.add(image); - }); - break; + case 'image1': + fabric.Image.fromURL('../assets/pug.jpg', function(image) { + image.set({ + left: left, + top: top, + angle: angle, + padding: 10, + cornersize: 10 + }); + image.scale(getRandomNum(0.1, 0.25)).setCoords(); + canvas.add(image); + }); + break; - case 'image2': - fabric.Image.fromURL('../assets/logo.png', function (image) { - image.set({ - left: left, - top: top, - angle: angle, - padding: 10, - cornersize: 10 - }); - image.scale(getRandomNum(0.1, 1)).setCoords(); - canvas.add(image); - updateComplexity(); - }); - break; + case 'image2': + fabric.Image.fromURL('../assets/logo.png', function(image) { + image.set({ + left: left, + top: top, + angle: angle, + padding: 10, + cornersize: 10 + }); + image.scale(getRandomNum(0.1, 1)).setCoords(); + canvas.add(image); + updateComplexity(); + }); + break; - case 'shape': - var id = element.id, match; - if (match = /\d+$/.exec(id)) { - fabric.loadSVGFromURL('../assets/' + match[0] + '.svg', function (objects, options) { - var loadedObject = fabric.util.groupSVGElements(objects, options); + case 'shape': + var id = element.id, match; + if (match = /\d+$/.exec(id)) { + fabric.loadSVGFromURL('../assets/' + match[0] + '.svg', function(objects, options) { + var loadedObject = fabric.util.groupSVGElements(objects, options); - loadedObject.set({ - left: left, - top: top, - angle: angle, - padding: 10, - cornersize: 10 - }); - loadedObject/*.scaleToWidth(300)*/.setCoords(); - - // loadedObject.hasRotatingPoint = true; - - canvas.add(loadedObject); - updateComplexity(); - canvas.calcOffset(); - }); - } - break; - - case 'clear': - if (confirm('Are you sure?')) { - canvas.clear(); - } - } - updateComplexity(); - }; - - document.getElementById('execute').onclick = function () { - var code = (document.getElementById('canvas-console')).value; - if (!(/^\s+$/).test(code)) { - eval(code); - } - }; - - - document.getElementById('rasterize').onclick = function () { - if (!fabric.Canvas.supports('toDataURL')) { - alert('This browser doesn\'t provide means to serialize canvas to an image'); - } - else { - window.open(canvas.toDataURL('png')); - } - }; - - var removeSelectedEl = document.getElementById('remove-selected'); - removeSelectedEl.onclick = function () { - var activeObject = canvas.getActiveObject(), - activeGroup = canvas.getActiveGroup(); - if (activeObject) { - canvas.remove(activeObject); - } - else if (activeGroup) { - var objectsInGroup = activeGroup.getObjects(); - canvas.discardActiveGroup(); - objectsInGroup.forEach(function (object) { - canvas.remove(object); + loadedObject.set({ + left: left, + top: top, + angle: angle, + padding: 10, + cornersize: 10 }); - } - }; + loadedObject/*.scaleToWidth(300)*/.setCoords(); - var supportsInputOfType = function (type) { - return function () { - var el = document.createElement('input'); - try { - el.type = type; - } - catch (err) { } - return el.type === type; - }; - }; - - var supportsSlider = supportsInputOfType('range'), - supportsColorpicker = supportsInputOfType('color'); - - if (supportsSlider()) { - (function () { - var controls = document.getElementById('controls'); - - var sliderLabel = document.createElement('label'); - sliderLabel.htmlFor = 'opacity'; - sliderLabel.innerHTML = 'Opacity: '; - - var slider = document.createElement('input'); - - try { slider.type = 'range'; } catch (err) { } - - slider.id = 'opacity'; - slider.value = "100"; - - controls.appendChild(sliderLabel); - controls.appendChild(slider); + // loadedObject.hasRotatingPoint = true; + canvas.add(loadedObject); + updateComplexity(); canvas.calcOffset(); + }); + } + break; - slider.onchange = function () { - var activeObject = canvas.getActiveObject(), - activeGroup = canvas.getActiveGroup(); - - if (activeObject || activeGroup) { - (activeObject || activeGroup).setOpacity(parseInt(this.value, 10) / 100); - canvas.renderAll(); - } - }; - })(); + case 'clear': + if (confirm('Are you sure?')) { + canvas.clear(); + } } + updateComplexity(); + }; - if (supportsColorpicker()) { - (function () { - var controls = document.getElementById('controls'); - - var label = document.createElement('label'); - label.htmlFor = 'color'; - label.innerHTML = 'Color: '; - label.style.marginLeft = '10px'; - - var colorpicker = document.createElement('input'); - colorpicker.type = 'color'; - colorpicker.id = 'color'; - colorpicker.style.width = '40px'; - - controls.appendChild(label); - controls.appendChild(colorpicker); - - canvas.calcOffset(); - - colorpicker.onchange = function () { - var activeObject = canvas.getActiveObject(), - activeGroup = canvas.getActiveGroup(); - - if (activeObject || activeGroup) { - (activeObject || activeGroup).setFill(this.value); - canvas.renderAll(); - } - }; - })(); + document.getElementById('execute').onclick = function() { + var code = (document.getElementById('canvas-console')).value; + if (!(/^\s+$/).test(code)) { + eval(code); } + }; - var lockHorizontallyEl = document.getElementById('lock-horizontally'); - lockHorizontallyEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockMovementX = !activeObject.lockMovementX; - lockHorizontallyEl.innerHTML = activeObject.lockMovementX - ? 'Unlock horizontal movement' - : 'Lock horizontal movement'; - } - }; - var lockVerticallyEl = document.getElementById('lock-vertically'); - lockVerticallyEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockMovementY = !activeObject.lockMovementY; - lockVerticallyEl.innerHTML = activeObject.lockMovementY - ? 'Unlock vertical movement' - : 'Lock vertical movement'; - } - }; - - var lockScalingXEl = document.getElementById('lock-scaling-x'); - lockScalingXEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockScalingX = !activeObject.lockScalingX; - lockScalingXEl.innerHTML = activeObject.lockScalingX - ? 'Unlock horizontal scaling' - : 'Lock horizontal scaling'; - } - }; - - var lockScalingYEl = document.getElementById('lock-scaling-y'); - lockScalingYEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockScalingY = !activeObject.lockScalingY; - lockScalingYEl.innerHTML = activeObject.lockScalingY - ? 'Unlock vertical scaling' - : 'Lock vertical scaling'; - } - }; - - var lockRotationEl = document.getElementById('lock-rotation'); - lockRotationEl.onclick = function () { - var activeObject: any = canvas.getActiveObject(); - if (activeObject) { - activeObject.lockRotation = !activeObject.lockRotation; - lockRotationEl.innerHTML = activeObject.lockRotation - ? 'Unlock rotation' - : 'Lock rotation'; - } - }; - - var gradientifyBtn = document.getElementById('gradientify'); - - var activeObjectButtons = [ - lockHorizontallyEl, - lockVerticallyEl, - lockScalingXEl, - lockScalingYEl, - lockRotationEl, - removeSelectedEl, - gradientifyBtn - ]; - - var opacityEl = document.getElementById('opacity'); - if (opacityEl) { - activeObjectButtons.push(opacityEl); + document.getElementById('rasterize').onclick = function() { + if (!fabric.Canvas.supports('toDataURL')) { + alert('This browser doesn\'t provide means to serialize canvas to an image'); } - var colorEl = document.getElementById('color'); - if (colorEl) { - activeObjectButtons.push(colorEl); + else { + window.open(canvas.toDataURL('png')); } + }; + + var removeSelectedEl = document.getElementById('remove-selected'); + removeSelectedEl.onclick = function() { + var activeObject = canvas.getActiveObject(), + activeGroup = canvas.getActiveGroup(); + if (activeObject) { + canvas.remove(activeObject); + } + else if (activeGroup) { + var objectsInGroup = activeGroup.getObjects(); + canvas.discardActiveGroup(); + objectsInGroup.forEach(function(object) { + canvas.remove(object); + }); + } + }; + + var supportsInputOfType = function(type) { + return function() { + var el = document.createElement('input'); + try { + el.type = type; + } + catch (err) { } + return el.type === type; + }; + }; + + var supportsSlider = supportsInputOfType('range'), + supportsColorpicker = supportsInputOfType('color'); + + if (supportsSlider()) { + (function() { + var controls = document.getElementById('controls'); + + var sliderLabel = document.createElement('label'); + sliderLabel.htmlFor = 'opacity'; + sliderLabel.innerHTML = 'Opacity: '; + + var slider = document.createElement('input'); + + try { slider.type = 'range'; } catch (err) { } + + slider.id = 'opacity'; + slider.value = "100"; + + controls.appendChild(sliderLabel); + controls.appendChild(slider); + + canvas.calcOffset(); + + slider.onchange = function() { + var activeObject = canvas.getActiveObject(), + activeGroup = canvas.getActiveGroup(); + + if (activeObject || activeGroup) { + (activeObject || activeGroup).setOpacity(parseInt(this.value, 10) / 100); + canvas.renderAll(); + } + }; + })(); + } + + if (supportsColorpicker()) { + (function() { + var controls = document.getElementById('controls'); + + var label = document.createElement('label'); + label.htmlFor = 'color'; + label.innerHTML = 'Color: '; + label.style.marginLeft = '10px'; + + var colorpicker = document.createElement('input'); + colorpicker.type = 'color'; + colorpicker.id = 'color'; + colorpicker.style.width = '40px'; + + controls.appendChild(label); + controls.appendChild(colorpicker); + + canvas.calcOffset(); + + colorpicker.onchange = function() { + var activeObject = canvas.getActiveObject(), + activeGroup = canvas.getActiveGroup(); + + if (activeObject || activeGroup) { + (activeObject || activeGroup).setFill(this.value); + canvas.renderAll(); + } + }; + })(); + } + + var lockHorizontallyEl = document.getElementById('lock-horizontally'); + lockHorizontallyEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockMovementX = !activeObject.lockMovementX; + lockHorizontallyEl.innerHTML = activeObject.lockMovementX + ? 'Unlock horizontal movement' + : 'Lock horizontal movement'; + } + }; + + var lockVerticallyEl = document.getElementById('lock-vertically'); + lockVerticallyEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockMovementY = !activeObject.lockMovementY; + lockVerticallyEl.innerHTML = activeObject.lockMovementY + ? 'Unlock vertical movement' + : 'Lock vertical movement'; + } + }; + + var lockScalingXEl = document.getElementById('lock-scaling-x'); + lockScalingXEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockScalingX = !activeObject.lockScalingX; + lockScalingXEl.innerHTML = activeObject.lockScalingX + ? 'Unlock horizontal scaling' + : 'Lock horizontal scaling'; + } + }; + + var lockScalingYEl = document.getElementById('lock-scaling-y'); + lockScalingYEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockScalingY = !activeObject.lockScalingY; + lockScalingYEl.innerHTML = activeObject.lockScalingY + ? 'Unlock vertical scaling' + : 'Lock vertical scaling'; + } + }; + + var lockRotationEl = document.getElementById('lock-rotation'); + lockRotationEl.onclick = function() { + var activeObject: any = canvas.getActiveObject(); + if (activeObject) { + activeObject.lockRotation = !activeObject.lockRotation; + lockRotationEl.innerHTML = activeObject.lockRotation + ? 'Unlock rotation' + : 'Lock rotation'; + } + }; + + var gradientifyBtn = document.getElementById('gradientify'); + + var activeObjectButtons = [ + lockHorizontallyEl, + lockVerticallyEl, + lockScalingXEl, + lockScalingYEl, + lockRotationEl, + removeSelectedEl, + gradientifyBtn + ]; + + var opacityEl = document.getElementById('opacity'); + if (opacityEl) { + activeObjectButtons.push(opacityEl); + } + var colorEl = document.getElementById('color'); + if (colorEl) { + activeObjectButtons.push(colorEl); + } + + for (var i = activeObjectButtons.length; i--;) { + activeObjectButtons[i].disabled = true; + } + + canvas.on('object:selected', onObjectSelected); + canvas.on('group:selected', onObjectSelected); + + function onObjectSelected(e) { + var selectedObject = e.target; for (var i = activeObjectButtons.length; i--;) { - activeObjectButtons[i].disabled = true; + activeObjectButtons[i].disabled = false; } - canvas.on('object:selected', onObjectSelected); - canvas.on('group:selected', onObjectSelected); + lockHorizontallyEl.innerHTML = (selectedObject.lockMovementX ? 'Unlock horizontal movement' : 'Lock horizontal movement'); + lockVerticallyEl.innerHTML = (selectedObject.lockMovementY ? 'Unlock vertical movement' : 'Lock vertical movement'); + lockScalingXEl.innerHTML = (selectedObject.lockScalingX ? 'Unlock horizontal scaling' : 'Lock horizontal scaling'); + lockScalingYEl.innerHTML = (selectedObject.lockScalingY ? 'Unlock vertical scaling' : 'Lock vertical scaling'); + lockRotationEl.innerHTML = (selectedObject.lockRotation ? 'Unlock rotation' : 'Lock rotation'); + } - function onObjectSelected(e) { - var selectedObject = e.target; - - for (var i = activeObjectButtons.length; i--;) { - activeObjectButtons[i].disabled = false; - } - - lockHorizontallyEl.innerHTML = (selectedObject.lockMovementX ? 'Unlock horizontal movement' : 'Lock horizontal movement'); - lockVerticallyEl.innerHTML = (selectedObject.lockMovementY ? 'Unlock vertical movement' : 'Lock vertical movement'); - lockScalingXEl.innerHTML = (selectedObject.lockScalingX ? 'Unlock horizontal scaling' : 'Lock horizontal scaling'); - lockScalingYEl.innerHTML = (selectedObject.lockScalingY ? 'Unlock vertical scaling' : 'Lock vertical scaling'); - lockRotationEl.innerHTML = (selectedObject.lockRotation ? 'Unlock rotation' : 'Lock rotation'); + canvas.on('selection:cleared', function(e) { + for (var i = activeObjectButtons.length; i--;) { + activeObjectButtons[i].disabled = true; } + }); - canvas.on('selection:cleared', function (e) { - for (var i = activeObjectButtons.length; i--;) { - activeObjectButtons[i].disabled = true; - } + var drawingModeEl = document.getElementById('drawing-mode'), + drawingOptionsEl = document.getElementById('drawing-mode-options'), + drawingColorEl = document.getElementById('drawing-color'), + drawingLineWidthEl = document.getElementById('drawing-line-width'); + + drawingModeEl.onclick = function() { + var canvasWithDrawingMode: any = canvas; + canvasWithDrawingMode.isDrawingMode = !canvasWithDrawingMode.isDrawingMode; + if (canvasWithDrawingMode.isDrawingMode) { + drawingModeEl.innerHTML = 'Cancel drawing mode'; + drawingModeEl.className = 'is-drawing'; + drawingOptionsEl.style.display = ''; + } + else { + drawingModeEl.innerHTML = 'Enter drawing mode'; + drawingModeEl.className = ''; + drawingOptionsEl.style.display = 'none'; + } + }; + + canvas.on('path:created', function() { + updateComplexity(); + }); + + drawingColorEl.onchange = function() { + canvas.freeDrawingColor = drawingColorEl.value; + }; + drawingLineWidthEl.onchange = function() { + canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; // disallow 0, NaN, etc. + }; + + canvas.freeDrawingColor = drawingColorEl.value; + canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; + + + var text = 'Lorem ipsum dolor sit amet,\nconsectetur adipisicing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore magna aliqua.\n' + + 'Ut enim ad minim veniam,\nquis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.'; + + document.getElementById('add-text').onclick = function() { + var textSample = new fabric.Text(text.slice(0, getRandomInt(0, text.length)), { + left: getRandomInt(350, 400), + top: getRandomInt(350, 400), + fontFamily: 'helvetica', + angle: getRandomInt(-10, 10), + fill: '#' + getRandomColor(), + scaleX: 0.5, + scaleY: 0.5, + fontWeight: '' }); + canvas.add(textSample); + updateComplexity(); + }; - var drawingModeEl = document.getElementById('drawing-mode'), - drawingOptionsEl = document.getElementById('drawing-mode-options'), - drawingColorEl = document.getElementById('drawing-color'), - drawingLineWidthEl = document.getElementById('drawing-line-width'); - drawingModeEl.onclick = function () { - var canvasWithDrawingMode: any = canvas; - canvasWithDrawingMode.isDrawingMode = !canvasWithDrawingMode.isDrawingMode; - if (canvasWithDrawingMode.isDrawingMode) { - drawingModeEl.innerHTML = 'Cancel drawing mode'; - drawingModeEl.className = 'is-drawing'; - drawingOptionsEl.style.display = ''; + document.onkeydown = function(e) { + var obj = canvas.getActiveObject() || canvas.getActiveGroup(); + if (obj && e.keyCode === 8) { + // this is horrible. need to fix, so that unified interface can be used + if (obj.type === 'group') { + // var groupObjects = obj.getObjects(); + // canvas.discardActiveGroup(); + // groupObjects.forEach(function(obj) { + // canvas.remove(obj); + // }); + } + else { + //canvas.remove(obj); + } + canvas.renderAll(); + // return false; + } + }; + + setTimeout(function() { + canvas.calcOffset(); + }, 100); + + if (document.location.search.indexOf('guidelines') > -1) { + //initCenteringGuidelines(canvas); + //initAligningGuidelines(canvas); + } + + gradientifyBtn.onclick = function() { + var obj = canvas.getActiveObject(); + if (obj) { + obj.setGradient("fill", { + x2: (getRandomInt(0, 1) ? 0 : obj.width), + y2: (getRandomInt(0, 1) ? 0 : obj.height), + colorStops: { + 0: '#' + getRandomColor(), + 1: '#' + getRandomColor() + } + }); + canvas.renderAll(); + } + }; + + var textEl = document.getElementById('text'); + if (textEl) { + textEl.onfocus = function() { + var activeObject = canvas.getActiveObject(); + + if (activeObject && activeObject.type === 'text') { + this.value = (activeObject).text; + } + }; + textEl.onkeyup = function(e) { + var activeObject = canvas.getActiveObject(); + if (activeObject) { + if (!this.value) { + canvas.discardActiveObject(); } else { - drawingModeEl.innerHTML = 'Enter drawing mode'; - drawingModeEl.className = ''; - drawingOptionsEl.style.display = 'none'; + (activeObject).text = this.value; } + canvas.renderAll(); + } }; + } - canvas.on('path:created', function () { - updateComplexity(); + var cmdUnderlineBtn = document.getElementById('text-cmd-underline'); + if (cmdUnderlineBtn) { + activeObjectButtons.push(cmdUnderlineBtn); + cmdUnderlineBtn.disabled = true; + cmdUnderlineBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textDecoration = (activeObject.textDecoration == 'underline' ? '' : 'underline'); + this.className = activeObject.textDecoration ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdLinethroughBtn = document.getElementById('text-cmd-linethrough'); + if (cmdLinethroughBtn) { + activeObjectButtons.push(cmdLinethroughBtn); + cmdLinethroughBtn.disabled = true; + cmdLinethroughBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textDecoration = (activeObject.textDecoration == 'line-through' ? '' : 'line-through'); + this.className = activeObject.textDecoration ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdOverlineBtn = document.getElementById('text-cmd-overline'); + if (cmdOverlineBtn) { + activeObjectButtons.push(cmdOverlineBtn); + cmdOverlineBtn.disabled = true; + cmdOverlineBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textDecoration = (activeObject.textDecoration == 'overline' ? '' : 'overline'); + this.className = activeObject.textDecoration ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdBoldBtn = document.getElementById('text-cmd-bold'); + if (cmdBoldBtn) { + activeObjectButtons.push(cmdBoldBtn); + cmdBoldBtn.disabled = true; + cmdBoldBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.fontWeight = (activeObject.fontWeight == 'bold' ? '' : 'bold'); + this.className = activeObject.fontWeight ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdItalicBtn = document.getElementById('text-cmd-italic'); + if (cmdItalicBtn) { + activeObjectButtons.push(cmdItalicBtn); + cmdItalicBtn.disabled = true; + cmdItalicBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.fontStyle = (activeObject.fontStyle == 'italic' ? '' : 'italic'); + this.className = activeObject.fontStyle ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var cmdShadowBtn = document.getElementById('text-cmd-shadow'); + if (cmdShadowBtn) { + activeObjectButtons.push(cmdShadowBtn); + cmdShadowBtn.disabled = true; + cmdShadowBtn.onclick = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.shadow = !activeObject.shadow ? 'rgba(0,0,0,0.2) 2px 2px 10px' : ''; + this.className = activeObject.shadow ? 'selected' : ''; + canvas.renderAll(); + } + }; + } + + var textAlignSwitch = document.getElementById('text-align'); + if (textAlignSwitch) { + activeObjectButtons.push(textAlignSwitch); + textAlignSwitch.disabled = true; + textAlignSwitch.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.textAlign = this.value.toLowerCase(); + canvas.renderAll(); + } + }; + } + + var fontFamilySwitch = document.getElementById('font-family'); + if (fontFamilySwitch) { + activeObjectButtons.push(fontFamilySwitch); + fontFamilySwitch.disabled = true; + fontFamilySwitch.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.fontFamily = this.value; + canvas.renderAll(); + } + }; + } + + var bgColorField = document.getElementById('text-bg-color'); + if (bgColorField) { + bgColorField.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.backgroundColor = this.value; + canvas.renderAll(); + } + }; + } + + var strokeColorField = document.getElementById('text-stroke-color'); + if (strokeColorField) { + strokeColorField.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.stroke = this.value; + canvas.renderAll(); + } + }; + } + + if (supportsSlider) { + (function() { + var container = document.getElementById('text-controls'); + var slider = document.createElement('input'); + var label = document.createElement('label'); + label.innerHTML = 'Line height: '; + try { slider.type = 'range'; } catch (err) { } + slider.min = "0"; + slider.max = "10"; + slider.step = "0.1"; + slider.value = "1.5"; + container.appendChild(label); + label.appendChild(slider); + slider.title = "Line height"; + slider.onchange = function() { + var activeObject = canvas.getActiveObject(); + if (activeObject && activeObject.type === 'text') { + activeObject.lineHeight = this.value; + canvas.renderAll(); + } + }; + + canvas.on('object:selected', function(e: fabric.IEvent) { + slider.value = String((e.target).lineHeight ); + }); + })(); + } + + document.getElementById('load-svg').onclick = function() { + var svg = (document.getElementById('svg-console')).value; + fabric.loadSVGFromString(svg, function(objects, options) { + var obj = fabric.util.groupSVGElements(objects, options); + canvas.add(obj).centerObject(obj).renderAll(); + obj.setCoords(); }); - - drawingColorEl.onchange = function () { - canvas.freeDrawingColor = drawingColorEl.value; - }; - drawingLineWidthEl.onchange = function () { - canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; // disallow 0, NaN, etc. - }; - - canvas.freeDrawingColor = drawingColorEl.value; - canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; - - - var text = 'Lorem ipsum dolor sit amet,\nconsectetur adipisicing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore magna aliqua.\n' + - 'Ut enim ad minim veniam,\nquis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.'; - - document.getElementById('add-text').onclick = function () { - var textSample = new fabric.Text(text.slice(0, getRandomInt(0, text.length)), { - left: getRandomInt(350, 400), - top: getRandomInt(350, 400), - fontFamily: 'helvetica', - angle: getRandomInt(-10, 10), - fill: '#' + getRandomColor(), - scaleX: 0.5, - scaleY: 0.5, - fontWeight: '' - }); - canvas.add(textSample); - updateComplexity(); - }; - - - document.onkeydown = function (e) { - var obj = canvas.getActiveObject() || canvas.getActiveGroup(); - if (obj && e.keyCode === 8) { - // this is horrible. need to fix, so that unified interface can be used - if (obj.type === 'group') { - // var groupObjects = obj.getObjects(); - // canvas.discardActiveGroup(); - // groupObjects.forEach(function(obj) { - // canvas.remove(obj); - // }); - } - else { - //canvas.remove(obj); - } - canvas.renderAll(); - // return false; - } - }; - - setTimeout(function () { - canvas.calcOffset(); - }, 100); - - if (document.location.search.indexOf('guidelines') > -1) { - //initCenteringGuidelines(canvas); - //initAligningGuidelines(canvas); - } - - gradientifyBtn.onclick = function () { - var obj = canvas.getActiveObject(); - if (obj) { - obj.setGradientFill({ - x2: (getRandomInt(0, 1) ? 0 : obj.width), - y2: (getRandomInt(0, 1) ? 0 : obj.height), - colorStops: { - 0: '#' + getRandomColor(), - 1: '#' + getRandomColor() - } - }); - canvas.renderAll(); - } - }; - - var textEl = document.getElementById('text'); - if (textEl) { - textEl.onfocus = function () { - var activeObject = canvas.getActiveObject(); - - if (activeObject && activeObject.type === 'text') { - this.value = (activeObject).text; - } - }; - textEl.onkeyup = function (e) { - var activeObject = canvas.getActiveObject(); - if (activeObject) { - if (!this.value) { - canvas.discardActiveObject(); - } - else { - (activeObject).text = this.value; - } - canvas.renderAll(); - } - }; - } - - var cmdUnderlineBtn = document.getElementById('text-cmd-underline'); - if (cmdUnderlineBtn) { - activeObjectButtons.push(cmdUnderlineBtn); - cmdUnderlineBtn.disabled = true; - cmdUnderlineBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textDecoration = (activeObject.textDecoration == 'underline' ? '' : 'underline'); - this.className = activeObject.textDecoration ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdLinethroughBtn = document.getElementById('text-cmd-linethrough'); - if (cmdLinethroughBtn) { - activeObjectButtons.push(cmdLinethroughBtn); - cmdLinethroughBtn.disabled = true; - cmdLinethroughBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textDecoration = (activeObject.textDecoration == 'line-through' ? '' : 'line-through'); - this.className = activeObject.textDecoration ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdOverlineBtn = document.getElementById('text-cmd-overline'); - if (cmdOverlineBtn) { - activeObjectButtons.push(cmdOverlineBtn); - cmdOverlineBtn.disabled = true; - cmdOverlineBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textDecoration = (activeObject.textDecoration == 'overline' ? '' : 'overline'); - this.className = activeObject.textDecoration ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdBoldBtn = document.getElementById('text-cmd-bold'); - if (cmdBoldBtn) { - activeObjectButtons.push(cmdBoldBtn); - cmdBoldBtn.disabled = true; - cmdBoldBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.fontWeight = (activeObject.fontWeight == 'bold' ? '' : 'bold'); - this.className = activeObject.fontWeight ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdItalicBtn = document.getElementById('text-cmd-italic'); - if (cmdItalicBtn) { - activeObjectButtons.push(cmdItalicBtn); - cmdItalicBtn.disabled = true; - cmdItalicBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.fontStyle = (activeObject.fontStyle == 'italic' ? '' : 'italic'); - this.className = activeObject.fontStyle ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var cmdShadowBtn = document.getElementById('text-cmd-shadow'); - if (cmdShadowBtn) { - activeObjectButtons.push(cmdShadowBtn); - cmdShadowBtn.disabled = true; - cmdShadowBtn.onclick = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textShadow = !activeObject.textShadow ? 'rgba(0,0,0,0.2) 2px 2px 10px' : ''; - this.className = activeObject.textShadow ? 'selected' : ''; - canvas.renderAll(); - } - }; - } - - var textAlignSwitch = document.getElementById('text-align'); - if (textAlignSwitch) { - activeObjectButtons.push(textAlignSwitch); - textAlignSwitch.disabled = true; - textAlignSwitch.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.textAlign = this.value.toLowerCase(); - canvas.renderAll(); - } - }; - } - - var fontFamilySwitch = document.getElementById('font-family'); - if (fontFamilySwitch) { - activeObjectButtons.push(fontFamilySwitch); - fontFamilySwitch.disabled = true; - fontFamilySwitch.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.fontFamily = this.value; - canvas.renderAll(); - } - }; - } - - var bgColorField = document.getElementById('text-bg-color'); - if (bgColorField) { - bgColorField.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.backgroundColor = this.value; - canvas.renderAll(); - } - }; - } - - var strokeColorField = document.getElementById('text-stroke-color'); - if (strokeColorField) { - strokeColorField.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.strokeStyle = this.value; - canvas.renderAll(); - } - }; - } - - if (supportsSlider) { - (function () { - var container = document.getElementById('text-controls'); - var slider = document.createElement('input'); - var label = document.createElement('label'); - label.innerHTML = 'Line height: '; - try { slider.type = 'range'; } catch (err) { } - slider.min = "0"; - slider.max = "10"; - slider.step = "0.1"; - slider.value = "1.5"; - container.appendChild(label); - label.appendChild(slider); - slider.title = "Line height"; - slider.onchange = function () { - var activeObject = canvas.getActiveObject(); - if (activeObject && activeObject.type === 'text') { - activeObject.lineHeight = this.value; - canvas.renderAll(); - } - }; - - canvas.on('object:selected', function (e) { - slider.value = e.target.lineHeight; - }); - })(); - } - - document.getElementById('load-svg').onclick = function () { - var svg = (document.getElementById('svg-console')).value; - fabric.loadSVGFromString(svg, function (objects, options) { - var obj = fabric.util.groupSVGElements(objects, options); - canvas.add(obj).centerObject(obj).renderAll(); - obj.setCoords(); - }); - }; + }; } function sample9() { - var canvas = new fabric.Canvas('c'); - canvas.setBackgroundImage('yolo.jpg', () => {"a"}, {opacity: 45}); - canvas.setBackgroundImage('yolo.jpg', () => {"a"}); + var canvas = new fabric.Canvas('c'); + canvas.setBackgroundImage('yolo.jpg',() => { "a" }, { opacity: 45 }); + canvas.setBackgroundImage('yolo.jpg',() => { "a" }); } diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index 048c915df..503b8c7db 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -1,8 +1,12 @@ // Type definitions for FabricJS v1.5.0 // Project: http://fabricjs.com/ -// Definitions by: Oliver Klemencic , edited by Joseph Livecchi +// Definitions by: Oliver Klemencic , Joseph Livecchi // Definitions: https://github.com/borisyankov/DefinitelyTyped +/* tslint:disable:no-unused-variable */ +/* tslint:disable:whitespace */ +/* tslint:disable:typedef */ + // Support AMD require declare module "fabric" { export = fabric; @@ -32,61 +36,62 @@ declare module fabric { */ function createSVGFontFacesMarkup(objects: IObject[]): string; /** - * Takes string corresponding to an SVG document, and parses it into a set of fabric objects - * @param {String} string - * @param {Function} callback - * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. - */ - function loadSVGFromString(string: string, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + * Takes string corresponding to an SVG document, and parses it into a set of fabric objects + * @param {String} string + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function loadSVGFromString(string: string, callback: (results: IObject[], options: any) => void, reviver?: Function); /** - * Takes url corresponding to an SVG document, and parses it into a set of fabric objects. Note that SVG is fetched via XMLHttpRequest, so it needs to conform to SOP (Same Origin Policy) - * @param {String} url - * @param {Function} callback - * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. - */ - function loadSVGFromURL(url, callback: (results: IObject[], options) => void, reviver?: (el, obj) => void); + * Takes url corresponding to an SVG document, and parses it into a set of fabric objects. + * Note that SVG is fetched via XMLHttpRequest, so it needs to conform to SOP (Same Origin Policy) + * @param {String} url + * @param {Function} callback + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ + function loadSVGFromURL(url: string, callback: (results: IObject[], options: any) => void, reviver?: Function); /** - * Returns CSS rules for a given SVG document - * @param {SVGDocument} doc SVG document to parse - */ + * Returns CSS rules for a given SVG document + * @param {SVGDocument} doc SVG document to parse + */ function getCSSRules(doc: SVGElement): any; - function parseElements(elements: any[], callback, options, reviver); + function parseElements(elements: any[], callback: Function, options: any, reviver?: Function); /** - * Parses "points" attribute, returning an array of values - * @param {String} points points attribute string - */ + * Parses "points" attribute, returning an array of values + * @param {String} points points attribute string + */ function parsePointsAttribute(points: string): any[]; /** - * Parses "style" attribute, retuning an object with values - * @param {SVGElement} element Element to parse - */ + * Parses "style" attribute, retuning an object with values + * @param {SVGElement} element Element to parse + */ function parseStyleAttribute(element: SVGElement): any; /** - * Transforms an array of svg elements to corresponding fabric.* instances - * @param {Array} elements Array of elements to parse - * @param {Function} callback Being passed an array of fabric instances (transformed from SVG elements) - * @param {Object} [options] Options object - * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. - */ + * Transforms an array of svg elements to corresponding fabric.* instances + * @param {Array} elements Array of elements to parse + * @param {Function} callback Being passed an array of fabric instances (transformed from SVG elements) + * @param {Object} [options] Options object + * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. + */ function parseElements(elements: any[], callback: Function, options?: any, reviver?: Function): void; /** - * Returns an object of attributes' name/value, given element and an array of attribute names; - * Parses parent "g" nodes recursively upwards. - * @param {DOMElement} element Element to parse - * @param {Array} attributes Array of attributes to parse - */ + * Returns an object of attributes' name/value, given element and an array of attribute names; + * Parses parent "g" nodes recursively upwards. + * @param {DOMElement} element Element to parse + * @param {Array} attributes Array of attributes to parse + */ function parseAttributes(elemen: HTMLElement, attributes: string[], svgUid?: string): { [key: string]: string } /** - * Parses an SVG document, returning all of the gradient declarations found in it - * @param {SVGDocument} doc SVG document to parse - */ + * Parses an SVG document, returning all of the gradient declarations found in it + * @param {SVGDocument} doc SVG document to parse + */ function getGradientDefs(doc: SVGElement): { [key: string]: any }; /** - * Parses a short font declaration, building adding its properties to a style object - * @param {String} value font declaration - * @param {Object} oStyle definition - */ + * Parses a short font declaration, building adding its properties to a style object + * @param {String} value font declaration + * @param {Object} oStyle definition + */ function parseFontDeclaration(value: string, oStyle: any): void; /** * Parses an SVG document, converts it to an array of corresponding fabric.* instances and passes them to a callback @@ -94,7 +99,7 @@ declare module fabric { * @param {Function} callback Callback to call when parsing is finished; It's being passed an array of elements (parsed from a document). * @param {Function} [reviver] Method for further parsing of SVG elements, called after each fabric object created. */ - function parseSVGDocument(doc: SVGElement, callback: (results, options) => void, reviver?: (el, obj) => void); + function parseSVGDocument(doc: SVGElement, callback: (results: IObject[], options: any) => void, reviver?: Function); /** * Parses "transform" attribute, returning an array of values * @param {String} attributeValue String containing attribute value @@ -104,14 +109,13 @@ declare module fabric { // fabric Log // --------------- /** - * Wrapper around `console.log` (when available) - */ - function log(values); + * Wrapper around `console.log` (when available) + */ + function log(...values: any[]); /** - * Wrapper around `console.warn` (when available) - */ - function warn(values); - + * Wrapper around `console.warn` (when available) + */ + function warn(...values: any[]); //////////////////////////////////////////////////// // Classes @@ -122,25 +126,25 @@ declare module fabric { var Color: IColorStatic; var Pattern: IPatternStatic; var Intersection: IIntersectionStatic; - var Point: IPointStatic + var Point: IPointStatic; var Circle: ICircleStatic; var Ellipse: IEllipseStatic; var Group: IGroupStatic; - var Image: IImageStatic + var Image: IImageStatic; var Line: ILineStatic; var Object: IObjectStatic; var Path: IPathStatic; - var PathGroup: IPathGroupStatic - var Polygon: IPolygonStatic + var PathGroup: IPathGroupStatic; + var Polygon: IPolygonStatic; var Polyline: IPolylineStatic; var Rect: IRectStatic; var Shadow: IShadowStatic; var Text: ITextStatic; var IText: IITextStatic; - var Triangle: ITriangleStatic + var Triangle: ITriangleStatic; - var util: Util; + var util: IUtil; /////////////////////////////////////////////////////////////////////////////// // Data Object Interfaces - These intrface are not specific part of fabric, @@ -148,32 +152,32 @@ declare module fabric { ////////////////////////////////////////////////////////////////////////////// interface IDataURLOptions { /** - * The format of the output image. Either "jpeg" or "png" - */ + * The format of the output image. Either "jpeg" or "png" + */ format?: string; /** - * Quality level (0..1). Only used for jpeg - */ + * Quality level (0..1). Only used for jpeg + */ quality?: number; /** - * Multiplier to scale by - */ + * Multiplier to scale by + */ multiplier?: number; /** - * Cropping left offset. Introduced in v1.2.14 - */ + * Cropping left offset. Introduced in v1.2.14 + */ left?: number; /** - * Cropping top offset. Introduced in v1.2.14 - */ + * Cropping top offset. Introduced in v1.2.14 + */ top?: number; /** - * Cropping width. Introduced in v1.2.14 - */ + * Cropping width. Introduced in v1.2.14 + */ width?: number; /** - * Cropping height. Introduced in v1.2.14 - */ + * Cropping height. Introduced in v1.2.14 + */ height?: number; } @@ -184,169 +188,164 @@ declare module fabric { interface IFillOptions { /** - * options.source Pattern source - */ - source: string|HTMLImageElement; + * options.source Pattern source + */ + source: string | HTMLImageElement; /** - * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) - */ + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ repeat?: string; /** - * Pattern horizontal offset from object's left/top corner - */ + * Pattern horizontal offset from object's left/top corner + */ offsetX?: number; /** - * Pattern vertical offset from object's left/top corner - */ + * Pattern vertical offset from object's left/top corner + */ offsetY?: number; } - interface IToSVGOptions { /** - * If true xml tag is not included - */ + * If true xml tag is not included + */ suppressPreamble: boolean; /** - * SVG viewbox object - */ + * SVG viewbox object + */ viewBox: IViewBox; /** - * Encoding of SVG output - */ + * Encoding of SVG output + */ encoding: string; } interface IViewBox { /** - * x-cooridnate of viewbox - */ + * x-cooridnate of viewbox + */ x: number; /** - * y-coordinate of viewbox - */ + * y-coordinate of viewbox + */ y: number; /** - * Width of viewbox - */ + * Width of viewbox + */ width: number; - /**Height of viewbox */ + /** + * Height of viewbox + */ height: number; } - - interface IFilter { - new (): IFilter; - new (options: any): IFilter; - } - - interface IEventList { - [index: string]: (e: Event) => void; - } - /////////////////////////////////////////////////////////////////////////////// // Mixins Interfaces ////////////////////////////////////////////////////////////////////////////// interface ICollection { /** - * Adds objects to collection, then renders canvas (if `renderOnAddRemove` is not `false`) - * Objects should be instances of (or inherit from) fabric.Object - * @param {...fabric.Object} object Zero or more fabric instances - */ + * Adds objects to collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * Objects should be instances of (or inherit from) fabric.Object + * @param {...fabric.Object} object Zero or more fabric instances + */ add(...object: IObject[]): T; /** - * Inserts an object into collection at specified index, then renders canvas (if `renderOnAddRemove` is not `false`) - * An object should be an instance of (or inherit from) fabric.Object - * @param {Object} object Object to insert - * @param {Number} index Index to insert object at - * @param {Boolean} nonSplicing When `true`, no splicing (shifting) of objects occurs - * @return {Self} thisArg - * @chainable - */ + * Inserts an object into collection at specified index, then renders canvas (if `renderOnAddRemove` is not `false`) + * An object should be an instance of (or inherit from) fabric.Object + * @param {Object} object Object to insert + * @param {Number} index Index to insert object at + * @param {Boolean} nonSplicing When `true`, no splicing (shifting) of objects occurs + * @return {Self} thisArg + * @chainable + */ insertAt(object: IObject, index: number, nonSplicing: boolean): T; /** - * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) - * @param {...fabric.Object} object Zero or more fabric instances - * @return {Self} thisArg - * @chainable - */ + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ remove(...object: IObject[]): T; /** - * Executes given function for each object in this group - * @param {Function} callback - * @param {Object} context Context (aka thisObject) - * @return {Self} thisArg - */ + * Executes given function for each object in this group + * @param {Function} callback + * @param {Object} context Context (aka thisObject) + * @return {Self} thisArg + */ forEachObject(callback: (element: IObject, index: number, array: IObject[]) => any, context?: any): T; /** - * Returns an array of children objects of this instance - * Type parameter introduced in 1.3.10 - * @param {String} [type] When specified, only objects of this type are returned - * @return {Array} - */ + * Returns an array of children objects of this instance + * Type parameter introduced in 1.3.10 + * @param {String} [type] When specified, only objects of this type are returned + * @return {Array} + */ getObjects(type?: string): IObject[]; - /** - * Returns object at specified index - * @param {Number} index - * @return {Self} thisArg - */ + * Returns object at specified index + * @param {Number} index + * @return {Self} thisArg + */ item(index: number): T; /** - * Returns true if collection contains no objects - * @return {Boolean} true if collection is empty - */ + * Returns true if collection contains no objects + * @return {Boolean} true if collection is empty + */ isEmpty(): boolean; /** - * Returns a size of a collection (i.e: length of an array containing its objects) - * @return {Number} Collection size - */ + * Returns a size of a collection (i.e: length of an array containing its objects) + * @return {Number} Collection size + */ size(): number; /** - * Returns true if collection contains an object - * @param {Object} object Object to check against - * @return {Boolean} `true` if collection contains an object - */ + * Returns true if collection contains an object + * @param {Object} object Object to check against + * @return {Boolean} `true` if collection contains an object + */ contains(object: IObject): boolean; /** - * Returns number representation of a collection complexity - * @return {Number} complexity - */ + * Returns number representation of a collection complexity + * @return {Number} complexity + */ complexity(): number; } interface IObservable { /** * Observes specified event - * @deprecated `observe` deprecated since 0.8.34 (use `on` instead) - * @param {String|Object} eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) - * @param {Function} handler Function that receives a notification when an event of the specified type occurs + * @param eventName Event name (eg. 'after:render') + * @param handler Function that receives a notification when an event of the specified type occurs */ - on(eventName: string|any, handler: (e: IEvent) => any): T; + on(eventName: string, handler: (e: IEvent) => any): T; + /** - * Fires event with an optional options object - * @deprecated `fire` deprecated since 1.0.7 (use `trigger` instead) - * @param {String} eventName Event name to fire - * @param {Object} [options] Options object - */ + * Observes specified event + * @param eventName Object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) + */ + on(eventName: {[key:string] : Function}): T; + /** + * Fires event with an optional options object + * @deprecated `fire` deprecated since 1.0.7 (use `trigger` instead) + * @param {String} eventName Event name to fire + * @param {Object} [options] Options object + */ trigger(eventName: string, options?: any): T; /** * Stops event observing for a particular event handler. Calling this method * without arguments removes all handlers for all events * @deprecated `stopObserving` deprecated since 0.8.34 (use `off` instead) - * @param {String|Object} eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) - * @param {Function} handler Function to be deleted from EventListeners + * @param eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) + * @param handler Function to be deleted from EventListeners */ - off(eventName: string|any, handler: (e) => any): T; + off(eventName: string|any, handler: (e: IEvent) => any): T; } // animation mixin @@ -384,204 +383,204 @@ declare module fabric { } interface IObjectAnimation { /** - * Animates object's properties - * object.animate('left', ..., {duration: ...}); - * @param property Property to animate - * @param value Value to animate property - * @param options The animation options - */ - animate(property: string, value: number | string, options?: IAnimationOptions): IObject; + * Animates object's properties + * object.animate('left', ..., {duration: ...}); + * @param property Property to animate + * @param value Value to animate property + * @param options The animation options + */ + animate(property: string, value: number|string, options?: IAnimationOptions): IObject; /** - * Animates object's properties - * object.animate({ left: ..., top: ... }, { duration: ... }); - * @param properties Properties to animate - * @param value Options object - */ + * Animates object's properties + * object.animate({ left: ..., top: ... }, { duration: ... }); + * @param properties Properties to animate + * @param value Options object + */ animate(properties: any, options?: IAnimationOptions): IObject; } interface IAnimationOptions { /** - * Allows to specify starting value of animatable property (if we don't want current value to be used). - */ + * Allows to specify starting value of animatable property (if we don't want current value to be used). + */ from?: string|number; /** - * Defaults to 500 (ms). Can be used to change duration of an animation. - */ + * Defaults to 500 (ms). Can be used to change duration of an animation. + */ duration?: number; /** - * Callback; invoked on every value change - */ + * Callback; invoked on every value change + */ onChange?: Function; /** - * Callback; invoked when value change is completed - */ - onComplete?: Function + * Callback; invoked when value change is completed + */ + onComplete?: Function; + /** - * Easing function. Default: fabric.util.ease.easeInSine - */ + * Easing function. Default: fabric.util.ease.easeInSine + */ easing?: Function; /** * Value to modify the property by, default: end - start */ by?: number; } - /////////////////////////////////////////////////////////////////////////////// // General Fabric Interfaces ////////////////////////////////////////////////////////////////////////////// interface IColor { /** - * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) - */ + * Returns source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + */ getSource(): number[]; /** - * Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1]) - */ + * Sets source of this color (where source is an array representation; ex: [200, 200, 100, 1]) + */ setSource(source: number[]); /** - * Returns color represenation in RGB format ex: rgb(0-255,0-255,0-255) - */ + * Returns color represenation in RGB format ex: rgb(0-255,0-255,0-255) + */ toRgb(): string; /** - * Returns color represenation in RGBA format ex: rgba(0-255,0-255,0-255,0-1) - */ + * Returns color represenation in RGBA format ex: rgba(0-255,0-255,0-255,0-1) + */ toRgba(): string; /** - * Returns color represenation in HSL format ex: hsl(0-360,0%-100%,0%-100%) - */ + * Returns color represenation in HSL format ex: hsl(0-360,0%-100%,0%-100%) + */ toHsl(): string; /** - * Returns color represenation in HSLA format ex: hsla(0-360,0%-100%,0%-100%,0-1) - */ + * Returns color represenation in HSLA format ex: hsla(0-360,0%-100%,0%-100%,0-1) + */ toHsla(): string; /** - * Returns color represenation in HEX format ex: FF5555 - */ + * Returns color represenation in HEX format ex: FF5555 + */ toHex(): string; /** - * Gets value of alpha channel for this color - */ + * Gets value of alpha channel for this color + */ getAlpha(): number; /** - * Sets value of alpha channel for this color - * @param {Number} alpha Alpha value 0-1 - */ + * Sets value of alpha channel for this color + * @param {Number} alpha Alpha value 0-1 + */ setAlpha(alpha: number); /** - * Transforms color to its grayscale representation - */ + * Transforms color to its grayscale representation + */ toGrayscale(): IColor; /** - * Transforms color to its black and white representation - * @param {Number} threshold - */ + * Transforms color to its black and white representation + * @param {Number} threshold + */ toBlackWhite(threshold: number): IColor; /** - * Overlays color with another color - * @param {String|fabric.Color} otherColor - */ + * Overlays color with another color + * @param {String|fabric.Color} otherColor + */ overlayWith(otherColor: string|IColor): IColor; } interface IColorStatic { /** - * Color class - * The purpose of Color is to abstract and encapsulate common color operations; - * @param {String} color optional in hex or rgb(a) format - */ + * Color class + * The purpose of Color is to abstract and encapsulate common color operations; + * @param {String} color optional in hex or rgb(a) format + */ new (color?: string): IColor; /** - * Returns new color object, when given a color in RGB format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255) - */ - fromRgb(color): IColor + * Returns new color object, when given a color in RGB format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgb(color: string): IColor; /** - * Returns new color object, when given a color in RGBA format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255) - */ - fromRgba(color): IColor + * Returns new color object, when given a color in RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255) + */ + fromRgba(color: string): IColor; /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format - * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) - */ + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in RGB or RGBA format + * @param {String} color Color value ex: rgb(0-255,0-255,0-255), rgb(0%-100%,0%-100%,0%-100%) + */ sourceFromRgb(color: string): number[]; /** - * Returns new color object, when given a color in HSL format - * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) - */ - fromHsl(color: string): IColor + * Returns new color object, when given a color in HSL format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsl(color: string): IColor; /** - * Returns new color object, when given a color in HSLA format - * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) - */ - fromHsla(color: string): IColor + * Returns new color object, when given a color in HSLA format + * @param {String} color Color value ex: hsl(0-260,0%-100%,0%-100%) + */ + fromHsla(color: string): IColor; /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. - * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) - */ + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HSL or HSLA format. + * @param {String} color Color value ex: hsl(0-360,0%-100%,0%-100%) or hsla(0-360,0%-100%,0%-100%, 0-1) + */ sourceFromHsl(color: string): number[]; /** - * Returns new color object, when given a color in HEX format - * @param {String} color Color value ex: FF5555 - */ - fromHex(color: string): IColor + * Returns new color object, when given a color in HEX format + * @param {String} color Color value ex: FF5555 + */ + fromHex(color: string): IColor; /** - * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format - * @param {String} color ex: FF5555 - */ + * Returns array represenatation (ex: [100, 100, 200, 1]) of a color that's in HEX format + * @param {String} color ex: FF5555 + */ sourceFromHex(color: string): number[]; /** - * Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) - * @param {Array} source - */ + * Returns new color object, when given color in array representation (ex: [200, 100, 100, 0.5]) + * @param {Array} source + */ fromSource(source: number[]): IColor; prototype: any; } interface IGradientOptions { /** - * @param {String} [options.type] Type of gradient 'radial' or 'linear' - */ + * @param {String} [options.type] Type of gradient 'radial' or 'linear' + */ type?: string; /** - * x-coordinate of start point - */ + * x-coordinate of start point + */ x1?: number; /** - * y-coordinate of start point - */ + * y-coordinate of start point + */ y1?: number; /** - * x-coordinate of end point - */ + * x-coordinate of end point + */ x2?: number; /** - * y-coordinate of end point - */ + * y-coordinate of end point + */ y2?: number; /** - * Radius of start point (only for radial gradients) - */ + * Radius of start point (only for radial gradients) + */ r1?: number; /** - * Radius of end point (only for radial gradients) - */ + * Radius of end point (only for radial gradients) + */ r2?: number; /** - * Color stops object eg. {0:string; 1:string; - */ + * Color stops object eg. {0:string; 1:string; + */ colorStops?: any; } interface IGradient extends IGradientOptions { @@ -626,12 +625,12 @@ declare module fabric { interface IIntersection { /** - * Appends a point to intersection - */ + * Appends a point to intersection + */ appendPoint(point: IPoint); /** - * Appends points to intersection - */ + * Appends points to intersection + */ appendPoints(points: IPoint[]); } interface IIntersectionStatic { @@ -640,41 +639,41 @@ declare module fabric { */ new (status?: string); /** - * Checks if polygon intersects another polygon - */ + * Checks if polygon intersects another polygon + */ intersectPolygonPolygon(points1: IPoint[], points2: IPoint[]): IIntersection; /** - * Checks if line intersects polygon - */ - intersectLinePolygon(a1: IPoint, a2: IPoint, points: IPoint[]): IIntersection + * Checks if line intersects polygon + */ + intersectLinePolygon(a1: IPoint, a2: IPoint, points: IPoint[]): IIntersection; /** - * Checks if one line intersects another - */ - intersectLineLine(a1: IPoint, a2: IPoint, b1: IPoint, b2: IPoint): IIntersection + * Checks if one line intersects another + */ + intersectLineLine(a1: IPoint, a2: IPoint, b1: IPoint, b2: IPoint): IIntersection; /** - * Checks if polygon intersects rectangle - */ + * Checks if polygon intersects rectangle + */ intersectPolygonRectangle(points: IPoint[], r1: number, r2: number): IIntersection; } interface IPatternOptions { /** - * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) - */ + * Repeat property of a pattern (one of repeat, repeat-x, repeat-y or no-repeat) + */ repeat: string; /** - * Pattern horizontal offset from object's left/top corner - */ + * Pattern horizontal offset from object's left/top corner + */ offsetX: number; /** - * Pattern vertical offset from object's left/top corner - */ + * Pattern vertical offset from object's left/top corner + */ offsetY: number; /** - * The source for the pattern - */ + * The source for the pattern + */ source: string|HTMLImageElement; } interface IPattern extends IPatternOptions { @@ -682,18 +681,18 @@ declare module fabric { initialise(options?: IPatternOptions): IPattern; /** - * Returns an instance of CanvasPattern - */ + * Returns an instance of CanvasPattern + */ toLive(ctx: CanvasRenderingContext2D): IPattern; /** - * Returns object representation of a pattern - */ + * Returns object representation of a pattern + */ toObject(): any; /** - * Returns SVG representation of a pattern - * @param {fabric.Object} object - */ + * Returns SVG representation of a pattern + * @param {fabric.Object} object + */ toSVG(object: IObject): string; } interface IPatternStatic { @@ -705,239 +704,216 @@ declare module fabric { x: number; y: number; /** - * Adds another point to this one and returns another one - * @param {fabric.Point} that - * @return {fabric.Point} new Point instance with added values - */ + * Adds another point to this one and returns another one + * @param {fabric.Point} that + */ add(that: IPoint): IPoint; /** - * Adds another point to this one - * @param {fabric.Point} that - * @return {fabric.Point} thisArg - */ + * Adds another point to this one + * @param {fabric.Point} that + */ addEquals(that: IPoint): IPoint; /** - * Adds value to this point and returns a new one - * @param {Number} scalar - * @return {fabric.Point} new Point with added value - */ + * Adds value to this point and returns a new one + * @param {Number} scalar + */ scalarAdd(scalar: number): IPoint; /** - * Adds value to this point - * @param {Number} scalar - * @return {fabric.Point} thisArg - */ + * Adds value to this point + * @param {Number} scalar + */ scalarAddEquals(scalar: number): IPoint; /** - * Subtracts another point from this point and returns a new one - * @param {fabric.Point} that - * @return {fabric.Point} new Point object with subtracted values - */ - subtract(that: IPoint): IPoint + * Subtracts another point from this point and returns a new one + * @param {fabric.Point} that + */ + subtract(that: IPoint): IPoint; /** - * Subtracts another point from this point - * @param {fabric.Point} that - * @return {fabric.Point} thisArg - */ - subtractEquals(that): IPoint; + * Subtracts another point from this point + * @param {fabric.Point} that + */ + subtractEquals(that: IPoint): IPoint; /** - * Subtracts value from this point and returns a new one - * @param {Number} scalar - * @return {fabric.Point} - */ + * Subtracts value from this point and returns a new one + * @param {Number} scalar + */ scalarSubtract(scalar: number): IPoint; /** - * Subtracts value from this point - * @param {Number} scalar - * @return {fabric.Point} thisArg - */ + * Subtracts value from this point + * @param {Number} scalar + */ scalarSubtractEquals(scalar: number): IPoint; /** - * Miltiplies this point by a value and returns a new one - * @param {Number} scalar - * @return {fabric.Point} - */ + * Miltiplies this point by a value and returns a new one + * @param {Number} scalar + */ multiply(scalar: number): IPoint; /** - * Miltiplies this point by a value - * @param {Number} scalar - * @return {fabric.Point} thisArg - */ - multiplyEquals(scalar): IPoint; + * Miltiplies this point by a value + * @param {Number} scalar + */ + multiplyEquals(scalar: number): IPoint; /** - * Divides this point by a value and returns a new one - * @param {Number} scalar - * @return {fabric.Point} - */ - divide(scalar): IPoint; + * Divides this point by a value and returns a new one + * @param {Number} scalar + */ + divide(scalar: number): IPoint; /** - * Divides this point by a value - * @param {Number} scalar - * @return {fabric.Point} thisArg - */ + * Divides this point by a value + * @param {Number} scalar + */ divideEquals(scalar: number): IPoint; /** - * Returns true if this point is equal to another one - * @param {fabric.Point} that - * @return {Boolean} - */ + * Returns true if this point is equal to another one + * @param {fabric.Point} that + */ eq(that: IPoint): IPoint; /** - * Returns true if this point is less than another one - * @param {fabric.Point} that - * @return {Boolean} - */ + * Returns true if this point is less than another one + * @param {fabric.Point} that + */ lt(that: IPoint): IPoint; /** - * Returns true if this point is less than or equal to another one - * @param {fabric.Point} that - * @return {Boolean} - */ + * Returns true if this point is less than or equal to another one + * @param {fabric.Point} that + */ lte(that: IPoint): IPoint; /** - * Returns true if this point is greater another one - * @param {fabric.Point} that - * @return {Boolean} - */ + * Returns true if this point is greater another one + * @param {fabric.Point} that + */ gt(that: IPoint): IPoint; /** - * Returns true if this point is greater than or equal to another one - * @param {fabric.Point} that - * @return {Boolean} - */ + * Returns true if this point is greater than or equal to another one + * @param {fabric.Point} that + */ gte(that: IPoint): IPoint; /** - * Returns new point which is the result of linear interpolation with this one and another one - * @param {fabric.Point} that - * @param {Number} t - * @return {fabric.Point} - */ - lerp(that, t: number): IPoint; + * Returns new point which is the result of linear interpolation with this one and another one + * @param {fabric.Point} that + * @param {Number} t + */ + lerp(that: IPoint, t: number): IPoint; /** - * Returns distance from this point and another one - * @param {fabric.Point} that - * @return {Number} - */ + * Returns distance from this point and another one + * @param {fabric.Point} that + */ distanceFrom(that: IPoint): number; /** - * Returns the point between this point and another one - * @param {fabric.Point} that - * @return {fabric.Point} - */ + * Returns the point between this point and another one + * @param {fabric.Point} that + */ midPointFrom(that: IPoint): IPoint; /** - * Returns a new point which is the min of this and another one - * @param {fabric.Point} that - * @return {fabric.Point} - */ + * Returns a new point which is the min of this and another one + * @param {fabric.Point} that + */ min(that: IPoint): IPoint; /** - * Returns a new point which is the max of this and another one - * @param {fabric.Point} that - * @return {fabric.Point} - */ + * Returns a new point which is the max of this and another one + * @param {fabric.Point} that + */ max(that: IPoint): IPoint; /** - * Returns string representation of this point - * @return {String} - */ + * Returns string representation of this point + */ toString(): string; /** - * Sets x/y of this point - * @param {Number} x - * @param {Number} y - */ - setXY(x, y: IPoint): IPoint; + * Sets x/y of this point + * @param {Number} x + * @param {Number} y + */ + setXY(x:number, y: number): IPoint; /** - * Sets x/y of this point from another point - * @param {fabric.Point} that - */ + * Sets x/y of this point from another point + * @param {fabric.Point} that + */ setFromPoint(that: IPoint): IPoint; /** - * Swaps x/y of this point and another point - * @param {fabric.Point} that - */ + * Swaps x/y of this point and another point + * @param {fabric.Point} that + */ swap(that: IPoint): IPoint; } interface IPointStatic { - new (x, y): IPoint; + new (x: number, y: number): IPoint; prototype: any; } interface IShadowOptions { /** - * Whether the shadow should affect stroke operations - */ + * Whether the shadow should affect stroke operations + */ affectStrike: boolean; /** - * Shadow blur - */ + * Shadow blur + */ blur: number; /** - * Shadow color - */ + * Shadow color + */ color: string; /** - * Indicates whether toObject should include default values - */ + * Indicates whether toObject should include default values + */ includeDefaultValues: boolean; /** - * Shadow horizontal offset - */ + * Shadow horizontal offset + */ offsetX: number; /** - * Shadow vertical offset - */ + * Shadow vertical offset + */ offsetY: number; } interface IShadow extends IShadowOptions { initialize(options?: IShadowOptions|string): IShadow; /** - * Returns object representation of a shadow - */ + * Returns object representation of a shadow + */ toObject(): IObject; /** - * Returns a string representation of an instance, CSS3 text-shadow declaration - */ + * Returns a string representation of an instance, CSS3 text-shadow declaration + */ toString(): string; /** - * Returns SVG representation of a shadow - * @param {fabric.Object} object - */ + * Returns SVG representation of a shadow + * @param {fabric.Object} object + */ toSVG(object: IObject): string; /** - * Regex matching shadow offsetX, offsetY and blur, Static - */ + * Regex matching shadow offsetX, offsetY and blur, Static + */ reOffsetsAndBlur: RegExp } interface IShadowStatic { - new (options?: IShadowOptions): IShadow + new (options?: IShadowOptions): IShadow; reOffsetsAndBlur: RegExp; } @@ -946,381 +922,421 @@ declare module fabric { ////////////////////////////////////////////////////////////////////////////// interface ICanvasDimensions { /** - * Width of canvas element - */ + * Width of canvas element + */ width: number; /** - * Height of canvas element - */ + * Height of canvas element + */ height: number; } interface ICanvasDimensionsOptions { /** - * Set the given dimensions only as canvas backstore dimensions - */ + * Set the given dimensions only as canvas backstore dimensions + */ backstoreOnly?: boolean; /** - * Set the given dimensions only as css dimensions - */ + * Set the given dimensions only as css dimensions + */ cssOnly?: boolean; } interface IStaticCanvasOptions { /** - * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas - */ + * Indicates whether the browser can be scrolled when using a touchscreen and dragging on the canvas + */ allowTouchScrolling?: boolean; /** - * Indicates whether this canvas will use image smoothing, this is on by default in browsers - */ + * Indicates whether this canvas will use image smoothing, this is on by default in browsers + */ imageSmoothingEnabled?: boolean; /** - * Indicates whether objects should remain in current stack position when selected. When false objects are brought to top and rendered as part of the selection group - */ + * Indicates whether objects should remain in current stack position when selected. + * When false objects are brought to top and rendered as part of the selection group + */ preserveObjectStacking?: boolean; /** - * The transformation (in the format of Canvas transform) which focuses the viewport - */ + * The transformation (in the format of Canvas transform) which focuses the viewport + */ viewportTransform?: number[]; - - freeDrawingColor?: string; freeDrawingLineWidth?: number; /** - * Background color of canvas instance. - * Should be set via setBackgroundColor - */ - backgroundColor?: string | IPattern; + * Background color of canvas instance. + * Should be set via setBackgroundColor + */ + backgroundColor?: string|IPattern; /** - * Background image of canvas instance. - * Should be set via setBackgroundImage - * Backwards incompatibility note: The "backgroundImageOpacity" and "backgroundImageStretch" properties are deprecated since 1.3.9. - */ - backgroundImage?: IImage; + * Background image of canvas instance. + * Should be set via setBackgroundImage + * Backwards incompatibility note: The "backgroundImageOpacity" and "backgroundImageStretch" properties are deprecated since 1.3.9. + */ + backgroundImage?: IImage | string; backgroundImageOpacity?: number; backgroundImageStretch?: number; /** - * Function that determines clipping of entire canvas area - * Being passed context as first argument. See clipping canvas area - */ + * Function that determines clipping of entire canvas area + * Being passed context as first argument. See clipping canvas area + */ clipTo?: (context: CanvasRenderingContext2D) => void; /** - * Indicates whether object controls (borders/controls) are rendered above overlay image - */ + * Indicates whether object controls (borders/controls) are rendered above overlay image + */ controlsAboveOverlay?: boolean; /** - * Indicates whether toObject/toDatalessObject should include default values - */ + * Indicates whether toObject/toDatalessObject should include default values + */ includeDefaultValues?: boolean; /** - * Overlay color of canvas instance. - * Should be set via setOverlayColor - */ - overlayColor?: string | IPattern; + * Overlay color of canvas instance. + * Should be set via setOverlayColor + */ + overlayColor?: string|IPattern; /** - * Overlay image of canvas instance. - * Should be set via setOverlayImage - * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. - */ + * Overlay image of canvas instance. + * Should be set via setOverlayImage + * Backwards incompatibility note: The "overlayImageLeft" and "overlayImageTop" properties are deprecated since 1.3.9. + */ overlayImage?: IImage; overlayImageLeft?: number; overlayImageTop?: number; /** - * Indicates whether add, insertAt and remove should also re-render canvas. - * Disabling this option could give a great performance boost when adding/removing a lot of objects to/from canvas at once - * (followed by a manual rendering after addition/deletion) - */ + * Indicates whether add, insertAt and remove should also re-render canvas. + * Disabling this option could give a great performance boost when adding/removing a lot of objects to/from canvas at once + * (followed by a manual rendering after addition/deletion) + */ renderOnAddRemove?: boolean; /** - * Indicates whether objects' state should be saved - */ + * Indicates whether objects' state should be saved + */ stateful?: boolean; } interface IStaticCanvas extends IObservable, IStaticCanvasOptions, ICollection, ICanvasAnimation { /** - * Calculates canvas element offset relative to the document - * This method is also attached as "resize" event handler of window - */ + * Calculates canvas element offset relative to the document + * This method is also attached as "resize" event handler of window + */ calcOffset(): IStaticCanvas; /** - * Sets {@link fabric.StaticCanvas#overlayImage|overlay image} for this canvas - * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set overlay to - * @param {Function} callback callback to invoke when image is loaded and set as an overlay - * @param {Object} [options] Optional options to set for the {@link fabric.Image|overlay image}. - */ - setOverlayImage(image: IImage | string, callback: Function, options?: IObjectOptions): IStaticCanvas; + * Sets {@link fabric.StaticCanvas#overlayImage|overlay image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set overlay to + * @param {Function} callback callback to invoke when image is loaded and set as an overlay + * @param {Object} [options] Optional options to set for the {@link fabric.Image|overlay image}. + */ + setOverlayImage(image: IImage|string, callback: Function, options?: IObjectOptions): IStaticCanvas; /** - * Sets {@link fabric.StaticCanvas#backgroundImage|background image} for this canvas - * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set background to - * @param {Function} callback Callback to invoke when image is loaded and set as background - * @param {Object} [options] Optional options to set for the {@link fabric.Image|background image}. - */ + * Sets {@link fabric.StaticCanvas#backgroundImage|background image} for this canvas + * @param {(fabric.Image|String)} image fabric.Image instance or URL of an image to set background to + * @param {Function} callback Callback to invoke when image is loaded and set as background + * @param {Object} [options] Optional options to set for the {@link fabric.Image|background image}. + */ setBackgroundImage(image: IImage|string, callback: Function, options?: IObjectOptions): IStaticCanvas; /** - * Sets {@link fabric.StaticCanvas#overlayColor|background color} for this canvas - * @param {(String|fabric.Pattern)} overlayColor Color or pattern to set background color to - * @param {Function} callback Callback to invoke when background color is set - */ + * Sets {@link fabric.StaticCanvas#overlayColor|background color} for this canvas + * @param {(String|fabric.Pattern)} overlayColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + */ setOverlayColor(overlayColor: string|IPattern, callback: Function): IStaticCanvas; /** - * Sets {@link fabric.StaticCanvas#backgroundColor|background color} for this canvas - * @param {(String|fabric.Pattern)} backgroundColor Color or pattern to set background color to - * @param {Function} callback Callback to invoke when background color is set - */ + * Sets {@link fabric.StaticCanvas#backgroundColor|background color} for this canvas + * @param {(String|fabric.Pattern)} backgroundColor Color or pattern to set background color to + * @param {Function} callback Callback to invoke when background color is set + */ setBackgroundColor(backgroundColor: string|IPattern, callback: Function): IStaticCanvas; /** - * Returns canvas width (in px) - */ + * Returns canvas width (in px) + */ getWidth(): number; /** - * Returns canvas height (in px) - */ + * Returns canvas height (in px) + */ getHeight(): number; /** - * Sets width of this canvas instance - * @param {Number|String} value Value to set width to - * @param {Object} [options] Options object - */ + * Sets width of this canvas instance + * @param {Number|String} value Value to set width to + * @param {Object} [options] Options object + */ setWidth(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas /** - * Sets height of this canvas instance - * @param {Number|String} value Value to set height to - * @param {Object} [options] Options object - */ - setHeight(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas + * Sets height of this canvas instance + * @param {Number|String} value Value to set height to + * @param {Object} [options] Options object + */ + setHeight(value: number|string, options?: ICanvasDimensionsOptions): IStaticCanvas; /** - * Sets dimensions (width, height) of this canvas instance. when options.cssOnly flag active you should also supply the unit of measure (px/%/em) - * @param {Object} dimensions Object with width/height properties - * @param {Object} [options] Options object - */ + * Sets dimensions (width, height) of this canvas instance. when options.cssOnly flag active you should also supply the unit of measure (px/%/em) + * @param {Object} dimensions Object with width/height properties + * @param {Object} [options] Options object + */ setDimensions(dimensions: ICanvasDimensions, options?: ICanvasDimensionsOptions): IStaticCanvas; - + /** - * Returns canvas zoom level - */ + * Returns canvas zoom level + */ getZoom(): number; /** - * Sets viewport transform of this canvas instance - * @param {Array} vpt the transform in the form of context.transform - */ + * Sets viewport transform of this canvas instance + * @param {Array} vpt the transform in the form of context.transform + */ setViewportTransform(vpt: number[]): IStaticCanvas; - /** - * Sets zoom level of this canvas instance, zoom centered around point - * @param {fabric.Point} point to zoom with respect to - * @param {Number} value to set zoom to, less than 1 zooms out - */ + * Sets zoom level of this canvas instance, zoom centered around point + * @param {fabric.Point} point to zoom with respect to + * @param {Number} value to set zoom to, less than 1 zooms out + */ zoomToPoint(point: IPoint, value: number): IStaticCanvas; /** - * Sets zoom level of this canvas instance - * @param {Number} value to set zoom to, less than 1 zooms out - */ + * Sets zoom level of this canvas instance + * @param {Number} value to set zoom to, less than 1 zooms out + */ setZoom(value: number): IStaticCanvas; /** - * Pan viewport so as to place point at top left corner of canvas - * @param {fabric.Point} point to move to - */ + * Pan viewport so as to place point at top left corner of canvas + * @param {fabric.Point} point to move to + */ absolutePan(point: IPoint): IStaticCanvas; /** - * Pans viewpoint relatively - * @param {fabric.Point} point (position vector) to move by - */ + * Pans viewpoint relatively + * @param {fabric.Point} point (position vector) to move by + */ relativePan(point: IPoint): IStaticCanvas; /** - * Returns element corresponding to this instance - */ + * Returns element corresponding to this instance + */ getElement(): HTMLCanvasElement; /** - * Returns currently selected object, if any - */ + * Returns currently selected object, if any + */ getActiveObject(): IObject; /** - * Returns currently selected group of object, if any - */ + * Returns currently selected group of object, if any + */ getActiveGroup(): IGroup; /** - * Clears specified context of canvas element - * @param {CanvasRenderingContext2D} ctx Context to clear - * @chainable - */ + * Clears specified context of canvas element + * @param {CanvasRenderingContext2D} ctx Context to clear + * @chainable + */ clearContext(ctx: CanvasRenderingContext2D): IStaticCanvas; /** - * Returns context of canvas where objects are drawn - */ + * Returns context of canvas where objects are drawn + */ getContext(): CanvasRenderingContext2D; /** - * Clears all contexts (background, main, top) of an instance - */ + * Clears all contexts (background, main, top) of an instance + */ clear(): IStaticCanvas; /** - * Renders both the top canvas and the secondary container canvas. - * @param {Boolean} [allOnTop] Whether we want to force all images to be rendered on the top canvas - * @chainable - */ + * Renders both the top canvas and the secondary container canvas. + * @param {Boolean} [allOnTop] Whether we want to force all images to be rendered on the top canvas + * @chainable + */ renderAll(allOnTop?: boolean): IStaticCanvas; /** - * Method to render only the top canvas. - * Also used to render the group selection box. - * @chainable - */ + * Method to render only the top canvas. + * Also used to render the group selection box. + * @chainable + */ renderTop(): IStaticCanvas; /** - * Returns coordinates of a center of canvas. - * Returned value is an object with top and left properties - */ - getCenter(): { top: number; left: number; } - + * Returns coordinates of a center of canvas. + * Returned value is an object with top and left properties + */ + getCenter(): { top: number; left: number; }; /** - * Centers object horizontally. - * You might need to call `setCoords` on an object after centering, to update controls area. - * @param {fabric.Object} object Object to center horizontally - */ + * Centers object horizontally. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center horizontally + */ centerObjectH(object: IObject): IStaticCanvas; /** - * Centers object vertically. - * You might need to call `setCoords` on an object after centering, to update controls area. - * @param {fabric.Object} object Object to center vertically - */ + * Centers object vertically. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center vertically + */ centerObjectV(object: IObject): IStaticCanvas; /** - * Centers object vertically and horizontally. - * You might need to call `setCoords` on an object after centering, to update controls area. - * @param {fabric.Object} object Object to center vertically and horizontally - */ + * Centers object vertically and horizontally. + * You might need to call `setCoords` on an object after centering, to update controls area. + * @param {fabric.Object} object Object to center vertically and horizontally + */ centerObject(object: IObject): IStaticCanvas; /** - * Returs dataless JSON representation of canvas - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ + * Returs dataless JSON representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ toDatalessJSON(propertiesToInclude?: any[]): string; /** - * Returns object representation of canvas - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ - toObject(propertiesToInclude?: any[]): any; + * Returns object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toObject(propertiesToInclude?: any[]): any; /** - * Returns dataless object representation of canvas - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ + * Returns dataless object representation of canvas + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ toDatalessObject(propertiesToInclude?: any[]): any; /** - * When true, getSvgTransform() will apply the StaticCanvas.viewportTransform to the SVG transformation. When true, - * a zoomed canvas will then produce zoomed SVG output. - */ + * When true, getSvgTransform() will apply the StaticCanvas.viewportTransform to the SVG transformation. When true, + * a zoomed canvas will then produce zoomed SVG output. + */ svgViewportTransformation: boolean; /** - * Returns SVG representation of canvas - * @param {Object} [options] Options object for SVG output - * @param {Function} [reviver] Method for further parsing of svg elements, called after each fabric object converted into svg representation. - */ + * Returns SVG representation of canvas + * @param {Object} [options] Options object for SVG output + * @param {Function} [reviver] Method for further parsing of svg elements, called after each fabric object converted into svg representation. + */ toSVG(options: IToSVGOptions, reviver?: Function): string; /** - * Moves an object to the bottom of the stack of drawn objects - * @param {fabric.Object} object Object to send to back - * @chainable - */ + * Moves an object to the bottom of the stack of drawn objects + * @param {fabric.Object} object Object to send to back + * @chainable + */ sendToBack(object: IObject): IStaticCanvas; /** - * Moves an object to the top of the stack of drawn objects - * @param {fabric.Object} object Object to send - * @chainable - */ + * Moves an object to the top of the stack of drawn objects + * @param {fabric.Object} object Object to send + * @chainable + */ bringToFront(object: IObject): IStaticCanvas; /** - * Moves an object down in stack of drawn objects - * @param {fabric.Object} object Object to send - * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object - * @chainable - */ + * Moves an object down in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + * @chainable + */ sendBackwards(object: IObject): IStaticCanvas; /** - * Moves an object up in stack of drawn objects - * @param {fabric.Object} object Object to send - * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object - * @chainable - */ + * Moves an object up in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + * @chainable + */ bringForward(object: IObject): IStaticCanvas; /** - * Moves an object to specified level in stack of drawn objects - * @param {fabric.Object} object Object to send - * @param {Number} index Position to move to - * @chainable - */ + * Moves an object to specified level in stack of drawn objects + * @param {fabric.Object} object Object to send + * @param {Number} index Position to move to + * @chainable + */ moveTo(object: IObject, index: number): IStaticCanvas; /** - * Clears a canvas element and removes all event listeners - */ + * Clears a canvas element and removes all event listeners + */ dispose(): IStaticCanvas; /** - * Returns a string representation of an instance - */ + * Returns a string representation of an instance + */ toString(): string; /** - * Provides a way to check support of some of the canvas methods - * (either those of HTMLCanvasElement itself, or rendering context) - * - * @param {String} methodName Method to check support for; - * Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" - * @return {Boolean | null} `true` if method is supported (or at least exists), - * `null` if canvas element or context can not be initialized - */ - supports(methodName: string): boolean; - EMPTY_JSON: string; + * Exports canvas element to a dataurl image. Note that when multiplier is used, cropping is scaled appropriately + * @param {Object} [options] Options object + */ + toDataURL(options?: IDataURLOptions): string; - // methods + /** + * Provides a way to check support of some of the canvas methods + * (either those of HTMLCanvasElement itself, or rendering context) + * @param {String} methodName Method to check support for; Could be one of "getImageData", "toDataURL", "toDataURLWithQuality" or "setLineDash" + * @return {Boolean | null} `true` if method is supported (or at least exists), null` if canvas element or context can not be initialized + */ + supports(methodName: string): boolean; + + /** + * Populates canvas with data from the specified JSON. + * JSON format must conform to the one of toJSON formats + * @param {String|Object} json JSON string or object + * @param {Function} callback Callback, invoked when json is parsed + * and corresponding objects (e.g: {@link fabric.Image}) + * are initialized + * @param {Function} [reviver] Method for further parsing of JSON elements, called after each fabric object created. + */ + loadFromJSON(json: string|any, callback: Function, reviver?: Function): ICanvas; + /** + * Clones canvas instance + * @param {Object} [callback] Receives cloned instance as a first argument + * @param {Array} [properties] Array of properties to include in the cloned canvas and children + */ + clone(callback: (canvas: IStaticCanvas) => any, properties?: any[]): void; + + /** + * Clones canvas instance without cloning existing data. + * This essentially copies canvas dimensions, clipping properties, etc. + * but leaves data empty (so that you can populate it with your own) + * @param {Object} [callback] Receives cloned instance as a first argument + */ + cloneWithoutData(callback: (canvas: IStaticCanvas) => any): void; + + /** + * Callback; invoked right before object is about to be scaled/rotated + */ onBeforeScaleRotate(target: IObject); - toGrayscale(propertiesToInclude: any[]): string; + + // Functions from object straighten mixin + // -------------------------------------------------------------------------------------------------------------------------------- + + /** + * Straightens object, then rerenders canvas + * @param {fabric.Object} object Object to straighten + */ + straightenObject(object: IObject): IStaticCanvas + + /** + * Same as straightenObject, but animated + * @param {fabric.Object} object Object to straighten + */ + fxStraightenObject(object: IObject): IStaticCanvas } interface IStaticCanvasStatic { /** - * Constructor - * @param {HTMLElement|String} element element to initialize instance on - * @param {Object} [options] Options object - */ - new (element: HTMLCanvasElement | string, options?: ICanvasOptions): IStaticCanvas; + * Constructor + * @param {HTMLElement|String} element element to initialize instance on + * @param {Object} [options] Options object + */ + new (element: HTMLCanvasElement|string, options?: ICanvasOptions): IStaticCanvas; EMPTY_JSON: string; /** @@ -1339,219 +1355,212 @@ declare module fabric { interface ICanvasOptions extends IStaticCanvasOptions { /** - * When true, objects can be transformed by one side (unproportionally) - */ + * When true, objects can be transformed by one side (unproportionally) + */ uniScaleTransform?: boolean; /** - * When true, objects use center point as the origin of scale transformation. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ + * When true, objects use center point as the origin of scale transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ centeredScaling?: boolean; /** - * When true, objects use center point as the origin of rotate transformation. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ + * When true, objects use center point as the origin of rotate transformation. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ centeredRotation?: boolean; /** - * Indicates that canvas is interactive. This property should not be changed. - */ + * Indicates that canvas is interactive. This property should not be changed. + */ interactive?: boolean; /** - * Indicates whether group selection should be enabled - */ + * Indicates whether group selection should be enabled + */ selection?: boolean; /** - * Color of selection - */ + * Color of selection + */ selectionColor?: string; /** - * Default dash array pattern - * If not empty the selection border is dashed - */ + * Default dash array pattern + * If not empty the selection border is dashed + */ selectionDashArray?: any[]; /** - * Color of the border of selection (usually slightly darker than color of selection itself) - */ + * Color of the border of selection (usually slightly darker than color of selection itself) + */ selectionBorderColor?: string; /** - * Width of a line used in object/group selection - */ + * Width of a line used in object/group selection + */ selectionLineWidth?: number; /** - * Default cursor value used when hovering over an object on canvas - */ + * Default cursor value used when hovering over an object on canvas + */ hoverCursor?: string; /** - * Default cursor value used when moving an object on canvas - */ + * Default cursor value used when moving an object on canvas + */ moveCursor?: string; /** - * Default cursor value used for the entire canvas - */ + * Default cursor value used for the entire canvas + */ defaultCursor?: string; /** - * Cursor value used during free drawing - */ + * Cursor value used during free drawing + */ freeDrawingCursor?: string; /** - * Cursor value used for rotation point - */ + * Cursor value used for rotation point + */ rotationCursor?: string; /** - * Default element class that's given to wrapper (div) element of canvas - */ + * Default element class that's given to wrapper (div) element of canvas + */ containerClass?: string; /** - * When true, object detection happens on per-pixel basis rather than on per-bounding-box - */ + * When true, object detection happens on per-pixel basis rather than on per-bounding-box + */ perPixelTargetFind?: boolean; /** - * Number of pixels around target pixel to tolerate (consider active) during object detection - */ + * Number of pixels around target pixel to tolerate (consider active) during object detection + */ targetFindTolerance?: number; /** - * When true, target detection is skipped when hovering over canvas. This can be used to improve performance. - */ + * When true, target detection is skipped when hovering over canvas. This can be used to improve performance. + */ skipTargetFind?: boolean; /** - * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. - * After mousedown, mousemove creates a shape, - * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. - */ + * When true, mouse events on canvas (mousedown/mousemove/mouseup) result in free drawing. + * After mousedown, mousemove creates a shape, + * and then mouseup finalizes it and adds an instance of `fabric.Path` onto canvas. + */ isDrawingMode?: boolean; } interface ICanvas extends IStaticCanvas, ICanvasOptions { - // constructors - new (element: HTMLCanvasElement|string, options: ICanvasOptions): ICanvas; - _objects: IObject[]; - // fields - freeDrawingColor: string; - freeDrawingLineWidth: number; - /** - * Checks if point is contained within an area of given object - * @param {Event} e Event object - * @param {fabric.Object} target Object to test against - */ + * Checks if point is contained within an area of given object + * @param {Event} e Event object + * @param {fabric.Object} target Object to test against + */ containsPoint(e: Event, target: IObject): boolean; /** - * Deactivates all objects on canvas, removing any active group or object - * @return {fabric.Canvas} thisArg - */ + * Deactivates all objects on canvas, removing any active group or object + * @return {fabric.Canvas} thisArg + */ deactivateAll(): ICanvas; /** - * Deactivates all objects and dispatches appropriate events - * @param {Event} [e] Event (passed along when firing) - * @return {fabric.Canvas} thisArg - */ + * Deactivates all objects and dispatches appropriate events + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + */ deactivateAllWithDispatch(e?: Event): ICanvas; /** - * Discards currently active group - * @param {Event} [e] Event (passed along when firing) - * @return {fabric.Canvas} thisArg - */ + * Discards currently active group + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + */ discardActiveGroup(e?: Event): ICanvas; /** - * Discards currently active object - * @param {Event} [e] Event (passed along when firing) - * @return {fabric.Canvas} thisArg - * @chainable - */ + * Discards currently active object + * @param {Event} [e] Event (passed along when firing) + * @return {fabric.Canvas} thisArg + * @chainable + */ discardActiveObject(e?: Event): ICanvas; /** - * Draws objects' controls (borders/controls) - * @param {CanvasRenderingContext2D} ctx Context to render controls on - */ + * Draws objects' controls (borders/controls) + * @param {CanvasRenderingContext2D} ctx Context to render controls on + */ drawControls(ctx: CanvasRenderingContext2D): void; - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, dashArray: number[]): ICanvas; /** - * Method that determines what object we are clicking on - * @param {Event} e mouse event - * @param {Boolean} skipGroup when true, group is skipped and only objects are traversed through - */ + * Method that determines what object we are clicking on + * @param {Event} e mouse event + * @param {Boolean} skipGroup when true, group is skipped and only objects are traversed through + */ findTarget(e: MouseEvent, skipGroup: boolean): ICanvas; /** - * Returns currently active group - * @return {fabric.Group} Current group - */ + * Returns currently active group + * @return {fabric.Group} Current group + */ getActiveGroup(): IGroup; /** - * Returns currently active object - * @return {fabric.Object} active object - */ + * Returns currently active object + * @return {fabric.Object} active object + */ getActiveObject(): IObject; /** - * Returns pointer coordinates relative to canvas. - * @param {Event} e - * @return {Object} object with "x" and "y" number values - */ + * Returns pointer coordinates relative to canvas. + * @param {Event} e + * @return {Object} object with "x" and "y" number values + */ getPointer(e: Event, ignoreZoom?: boolean, upperCanvasEl?: CanvasRenderingContext2D): { x: number; y: number; }; /** - * Returns context of canvas where object selection is drawn - * @return {CanvasRenderingContext2D} - */ + * Returns context of canvas where object selection is drawn + * @return {CanvasRenderingContext2D} + */ getSelectionContext(): CanvasRenderingContext2D; /** - * Returns element on which object selection is drawn - * @return {HTMLCanvasElement} - */ + * Returns element on which object selection is drawn + * @return {HTMLCanvasElement} + */ getSelectionElement(): HTMLCanvasElement; /** - * Returns true if object is transparent at a certain location - * @param {fabric.Object} target Object to check - * @param {Number} x Left coordinate - * @param {Number} y Top coordinate - */ + * Returns true if object is transparent at a certain location + * @param {fabric.Object} target Object to check + * @param {Number} x Left coordinate + * @param {Number} y Top coordinate + */ isTargetTransparent(target: IObject, x: number, y: number): boolean; /** - * Sets active group to a speicified one - * @param {fabric.Group} group Group to set as a current one - * @param {Event} [e] Event (passed along when firing) - */ + * Sets active group to a speicified one + * @param {fabric.Group} group Group to set as a current one + * @param {Event} [e] Event (passed along when firing) + */ setActiveGroup(group: IGroup, e?: Event): ICanvas; /** - * Sets given object as the only active object on canvas - * @param {fabric.Object} object Object to set as an active one - * @param {Event} [e] Event (passed along when firing "object:selected") - */ + * Sets given object as the only active object on canvas + * @param {fabric.Object} object Object to set as an active one + * @param {Event} [e] Event (passed along when firing "object:selected") + */ setActiveObject(object: IObject, e?: Event): ICanvas; /** - * Set the cursor type of the canvas element - * @param {String} value Cursor type of the canvas element. - * @see http://www.w3.org/TR/css3-ui/#cursor - */ + * Set the cursor type of the canvas element + * @param {String} value Cursor type of the canvas element. + * @see http://www.w3.org/TR/css3-ui/#cursor + */ setCursor(value: string): void; - - loadFromJSON(json, callback: () => void): void; - loadFromDatalessJSON(json, callback: () => void): void; + /** + * Removes all event listeners + */ + removeListeners(): void } interface ICanvasStatic { /** - * Constructor - * @param {HTMLElement|String} element element to initialize instance on - * @param {Object} [options] Options object - */ + * Constructor + * @param {HTMLElement|String} element element to initialize instance on + * @param {Object} [options] Options object + */ new (element: HTMLCanvasElement | string, options?: ICanvasOptions): ICanvas; EMPTY_JSON: string; @@ -1569,8 +1578,6 @@ declare module fabric { toJSON(propertiesToInclude?: any[]): string; } - - /////////////////////////////////////////////////////////////////////////////// // Shape Interfaces ////////////////////////////////////////////////////////////////////////////// @@ -1591,17 +1598,15 @@ declare module fabric { endAngle?: number; } interface ICircle extends IObject, ICircleOptions { - initialize(options?: ICircleOptions): ICircle; - /** * Returns complexity of an instance * @return {Number} complexity of this instance */ complexity(): number; /** - * Returns horizontal radius of an object (according to how an object is scaled) - * @return {Number} - */ + * Returns horizontal radius of an object (according to how an object is scaled) + * @return {Number} + */ getRadiusX(): number; /** * Returns vertical radius of an object (according to how an object is scaled) @@ -1629,14 +1634,14 @@ declare module fabric { } interface ICircleStatic { /** - * List of attribute names to account for when parsing SVG element (used by {@link fabric.Circle.fromElement}) - */ + * List of attribute names to account for when parsing SVG element (used by {@link fabric.Circle.fromElement}) + */ ATTRIBUTE_NAMES: string[]; /** - * Returns Circle instance from an SVG element - * @param {SVGElement} element Element to parse - * @param {Object} [options] Options object - */ + * Returns Circle instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ fromElement(element: SVGElement, options: ICircleOptions): ICircle; /** * Returns Circle instance from an object representation @@ -1652,8 +1657,8 @@ declare module fabric { interface IEllipseOptions extends IObjectOptions { /** - * Horizontal radius - */ + * Horizontal radius + */ rx?: number; /** * Vertical radius @@ -1661,7 +1666,6 @@ declare module fabric { ry?: number; } interface IEllipse extends IObject, IEllipseOptions { - initialize(options?: IEllipseOptions): IEllipse; /** * Returns horizontal radius of an object (according to how an object is scaled) * @return {Number} @@ -1694,8 +1698,8 @@ declare module fabric { interface IEllipseStatic { new (options?: IEllipseOptions): IEllipse; /** - * List of attribute names to account for when parsing SVG element (used by {@link fabric.Ellipse.fromElement}) - */ + * List of attribute names to account for when parsing SVG element (used by {@link fabric.Ellipse.fromElement}) + */ ATTRIBUTE_NAMES: string[]; /** @@ -1703,7 +1707,7 @@ declare module fabric { * @param {SVGElement} element Element to parse * @param {Object} [options] Options object */ - fromElement(element: SVGElement, options?: IEllipseOptions): IEllipse + fromElement(element: SVGElement, options?: IEllipseOptions): IEllipse; /** * Returns Ellipse instance from an object representation @@ -1713,9 +1717,6 @@ declare module fabric { } interface IGroup extends IObject, ICollection { - initialize(objects?: IObject[], options?: IObjectOptions): any; - type: string; - activateAllObjects(): IGroup; /** * Adds an object to a group; Then recalculates group's dimension, position. @@ -1724,23 +1725,23 @@ declare module fabric { * @chainable */ addWithUpdate(object: IObject): IGroup; - containsPoint(point): boolean; + containsPoint(point: IPoint): boolean; /** - * Destroys a group (restoring state of its objects) - * @return {fabric.Group} thisArg - * @chainable - */ + * Destroys a group (restoring state of its objects) + * @return {fabric.Group} thisArg + * @chainable + */ destroy(): IGroup; /** - * Returns requested property - * @param {String} prop Property to get - * @return {Any} - */ + * Returns requested property + * @param {String} prop Property to get + * @return {Any} + */ get(prop: string): any; /** - * Checks whether this group was moved (since `saveCoords` was called last) - * @return {Boolean} true if an object was moved (since fabric.Group#saveCoords was called) - */ + * Checks whether this group was moved (since `saveCoords` was called last) + * @return {Boolean} true if an object was moved (since fabric.Group#saveCoords was called) + */ hasMoved(): boolean; /** * Removes an object from a group; Then recalculates group's dimension, position. @@ -1755,11 +1756,11 @@ declare module fabric { */ render(ctx: CanvasRenderingContext2D): void; /** - * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) - * @param {...fabric.Object} object Zero or more fabric instances - * @return {Self} thisArg - * @chainable - */ + * Removes objects from a collection, then renders canvas (if `renderOnAddRemove` is not `false`) + * @param {...fabric.Object} object Zero or more fabric instances + * @return {Self} thisArg + * @chainable + */ remove(...object: IObject[]): IGroup; /** * Saves coordinates of this instance (to be used together with `hasMoved`) @@ -1774,7 +1775,6 @@ declare module fabric { * @chainable */ setObjectsCoords(): IGroup; - toGrayscale(): IGroup; /** * Returns object representation of an instance * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output @@ -1836,14 +1836,14 @@ declare module fabric { /** * Image filter array */ - filters: IFilter[]; + filters: IBaseFilter[]; } interface IImage extends IObject, IImageOptions { initialize(element?: string|HTMLImageElement, options?: IImageOptions); /** - * Applies filters assigned to this image (from "filters" array) - * @param {Function} callback Callback is invoked when all filters have been applied and new image is generated - */ + * Applies filters assigned to this image (from "filters" array) + * @param {Function} callback Callback is invoked when all filters have been applied and new image is generated + */ applyFilters(callback: Function); /** * Returns a clone of an instance @@ -1874,18 +1874,18 @@ declare module fabric { render(ctx: CanvasRenderingContext2D, noTransform: boolean); /** - * Sets image element for this instance to a specified one. - * If filters defined they are applied to new image. - * You might need to call `canvas.renderAll` and `object.setCoords` after replacing, to render new image and update controls area. - * @param {HTMLImageElement} element - * @param {Function} [callback] Callback is invoked when all filters have been applied and new image is generated - * @param {Object} [options] Options object - */ + * Sets image element for this instance to a specified one. + * If filters defined they are applied to new image. + * You might need to call `canvas.renderAll` and `object.setCoords` after replacing, to render new image and update controls area. + * @param {HTMLImageElement} element + * @param {Function} [callback] Callback is invoked when all filters have been applied and new image is generated + * @param {Object} [options] Options object + */ setElement(element: HTMLImageElement, callback: Function, options: IImageOptions): IImage; /** * Sets crossOrigin value (on an instance and corresponding image element) */ - setCrossOrigin(value): IImage; + setCrossOrigin(value: string): IImage; /** * Returns object representation of an instance * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output @@ -1919,30 +1919,30 @@ declare module fabric { */ new (element: HTMLImageElement, objObjects: IObjectOptions): IImage; /** - * Creates an instance of fabric.Image from an URL string - * @param {String} url URL to create an image from - * @param {Function} [callback] Callback to invoke when image is created (newly created image is passed as a first argument) - * @param {Object} [imgOptions] Options object - */ + * Creates an instance of fabric.Image from an URL string + * @param {String} url URL to create an image from + * @param {Function} [callback] Callback to invoke when image is created (newly created image is passed as a first argument) + * @param {Object} [imgOptions] Options object + */ fromURL(url: string, callback?: (image: IImage) => any, objObjects?: IObjectOptions): IImage; /** - * Creates an instance of fabric.Image from its object representation - * @static - * @param {Object} object Object to create an instance from - * @param {Function} [callback] Callback to invoke when an image instance is created - */ + * Creates an instance of fabric.Image from its object representation + * @static + * @param {Object} object Object to create an instance from + * @param {Function} [callback] Callback to invoke when an image instance is created + */ fromObject(object: any, callback: (image: IImage) => {}): void; /** - * Returns Image instance from an SVG element - * @param {SVGElement} element Element to parse - * @param {Function} callback Callback to execute when fabric.Image object is created - * @param {Object} [options] Options object - */ + * Returns Image instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Function} callback Callback to execute when fabric.Image object is created + * @param {Object} [options] Options object + */ fromElement(element: SVGElement, callback: Function, options?: IImageOptions): void; prototype: any; /** - * Default CSS class name for canvas - */ + * Default CSS class name for canvas + */ CSS_CANVAS: string; filters: IAllFilters @@ -1990,16 +1990,16 @@ declare module fabric { interface ILineStatic { ATTRIBUTE_NAMES: string[]; /** - * Returns fabric.Line instance from an SVG element - * @param {SVGElement} element Element to parse - * @param {Object} [options] Options object - */ + * Returns fabric.Line instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ fromElement(element: SVGElement, options?: ILineOptions): ILine; /** - * Returns fabric.Line instance from an object representation - * @param {Object} object Object to create an instance from - */ - fromObject(object): ILine; + * Returns fabric.Line instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ILine; prototype: any; /** * Constructor @@ -2011,294 +2011,292 @@ declare module fabric { interface IObjectOptions { /** - * Type of an object (rect, circle, path, etc.). - * Note that this property is meant to be read-only and not meant to be modified. - * If you modify, certain parts of Fabric (such as JSON loading) won't work correctly. - */ + * Type of an object (rect, circle, path, etc.). + * Note that this property is meant to be read-only and not meant to be modified. + * If you modify, certain parts of Fabric (such as JSON loading) won't work correctly. + */ type?: string; /** - * Horizontal origin of transformation of an object (one of "left", "right", "center") - */ + * Horizontal origin of transformation of an object (one of "left", "right", "center") + */ originX?: string; /** - * Vertical origin of transformation of an object (one of "top", "bottom", "center") - */ + * Vertical origin of transformation of an object (one of "top", "bottom", "center") + */ originY?: string; /** - * Top position of an object. Note that by default it's relative to object center. You can change this by setting originY={top/center/bottom} - */ + * Top position of an object. Note that by default it's relative to object center. You can change this by setting originY={top/center/bottom} + */ top?: number; /** - * Left position of an object. Note that by default it's relative to object center. You can change this by setting originX={left/center/right} - */ + * Left position of an object. Note that by default it's relative to object center. You can change this by setting originX={left/center/right} + */ left?: number; /** - * Object width - */ + * Object width + */ width?: number; /** - * Object height - */ + * Object height + */ height?: number; /** - * Object scale factor (horizontal) - */ + * Object scale factor (horizontal) + */ scaleX?: number; /** - * Object scale factor (vertical) - */ + * Object scale factor (vertical) + */ scaleY?: number; /** - * When true, an object is rendered as flipped horizontally - */ + * When true, an object is rendered as flipped horizontally + */ flipX?: boolean; /** - * When true, an object is rendered as flipped vertically - */ + * When true, an object is rendered as flipped vertically + */ flipY?: boolean; /** - * Opacity of an object - */ + * Opacity of an object + */ opacity?: number; /** - * Angle of rotation of an object (in degrees) - */ + * Angle of rotation of an object (in degrees) + */ angle?: number; /** - * Size of object's controlling corners (in pixels) - */ + * Size of object's controlling corners (in pixels) + */ cornerSize?: number; /** - * When true, object's controlling corners are rendered as transparent inside (i.e. stroke instead of fill) - */ + * When true, object's controlling corners are rendered as transparent inside (i.e. stroke instead of fill) + */ transparentCorners?: boolean; /** - * Default cursor value used when hovering over this object on canvas - */ + * Default cursor value used when hovering over this object on canvas + */ hoverCursor?: string; /** - * Padding between object and its controlling borders (in pixels) - */ + * Padding between object and its controlling borders (in pixels) + */ padding?: number; /** - * Color of controlling borders of an object (when it's active) - */ + * Color of controlling borders of an object (when it's active) + */ borderColor?: string; /** - * Color of controlling corners of an object (when it's active) - */ + * Color of controlling corners of an object (when it's active) + */ cornerColor?: string; /** - * When true, this object will use center point as the origin of transformation - * when being scaled via the controls. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ + * When true, this object will use center point as the origin of transformation + * when being scaled via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ centeredScaling?: boolean; /** - * When true, this object will use center point as the origin of transformation - * when being rotated via the controls. - * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). - */ + * When true, this object will use center point as the origin of transformation + * when being rotated via the controls. + * Backwards incompatibility note: This property replaces "centerTransform" (Boolean). + */ centeredRotation?: boolean; /** - * Color of object's fill - */ + * Color of object's fill + */ fill?: string; /** - * Fill rule used to fill an object - * accepted values are nonzero, evenodd - * Backwards incompatibility note: This property was used for setting globalCompositeOperation until v1.4.12 (use `fabric.Object#globalCompositeOperation` instead) - */ + * Fill rule used to fill an object + * accepted values are nonzero, evenodd + * Backwards incompatibility note: This property was used for setting globalCompositeOperation until v1.4.12, use `globalCompositeOperation` instead + */ fillRule?: string; /** - * Composite rule used for canvas globalCompositeOperation - */ + * Composite rule used for canvas globalCompositeOperation + */ globalCompositeOperation?: string; /** - * Background color of an object. Only works with text objects at the moment. - */ + * Background color of an object. Only works with text objects at the moment. + */ backgroundColor?: string; /** - * When defined, an object is rendered via stroke and this property specifies its color - */ + * When defined, an object is rendered via stroke and this property specifies its color + */ stroke?: string; /** - * Width of a stroke used to render this object - */ + * Width of a stroke used to render this object + */ strokeWidth?: number; /** - * Array specifying dash pattern of an object's stroke (stroke must be defined) - */ + * Array specifying dash pattern of an object's stroke (stroke must be defined) + */ strokeDashArray?: any[]; /** - * Line endings style of an object's stroke (one of "butt", "round", "square") - */ + * Line endings style of an object's stroke (one of "butt", "round", "square") + */ strokeLineCap?: string; /** - * Corner style of an object's stroke (one of "bevil", "round", "miter") - */ + * Corner style of an object's stroke (one of "bevil", "round", "miter") + */ strokeLineJoin?: string; /** - * Maximum miter length (used for strokeLineJoin = "miter") of an object's stroke - */ + * Maximum miter length (used for strokeLineJoin = "miter") of an object's stroke + */ strokeMiterLimit?: number; /** - * Shadow object representing shadow of this shape - */ + * Shadow object representing shadow of this shape + */ shadow?: IShadow|string; /** - * Opacity of object's controlling borders when object is active and moving - */ + * Opacity of object's controlling borders when object is active and moving + */ borderOpacityWhenMoving?: number; /** - * Scale factor of object's controlling borders - */ + * Scale factor of object's controlling borders + */ borderScaleFactor?: number; /** - * Transform matrix (similar to SVG's transform matrix) - */ + * Transform matrix (similar to SVG's transform matrix) + */ transformMatrix?: any[]; /** - * Minimum allowed scale value of an object - */ + * Minimum allowed scale value of an object + */ minScaleLimit?: number; /** - * When set to `false`, an object can not be selected for modification (using either point-click-based or group-based selection). - * But events still fire on it. - */ + * When set to `false`, an object can not be selected for modification (using either point-click-based or group-based selection). + * But events still fire on it. + */ selectable?: boolean; /** - * When set to `false`, an object can not be a target of events. All events propagate through it. Introduced in v1.3.4 - */ + * When set to `false`, an object can not be a target of events. All events propagate through it. Introduced in v1.3.4 + */ evented?: boolean; /** - * When set to `false`, an object is not rendered on canvas - */ + * When set to `false`, an object is not rendered on canvas + */ visible?: boolean; /** - * When set to `false`, object's controls are not displayed and can not be used to manipulate object - */ + * When set to `false`, object's controls are not displayed and can not be used to manipulate object + */ hasControls?: boolean; /** - * When set to `false`, object's controlling borders are not rendered - */ + * When set to `false`, object's controlling borders are not rendered + */ hasBorders?: boolean; /** - * When set to `false`, object's controlling rotating point will not be visible or selectable - */ + * When set to `false`, object's controlling rotating point will not be visible or selectable + */ hasRotatingPoint?: boolean; /** - * Offset for object's controlling rotating point (when enabled via `hasRotatingPoint`) - */ + * Offset for object's controlling rotating point (when enabled via `hasRotatingPoint`) + */ rotatingPointOffset?: number; /** - * When set to `true`, objects are "found" on canvas on per-pixel basis rather than according to bounding box - */ + * When set to `true`, objects are "found" on canvas on per-pixel basis rather than according to bounding box + */ perPixelTargetFind?: boolean; /** - * When `false`, default object's values are not included in its serialization - */ + * When `false`, default object's values are not included in its serialization + */ includeDefaultValues?: boolean; /** - * Function that determines clipping of an object (context is passed as a first argument) - * Note that context origin is at the object's center point (not left/top corner) - * @type Function - */ + * Function that determines clipping of an object (context is passed as a first argument) + * Note that context origin is at the object's center point (not left/top corner) + * @type Function + */ clipTo?: Function; /** - * When `true`, object horizontal movement is locked - */ + * When `true`, object horizontal movement is locked + */ lockMovementX?: boolean; /** - * When `true`, object vertical movement is locked - */ + * When `true`, object vertical movement is locked + */ lockMovementY?: boolean; /** - * When `true`, object rotation is locked - */ + * When `true`, object rotation is locked + */ lockRotation?: boolean; /** - * When `true`, object horizontal scaling is locked - */ + * When `true`, object horizontal scaling is locked + */ lockScalingX?: boolean; /** - * When `true`, object vertical scaling is locked - */ + * When `true`, object vertical scaling is locked + */ lockScalingY?: boolean; /** - * When `true`, object non-uniform scaling is locked - */ + * When `true`, object non-uniform scaling is locked + */ lockUniScaling?: boolean; /** - * When `true`, object cannot be flipped by scaling into negative values - */ + * When `true`, object cannot be flipped by scaling into negative values + */ lockScalingFlip?: boolean; /** - * Not used by fabric, just for convenience - */ + * Not used by fabric, just for convenience + */ name?: string; /** - * Not used by fabric, just for convenience - */ + * Not used by fabric, just for convenience + */ data?: any; } interface IObject extends IObservable, IObjectOptions, IObjectAnimation { - - getCurrentWidth(): number; getCurrentHeight(): number; @@ -2310,7 +2308,6 @@ declare module fabric { getBorderScaleFactor(): number; - getCornersize(): number; setCornersize(value: number): IObject; @@ -2356,216 +2353,420 @@ declare module fabric { setWidth(value: number): IObject; /* * Sets object's properties from options - * @param {Object} [options] Options object - */ + * @param {Object} [options] Options object + */ setOptions(options: any): void; /** - * Transforms context when rendering an object - * @param {CanvasRenderingContext2D} ctx Context - * @param {Boolean} fromLeft When true, context is transformed to object's top/left corner. This is used when rendering text on Node - */ + * Transforms context when rendering an object + * @param {CanvasRenderingContext2D} ctx Context + * @param {Boolean} fromLeft When true, context is transformed to object's top/left corner. This is used when rendering text on Node + */ transform(ctx: CanvasRenderingContext2D, fromLeft: boolean): void; /** - * Returns an object representation of an instance - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ - toObject(propertiesToInclude?: any[]): any; + * Returns an object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ + toObject(propertiesToInclude?: any[]): any; /** - * Returns (dataless) object representation of an instance - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ + * Returns (dataless) object representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ toDatalessObject(propertiesToInclude?: any[]): any; /** - * Returns a string representation of an instance - */ + * Returns a string representation of an instance + */ toString(): string; /** - * Basic getter - * @param {String} property Property name - */ + * Basic getter + * @param {String} property Property name + */ get(property: string): any; /** - * Sets property to a given value. When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. - * If you need to update those, call `setCoords()`. - * @param {String|Object} key Property name or object (if object, iterate over the object properties) - * @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one) - */ - set(key: string|any, value: any|Function): IObject; + * Sets property to a given value. + * When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. + * If you need to update those, call `setCoords()`. + * @param {String} key Property name + * @param {Object|Function} value Property value (if function, the value is passed into it and its return value is used as a new one) + */ + set(key: string, value: any|Function): IObject; + /** + * Sets property to a given value. + * When changing position/dimension -related properties (left, top, scale, angle, etc.) `set` does not update position of object's borders/controls. + * If you need to update those, call `setCoords()`. + * @param Object key Property object, iterate over the object properties + */ + set(key: any): IObject; /** - * Toggles specified property from `true` to `false` or from `false` to `true` - * @param {String} property Property to toggle - */ + * Toggles specified property from `true` to `false` or from `false` to `true` + * @param {String} property Property to toggle + */ toggle(property: string): IObject; /** - * Sets sourcePath of an object - * @param {String} value Value to set sourcePath to - */ - setSourcePath(value): IObject + * Sets sourcePath of an object + * @param {String} value Value to set sourcePath to + */ + setSourcePath(value: string): IObject; /** - * Retrieves viewportTransform from Object's canvas if possible - * @method getViewportTransform - * @memberOf fabric.Object.prototype - */ + * Retrieves viewportTransform from Object's canvas if possible + */ getViewportTransform(): boolean; - /** - * Renders an object on a specified context - * @param {CanvasRenderingContext2D} ctx Context to render on - * @param {Boolean} [noTransform] When true, context is not transformed - */ + * Renders an object on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render on + * @param {Boolean} [noTransform] When true, context is not transformed + */ render(ctx: CanvasRenderingContext2D, noTransform?: boolean): void; /** - * Clones an instance - * @param {Function} callback Callback is invoked with a clone as a first argument - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ + * Clones an instance + * @param {Function} callback Callback is invoked with a clone as a first argument + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ clone(callback: Function, propertiesToInclude?: any[]): IObject; /** - * Creates an instance of fabric.Image out of an object - * @param {Function} callback callback, invoked with an instance as a first argument - */ + * Creates an instance of fabric.Image out of an object + * @param {Function} callback callback, invoked with an instance as a first argument + */ cloneAsImage(callback: (image: IImage) => any): IObject; - /** - * Converts an object into a data-url-like string - * @param options Options object - */ + * Converts an object into a data-url-like string + * @param options Options object + */ toDataURL(options: IDataURLOptions): string; /** - * Returns true if specified type is identical to the type of an instance - * @param {String} type Type to check against - */ + * Returns true if specified type is identical to the type of an instance + * @param {String} type Type to check against + */ isType(type: string): boolean; /** - * Returns complexity of an instance - */ + * Returns complexity of an instance + */ complexity(): number; /** - * Returns a JSON representation of an instance - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - */ + * Returns a JSON representation of an instance + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + */ toJSON(propertiesToInclude?: any[]): any; - - /** - * Sets gradient (fill or stroke) of an object - * Backwards incompatibility note: This method was named "setGradientFill" until v1.1.0 - * @param {String} property Property name 'stroke' or 'fill' - * @param {Object} [options] Options object - */ - setGradient(property: string, options: IGradientOptions): IObject; - + * Sets gradient (fill or stroke) of an object + * Backwards incompatibility note: This method was named "setGradientFill" until v1.1.0 + * @param {String} property Property name 'stroke' or 'fill' + * @param {Object} [options] Options object + */ + setGradient(property: string, options: IGradientOptions): IObject; /** - * Sets pattern fill of an object - * @param {Object} options Options object - */ + * Sets pattern fill of an object + * @param {Object} options Options object + */ setPatternFill(options: IFillOptions): IObject; /** - * Sets shadow of an object - * @param {String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") - */ + * Sets shadow of an object + * @param {String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") + */ setShadow(options?: string): IObject; /** - * Sets shadow of an object - * @param [options] Options object - */ + * Sets shadow of an object + * @param [options] Options object + */ setShadow(options: IShadow): IObject; /** - * Sets "color" of an instance (alias of `set('fill', …)`) - * @param {String} color Color value - */ + * Sets "color" of an instance (alias of `set('fill', …)`) + * @param {String} color Color value + */ setColor(color: string): IObject; /** - * Sets "angle" of an instance - * @param {Number} angle Angle value - */ - setAngle(angle: number): IObject + * Sets "angle" of an instance + * @param {Number} angle Angle value + */ + setAngle(angle: number): IObject; /** - * Sets "angle" of an instance - * @param {Number} angle Angle value - */ - rotate(angle: number): IObject + * Sets "angle" of an instance + * @param {Number} angle Angle value + */ + rotate(angle: number): IObject; /** - * Centers object horizontally on canvas to which it was added last. - * You might need to call `setCoords` on an object after centering, to update controls area. - */ + * Centers object horizontally on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + */ centerH(): void; /** - * Centers object vertically on canvas to which it was added last. - * You might need to call `setCoords` on an object after centering, to update controls area. - */ + * Centers object vertically on canvas to which it was added last. + * You might need to call `setCoords` on an object after centering, to update controls area. + */ centerV(): void; /** - * Centers object vertically and horizontally on canvas to which is was added last - * You might need to call `setCoords` on an object after centering, to update controls area. - */ + * Centers object vertically and horizontally on canvas to which is was added last + * You might need to call `setCoords` on an object after centering, to update controls area. + */ center(): void; /** - * Removes object from canvas to which it was added last - */ + * Removes object from canvas to which it was added last + */ remove(): IObject; /** - * Returns coordinates of a pointer relative to an object - * @param {Event} e Event to operate upon - * @param {Object} [pointer] Pointer to operate upon (instead of event) - */ + * Returns coordinates of a pointer relative to an object + * @param {Event} e Event to operate upon + * @param {Object} [pointer] Pointer to operate upon (instead of event) + */ getLocalPointer(e: Event, pointer: any): any; - // methods - bringForward(intersecting?: boolean): IObject; - bringToFront(): IObject; - drawBorders(context: CanvasRenderingContext2D): IObject; - drawCorners(context: CanvasRenderingContext2D): IObject; - getBoundingRect(): { left: number; top: number; width: number; height: number }; - getBoundingRectHeight(): number; - getBoundingRectWidth(): number; - getSvgStyles(): string; - getSvgTransform(): string; - hasStateChanged(): boolean; - initialize(options: any); - intersectsWithObject(other: IObject): boolean; - intersectsWithRect(selectionTL: any, selectionBR: any): boolean; - isActive(): boolean; - isContainedWithinObject(other: IObject): boolean; - isContainedWithinRect(selectionTL: any, selectionBR: any): boolean; - saveState(): IObject; - scale(value: number): IObject; - scaleToHeight(value: number): IObject; - scaleToWidth(value: number): IObject; - sendBackwards(intersecting?: boolean): IObject; - sendToBack(): IObject; - - setActive(active: boolean): IObject; - setCoords(); + /** + * Sets object's properties from options + * @param {Object} [options] Options object + */ setOptions(options: any); + /** + * Sets sourcePath of an object + * @param {String} value Value to set sourcePath to + */ setSourcePath(value: string): IObject; - toGrayscale(): IObject; + // functions from object svg export mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Returns styles-string for svg-export + */ + getSvgStyles(): string; + /** + * Returns transform-string for svg-export + */ + getSvgTransform(): string; + /** + * Returns transform-string for svg-export from the transform matrix of single elements + */ + getSvgTransformMatrix(): string; + + // functions from stateful mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Returns true if object state (one of its state properties) was changed + */ + hasStateChanged(): boolean; + /** + * Saves state of an object + * @param {Object} [options] Object with additional `stateProperties` array to include when saving state + * @return {fabric.Object} thisArg + */ + saveState(options?: { stateProperties: any[] }): IObject; + /** + * Setups state of an object + */ + setupState(): IObject; + // functions from object straightening mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Straightens an object (rotating it from current angle to one of 0, 90, 180, 270, etc. depending on which is closer) + */ + straighten(): IObject; + /** + * Same as straighten but with animation + * @param {Object} callbacks Object with callback functions + * @param {Function} [callbacks.onComplete] Invoked on completion + * @param {Function} [callbacks.onChange] Invoked on every step of animation + */ + fxStraighten(callbacks: { onComplete?: Function; onChange: Function }): IObject; + + // functions from object stacking mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Moves an object up in stack of drawn objects + * @param {Boolean} [intersecting] If `true`, send object in front of next upper intersecting object + */ + bringForward(intersecting?: boolean): IObject; + /** + * Moves an object to the top of the stack of drawn objects + */ + bringToFront(): IObject; + /** + * Moves an object down in stack of drawn objects + * @param {Boolean} [intersecting] If `true`, send object behind next lower intersecting object + */ + sendBackwards(intersecting?: boolean): IObject; + /** + * Moves an object to the bottom of the stack of drawn objects + */ + sendToBack(): IObject; + /** + * Moves an object to specified level in stack of drawn objects + * @param {Number} index New position of object + */ + moveTo(index: number): IObject; + + // functions from object origin mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /** + * Translates the coordinates from origin to center coordinates (based on the object's dimensions) + * @param {fabric.Point} point The point which corresponds to the originX and originY params + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + translateToCenterPoint(point: IPoint, originX: string, originY: string): IPoint; + + /** + * Translates the coordinates from center to origin coordinates (based on the object's dimensions) + * @param {fabric.Point} center The point which corresponds to center of the object + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + translateToOriginPoint(center: IPoint, originX: string, originY: string): IPoint; + /** + * Returns the real center coordinates of the object + */ + getCenterPoint(): IPoint; + + /** + * Returns the coordinates of the object as if it has a different origin + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + getPointByOrigin(): IPoint; + + /** + * Returns the point in local coordinates + * @param {fabric.Point} point The point relative to the global coordinate system + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + */ + toLocalPoint(point: IPoint, originX: string, originY: string): IPoint; + + /** + * Sets the position of the object taking into consideration the object's origin + * @param {fabric.Point} pos The new position of the object + * @param {String} originX Horizontal origin: 'left', 'center' or 'right' + * @param {String} originY Vertical origin: 'top', 'center' or 'bottom' + * @return {void} + */ + setPositionByOrigin(pos: IPoint, originX: string, originY: string): void; + + /** + * @param {String} to One of 'left', 'center', 'right' + */ + adjustPosition(to: string): void; + + // functions from interactivity mixin + // ----------------------------------------------------------------------------------------------------------------------------------- + /**- + * Draws borders of an object's bounding box. + * Requires public properties: width, height + * Requires public options: padding, borderColor + * @param {CanvasRenderingContext2D} ctx Context to draw on + */ + drawBorders(context: CanvasRenderingContext2D): IObject; + + /** + * Draws corners of an object's bounding box. + * Requires public properties: width, height + * Requires public options: cornerSize, padding + * @param {CanvasRenderingContext2D} ctx Context to draw on + */ + drawCorners(context: CanvasRenderingContext2D): IObject; + + /** + * Returns true if the specified control is visible, false otherwise. + * @param {String} controlName The name of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'. + */ + isControlVisible(controlName: string): boolean; + /** + * Sets the visibility of the specified control. + * @param {String} controlName The name of the control. Possible values are 'tl', 'tr', 'br', 'bl', 'ml', 'mt', 'mr', 'mb', 'mtr'. + * @param {Boolean} visible true to set the specified control visible, false otherwise + */ + setControlVisible(controlName: string, visible: boolean): IObject; + + /** + * Sets the visibility state of object controls. + * @param {Object} [options] Options object + */ + setControlsVisibility(options?: { + bl?: boolean; + br?: boolean; + mb?: boolean; + ml?: boolean; + mr?: boolean; + mt?: boolean; + tl?: boolean; + tr?: boolean; + mtr?: boolean; }): IObject; + + // functions from geometry mixin + // ------------------------------------------------------------------------------------------------------------------------------- + /** + * Sets corner position coordinates based on current angle, width and height + * See https://github.com/kangax/fabric.js/wiki/When-to-call-setCoords + */ + setCoords(): IObject; + /** + * Returns coordinates of object's bounding rectangle (left, top, width, height) + * @return {Object} Object with left, top, width, height properties + */ + getBoundingRect(): { left: number; top: number; width: number; height: number }; + /** + * Checks if object is fully contained within area of another object + * @param {Object} other Object to test + */ + isContainedWithinObject(other: IObject): boolean; + /** + * Checks if object is fully contained within area formed by 2 points + * @param {Object} pointTL top-left point of area + * @param {Object} pointBR bottom-right point of area + */ + isContainedWithinRect(pointTL: any, pointBR: any): boolean; + /** + * Checks if point is inside the object + * @param {fabric.Point} point Point to check against + */ + containsPoint(point: IPoint): boolean; + /** + * Scales an object (equally by x and y) + * @param {Number} value Scale factor + * @return {fabric.Object} thisArg + */ + scale(value: number): IObject; + /** + * Scales an object to a given height, with respect to bounding box (scaling by x/y equally) + * @param {Number} value New height value + */ + scaleToHeight(value: number): IObject; + /** + * Scales an object to a given width, with respect to bounding box (scaling by x/y equally) + * @param {Number} value New width value + */ + scaleToWidth(value: number): IObject; + /** + * Checks if object intersects with another object + * @param {Object} other Object to test + */ + intersectsWithObject(other: IObject): boolean; + /** + * Checks if object intersects with an area formed by 2 points + * @param {Object} pointTL top-left point of area + * @param {Object} pointBR bottom-right point of area + */ + intersectsWithRect(pointTL: any, pointBR: any): boolean; } interface IObjectStatic { prototype: any; @@ -2661,9 +2862,9 @@ declare module fabric { */ isSameColor(): boolean; /** - * Renders this group on a specified context - * @param {CanvasRenderingContext2D} ctx Context to render this instance on - */ + * Renders this group on a specified context + * @param {CanvasRenderingContext2D} ctx Context to render this instance on + */ render(ctx: CanvasRenderingContext2D); /** * Returns dataless object representation of this path group @@ -2671,12 +2872,11 @@ declare module fabric { * @return {Object} dataless object representation of an instance */ toDatalessObject(propertiesToInclude?: any[]): any; - toGrayscale(): IPathGroup; /** - * Returns object representation of this path group - * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - * @return {Object} object representation of an instance - */ + * Returns object representation of this path group + * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output + * @return {Object} object representation of an instance + */ toObject(propertiesToInclude?: any[]): any; /** * Returns a string representation of this path group @@ -2696,7 +2896,7 @@ declare module fabric { getObjects(): IPath[]; } interface IPathGroupStatic { - fromObject(object): IPathGroup; + fromObject(object: any): IPathGroup; /** * Constructor * @param {Array} paths @@ -2704,12 +2904,12 @@ declare module fabric { */ new (paths: IPath[], options?: IObjectOptions): IPathGroup; /** - * Creates fabric.PathGroup instance from an object representation - * @static - * @memberOf fabric.PathGroup - * @param {Object} object Object to create an instance from - * @param {Function} callback Callback to invoke when an fabric.PathGroup instance is created - */ + * Creates fabric.PathGroup instance from an object representation + * @static + * @memberOf fabric.PathGroup + * @param {Object} object Object to create an instance from + * @param {Function} callback Callback to invoke when an fabric.PathGroup instance is created + */ fromObject(object: any, callback: (group: IPathGroup) => any): void; prototype: any; } @@ -2718,7 +2918,7 @@ declare module fabric { /** * Points array */ - points?: IPoint[] + points?: IPoint[]; /** * Minimum X from points values, necessary to offset points @@ -2752,8 +2952,8 @@ declare module fabric { } interface IPolygonStatic { /** - * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) - */ + * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) + */ ATTRIBUTE_NAMES: string[]; /** @@ -2763,9 +2963,9 @@ declare module fabric { */ fromElement(element: SVGElement, options?: IPolygonOptions): IPolygon; /** - * Returns fabric.Polygon instance from an object representation - * @param {Object} object Object to create an instance from - */ + * Returns fabric.Polygon instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object: any): IPolygon; /** * Constructor @@ -2780,7 +2980,7 @@ declare module fabric { /** * Points array */ - points?: IPoint[] + points?: IPoint[]; /** * Minimum X from points values, necessary to offset points @@ -2814,8 +3014,8 @@ declare module fabric { } interface IPolylineStatic { /** - * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) - */ + * List of attribute names to account for when parsing SVG element (used by `fabric.Polygon.fromElement`) + */ ATTRIBUTE_NAMES: string[]; /** @@ -2825,9 +3025,9 @@ declare module fabric { */ fromElement(element: SVGElement, options?: IPolylineOptions): IPolyline; /** - * Returns fabric.Polyline instance from an object representation - * @param {Object} object Object to create an instance from - */ + * Returns fabric.Polyline instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object: any): IPolyline; /** * Constructor @@ -2875,19 +3075,19 @@ declare module fabric { } interface IRectStatic { /** - * List of attribute names to account for when parsing SVG element (used by `fabric.Rect.fromElement`) - */ + * List of attribute names to account for when parsing SVG element (used by `fabric.Rect.fromElement`) + */ ATTRIBUTE_NAMES: string[]; /** - * Returns Rect instance from an SVG element - * @param {SVGElement} element Element to parse - * @param {Object} [options] Options object - */ + * Returns Rect instance from an SVG element + * @param {SVGElement} element Element to parse + * @param {Object} [options] Options object + */ fromElement(element: SVGElement, options?: IRectOptions): IRect; /** - * Returns Rect instance from an object representation - * @param {Object} object Object to create an instance from - */ + * Returns Rect instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object: any): IRect; /** * Constructor @@ -2907,8 +3107,8 @@ declare module fabric { */ fontWeight?: number|string; /** - * Font family - */ + * Font family + */ fontFamily?: string; /** * Text decoration Possible values?: "", "underline", "overline" or "line-through". @@ -2927,9 +3127,9 @@ declare module fabric { */ lineHeight?: number; /** - * When defined, an object is rendered via stroke and this property specifies its color. - * Backwards incompatibility note?: This property was named "strokeStyle" until v1.1.6 - */ + * When defined, an object is rendered via stroke and this property specifies its color. + * Backwards incompatibility note?: This property was named "strokeStyle" until v1.1.6 + */ stroke?: string; /** * Shadow object representing shadow of this shape. @@ -2938,8 +3138,6 @@ declare module fabric { shadow?: IShadow|string; /** * Background color of text lines - * @type String - * @default */ textBackgroundColor?: string; @@ -2948,18 +3146,13 @@ declare module fabric { text?: string; } interface IText extends IObject, ITextOptions { - - - initialize(text: string, options?: IITextOptions): IText; /** * Returns complexity of an instance - * @return {Number} complexity */ complexity(): number; /** - * Returns string representation of an instance - * @return {String} String representation of text object - */ + * Returns string representation of an instance + */ toString(): string; /** * Renders text instance on a specified context @@ -2968,15 +3161,12 @@ declare module fabric { render(ctx: CanvasRenderingContext2D, noTransform: boolean); /** * Returns object representation of an instance - * @method toObject * @param {Array} [propertiesToInclude] Any properties that you might want to additionally include in the output - * @return {Object} object representation of an instance */ toObject(propertiesToInclude?: any[]): IObject; /** * Returns SVG representation of an instance * @param {Function} [reviver] Method for further parsing of svg representation. - * @return {String} svg representation of an instance */ toSVG(reviver?: Function): string; /** @@ -2987,14 +3177,13 @@ declare module fabric { * Sets object's fontSize * @param {Number} fontSize Font size (in pixels) */ - setFontSize(fontSize): IText; + setFontSize(fontSize: number): IText; /** * Retrieves object's fontWeight */ getFontWeight(): number|string; /** * Sets object's fontWeight - * @method setFontWeight * @param {(Number|String)} fontWeight Font weight */ setFontWeight(fontWeight: string|number): IText; @@ -3061,12 +3250,11 @@ declare module fabric { * @param {String} textBackgroundColor Text background color */ setTextBackgroundColor(textBackgroundColor: string): IText; - } interface ITextStatic { /** - * List of attribute names to account for when parsing SVG element (used by `fabric.Text.fromElement`) - */ + * List of attribute names to account for when parsing SVG element (used by `fabric.Text.fromElement`) + */ ATTRIBUTE_NAMES: string[]; /** * Default SVG font size @@ -3084,8 +3272,7 @@ declare module fabric { * @param {SVGElement} element Element to parse * @param {Object} [options] Options object */ - fromElement(element: SVGElement, options?: ITextOptions): IText - + fromElement(element: SVGElement, options?: ITextOptions): IText; /** * Returns fabric.Text instance from an object representation * @param {Object} object Object to create an instance from @@ -3156,11 +3343,9 @@ declare module fabric { caching?: boolean; } interface IIText extends IObject, IText, IITextOptions { - initialize(text?: string, options?: IITextOptions): IText; - /** - * Returns true if object has no styling - */ + * Returns true if object has no styling + */ isEmptyStyles(): boolean; render(ctx: CanvasRenderingContext2D, noTransform: boolean); /** @@ -3183,11 +3368,11 @@ declare module fabric { */ setSelectionEnd(index: number): void; /** - * Gets style of a current selection/cursor (at the start position) - * @param {Number} [startIndex] Start index to get styles at - * @param {Number} [endIndex] End index to get styles at - * @return {Object} styles Style object at a specified (or current) index - */ + * Gets style of a current selection/cursor (at the start position) + * @param {Number} [startIndex] Start index to get styles at + * @param {Number} [endIndex] End index to get styles at + * @return {Object} styles Style object at a specified (or current) index + */ getSelectionStyles(startIndex: number, endIndex: number): any; /** * Sets style of a current selection @@ -3198,8 +3383,8 @@ declare module fabric { setSelectionStyles(styles: any): IText; /** - * Renders cursor or selection (depending on what exists) - */ + * Renders cursor or selection (depending on what exists) + */ renderCursorOrSelection(): void; /** @@ -3211,7 +3396,7 @@ declare module fabric { * Returns complete style of char at the current cursor * @param {Number} lineIndex Line index * @param {Number} charIndex Char index - * @return {Object} Character style + * @return {Object} Character style */ getCurrentCharStyle(lineIndex: number, charIndex: number): any; @@ -3234,15 +3419,166 @@ declare module fabric { * Renders cursor * @param {Object} boundaries */ - renderCursor(boundaries): void; + renderCursor(boundaries: any): void; /** - * Renders text selection - * @param {Array} chars Array of characters - * @param {Object} boundaries Object with left/top/leftOffset/topOffset - */ + * Renders text selection + * @param {Array} chars Array of characters + * @param {Object} boundaries Object with left/top/leftOffset/topOffset + */ renderSelection(chars: string[], boundaries: any): void; + // functions from itext behavior mixin + // ------------------------------------------------------------------------------------------------------------------------ + /** + * Initializes all the interactive behavior of IText + */ + initBehavior(): void; + + /** + * Initializes "selected" event handler + */ + initSelectedHandler(): void; + + /** + * Initializes "added" event handler + */ + initAddedHandler(): void; + + initRemovedHandler(): void; + + /** + * Initializes delayed cursor + */ + initDelayedCursor(restart: boolean): void; + + /** + * Aborts cursor animation and clears all timeouts + */ + abortCursorAnimation(): void; + + /** + * Selects entire text + */ + selectAll(): void; + + /** + * Returns selected text + */ + getSelectedText(): string; + + /** + * Find new selection index representing start of current word according to current selection index + * @param {Number} startFrom Surrent selection index + * @return {Number} New selection index + */ + findWordBoundaryLeft(startFrom: number): number; + + /** + * Find new selection index representing end of current word according to current selection index + * @param {Number} startFrom Current selection index + * @return {Number} New selection index + */ + findWordBoundaryRight(startFrom: number): number; + + /** + * Find new selection index representing start of current line according to current selection index + * @param {Number} startFrom Current selection index + */ + findLineBoundaryLeft(startFrom: number): number; + + /** + * Find new selection index representing end of current line according to current selection index + * @param {Number} startFrom Current selection index + */ + findLineBoundaryRight(startFrom: number): number; + + /** + * Returns number of newlines in selected text + */ + getNumNewLinesInSelectedText(): number; + + /** + * Finds index corresponding to beginning or end of a word + * @param {Number} selectionStart Index of a character + * @param {Number} direction: 1 or -1 + */ + searchWordBoundary(selectionStart: number, direction: number): number; + + /** + * Selects a word based on the index + * @param {Number} selectionStart Index of a character + */ + selectWord(selectionStart: number): void; + /** + * Selects a line based on the index + * @param {Number} selectionStart Index of a character + */ + selectLine(selectionStart: number): void; + + /** + * Enters editing state + */ + enterEditing(): IIText; + + /** + * Initializes "mousemove" event handler + */ + initMouseMoveHandler(): void; + /** + * Exits from editing state + * @return {fabric.IText} thisArg + * @chainable + */ + exitEditing(): IIText; + + /** + * Inserts a character where cursor is (replacing selection if one exists) + * @param {String} _chars Characters to insert + */ + insertChars(_chars: string, useCopiedStyle?: boolean): void; + /** + * Inserts new style object + * @param {Number} lineIndex Index of a line + * @param {Number} charIndex Index of a char + * @param {Boolean} isEndOfLine True if it's end of line + */ + insertNewlineStyleObject(lineIndex: number, charIndex: number, isEndOfLine: boolean): void; + + /** + * Inserts style object for a given line/char index + * @param {Number} lineIndex Index of a line + * @param {Number} charIndex Index of a char + * @param {Object} [style] Style object to insert, if given + */ + insertCharStyleObject(lineIndex: number, charIndex: number, isEndOfLine: boolean): void; + + /** + * Inserts style object(s) + * @param {String} _chars Characters at the location where style is inserted + * @param {Boolean} isEndOfLine True if it's end of line + * @param {Boolean} [useCopiedStyle] Style to insert + */ + insertStyleObjects(_chars: string, isEndOfLine: boolean, useCopiedStyle?: boolean): void; + + /** + * Shifts line styles up or down + * @param {Number} lineIndex Index of a line + * @param {Number} offset Can be -1 or +1 + */ + shiftLineStyles(lineIndex: number, offset: number): void; + + /** + * Removes style object + * @param {Boolean} isBeginningOfLine True if cursor is at the beginning of line + * @param {Number} [index] Optional index. When not given, current selectionStart is used. + */ + removeStyleObject(isBeginningOfLine: boolean, index?: number): void; + /** + * Inserts new line + */ + insertNewline(): void; + } interface IITextStatic extends ITextStatic { /** @@ -3252,16 +3588,14 @@ declare module fabric { */ new (text: string, options?: IITextOptions): IIText; /** - * Returns fabric.IText instance from an object representation - * @param {Object} object Object to create an instance from - */ + * Returns fabric.IText instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object: any): IIText; } interface ITriangleOptions extends IObjectOptions { } interface ITriangle extends IObject { - initialize(options: IObjectOptions): ITriangle; - /** * Returns complexity of an instance * @return {Number} complexity of this instance @@ -3282,9 +3616,9 @@ declare module fabric { */ new (options?: ITriangleOptions): ITriangle; /** - * Returns Triangle instance from an object representation - * @param {Object} object Object to create an instance from - */ + * Returns Triangle instance from an object representation + * @param {Object} object Object to create an instance from + */ fromObject(object: any): ITriangle; } @@ -3298,7 +3632,200 @@ declare module fabric { * @param {Object} [options] Options object */ new (options?: any): IBaseFilter; - } + }; + Blend: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: { color?: string; mode?: string; alpha?: number; image?: IImage }): IBlendFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IBlendFilter + }; + Brightness: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.brightness=0] Value to brighten the image up (0..255) + */ + new (options?: { brightness: number }): IBrightnessFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IBrightnessFilter + }; + Convolute: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Boolean} [options.opaque=false] Opaque value (true/false) + * @param {Array} [options.matrix] Filter matrix + */ + new (options?: { opaque?: boolean; matrix?: number[] }): IConvoluteFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IConvoluteFilter + }; + GradientTransparency: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.threshold=100] Threshold value + */ + new (options?: { threshold?: number; }): IGradientTransparencyFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IGradientTransparencyFilter + }; + Grayscale: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IGrayscaleFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IGrayscaleFilter + }; + Invert: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IInvertFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IInvertFilter + }; + Mask: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {fabric.Image} [options.mask] Mask image object + * @param {Number} [options.channel=0] Rgb channel (0, 1, 2 or 3) + */ + new (options?: { mask?: IImage; channel: number; }): IMaskFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IMaskFilter + }; + Multiply: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.color=#000000] Color to multiply the image pixels with + */ + new (options?: { color: string; }): IMultiplyFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IMultiplyFilter + }; + Noise: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.noise=0] Noise value + */ + new (options?: { noise: number; }): INoiseFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): INoiseFilter + }; + Pixelate: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.blocksize=4] Blocksize for pixelate + */ + new (options?: { blocksize?: number; }): IPixelateFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IPixelateFilter + }; + RemoveWhite: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {Number} [options.threshold=30] Threshold value + * @param {Number} [options.distance=20] Distance value + */ + new (options?: { threshold?: number; distance?: number; }): IRemoveWhiteFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IRemoveWhiteFilter + }; + Resize: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): IResizeFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): IResizeFilter + }; + Sepia2: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): ISepia2Filter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ISepia2Filter + }; + Sepia: { + /** + * Constructor + * @param {Object} [options] Options object + */ + new (options?: any): ISepiaFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ISepiaFilter + }; + Tint: { + /** + * Constructor + * @param {Object} [options] Options object + * @param {String} [options.color=#000000] Color to tint the image with + * @param {Number} [options.opacity] Opacity value that controls the tint effect's transparency (0..1) + */ + new (options?: { color?: string; opacity?: number; }): ITintFilter; + /** + * Returns filter instance from an object representation + * @param {Object} object Object to create an instance from + */ + fromObject(object: any): ITintFilter + }; } interface IBaseFilter { /** @@ -3309,528 +3836,761 @@ declare module fabric { /** * Returns object representation of an instance */ - toObject(): any; - + toObject(): any; /** * Returns a JSON representation of an instance */ toJSON(): string; } -} -interface IBrightnessFilter { -} -interface IInvertFilter { -} -interface IRemoveWhiteFilter { -} -interface IGrayscaleFilter { -} -interface ISepiaFilter { -} -interface ISepia2Filter { -} -interface INoiseFilter { -} -interface IGradientTransparencyFilter { -} -interface IPixelateFilter { -} -interface IConvoluteFilter { -} - - -/////////////////////////////////////////////////////////////////////////////// -// Fabric util Interface -////////////////////////////////////////////////////////////////////////////// -interface IUtilAnimationOptions { - /** - * Starting value - */ - startValue?: number; - /** - * Ending value - */ - endValue?: number; - /** - * Value to modify the property by - */ - byValue: number; - /** - * Duration of change (in ms) - */ - duration?: number; - /** - * Callback; invoked on every value change - */ - onChange?: Function; - /** - * Callback; invoked when value change is completed - */ - onComplete?: Function - /** - * Easing function - */ - easing?: Function; -} -interface IUtilAnimation { - /** - * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. - * @param {Object} [options] Animation options - */ - animate(options?: IUtilAnimationOptions): void; - /** - * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ - * In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method - * @param {Function} callback Callback to invoke - */ - requestAnimFrame(callback: Function): void; -} - -interface IUtilAnimEase { - easeInBack(): Function; - easeInBounce(): Function; - easeInCirc(): Function; - easeInCubic(): Function; - easeInElastic(): Function; - easeInExpo(): Function; - easeInOutBack(): Function; - easeInOutBounce(): Function; - easeInOutCirc(): Function; - easeInOutCubic(): Function; - easeInOutElastic(): Function; - easeInOutExpo(): Function; - easeInOutQuad(): Function; - easeInOutQuart(): Function; - easeInOutQuint(): Function; - easeInOutSine(): Function; - easeInQuad(): Function; - easeInQuart(): Function; - easeInQuint(): Function; - easeInSine(): Function; - easeOutBack(): Function; - easeOutBounce(): Function; - easeOutCirc(): Function; - easeOutCubic(): Function; - easeOutElastic(): Function; - easeOutExpo(): Function; - easeOutQuad(): Function; - easeOutQuart(): Function; - easeOutQuint(): Function; - easeOutSine(): Function; -} - -interface IUtilArc { - /** - * Draws arc - * @param {CanvasRenderingContext2D} ctx - * @param {Number} fx - * @param {Number} fy - * @param {Array} coords - */ - drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void; - /** - * Calculate bounding box of a elliptic-arc - * @param {Number} fx start point of arc - * @param {Number} fy - * @param {Number} rx horizontal radius - * @param {Number} ry vertical radius - * @param {Number} rot angle of horizontal axe - * @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points - * @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction - * @param {Number} tx end point of arc - * @param {Number} ty - */ - getBoundsOfArc(fx: number, fy: number, rx: number, ry: number, rot: number, large: number, sweep: number, tx: number, ty: number): IPoint[]; - /** - * Calculate bounding box of a beziercurve - * @param {Number} x0 starting point - * @param {Number} y0 - * @param {Number} x1 first control point - * @param {Number} y1 - * @param {Number} x2 secondo control point - * @param {Number} y2 - * @param {Number} x3 end of beizer - * @param {Number} y3 - */ - getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): IPoint[]; - -} - -interface IUtilDomEvent { - /** - * Cross-browser wrapper for getting event's coordinates - * @param {Event} event Event object - * @param {HTMLCanvasElement} upperCanvasEl <canvas> element on which object selection is drawn - */ - getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): IPoint; - - /** - * Adds an event listener to an element - * @param {HTMLElement} element - * @param {String} eventName - * @param {Function} handler - */ - addListener(element: HTMLElement, eventName: string, handler: Function): void; - - /** - * Removes an event listener from an element - * @param {HTMLElement} element - * @param {String} eventName - * @param {Function} handler - */ - removeListener(element: HTMLElement, eventName: string, handler: Function): void; -} - -interface IUtilDomMisc { - /** - * Takes id and returns an element with that id (if one exists in a document) - * @param {String|HTMLElement} id - */ - getById(id: string|HTMLElement): HTMLElement; - /** - * Converts an array-like object (e.g. arguments or NodeList) to an array - * @param {Object} arrayLike - */ - toArray(arrayLike: any): any[]; - /** - * Creates specified element with specified attributes - * @memberOf fabric.util - * @param {String} tagName Type of an element to create - * @param {Object} [attributes] Attributes to set on an element - * @return {HTMLElement} Newly created element - */ - makeElement(tagName: string, attributes?: any): HTMLElement; - /** - * Adds class to an element - * @param {HTMLElement} element Element to add class to - * @param {String} className Class to add to an element - */ - addClass(element: HTMLElement, classname: string): void; - /** - * Wraps element with another element - * @param {HTMLElement} element Element to wrap - * @param {HTMLElement|String} wrapper Element to wrap with - * @param {Object} [attributes] Attributes to set on a wrapper - */ - wrapElement(element: HTMLElement, wrapper: HTMLElement|string, attributes?: any): HTMLElement; - /** - * Returns element scroll offsets - * @param {HTMLElement} element Element to operate on - * @param {HTMLElement} upperCanvasEl Upper canvas element - */ - getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; } - /** - * Returns offset for a given element - * @param {HTMLElement} element Element to get offset for - */ - getElementOffset(element: HTMLElement): { left: number; right: number; } - /** - * Returns style attribute value of a given element - * @param {HTMLElement} element Element to get style attribute for - * @param {String} attr Style attribute to get for element - */ - getElementStyle(elment: HTMLElement, attr: string): string; - /** - * Inserts a script element with a given url into a document; invokes callback, when that script is finished loading - * @memberOf fabric.util - * @param {String} url URL of a script to load - * @param {Function} callback Callback to execute when script is finished loading - */ - getScript(url: string, callback: Function): void; - /** - * Makes element unselectable - * @param {HTMLElement} element Element to make unselectable - */ - makeElementUnselectable(element: HTMLElement): HTMLElement; - /** - * Makes element selectable - * @param {HTMLElement} element Element to make selectable - */ - makeElementSelectable(element: HTMLElement): HTMLElement; -} - -interface IUtilDomRequest { - /** - * Cross-browser abstraction for sending XMLHttpRequest - * @param {String} url URL to send XMLHttpRequest to - * @param {Object} [options] Options object - * @param {String} [options.method="GET"] - * @param {Function} options.onComplete Callback to invoke when request is completed - */ - request(url: string, options?: { method?: string; onComplete: Function }): XMLHttpRequest; -} - -interface IUtilDomStyle { - /** - * Cross-browser wrapper for setting element's style - * @param {HTMLElement} element - * @param {Object} styles - */ - setStyle(element: HTMLElement, styles: any): HTMLElement; -} - -interface IUtilArray { - /** - * Invokes method on all items in a given array - * @param {Array} array Array to iterate over - * @param {String} method Name of a method to invoke - */ - invoke(array: any[], method: string): any[]; - /** - * Finds minimum value in array (not necessarily "first" one) - * @param {Array} array Array to iterate over - * @param {String} byProperty - */ - min(array: any[], byProperty: string): any; - /** - * Finds maximum value in array (not necessarily "first" one) - * @param {Array} array Array to iterate over - * @param {String} byProperty - */ - max(array: any[], byProperty: string): any; -} - -interface IUtilClass { - /** - * Helper for creation of "classes". - * @param {Function} [parent] optional "Class" to inherit from - * @param {Object} [properties] Properties shared by all instances of this class - * (be careful modifying objects defined here as this would affect all instances) - */ - createClass(parent: Function, properties?: any); - /** - * Helper for creation of "classes". - * @param {Object} [properties] Properties shared by all instances of this class - * (be careful modifying objects defined here as this would affect all instances) - */ - createClass(properties?: any); - -} - -interface IUtilObject { - /** - * Copies all enumerable properties of one object to another - * @param {Object} destination Where to copy to - * @param {Object} source Where to copy from - */ - extend(destination: any, source: any): any; - - /** - * Creates an empty object and copies all enumerable properties of another object to it - * @memberOf fabric.util.object - * @param {Object} object Object to clone - * @return {Object} - */ - clone(object: any): any -} - -interface IUtilString { - /** - * Camelizes a string - * @param {String} string String to camelize - */ - camelize(string: string): string; - - /** - * Capitalizes a string - * @param {String} string String to capitalize - * @param {Boolean} [firstLetterOnly] If true only first letter is capitalized - * and other letters stay untouched, if false first letter is capitalized - * and other letters are converted to lowercase. - */ - capitalize(string: string, firstLetterOnly: boolean): string; - - /** - * Escapes XML in a string - * @param {String} string String to escape - */ - escapeXml(string: string): string; -} - -interface IUtilMisc { - /** - * Removes value from an array. - * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` - * @param {Array} array - * @param {Any} value - */ - removeFromArray(array: any[], value: any): any[]; - - /** - * Returns random number between 2 specified ones. - * @param {Number} min lower limit - * @param {Number} max upper limit - */ - getRandomInt(min: number, max: number): number; - - /** - * Transforms degrees to radians. - * @param {Number} degrees value in degrees - */ - degreesToRadians(degrees: number): number; - - /** - * Transforms radians to degrees. - * @memberOf fabric.util - * @param {Number} radians value in radians - */ - radiansToDegrees(radians: number): number; - - /** - * Rotates `point` around `origin` with `radians` - * @param {fabric.Point} point The point to rotate - * @param {fabric.Point} origin The origin of the rotation - * @param {Number} radians The radians of the angle for the rotation - */ - rotatePoint(point: IPoint, origin: IPoint, radians: number): IPoint; - - /** - * Apply transform t to point p - * @param {fabric.Point} p The point to transform - * @param {Array} t The transform - * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied - */ - transformPoint(p: IPoint, t: any[], ignoreOffset?: boolean): IPoint - - /** - * Invert transformation t - * @param {Array} t The transform - */ - invertTransform(t: any[]): any[]; - - /** - * A wrapper around Number#toFixed, which contrary to native method returns number, not string. - * @param {Number|String} number number to operate on - * @param {Number} fractionDigits number of fraction digits to "leave" - */ - toFixed(number: number, fractionDigits: number): number; - - /** - * Converts from attribute value to pixel value if applicable. - * Returns converted pixels or original value not converted. - * @param {Number|String} value number to operate on - */ - parseUnit(value: number|string, fontSize?: number): number|string; - - /** - * Function which always returns `false`. - */ - falseFunction(): boolean - - /** - * Returns klass "Class" object of given namespace - * @param {String} type Type of object (eg. 'circle') - * @param {String} namespace Namespace to get klass "Class" object from - */ - getKlass(type: string, namespace: string): any; - - /** - * Returns object of given namespace - * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' - */ - resolveNamespace(namespace: string): any; - - /** - * Loads image element from given url and passes it to a callback - * @param {String} url URL representing an image - * @param {Function} callback Callback; invoked with loaded image - * @param {Any} [context] Context to invoke callback in - * @param {Object} [crossOrigin] crossOrigin value to set image element to - */ - loadImage(url: string, callback: (image: HTMLImageElement) => {}, context?: any, crossOrigin?: boolean): void; - - /** - * Creates corresponding fabric instances from their object representations - * @param {Array} objects Objects to enliven - * @param {Function} callback Callback to invoke when all objects are created - * @param {String} namespace Namespace to get klass "Class" object from - * @param {Function} reviver Method for further parsing of object elements, called after each fabric object created. - */ - enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void; - - /** - * Groups SVG elements (usually those retrieved from SVG document) - * @param {Array} elements SVG elements to group - * @param {Object} [options] Options object - */ - groupSVGElements(elements: any[], options?: any, path?: any): IPathGroup - - /** - * Populates an object with properties of another object - * @param {Object} source Source object - * @param {Object} destination Destination object - * @param {Array} properties Propertie names to include - */ - populateWithProperties(source: any, destination: any, properties: any): void; - - /** - * Draws a dashed line between two points - * - * This method is used to draw dashed line around selection area. - * - * @param {CanvasRenderingContext2D} ctx context - * @param {Number} x start x coordinate - * @param {Number} y start y coordinate - * @param {Number} x2 end x coordinate - * @param {Number} y2 end y coordinate - * @param {Array} da dash array pattern - */ - drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void; - - /** - * Creates canvas element and initializes it via excanvas if necessary - * @param {CanvasElement} [canvasEl] optional canvas element to initialize; - * when not given, element is created implicitly - */ - createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement; - - /** - * Creates image element (works on client and node) - */ - createImage(): HTMLImageElement; - - /** - * Creates accessors (getXXX, setXXX) for a "class", based on "stateProperties" array - * @param {Object} klass "Class" to create accessors for - */ - createAccessors(klass: any): any; - - /** - * @param {fabric.Object} receiver Object implementing `clipTo` method - * @param {CanvasRenderingContext2D} ctx Context to clip - */ - clipContext(receiver: IObject, ctx: CanvasRenderingContext2D): void; - - /** - * Multiply matrix A by matrix B to nest transformations - * @param {Array} a First transformMatrix - * @param {Array} b Second transformMatrix - */ - multiplyTransformMatrices(a: any[], b: any[]): any[] - - /** - * Returns string representation of function body - * @param {Function} fn Function to get body of - */ - getFunctionBody(fn: Function): string; - - /** - * Returns true if context has transparent pixel - * at specified location (taking tolerance into account) - * @param {CanvasRenderingContext2D} ctx context - * @param {Number} x x coordinate - * @param {Number} y y coordinate - * @param {Number} tolerance Tolerance - */ - isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; -} - - -interface Util extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, - IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { - ease: IUtilAnimEase; - array: IUtilArray; - object: IUtilObject; - string: IUtilString; -} + interface IBlendFilter extends IBaseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IBrightnessFilter extends IBaseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IConvoluteFilter extends IBaseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IGradientTransparencyFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IGrayscaleFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IInvertFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IMaskFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IMultiplyFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface INoiseFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IPixelateFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IRemoveWhiteFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface IResizeFilter { + /** + * Resize type + */ + resizeType: string; + + /** + * Scale factor for resizing, x axis + */ + scaleX: number; + + /** + * Scale factor for resizing, y axis + */ + scaleY: number; + + /** + * LanczosLobes parameter for lanczos filter + */ + lanczosLobes: number; + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface ISepiaFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface ISepia2Filter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + interface ITintFilter { + /** + * Applies filter to canvas element + * @param {Object} canvasEl Canvas element to apply filter to + */ + applyTo(canvasEl: HTMLCanvasElement): void; + } + + //////////////////////////////////////////////////////////// + // Brushes + //////////////////////////////////////////////////////////// + interface IBaseBrush { + /** + * Color of a brush + */ + color: string; + + /** + * Width of a brush + */ + width: number; + + /** + * Shadow object representing shadow of this shape. + * Backwards incompatibility note: This property replaces "shadowColor" (String), "shadowOffsetX" (Number), + * "shadowOffsetY" (Number) and "shadowBlur" (Number) since v1.2.12 + */ + shadow: IShadow|string; + /** + * Line endings style of a brush (one of "butt", "round", "square") + */ + strokeLineCap: string; + + /** + * Corner style of a brush (one of "bevil", "round", "miter") + */ + strokeLineJoin: string; + + /** + * Stroke Dash Array. + */ + strokeDashArray: any[]; + + /** + * Sets shadow of an object + * @param {Object|String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") + */ + setShadow(options: string|any): IBaseBrush; + + } + interface ICircleBrush extends IBaseBrush { + /** + * Width of a brush + */ + width: number; + /** + * Invoked inside on mouse down and mouse move + * @param {Object} pointer + */ + drawDot(pointer: any): void; + + /** + * @param {Object} pointer + * @return {fabric.Point} Just added pointer point + */ + addPoint(pointer: any): IPoint + } + interface ISprayBrush extends IBaseBrush { + /** + * Width of a brush + */ + width: number; + /** + * Density of a spray (number of dots per chunk) + */ + density: number; + + /** + * Width of spray dots + */ + dotWidth: number; + /** + * Width variance of spray dots + */ + dotWidthVariance: number; + + /** + * Whether opacity of a dot should be random + */ + randomOpacity: boolean; + /** + * Whether overlapping dots (rectangles) should be removed (for performance reasons) + */ + optimizeOverlapping: boolean; + /** + * @param {Object} pointer + */ + addSprayChunk(pointer: any): void + } + interface IPatternBrush extends IPencilBrush { + getPatternSrc(): HTMLCanvasElement; + + getPatternSrcFunction(): string; + + /** + * Creates "pattern" instance property + */ + getPattern(): any; + /** + * Creates path + */ + createPath(pathData: string): IPath; + } + interface IPencilBrush extends IBaseBrush { + /** + * Converts points to SVG path + * @param {Array} points Array of points + * @param {Number} minX + * @param {Number} minY + */ + convertPointsToSVGPath(points: { x: number; y: number }[], minX?: number, minY?: number): string[]; + + /** + * Creates fabric.Path object to add on canvas + * @param {String} pathData Path data + */ + createPath(pathData: string): IPath; + } + var BaseBrush: { + new (): IBaseBrush + }; + var CircleBrush: { + new (canvas: fabric.ICanvas): ICircle + }; + var SprayBrush: { + new (canvas: fabric.ICanvas): ISprayBrush + }; + var PencilBrush: { + new (canvas: fabric.ICanvas): IPencilBrush + }; + var PatternBrush: { + new (canvas: fabric.ICanvas): IPatternBrush + }; + /////////////////////////////////////////////////////////////////////////////// + // Fabric util Interface + ////////////////////////////////////////////////////////////////////////////// + interface IUtilAnimationOptions { + /** + * Starting value + */ + startValue?: number; + /** + * Ending value + */ + endValue?: number; + /** + * Value to modify the property by + */ + byValue: number; + /** + * Duration of change (in ms) + */ + duration?: number; + /** + * Callback; invoked on every value change + */ + onChange?: Function; + /** + * Callback; invoked when value change is completed + */ + onComplete?: Function; + /** + * Easing function + */ + easing?: Function; + } + interface IUtilAnimation { + /** + * Changes value from one to another within certain period of time, invoking callbacks as value is being changed. + * @param {Object} [options] Animation options + */ + animate(options?: IUtilAnimationOptions): void; + /** + * requestAnimationFrame polyfill based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/ + * In order to get a precise start time, `requestAnimFrame` should be called as an entry into the method + * @param {Function} callback Callback to invoke + */ + requestAnimFrame(callback: Function): void; + } + + interface IUtilAnimEase { + easeInBack(): Function; + easeInBounce(): Function; + easeInCirc(): Function; + easeInCubic(): Function; + easeInElastic(): Function; + easeInExpo(): Function; + easeInOutBack(): Function; + easeInOutBounce(): Function; + easeInOutCirc(): Function; + easeInOutCubic(): Function; + easeInOutElastic(): Function; + easeInOutExpo(): Function; + easeInOutQuad(): Function; + easeInOutQuart(): Function; + easeInOutQuint(): Function; + easeInOutSine(): Function; + easeInQuad(): Function; + easeInQuart(): Function; + easeInQuint(): Function; + easeInSine(): Function; + easeOutBack(): Function; + easeOutBounce(): Function; + easeOutCirc(): Function; + easeOutCubic(): Function; + easeOutElastic(): Function; + easeOutExpo(): Function; + easeOutQuad(): Function; + easeOutQuart(): Function; + easeOutQuint(): Function; + easeOutSine(): Function; + } + + interface IUtilArc { + /** + * Draws arc + * @param {CanvasRenderingContext2D} ctx + * @param {Number} fx + * @param {Number} fy + * @param {Array} coords + */ + drawArc(ctx: CanvasRenderingContext2D, fx: number, fy: number, coords: number[]): void; + /** + * Calculate bounding box of a elliptic-arc + * @param {Number} fx start point of arc + * @param {Number} fy + * @param {Number} rx horizontal radius + * @param {Number} ry vertical radius + * @param {Number} rot angle of horizontal axe + * @param {Number} large 1 or 0, whatever the arc is the big or the small on the 2 points + * @param {Number} sweep 1 or 0, 1 clockwise or counterclockwise direction + * @param {Number} tx end point of arc + * @param {Number} ty + */ + getBoundsOfArc(fx: number, fy: number, rx: number, ry: number, rot: number, large: number, sweep: number, tx: number, ty: number): IPoint[]; + /** + * Calculate bounding box of a beziercurve + * @param {Number} x0 starting point + * @param {Number} y0 + * @param {Number} x1 first control point + * @param {Number} y1 + * @param {Number} x2 secondo control point + * @param {Number} y2 + * @param {Number} x3 end of beizer + * @param {Number} y3 + */ + getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): IPoint[]; + + } + + interface IUtilDomEvent { + /** + * Cross-browser wrapper for getting event's coordinates + * @param {Event} event Event object + * @param {HTMLCanvasElement} upperCanvasEl <canvas> element on which object selection is drawn + */ + getPointer(event: Event, upperCanvasEl: HTMLCanvasElement): IPoint; + + /** + * Adds an event listener to an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + addListener(element: HTMLElement, eventName: string, handler: Function): void; + + /** + * Removes an event listener from an element + * @param {HTMLElement} element + * @param {String} eventName + * @param {Function} handler + */ + removeListener(element: HTMLElement, eventName: string, handler: Function): void; + } + + interface IUtilDomMisc { + /** + * Takes id and returns an element with that id (if one exists in a document) + * @param {String|HTMLElement} id + */ + getById(id: string|HTMLElement): HTMLElement; + /** + * Converts an array-like object (e.g. arguments or NodeList) to an array + * @param {Object} arrayLike + */ + toArray(arrayLike: any): any[]; + /** + * Creates specified element with specified attributes + * @memberOf fabric.util + * @param {String} tagName Type of an element to create + * @param {Object} [attributes] Attributes to set on an element + * @return {HTMLElement} Newly created element + */ + makeElement(tagName: string, attributes?: any): HTMLElement; + /** + * Adds class to an element + * @param {HTMLElement} element Element to add class to + * @param {String} className Class to add to an element + */ + addClass(element: HTMLElement, classname: string): void; + /** + * Wraps element with another element + * @param {HTMLElement} element Element to wrap + * @param {HTMLElement|String} wrapper Element to wrap with + * @param {Object} [attributes] Attributes to set on a wrapper + */ + wrapElement(element: HTMLElement, wrapper: HTMLElement|string, attributes?: any): HTMLElement; + /** + * Returns element scroll offsets + * @param {HTMLElement} element Element to operate on + * @param {HTMLElement} upperCanvasEl Upper canvas element + */ + getScrollLeftTop(element: HTMLElement, upperCanvasEl: HTMLElement): { left: number; right: number; }; + /** + * Returns offset for a given element + * @param {HTMLElement} element Element to get offset for + */ + getElementOffset(element: HTMLElement): { left: number; right: number; }; + /** + * Returns style attribute value of a given element + * @param {HTMLElement} element Element to get style attribute for + * @param {String} attr Style attribute to get for element + */ + getElementStyle(elment: HTMLElement, attr: string): string; + /** + * Inserts a script element with a given url into a document; invokes callback, when that script is finished loading + * @memberOf fabric.util + * @param {String} url URL of a script to load + * @param {Function} callback Callback to execute when script is finished loading + */ + getScript(url: string, callback: Function): void; + /** + * Makes element unselectable + * @param {HTMLElement} element Element to make unselectable + */ + makeElementUnselectable(element: HTMLElement): HTMLElement; + /** + * Makes element selectable + * @param {HTMLElement} element Element to make selectable + */ + makeElementSelectable(element: HTMLElement): HTMLElement; + } + + interface IUtilDomRequest { + /** + * Cross-browser abstraction for sending XMLHttpRequest + * @param {String} url URL to send XMLHttpRequest to + * @param {Object} [options] Options object + * @param {String} [options.method="GET"] + * @param {Function} options.onComplete Callback to invoke when request is completed + */ + request(url: string, options?: { method?: string; onComplete: Function }): XMLHttpRequest; + } + + interface IUtilDomStyle { + /** + * Cross-browser wrapper for setting element's style + * @param {HTMLElement} element + * @param {Object} styles + */ + setStyle(element: HTMLElement, styles: any): HTMLElement; + } + + interface IUtilArray { + /** + * Invokes method on all items in a given array + * @param {Array} array Array to iterate over + * @param {String} method Name of a method to invoke + */ + invoke(array: any[], method: string): any[]; + /** + * Finds minimum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + min(array: any[], byProperty: string): any; + /** + * Finds maximum value in array (not necessarily "first" one) + * @param {Array} array Array to iterate over + * @param {String} byProperty + */ + max(array: any[], byProperty: string): any; + } + + interface IUtilClass { + /** + * Helper for creation of "classes". + * @param {Function} [parent] optional "Class" to inherit from + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(parent: Function, properties?: any); + /** + * Helper for creation of "classes". + * @param {Object} [properties] Properties shared by all instances of this class + * (be careful modifying objects defined here as this would affect all instances) + */ + createClass(properties?: any); + + } + + interface IUtilObject { + /** + * Copies all enumerable properties of one object to another + * @param {Object} destination Where to copy to + * @param {Object} source Where to copy from + */ + extend(destination: any, source: any): any; + + /** + * Creates an empty object and copies all enumerable properties of another object to it + * @memberOf fabric.util.object + * @param {Object} object Object to clone + * @return {Object} + */ + clone(object: any): any + } + + interface IUtilString { + /** + * Camelizes a string + * @param {String} string String to camelize + */ + camelize(string: string): string; + + /** + * Capitalizes a string + * @param {String} string String to capitalize + * @param {Boolean} [firstLetterOnly] If true only first letter is capitalized + * and other letters stay untouched, if false first letter is capitalized + * and other letters are converted to lowercase. + */ + capitalize(string: string, firstLetterOnly: boolean): string; + + /** + * Escapes XML in a string + * @param {String} string String to escape + */ + escapeXml(string: string): string; + } + + interface IUtilMisc { + /** + * Removes value from an array. + * Presence of value (and its position in an array) is determined via `Array.prototype.indexOf` + * @param {Array} array + * @param {Any} value + */ + removeFromArray(array: any[], value: any): any[]; + + /** + * Returns random number between 2 specified ones. + * @param {Number} min lower limit + * @param {Number} max upper limit + */ + getRandomInt(min: number, max: number): number; + + /** + * Transforms degrees to radians. + * @param {Number} degrees value in degrees + */ + degreesToRadians(degrees: number): number; + + /** + * Transforms radians to degrees. + * @memberOf fabric.util + * @param {Number} radians value in radians + */ + radiansToDegrees(radians: number): number; + + /** + * Rotates `point` around `origin` with `radians` + * @param {fabric.Point} point The point to rotate + * @param {fabric.Point} origin The origin of the rotation + * @param {Number} radians The radians of the angle for the rotation + */ + rotatePoint(point: IPoint, origin: IPoint, radians: number): IPoint; + + /** + * Apply transform t to point p + * @param {fabric.Point} p The point to transform + * @param {Array} t The transform + * @param {Boolean} [ignoreOffset] Indicates that the offset should not be applied + */ + transformPoint(p: IPoint, t: any[], ignoreOffset?: boolean): IPoint; + + /** + * Invert transformation t + * @param {Array} t The transform + */ + invertTransform(t: any[]): any[]; + + /** + * A wrapper around Number#toFixed, which contrary to native method returns number, not string. + * @param {Number|String} number number to operate on + * @param {Number} fractionDigits number of fraction digits to "leave" + */ + toFixed(number: number, fractionDigits: number): number; + + /** + * Converts from attribute value to pixel value if applicable. + * Returns converted pixels or original value not converted. + * @param {Number|String} value number to operate on + */ + parseUnit(value: number|string, fontSize?: number): number|string; + + /** + * Function which always returns `false`. + */ + falseFunction(): boolean; + + /** + * Returns klass "Class" object of given namespace + * @param {String} type Type of object (eg. 'circle') + * @param {String} namespace Namespace to get klass "Class" object from + */ + getKlass(type: string, namespace: string): any; + + /** + * Returns object of given namespace + * @param {String} namespace Namespace string e.g. 'fabric.Image.filter' or 'fabric' + */ + resolveNamespace(namespace: string): any; + + /** + * Loads image element from given url and passes it to a callback + * @param {String} url URL representing an image + * @param {Function} callback Callback; invoked with loaded image + * @param {Any} [context] Context to invoke callback in + * @param {Object} [crossOrigin] crossOrigin value to set image element to + */ + loadImage(url: string, callback: (image: HTMLImageElement) => {}, context?: any, crossOrigin?: boolean): void; + + /** + * Creates corresponding fabric instances from their object representations + * @param {Array} objects Objects to enliven + * @param {Function} callback Callback to invoke when all objects are created + * @param {String} namespace Namespace to get klass "Class" object from + * @param {Function} reviver Method for further parsing of object elements, called after each fabric object created. + */ + enlivenObjects(objects: any[], callback: Function, namespace: string, reviver?: Function): void; + + /** + * Groups SVG elements (usually those retrieved from SVG document) + * @param {Array} elements SVG elements to group + * @param {Object} [options] Options object + */ + groupSVGElements(elements: any[], options?: any, path?: any): IPathGroup; + + /** + * Populates an object with properties of another object + * @param {Object} source Source object + * @param {Object} destination Destination object + * @param {Array} properties Propertie names to include + */ + populateWithProperties(source: any, destination: any, properties: any): void; + + /** + * Draws a dashed line between two points + * This method is used to draw dashed line around selection area. + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x start x coordinate + * @param {Number} y start y coordinate + * @param {Number} x2 end x coordinate + * @param {Number} y2 end y coordinate + * @param {Array} da dash array pattern + */ + drawDashedLine(ctx: CanvasRenderingContext2D, x: number, y: number, x2: number, y2: number, da: any[]): void; + + /** + * Creates canvas element and initializes it via excanvas if necessary + * @param {CanvasElement} [canvasEl] optional canvas element to initialize; + * when not given, element is created implicitly + */ + createCanvasElement(canvasEl?: HTMLCanvasElement): HTMLCanvasElement; + + /** + * Creates image element (works on client and node) + */ + createImage(): HTMLImageElement; + + /** + * Creates accessors (getXXX, setXXX) for a "class", based on "stateProperties" array + * @param {Object} klass "Class" to create accessors for + */ + createAccessors(klass: any): any; + + /** + * @param {fabric.Object} receiver Object implementing `clipTo` method + * @param {CanvasRenderingContext2D} ctx Context to clip + */ + clipContext(receiver: IObject, ctx: CanvasRenderingContext2D): void; + + /** + * Multiply matrix A by matrix B to nest transformations + * @param {Array} a First transformMatrix + * @param {Array} b Second transformMatrix + */ + multiplyTransformMatrices(a: any[], b: any[]): any[]; + + /** + * Returns string representation of function body + * @param {Function} fn Function to get body of + */ + getFunctionBody(fn: Function): string; + + /** + * Returns true if context has transparent pixel + * at specified location (taking tolerance into account) + * @param {CanvasRenderingContext2D} ctx context + * @param {Number} x x coordinate + * @param {Number} y y coordinate + * @param {Number} tolerance Tolerance + */ + isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; + } + + interface IUtil extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, + IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { + ease: IUtilAnimEase; + array: IUtilArray; + object: IUtilObject; + string: IUtilString; + } } From 333fa1e40280c24ae122bc65f022c39b592048b4 Mon Sep 17 00:00:00 2001 From: phillips1012 Date: Mon, 18 May 2015 20:32:47 -0600 Subject: [PATCH 221/534] add typings for node-irc --- node-irc/node-irc-tests.ts | 52 +++ node-irc/node-irc.d.ts | 877 +++++++++++++++++++++++++++++++++++++ 2 files changed, 929 insertions(+) create mode 100644 node-irc/node-irc-tests.ts create mode 100644 node-irc/node-irc.d.ts diff --git a/node-irc/node-irc-tests.ts b/node-irc/node-irc-tests.ts new file mode 100644 index 000000000..1ea58c2dd --- /dev/null +++ b/node-irc/node-irc-tests.ts @@ -0,0 +1,52 @@ +// https://github.com/martynsmith/node-irc/blob/master/example/bot.js +import irc = require('irc'); + +let bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', { + debug: true, + channels: ['#blah', '#test'] +}); + +bot.addListener('error', ((message) => { + console.error('ERROR: %s: %s', message.command, message.args.join(' ')); +})); + +bot.addListener('message#blah', ((from, message) => { + console.log('<%s> %s', from, message); +})); + +bot.addListener('message', ((from, to, message) => { + console.log('%s => %s: %s', from, to, message); + + if (to.match(/^[#&]/)) { + // channel message + if (message.match(/hello/i)) { + bot.say(to, 'Hello there ' + from); + } + if (message.match(/dance/)) { + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D\\-<\u0001'); }, 1000); + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D|-<\u0001'); }, 2000); + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D/-<\u0001'); }, 3000); + setTimeout(() => { bot.say(to, '\u0001ACTION dances: :D|-<\u0001'); }, 4000); + } + } + else { + // private message + console.log('private message'); + } +})); + +bot.addListener('pm', ((nick, message) => { + console.log('Got private message from %s: %s', nick, message); +})); + +bot.addListener('join', ((channel, who) => { + console.log('%s has joined %s', who, channel); +})); + +bot.addListener('part', ((channel, who, reason) => { + console.log('%s has left %s: %s', who, channel, reason); +})); + +bot.addListener('kick', ((channel, who, by, reason) => { + console.log('%s was kicked from %s by %s: %s', who, channel, by, reason); +})); diff --git a/node-irc/node-irc.d.ts b/node-irc/node-irc.d.ts new file mode 100644 index 000000000..a5a366643 --- /dev/null +++ b/node-irc/node-irc.d.ts @@ -0,0 +1,877 @@ +// Type definitions for node-irc v0.3.12 +// Project: https://github.com/martynsmith/node-irc +// Definitions by: phillips1012 +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** This library provides IRC client functionality. */ +declare module 'irc' { + import events = require('events'); + import crypto = require('crypto'); + import net = require('net'); + + /** This library provides IRC client functionality. */ + module NodeIRC { + /** A nick connect to an IRC server. */ + export class Client extends events.EventEmitter { + /** + * Socket to the server. Rarely, if ever needed. Use Client#send + * instead. + */ + public conn: net.Socket + + /** + * Channels joined. Includes channel modes, user list, and topic + * information. Only updated after the server recognizes the join. + */ + public chans: { + [index: string]: { + key: string; + serverName: string; + users: { + [index: string]: string; + }; + mode: string; + created: string; + } + } + + /** Features supported by the server */ + public supported: { + channel: { + idlength: string[]; + length: number; + limit: string[]; + modes: { + [index: string]: string; + } + types: string; + }; + + kicklength: number; + maxlist: number[]; + maxtargets: string[]; + modes: number; + nicklength: number + topiclength: number; + usermodes: string; + } + + /** + * The current nick of the client. Updated if the nick changes + */ + public nick: string; + + /** Channel listing data. */ + public channellist: IChannel[]; + + /** IRC server MOTD */ + public motd: string; + + /** Maximum line length */ + public maxLineLength: number; + + /** Bot options */ + public opt: IClientOpts; + + /** Host mask */ + public hostMask: string; + + /** + * Connect to an IRC server + * @param server - server hostname + * @param nick - nickname + * @param opts + */ + constructor( + server: string, + nick: string, + opts?: IClientOpts + ); + + /** + * Send a raw message to the server; generally speaking, it’s best + * not to use this method unless you know what you’re doing. + * @param command - irc command + * @param args - command arguments (splat) + */ + public send( + command: string, + ...args: string[] + ): void; + + /** + * Join the specified channel + * @param channel - channel to join + * @param callback + */ + public join( + channel: string, + callback?: handlers.IJoinChannel + ): void; + + /** + * Part the specified channel + * @param channel - channel to part + * @param message - optional message to send + * @param callback + */ + public part( + channel: string, + message: string, + callback: handlers.IPartChannel + ): void; + + /** + * Send a message to the specified target + * @param target - nick or channel + * @param message - message to send + */ + public say( + target: string, + message: string + ): void; + + /** + * Send a CTCP message to the specified target + * @param target - nick or channel + * @param type - "privmsg" for PRIVMSG, anything else for NOTICE + * @param text - CTCP message + */ + public ctcp( + target: string, + type: string, + text: string + ): void; + + /** + * Send an action to the specified target + * @param target - target + * @param message - message + */ + public action( + target: string, + message: string + ): void; + + /** + * Send a notice to the specified target. + * @param target - nick or channel + * @param message - message to send + */ + public notice( + target: string, + message: string + ): void; + + /** + * Request a whois for the specified nick + * @param nick - nickname + * @param callback + */ + public whois( + nick: string, + callback: handlers.IWhois + ): void; + + /** + * Request a channel listing from the server. The arguments for this + * are farily server specific, this method passes them as specified. + * + * Responses from the server are available via `channellist_start`, + * `channellist_item`, and `channellist` events. + * + * @param args - arguments + */ + public list( + ...args: string[] + ): void; + + /** + * Connect to the server. Use when `autoConnect` is false. + * @param retryCount - times to retry + * @param callback + */ + public connect( + retryCount?: number, + callback?: handlers.IRaw + ): void; + + /** + * Disconnect from the IRC server + * @param message - message to send + * @param callback + */ + public disconnect( + message: string, + callback: () => void + ): void; + + /** + * Activate flood protection “after the factâ€. You can also use + * floodProtection while instantiating the Client to enable flood + * protection, and floodProtectionDelay to set the default message + * interval. + * @param interval - ms to wait between messages + */ + public activateFloodProtection( + interval: number + ): void; + } + + /** Client options object */ + export interface IClientOpts { + /** + * IRC username + * @default 'nodebot' + */ + userName?: string; + + /** + * IRC "real name" + * @default 'nodeJS IRC client' + */ + realName?: string; + + /** + * IRC connection port. See + * https://nodejs.org/api/net.html#net_socket_remoteport + * @default 6667 + */ + port?: number; + + /** + * Local interface to bind to for network connections. See + * https://nodejs.org/api/net.html#net_socket_localaddress + */ + localAddress?: string; + + /** + * Should we output debug messages to STDOUT? + * @default false + */ + debug?: boolean; + + /** + * Should we output IRC errors? + * @default false + */ + showErrors?: boolean; + + /** + * Should we auto-rejoin channels? + * @default false + */ + autoRejoin?: boolean; + + /** + * Should we auto-reconnect to networks? + * @default true + */ + autoConnect?: boolean; + + /** + * Channels to join + * @default [] + */ + channels?: string[]; + + /** + * Should SSL be used? Can either be true or crypto credentials. + * @default false + */ + secure?: boolean | crypto.Credentials; + + /** + * Should we accept self-signed certificates? + * @default false + */ + selfSigned?: boolean; + + + /** + * Should we accept expired certificates? + * @default false + */ + certExpired?: boolean; + + /** + * Should we queue our messages to ensure we don't get kicked? + * @default false + */ + floodProtection?: boolean; + + /** + * Delay between messages when flood protection is active + * @default 1000 + */ + floodProtectionDelay?: number; + + /** + * Should we use SASL authentication? + * @default false + */ + sasl?: boolean; + + /** + * Should we strip mIRC colors from the output messages? + * @default false + */ + stripColors?: boolean; + + /** + * Channel prefix + * @default '&#' + */ + channelPrefixes?: string; + + /** + * Characters to split a message at. + * @default 512 + */ + messageSplit?: number; + + /** + * Encoding to use. See + * https://nodejs.org/api/stream.html#stream_readable_setencoding_encoding + * @default 'utf-8' + */ + encoding?: string; + } + + /** Command types */ + export enum CommandType { + normal, reply, error + } + + /** Parsed IRC message. */ + export interface IMessage { + /** Prefix */ + prefix?: string; + + /** Mapped IRC command */ + command: string; + + /** Raw IRC command */ + rawCommand: string; + + /** Command type */ + commandType: CommandType; + + /** Command arguments */ + args: string[]; + } + + /** Whois data */ + export interface IWhoisData { + /** Nickname */ + nick: string; + + /** Username */ + user: string; + + /** Hostnamej */ + host: string; + + /** Real name" */ + realname: string; + + /** Channels */ + channels: string[]; + + /** Server */ + server: string; + + /** Server description string */ + serverinfo: string; + + /** Is this user an operator? */ + operator: string; + } + + /** A channel returned by a channel listing. */ + export interface IChannel { + /** Channel name */ + name: string; + + /** User count */ + users: string; + + /** Topic string */ + topic: string; + } + + /** + * Handler functions for Client. + */ + module handlers { + /** + * 'registered': Emitted when the server sends the initial 001 line, + * indicating you’ve connected to the server. See the raw event for + * details on the message object. + */ + export interface IRegistered { + /** + * @param message - raw message + */ + (message: IMessage): void; + } + + /** + * 'motd': Emitted when the server sends the message of the day to + * clients. + */ + export interface IMotd { + /** + * @param motd - motd string + */ + (motd: string): void; + } + + /** + * 'names': Emitted when the server sends a list of nicks for a channel + * (which happens immediately after joining and on request. The nicks + * object passed to the callback is keyed by nick names, and has + * values ‘’, ‘+’, or ‘@’ depending on the level of that nick in the + * channel. + */ + export interface INames { + /** + * @param channel - channel name + * @param nicks - nicks list + */ + (channel: string, nicks: string[]): void; + } + + /** + * 'names#*' As per ‘names’ event but only emits for the subscribed + * channel. + */ + export interface INamesChannel { + /** + * @param channel - channel name + * @param nicks - nicks list + */ + (nicks: string[]): void; + } + + /** + * 'topic': Emitted when the server sends the channel topic on joining + * a channel, or when a user changes the topic on a channel. See the + * raw event for details on the message object. + */ + export interface ITopic { + /** + * @param channel - channel name + * @param topic - topic + * @param nick - nick + * @param message - raw message + */ + ( + channel: string, + topic: string, + nick: string, + message: IMessage + ): void; + } + + /** + * 'join': Emitted when a user joins a channel (including when the + * client itself joins a channel). See the raw event for details on the + * message object. + */ + export interface IJoin { + /** + * @param channel - channel name + * @param nick - who joined + * @param message - raw message + */ + (channel: string, nick: string, message: IMessage): void; + } + + /** + * 'join#*': As per ‘join’ event but only emits for the subscribed + * channel. See the raw event for details on the message object. + */ + export interface IJoinChannel { + /** + * @param nick - who joined + * @param message - raw message + */ + (nick: string, message: IMessage): void; + } + + /** + * 'part': Emitted when a user parts a channel (including when the + * client itself parts a channel). See the raw event for details on the + * message object. + */ + export interface IPart { + /** + * @param channel - channel name + * @param nick - who parted + * @param reason - part reason + * @param message - raw message + */ + ( + channel: string, + nick: string, + reason: string, + message: IMessage + ): void + } + + /** + * 'part': As per ‘part’ event but only emits for the subscribed + * channel. See the raw event for details on the message object. + */ + export interface IPartChannel { + /** + * @param nick - who parted + * @param reason - part reason + * @param message - raw message + */ + ( + nick: string, + reason: string, + message: IMessage + ): void + } + + /** + * 'kick': Emitted when a user is kicked from a channel. See the raw + * event for details on the message object. + */ + export interface IKick { + /** + * @param channel - channel name + * @param nick - who was kicked + * @param by - kicker + * @param reason - kick reason + * @param message - raw message + */ + ( + channel: string, + nick: string, + by: string, + reason: string, + message: IMessage + ): void; + } + + /** + * 'kick#*': Emitted when a user is kicked from a channel. See the raw + * event for details on the message object. + */ + export interface IKickChannel { + /** + * @param nick - who was kicked + * @param by - kicker + * @param reason - kick reason + * @param message - raw message + */ + ( + nick: string, + by: string, + reason: string, + message: IMessage + ): void; + } + + /** + * 'message': Emitted when a message is sent. to can be either a nick + * (which is most likely this clients nick and means a private message), + * or a channel (which means a message to that channel). See the raw + * event for details on the message object. + */ + export interface IRecievedMessage { + /** + * @param nick - who sent the message + * @param to - to whom was the message sent + * @param text - message text + * @param message - raw message + */ + ( + nick: string, to: string, text: string, message: IMessage + ): void; + } + + /** + * 'message#': Emitted when a message is sent to any channel (i.e. + * exactly the same as the message event but excluding private + * messages. See the raw event for details on the message object. + */ + export interface IMessageAllChannels { + /** + * @param nick - who sent the message + * @param to - to whom was the message sent + * @param text - message text + * @param message - raw message + */ + ( + nick: string, to: string, text: string, message: IMessage + ): void; + } + + /** + * 'message#*': As per ‘message’ event but only emits for the + * subscribed channel. See the raw event for details on the message + * object. + */ + export interface IMessageChannel { + /** + * @param nick - who sent the message + * @param text - message text + * @param message - raw message + */ + (nick: string, text: string, message: IMessage): void; + } + + /** + * 'selfMessage': Emitted when a message is sent from the client. + * `to` is who the message was sent to. It can be either a nick + * (which most likely means a private message), or a channel (which + * means a message to that channel). + */ + export interface ISelfMessage { + (to: string, text: string): void; + } + + /** + * 'notice': Emitted when a notice is sent. to can be either a nick + * (which is most likely this clients nick and means a private + * message), or a channel (which means a message to that channel). nick + * is either the senders nick or null which means that the notice comes + * from the server. See the raw event for details on the message object. + */ + export interface INotice { + /** + * @param nick - from + * @param to - to + * @param text - text + * @param message - raw message + */ + (nick: string, to: string, text: string, message: IMessage): void; + } + + /** + * 'ping': Emitted when a server PINGs the client. The client will + * automatically send a PONG request just before this is emitted. + */ + export interface IPing { + /** + * @param server - server that adiministered the ping + */ + (server: string): void; + } + + /** + * 'pm': As per ‘message’ event but only emits when the message is + * direct to the client. See the raw event for details on the message + * object. + */ + export interface IPm { + /** + * @param nick - sender + * @param text - message text + * @param message - raw message + */ + (nick: string, text: string, message: IMessage): void; + } + + /** + * 'ctcp': Emitted when a CTCP notice or privmsg was received (type + * is either ‘notice’ or ‘privmsg’). See the raw event for details + * on the message object. + */ + export interface ICtcp { + /** + * @param from - sender + * @param to - recievier + * @param text - ctcp text + * @param type - ctcp type + * @param message - raw message + */ + ( + from: string, + to: string, + text: string, + type: string, + message: IMessage + ): void; + } + + + /** + * 'ctcp-*': Emitted when a specific type of CTCP request was + * recieved. + */ + export interface ICtcpSpecific { + /** + * @param from - sender + * @param to - recievier + * @param message - raw message + */ + ( + from: string, + to: string, + text: string, + message: IMessage + ): void; + + ( + from: string, + to: string, + text: string, + type: string, + message: IMessage + ): void; + } + + /** + * 'nick': Emitted when a user changes nick along with the channels + * the user is in. See the raw event for details on the message + * object. + */ + export interface INick { + /** + * @param oldnick - old nickname + * @param newnick - new nickname + * @param channels - channels the nick changed in + * @param message - raw message + */ + ( + oldnick: string, + newnick: string, + channels: string[], + message: IMessage + ): void; + } + + /** + * 'invite': Emitted when the client receives an /invite. See the + * raw event for details on the message object. + */ + export interface IInvite { + /** + * @param channel - channel user was invited to + * @param from - user who invited + * @param message - raw message + */ + (channel: string, from: string, message: IMessage): void; + } + + /** + * '+mode'/'-mode': Emitted when a mode is added or removed from a user or + * channel. channel is the channel which the mode is being set on/in + * . by is the user setting the mode. mode is the single character + * mode identifier. If the mode is being set on a user, argument is + * the nick of the user. If the mode is being set on a channel, + * argument is the argument to the mode. If a channel mode doesn’t + * have any arguments, argument will be ‘undefined’. See the raw + * event for details on the message object. + */ + export interface IModeChange { + /** + * @param channel - channel + * @param by - nick that changed mode + * @param mode - single character mode identifier + * @param argument - mode argument + * @param message - raw message + */ + ( + channel: string, + by: string, + mode: string, + argument: string, + message: IMessage + ): void; + } + + /** + * 'whois': Emitted whenever the server finishes outputting a WHOIS + * response. + */ + export interface IWhois { + (info: IWhoisData): void; + } + + /** + * 'channellist': Emitted when the server has finished returning a + * channel list. The channel_list array is simply a list of the + * objects that were returned in the intervening channellist_item + * events. + * + * This data is also available via the Client.channellist property + * after this event has fired. + */ + export interface IChannelList { + /** + * @param list - channels + */ + ( + list: IChannel[] + ): void; + } + + /** + * 'raw': Emitted when ever the client receives a “message†from + * the server. A message is a parsed line from the server. + */ + export interface IRaw { + /** + * @param message - raw message + */ + (message: IMessage): void; + } + + /** + * 'error': Emitted when ever the server responds with an error-type message. The message parameter is exactly as in the ‘raw’ event. + */ + export interface IError { + /** + * @param message - raw message + */ + (message: IMessage): void; + } + + /** + * 'action': Emitted whenever a user performs an action + * (e.g. /me waves). + */ + export interface IAction { + /** + * @param from - sender + * @param to - reciever + * @param text - text + * @param message - raw message + */ + ( + from: string, to: string, text: string, message: IMessage + ): void; + } + } + } + + /** Colors */ + module NodeIRC.colors { + /** + * Takes a color by name, text, and optionally what color to return. + * @param color - name of color + * @param text - text to color + * @param reset_color - color to set after text + */ + export function wrap( + color: string, text: string, reset_color?: string + ): string; + + /** + * This contains the set of colors available and a function to wrap + * text in a color. + */ + export const codes: { + [index: string]: string; + }; + } + + export = NodeIRC; +} From 03b65ffa983508e69750d5687d12ecfc82538f65 Mon Sep 17 00:00:00 2001 From: phillips1012 Date: Mon, 18 May 2015 20:45:38 -0600 Subject: [PATCH 222/534] fix es6 usage in node-irc --- node-irc/node-irc-tests.ts | 2 +- node-irc/node-irc.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node-irc/node-irc-tests.ts b/node-irc/node-irc-tests.ts index 1ea58c2dd..07137b876 100644 --- a/node-irc/node-irc-tests.ts +++ b/node-irc/node-irc-tests.ts @@ -1,7 +1,7 @@ // https://github.com/martynsmith/node-irc/blob/master/example/bot.js import irc = require('irc'); -let bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', { +var bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', { debug: true, channels: ['#blah', '#test'] }); diff --git a/node-irc/node-irc.d.ts b/node-irc/node-irc.d.ts index a5a366643..6831ece82 100644 --- a/node-irc/node-irc.d.ts +++ b/node-irc/node-irc.d.ts @@ -868,7 +868,7 @@ declare module 'irc' { * This contains the set of colors available and a function to wrap * text in a color. */ - export const codes: { + export var codes: { [index: string]: string; }; } From e10cc3a2829d0a9a3ada99667f8bb9cb6dfc0af0 Mon Sep 17 00:00:00 2001 From: Legokichi Duckscallion Date: Tue, 19 May 2015 12:33:07 +0900 Subject: [PATCH 223/534] JSZip.compressions.DEFLATE add --- jszip/jszip-tests.ts | 45 +++++++++++++++++++++++++++++++------------- jszip/jszip.d.ts | 22 +++++++++++++++++++--- 2 files changed, 51 insertions(+), 16 deletions(-) diff --git a/jszip/jszip-tests.ts b/jszip/jszip-tests.ts index 97fd10450..514beb501 100644 --- a/jszip/jszip-tests.ts +++ b/jszip/jszip-tests.ts @@ -33,18 +33,18 @@ function testJSZip() { var folder = newJszip.folder("test"); if(folder.file("test.txt").asText() == "test string") { log(SEVERITY.INFO, "all ok"); - } + } else { log(SEVERITY.ERROR, "wrong file"); } var folders = newJszip.folder(new RegExp("^test")); - + if(folders.length == 1) { log(SEVERITY.INFO, "all ok"); if(folders[0].dir == true) { log(SEVERITY.INFO, "all ok"); - } + } else { log(SEVERITY.ERROR, "wrong file"); } @@ -59,14 +59,14 @@ function testJSZip() { log(SEVERITY.INFO, "all ok"); } else { - log(SEVERITY.ERROR, "wrong data in files"); + log(SEVERITY.ERROR, "wrong data in files"); } - } + } else { log(SEVERITY.ERROR, "wrong number of files"); } - var filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { + var filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { if (file.asText() == "test string") { return true; } @@ -82,7 +82,7 @@ function testJSZip() { newJszip.remove("test/test.txt"); - filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { + filterFiles = newJszip.filter((relativePath: string, file: JSZipObject) => { if (file.asText() == "test string") { return true; } @@ -95,24 +95,43 @@ function testJSZip() { else { log(SEVERITY.ERROR, "wrong number of files"); } + + var uncompressedStr = JSZip.compressions.DEFLATE.uncompress( + JSZip.compressions.DEFLATE.compress("\0\1\2\3\4\5\6\7",{level:9})); + var uncompressedArr = JSZip.compressions.DEFLATE.uncompress( + JSZip.compressions.DEFLATE.compress([0,1,2,3,4,5,6,7],{level:9})); + var uncompressedUint8Arr = JSZip.compressions.DEFLATE.uncompress( + JSZip.compressions.DEFLATE.compress(new Uint8Array([0,1,2,3,4,5,6,7]),{level:9})); + + var every_match = [0,1,2,3,4,5,6,7].every(function(val, i){ + return uncompressedStr[i] === val && + uncompressedArr[i] === val && + uncompressedUint8Arr[i] === val; + }); + if(every_match) { + log(SEVERITY.INFO, "compress and uncompress ok."); + }else{ + log(SEVERITY.ERROR, "compress or uncompress failed."); + } + } function log(severity:number, message: any) { var log = ""; switch(severity) { - case 0: + case 0: log += "[DEBUG] "; break; - case 1: + case 1: log += "[INFO] "; break; - case 2: + case 2: log += "[WARN] "; break; - case 3: + case 3: log += "[ERROR] "; break; - case 4: + case 4: log += "[FATAL] "; break; default: @@ -122,4 +141,4 @@ function log(severity:number, message: any) { console.log(log += message); } -testJSZip(); \ No newline at end of file +testJSZip(); diff --git a/jszip/jszip.d.ts b/jszip/jszip.d.ts index df571793b..dfa316625 100644 --- a/jszip/jszip.d.ts +++ b/jszip/jszip.d.ts @@ -32,7 +32,7 @@ interface JSZip { /** * Return an new JSZip instance with the given folder as root - * + * * @param name Name of the folder * @return New JSZip object with the given folder as root or null */ @@ -40,7 +40,7 @@ interface JSZip { /** * Returns new JSZip instances with the matching folders as root - * + * * @param name RegExp to match * @return New array of JSZipFile objects which match the RegExp */ @@ -56,7 +56,7 @@ interface JSZip { /** * Removes the file or folder from the archive - * + * * @param path Relative path of file or folder * @return Returns the JSZip instance */ @@ -140,6 +140,18 @@ interface JSZipSupport { nodebuffer: boolean; } +interface DEFLATE { + /** pako.deflateRaw, level:0-9 */ + compress(input: string, compressionOptions: {level:number}): Uint8Array; + compress(input: number[], compressionOptions: {level:number}): Uint8Array; + compress(input: Uint8Array, compressionOptions: {level:number}): Uint8Array; + + /** pako.inflateRaw */ + uncompress(input: string): Uint8Array; + uncompress(input: number[]): Uint8Array; + uncompress(input: Uint8Array): Uint8Array; +} + declare var JSZip: { /** * Create JSZip instance @@ -169,6 +181,10 @@ declare var JSZip: { prototype: JSZip; support: JSZipSupport; + + compressions: { + DEFLATE: DEFLATE; + } } declare module "jszip" { From fd23f8f26c8cb903ae0230c9c97af9c8a609a515 Mon Sep 17 00:00:00 2001 From: Legokichi Duckscallion Date: Tue, 19 May 2015 12:42:18 +0900 Subject: [PATCH 224/534] force travis --- jszip/jszip.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/jszip/jszip.d.ts b/jszip/jszip.d.ts index dfa316625..651a26da5 100644 --- a/jszip/jszip.d.ts +++ b/jszip/jszip.d.ts @@ -181,7 +181,6 @@ declare var JSZip: { prototype: JSZip; support: JSZipSupport; - compressions: { DEFLATE: DEFLATE; } From e8c7e9b41423d5e19910a503f5a82be9ed9d5d91 Mon Sep 17 00:00:00 2001 From: phillips1012 Date: Mon, 18 May 2015 21:46:56 -0600 Subject: [PATCH 225/534] fix references for node-irc --- node-irc/node-irc-tests.ts | 2 ++ node-irc/node-irc.d.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/node-irc/node-irc-tests.ts b/node-irc/node-irc-tests.ts index 07137b876..a4af82d80 100644 --- a/node-irc/node-irc-tests.ts +++ b/node-irc/node-irc-tests.ts @@ -1,4 +1,6 @@ +/// // https://github.com/martynsmith/node-irc/blob/master/example/bot.js + import irc = require('irc'); var bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', { diff --git a/node-irc/node-irc.d.ts b/node-irc/node-irc.d.ts index 6831ece82..ebb3f7e34 100644 --- a/node-irc/node-irc.d.ts +++ b/node-irc/node-irc.d.ts @@ -3,6 +3,8 @@ // Definitions by: phillips1012 // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + /** This library provides IRC client functionality. */ declare module 'irc' { import events = require('events'); From 155e657e34d2e7b82533ee50e729af3d56dcecc8 Mon Sep 17 00:00:00 2001 From: phillips1012 Date: Mon, 18 May 2015 21:59:55 -0600 Subject: [PATCH 226/534] fix tests for node-irc --- node-irc/node-irc-tests.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/node-irc/node-irc-tests.ts b/node-irc/node-irc-tests.ts index a4af82d80..62d105acc 100644 --- a/node-irc/node-irc-tests.ts +++ b/node-irc/node-irc-tests.ts @@ -8,15 +8,15 @@ var bot = new irc.Client('irc.dollyfish.net.nz', 'nodebot', { channels: ['#blah', '#test'] }); -bot.addListener('error', ((message) => { +bot.addListener('error', ((message: irc.IMessage) => { console.error('ERROR: %s: %s', message.command, message.args.join(' ')); })); -bot.addListener('message#blah', ((from, message) => { +bot.addListener('message#blah', ((from: string, message: string) => { console.log('<%s> %s', from, message); })); -bot.addListener('message', ((from, to, message) => { +bot.addListener('message', ((from: string, to: string, message: string) => { console.log('%s => %s: %s', from, to, message); if (to.match(/^[#&]/)) { @@ -37,18 +37,18 @@ bot.addListener('message', ((from, to, message) } })); -bot.addListener('pm', ((nick, message) => { +bot.addListener('pm', ((nick: string, message: string) => { console.log('Got private message from %s: %s', nick, message); })); -bot.addListener('join', ((channel, who) => { +bot.addListener('join', ((channel: string, who: string) => { console.log('%s has joined %s', who, channel); })); -bot.addListener('part', ((channel, who, reason) => { +bot.addListener('part', ((channel: string, who: string, reason: string) => { console.log('%s has left %s: %s', who, channel, reason); })); -bot.addListener('kick', ((channel, who, by, reason) => { +bot.addListener('kick', ((channel: string, who: string, by: string, reason: string) => { console.log('%s was kicked from %s by %s: %s', who, channel, by, reason); })); From a38b9565636e8fd7720c02b77e4e617e26760fd0 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 19 May 2015 10:45:42 +0200 Subject: [PATCH 227/534] backgrid.d.ts: added some class and exported the module --- backgrid/backgrid.d.ts | 133 +++++++++++++++++++++++++++-------------- 1 file changed, 87 insertions(+), 46 deletions(-) diff --git a/backgrid/backgrid.d.ts b/backgrid/backgrid.d.ts index fcae05d80..3a75e6142 100644 --- a/backgrid/backgrid.d.ts +++ b/backgrid/backgrid.d.ts @@ -8,12 +8,12 @@ declare module Backgrid { interface GridOptions { - columns: Column[]; - collection: Backbone.Collection; - header: Header; - body: Body; - row: Row; - footer: Footer; + columns: Column[]; + collection: Backbone.Collection; + header: Header; + body: Body; + row: Row; + footer: Footer; } class Header extends Backbone.View { @@ -21,65 +21,106 @@ declare module Backgrid { class Footer extends Backbone.View { } - + class Row extends Backbone.View { } class Command { - cancel(); - moveDown(); - moveLeft(); - moveRight(); - moveUp(); - passThru(); - save(); + moveUp(): boolean; + moveDown(): boolean; + moveLeft(): boolean; + moveRight(): boolean; + save(): boolean; + cancel(): boolean; + passThru(): boolean; + } + + class CellFormatter { + fromRaw(rawData: any, model: Backbone.Model); + toRaw(formattedData: any, model: Backbone.Model); + } + + class NumberFormatter extends CellFormatter {} + + class PercentFormatter extends NumberFormatter {} + + class DateTimeFormatter extends CellFormatter {} + + class StringFormatter extends CellFormatter {} + + class EmailFormatter extends CellFormatter {} + + class SelectFormatter extends CellFormatter {} + + class CellEditor extends Backbone.View{ + initialize(options?: any); + postRender(model: Backbone.Model, column: Backbone.Model); + } + + class InputCellEditor extends CellEditor { + render(); + saveOrCancel(event: any); + } + + class Cell extends Backbone.View{ + tagName: string; + formatter: CellFormatter; + editor: InputCellEditor; + enterEditMode(); + renderError(); + exitEditMode(); + remove(); + } + + class StringCell extends Cell { } interface ColumnAttr { - name: string; - cell: string; - headerCell: string; - label: string; - sortable: boolean; - editable: boolean; - renderable: boolean; - formater: string; + name: string; + cell: string; + headerCell: string; + label: string; + sortable: boolean; + editable: boolean; + renderable: boolean; + formater: string; } class Column extends Backbone.Model { - initialize(options?: any); + initialize(options?: any); } class Body extends Backbone.View { - tagName: string; + tagName: string; - initialize(options?: any); - insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - moveToNextCell(model: Backbone.Model, cell: Column, command: Command); - refresh(): Body; - remove(): Body; - removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - render(): Body; + initialize(options?: any); + insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + moveToNextCell(model: Backbone.Model, cell: Column, command: Command); + refresh(): Body; + remove(): Body; + removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + render(): Body; } class Grid extends Backbone.View { - body: Backgrid.Body; - className: string; - footer: any; - header: any; - tagName: string; + body: Backgrid.Body; + className: string; + footer: any; + header: any; + tagName: string; - initialize(options: any); - getSelectedModels(): Backbone.Model[]; - insertColumn(...options: any[]): Grid; - insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - remove():Grid; - removeColumn(...options: any[]): Grid; - removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); - render():Grid; + initialize(options: any); + getSelectedModels(): Backbone.Model[]; + insertColumn(...options: any[]): Grid; + insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + remove(): Grid; + removeColumn(...options: any[]): Grid; + removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any); + render(): Grid; } - - } +declare module "backgrid" { + export = Backgrid; +} From 2440153cd3bb1037500597f2a2a5407509cd105f Mon Sep 17 00:00:00 2001 From: Aleksey Blokhin Date: Tue, 19 May 2015 12:06:01 +0300 Subject: [PATCH 228/534] Interface updates. --- angular-translate/angular-translate.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 141804791..87a75439b 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -28,7 +28,6 @@ declare module angular.translate { interface IPartialLoader { addPart(name : string, priority? : number) : T; - setPart(lang : string, part : string, table : ITranslationTable) : T; deletePart(name : string) : T; isPartAvailable(name : string) : boolean; } @@ -39,6 +38,7 @@ declare module angular.translate { } interface ITranslatePartialLoaderProvider extends angular.IServiceProvider, IPartialLoader { + setPart(lang : string, part : string, table : ITranslationTable) : ITranslatePartialLoaderProvider; } interface ITranslateService { From ca2e9fe96668108e4270640a715ae1de3640b541 Mon Sep 17 00:00:00 2001 From: jdtaylor91 Date: Tue, 19 May 2015 15:06:22 +0100 Subject: [PATCH 229/534] Add missing definitions for youtube.d.ts --- youtube/youtube.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/youtube/youtube.d.ts b/youtube/youtube.d.ts index 85f96b22f..d7e52ae17 100644 --- a/youtube/youtube.d.ts +++ b/youtube/youtube.d.ts @@ -38,11 +38,11 @@ declare module YT { iv_load_policy?: number; list?: string; listType?: ListType; - loop?; + loop?: number; modestbranding?: number; - origin?; + origin?: string; playerpiid?: string; - playlist?; + playlist?: string[]; rel?: number; showinfo?: number; start?: number; @@ -84,17 +84,17 @@ declare module YT { // Queueing functions loadVideoById(videoId: string, startSeconds?: number, suggestedQuality?: string): void; - loadVideoById(VideoByIdParams): void; + loadVideoById(VideoByIdParams: Object): void; cueVideoById(videoId: string, startSeconds?: number, suggestedQuality?: string): void; - cueVideoById(VideoByIdParams): void; + cueVideoById(VideoByIdParams: Object): void; loadVideoByUrl(mediaContentUrl: string, startSeconds?: number, suggestedQuality?: string): void; - loadVideoByUrl(VideoByUrlParams): void; + loadVideoByUrl(VideoByUrlParams: Object): void; cueVideoByUrl(mediaContentUrl: string, startSeconds?: number, suggestedQuality?: string): void; - cueVideoByUrl(VideoByUrlParams): void; + cueVideoByUrl(VideoByUrlParams: Object): void; // Properties - size; + size: any; // Playing playVideo(): void; @@ -156,4 +156,4 @@ declare module YT { PAUSED, PLAYING } -} +} \ No newline at end of file From 0669ff6b2354aed3f65b48f96af3e954b4ff4ca5 Mon Sep 17 00:00:00 2001 From: Matt Brooks Date: Tue, 19 May 2015 16:15:14 +0100 Subject: [PATCH 230/534] Renamed succinct type definition and test files Renamed files to match Bower package name: - `jquery.succinct/jquery.succinct-tests.ts` to `succinct/succinct-tests.ts` - `jquery.succinct/jquery.succinct.d.ts` to `succinct/succinct.d.ts` --- succinct/succinct-tests.ts | 31 +++++++++++++++++++++++++++++++ succinct/succinct.d.ts | 18 ++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 succinct/succinct-tests.ts create mode 100644 succinct/succinct.d.ts diff --git a/succinct/succinct-tests.ts b/succinct/succinct-tests.ts new file mode 100644 index 000000000..7b81e5f85 --- /dev/null +++ b/succinct/succinct-tests.ts @@ -0,0 +1,31 @@ +/// + +// Call with no arguments (accepting defaults) +$(".truncate").succinct(); + +// Specify size +$(".truncate").succinct({ + size: 120 +}); + +// Specify ellipsis replacement +$(".truncate").succinct({ + omission: "→" +}); + +// Specify flag to leave trailing special characters +$(".truncate").succinct({ + ignore: false +}); + +// Combine options +$(".truncate").succinct({ + size: 120, + omission: '...', + ignore: false +}); + +// Can chain jQuery methods +$(".truncate") + .succinct() + .removeClass("truncate"); \ No newline at end of file diff --git a/succinct/succinct.d.ts b/succinct/succinct.d.ts new file mode 100644 index 000000000..59a1646e3 --- /dev/null +++ b/succinct/succinct.d.ts @@ -0,0 +1,18 @@ +// Type definitions for jQuery Succinct v1.1.0 +// Project: http://mikeking.io/succinct/ +// Definitions by: Matt Brooks +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQuerySuccinct { + interface Options { + size?: number; + omission?: string; + ignore?: boolean; + } +} + +interface JQuery { + succinct(settings?: JQuerySuccinct.Options): JQuery; +} \ No newline at end of file From de56afe5ed5b4b6373e3c3d35f62989aa1e825d5 Mon Sep 17 00:00:00 2001 From: Matt Brooks Date: Tue, 19 May 2015 16:18:21 +0100 Subject: [PATCH 231/534] Removing original files left over from rename --- jquery.succinct/jquery.succinct-tests.ts | 31 ------------------------ jquery.succinct/jquery.succinct.d.ts | 18 -------------- 2 files changed, 49 deletions(-) delete mode 100644 jquery.succinct/jquery.succinct-tests.ts delete mode 100644 jquery.succinct/jquery.succinct.d.ts diff --git a/jquery.succinct/jquery.succinct-tests.ts b/jquery.succinct/jquery.succinct-tests.ts deleted file mode 100644 index 7ca72048e..000000000 --- a/jquery.succinct/jquery.succinct-tests.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// - -// Call with no arguments (accepting defaults) -$(".truncate").succinct(); - -// Specify size -$(".truncate").succinct({ - size: 120 -}); - -// Specify ellipsis replacement -$(".truncate").succinct({ - omission: "→" -}); - -// Specify flag to leave trailing special characters -$(".truncate").succinct({ - ignore: false -}); - -// Combine options -$(".truncate").succinct({ - size: 120, - omission: '...', - ignore: false -}); - -// Can chain jQuery methods -$(".truncate") - .succinct() - .removeClass("truncate"); \ No newline at end of file diff --git a/jquery.succinct/jquery.succinct.d.ts b/jquery.succinct/jquery.succinct.d.ts deleted file mode 100644 index 489ee98d2..000000000 --- a/jquery.succinct/jquery.succinct.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Type definitions for jQuery Succinct v1.1.0 -// Project: http://mikeking.io/succinct/ -// Definitions by: Matt Brooks -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module JQuerySuccinct { - interface Options { - size?: number; - omission?: string; - ignore?: boolean; - } -} - -interface JQuery { - succinct(settings?: JQuerySuccinct.Options): JQuery; -} \ No newline at end of file From 38571cb9dd66f6979bbf02b102bddc8a1dbc7472 Mon Sep 17 00:00:00 2001 From: phillips1012 Date: Tue, 19 May 2015 09:43:30 -0600 Subject: [PATCH 232/534] rename node-irc to irc --- node-irc/node-irc-tests.ts => irc/irc-tests.ts | 2 +- node-irc/node-irc.d.ts => irc/irc.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename node-irc/node-irc-tests.ts => irc/irc-tests.ts (98%) rename node-irc/node-irc.d.ts => irc/irc.d.ts (99%) diff --git a/node-irc/node-irc-tests.ts b/irc/irc-tests.ts similarity index 98% rename from node-irc/node-irc-tests.ts rename to irc/irc-tests.ts index 62d105acc..edda5e14f 100644 --- a/node-irc/node-irc-tests.ts +++ b/irc/irc-tests.ts @@ -1,4 +1,4 @@ -/// +/// // https://github.com/martynsmith/node-irc/blob/master/example/bot.js import irc = require('irc'); diff --git a/node-irc/node-irc.d.ts b/irc/irc.d.ts similarity index 99% rename from node-irc/node-irc.d.ts rename to irc/irc.d.ts index ebb3f7e34..11f14ab6f 100644 --- a/node-irc/node-irc.d.ts +++ b/irc/irc.d.ts @@ -1,4 +1,4 @@ -// Type definitions for node-irc v0.3.12 +// Type definitions for irc v0.3.12 // Project: https://github.com/martynsmith/node-irc // Definitions by: phillips1012 // Definitions: https://github.com/borisyankov/DefinitelyTyped From 2dc99a01410103c3e935d6946c195ed1d31edc4e Mon Sep 17 00:00:00 2001 From: Jordi Aranda Date: Tue, 19 May 2015 18:31:48 +0200 Subject: [PATCH 233/534] Callback type definition fix in xhr methods --- d3/d3.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 0bf3d599d..fd81d7e9a 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -304,7 +304,7 @@ declare module D3 { * @param url Url to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (url: string, callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; /** * Creates an asynchronous request for specified url * @@ -312,7 +312,7 @@ declare module D3 { * @param mime MIME type to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, mime: string, callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (url: string, mime: string, callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; }; /** * Request a text file @@ -324,7 +324,7 @@ declare module D3 { * @param url Url to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, callback?: (response: string) => void ): Xhr; + (url: string, callback?: (error: any, responseText: string) => void ): Xhr; /** * Request a text file * @@ -332,7 +332,7 @@ declare module D3 { * @param mime MIME type to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, mime: string, callback?: (response: string) => void ): Xhr; + (url: string, mime: string, callback?: (error: any, responseText: string) => void ): Xhr; }; /** * Request a JSON blob @@ -351,7 +351,7 @@ declare module D3 { * @param url Url to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, callback?: (response: Document) => void ): Xhr; + (url: string, callback?: (error: any, response: Document) => void ): Xhr; /** * Request an HTML document fragment. * @@ -359,7 +359,7 @@ declare module D3 { * @param mime MIME type to request * @param callback Function to invoke when resource is loaded or the request fails */ - (url: string, mime: string, callback?: (response: Document) => void ): Xhr; + (url: string, mime: string, callback?: (error: any, response: Document) => void ): Xhr; }; /** * Request an XML document fragment. @@ -367,7 +367,7 @@ declare module D3 { * @param url Url to request * @param callback Function to invoke when resource is loaded or the request fails */ - html: (url: string, callback?: (response: DocumentFragment) => void ) => Xhr; + html: (url: string, callback?: (error: any, response: DocumentFragment) => void ) => Xhr; /** * Request a comma-separated values (CSV) file. */ @@ -654,7 +654,7 @@ declare module D3 { * * @param callback Function to invoke on completion of request */ - get(callback?: (xhr: XMLHttpRequest) => void ): Xhr; + get(callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; /** * Issue the request using the POST method */ From c514d8784a943e7f9cc470999fabd7689e8695fa Mon Sep 17 00:00:00 2001 From: Jordi Aranda Date: Tue, 19 May 2015 18:57:52 +0200 Subject: [PATCH 234/534] Fixes in callback type definition in xhr methods --- d3/d3.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index fd81d7e9a..ae0c8911a 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -664,14 +664,14 @@ declare module D3 { * * @param callback Function to invoke on completion of request */ - (callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; /** * Issue the request using the POST method * * @param data Data to post back in the request * @param callback Function to invoke on completion of request */ - (data: any, callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (data: any, callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; }; /** * Issues this request using the specified method @@ -683,7 +683,7 @@ declare module D3 { * @param method Method to use to make the request * @param callback Function to invoke on completion of request */ - (method: string, callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (method: string, callback?: (eror: any, xhr: XMLHttpRequest) => void ): Xhr; /** * Issues this request using the specified method * @@ -691,7 +691,7 @@ declare module D3 { * @param data Data to post back in the request * @param callback Function to invoke on completion of request */ - (method: string, data: any, callback?: (xhr: XMLHttpRequest) => void ): Xhr; + (method: string, data: any, callback?: (error: any, xhr: XMLHttpRequest) => void ): Xhr; }; /** * Aborts this request, if it is currently in-flight From 3efc88b49af47c3632f953a5b2763da364b35332 Mon Sep 17 00:00:00 2001 From: Nick Lee Date: Tue, 19 May 2015 15:14:55 -0400 Subject: [PATCH 235/534] Added uri validator to Joi --- joi/joi.d.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 951fc4045..5e4bfc37b 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -61,6 +61,11 @@ declare module 'joi' { options?: ValidationOptions; } + export interface ValidationResult { + error: ValidationError; + value: T; + } + export interface SchemaMap { [key: string]: Schema; } @@ -252,6 +257,11 @@ declare module 'joi' { * Requires the string value to contain no whitespace before or after. If the validation convert option is on (enabled by default), the string will be trimmed. */ trim(): StringSchema; + + /** + * Requires the string value to be a valid uri with the passed scheme. + */ + uri(options?: { scheme?: string }): StringSchema; } export interface ArraySchema extends AnySchema { @@ -461,8 +471,7 @@ declare module 'joi' { */ export function validate(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void; export function validate(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void; - export function validate(value: T, schema: Schema, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void; - export function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void; + export function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): ValidationResult; /** * Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object). From 56532a6b84a85f0bede3f0d5582d838cad6ff563 Mon Sep 17 00:00:00 2001 From: Josh Heyse Date: Tue, 19 May 2015 16:51:02 -0500 Subject: [PATCH 236/534] Added WebSocket router declerations --- websocket/websocket-tests.ts | 44 ++++++++++++++- websocket/websocket.d.ts | 102 +++++++++++++++++++++++++++++++---- 2 files changed, 136 insertions(+), 10 deletions(-) diff --git a/websocket/websocket-tests.ts b/websocket/websocket-tests.ts index 7de0fa5b0..c30ddd3e9 100644 --- a/websocket/websocket-tests.ts +++ b/websocket/websocket-tests.ts @@ -45,6 +45,48 @@ import http = require('http'); console.log(Date.now() + ' Peer ' + connection.remoteAddress + ' disconnected.'); }); }); + + var wsRouter = new websocket.router({ + server: wsServer + }); + + wsRouter.mount('*', (request) => { + if(!originIsAllowed(request.origin)) { + request.reject(); + console.log((new Date()) + ' Connection from origin ' + request.origin + ' rejected.'); + return; + } + + var connection = request.accept('echo-protocol', request.origin); + console.log((new Date()) + ' Connection accepted.'); + connection.on('message', (message: websocket.IMessage) => { + if (message.type === 'utf8') { + console.log('Received Message: ' + message.utf8Data); + connection.sendUTF(message.utf8Data); + } + else if (message.type === 'binary') { + console.log('Received Binary Message of ' + message.binaryData.length + ' bytes'); + connection.sendBytes(message.binaryData); + } + }); + + connection.on('close', (code: number) => { + console.log(Date.now() + ' Peer ' + connection.remoteAddress + ' disconnected.'); + }); + }); + + wsRouter.mount('*', 'protocol', (request) => { + }); + + wsRouter.mount(/^route\/[a-zA-Z]+$/, (request) => { + + }); + + wsRouter.unmount('*'); + wsRouter.unmount('*', 'protocol'); + + wsRouter.unmount(/^route\/[a-zA-Z]+$/); + wsRouter.unmount(/^route\/[a-zA-Z]+$/, 'protocol'); } { @@ -78,7 +120,7 @@ import http = require('http'); setTimeout(sendNumber, 1000); } } - + sendNumber(); }); diff --git a/websocket/websocket.d.ts b/websocket/websocket.d.ts index d984e1bea..d17542e82 100644 --- a/websocket/websocket.d.ts +++ b/websocket/websocket.d.ts @@ -106,7 +106,7 @@ declare module "websocket" { /** * If this is true, websocket connections will be accepted regardless of the path - * and protocol specified by the client. The protocol accepted will be the first + * and protocol specified by the client. The protocol accepted will be the first * that was requested by the client. * @default false */ @@ -118,7 +118,7 @@ declare module "websocket" { * together before going onto the wire. This however comes at the cost of latency. * @default true */ - disableNagleAlgorithm?: boolean; + disableNagleAlgorithm?: boolean; } export class server extends events.EventEmitter { @@ -188,7 +188,7 @@ declare module "websocket" { key: string; /** Parsed resource, including the query string parameters */ resourceURL: url.Url; - + /** * Client's IP. If an `X-Forwarded-For` header is present, the value will be taken * from that header to facilitate WebSocket servers that live behind a reverse-proxy @@ -226,7 +226,7 @@ declare module "websocket" { * After inspecting the `request` properties, call this function on the * request object to accept the connection. If you don't have a particular subprotocol * you wish to speak, you may pass `null` for the `acceptedProtocol` parameter. - * + * * @param [acceptedProtocol] case-insensitive value that was requested by the client */ accept(acceptedProtocol?: string, allowedOrigin?: string, cookies?: ICookie[]): connection; @@ -321,7 +321,7 @@ declare module "websocket" { */ closeReasonCode: number; - /** + /** * The subprotocol that was chosen to be spoken on this connection. This field * will have been converted to lower case. */ @@ -451,13 +451,13 @@ declare module "websocket" { * a Protocol Error on the receiving peer. */ rsv1: boolean; - + /** * Represents the RSV1 field in the framing. Setting this to true will result in * a Protocol Error on the receiving peer. */ rsv2: boolean; - + /** * Represents the RSV1 field in the framing. Setting this to true will result in * a Protocol Error on the receiving peer. @@ -473,7 +473,7 @@ declare module "websocket" { /** * Identifies which kind of frame this is. - * + * * Hex - Dec - Description * 0x00 - 0 - Continuation * 0x01 - 1 - Text Frame @@ -548,7 +548,7 @@ declare module "websocket" { /** * Establish a connection. The remote server will select the best subprotocol that * it supports and send that back when establishing the connection. - * + * * @param [origin] can be used in user-agent scenarios to identify the page containing * any scripting content that caused the connection to be requested. * @param requestUrl should be a standard websocket url @@ -567,6 +567,90 @@ declare module "websocket" { addListener(event: 'connectFailed', cb: (err: Error) => void): client; } + class routerRequest extends events.EventEmitter { + + /** A reference to the original Node HTTP request object */ + httpRequest: http.ClientRequest; + /** A string containing the path that was requested by the client */ + resource: string; + /** Parsed resource, including the query string parameters */ + resourceURL: url.Url; + + /** + * Client's IP. If an `X-Forwarded-For` header is present, the value will be taken + * from that header to facilitate WebSocket servers that live behind a reverse-proxy + */ + remoteAddress: string; + + /** + * If the client is a web browser, origin will be a string containing the URL + * of the page containing the script that opened the connection. + * If the client is not a web browser, origin may be `null` or "*". + */ + origin: string; + + /** The version of the WebSocket protocol requested by the client */ + webSocketVersion: number; + /** An array containing a list of extensions requested by the client */ + requestedExtensions: any[]; + + cookies: ICookie[]; + + constructor(webSocketRequest: request, resolvedProtocol: string); + + /** + * After inspecting the `request` properties, call this function on the + * request object to accept the connection. If you don't have a particular subprotocol + * you wish to speak, you may pass `null` for the `acceptedProtocol` parameter. + * + * @param [acceptedProtocol] case-insensitive value that was requested by the client + */ + accept(acceptedProtocol?: string, allowedOrigin?: string, cookies?: ICookie[]): connection; + + /** + * Reject connection. + * You may optionally pass in an HTTP Status code (such as 404) and a textual + * description that will be sent to the client in the form of an + * `X-WebSocket-Reject-Reason` header. + */ + reject(httpStatus?: number, reason?: string): void; + + // Events + on(event: string, listener: () => void): request; + on(event: 'requestAccepted', cb: (connection: connection) => void): request; + on(event: 'requestRejected', cb: () => void): request; + addListener(event: string, listener: () => void): request; + addListener(event: 'requestAccepted', cb: (connection: connection) => void): request; + addListener(event: 'requestRejected', cb: () => void): request; + } + + interface IRouterConfig { + /* + * The WebSocketServer instance to attach to. + */ + server: server + } + + class router extends events.EventEmitter { + + constructor(config?: IRouterConfig); + + /** Attach to WebSocket server */ + attachServer(server: server): void; + + /** Detach from WebSocket server */ + detachServer(): void; + + mount(path: string, cb: (request: routerRequest) => void): void; + mount(path: string, protocol: string, cb: (request: routerRequest) => void): void; + mount(path: RegExp, cb: (request: routerRequest) => void): void; + mount(path: RegExp, protocol: string, cb: (request: routerRequest) => void): void; + + unmount(path: string, protocol?: string): void; + unmount(path: RegExp, protocol?: string): void; + + } + export var version: string; export var constants: { DEBUG: boolean; From 962cf3f96bf7aa45cf34c5575fb0a70d98a8aa80 Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Tue, 19 May 2015 16:29:28 -0600 Subject: [PATCH 237/534] adding defs for https://github.com/gkz/type-check --- type-check/type-check-tests.ts | 95 ++++++++++++++++++++++++++++++++++ type-check/type-check.d.ts | 33 ++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 type-check/type-check-tests.ts create mode 100644 type-check/type-check.d.ts diff --git a/type-check/type-check-tests.ts b/type-check/type-check-tests.ts new file mode 100644 index 000000000..d0c40ba8b --- /dev/null +++ b/type-check/type-check-tests.ts @@ -0,0 +1,95 @@ +// run this in node +/// +import tchecker = require("type-check"); + +var typeCheck = (i1:string|string[],i2:any,i3?: TypeCheck.Options ) => { + console.log(tchecker.typeCheck(i1,i2,i3)); + } ; +var parseType = (i1:string) => { + var res = tchecker.parseType(i1); + console.log(res); + return res; + } ; +var parsedTypeCheck= (i1:any,i2:any) => { + var res =tchecker.parsedTypeCheck(i1,i2); + console.log(res); + return res; + } ; +var TCVersion= () => { console.log(tchecker.VERSION); } ; + + + +console.log("===>testing typeCheck function"); +typeCheck('Number', 1); // true +typeCheck('Number', 2); // true +typeCheck('Number', 'str'); // false +typeCheck('Error', new Error); // true +typeCheck('Undefined', undefined); // true + +console.log("===>testing typeCheck function on Date"); +typeCheck('Date', new Date()); // true +typeCheck('Date', new Date("invalid")); // false + +// Comment +typeCheck('count::Number', 1); // true + +// One type OR another type: +typeCheck('Number | String', 2); // true +typeCheck('Number | String', 'str'); // true + +// Wildcard, matches all types: +typeCheck('*', 2) // true + +// Array, all elements of a single type: +typeCheck('[Number]', [1, 2, 3]); // true +typeCheck('[Number]', [1, 'str', 3]); // false + +// Tuples, or fixed length arrays with elements of different types: +typeCheck('(String, Number)', ['str', 2]); // true +typeCheck('(String, Number)', ['str']); // false +typeCheck('(String, Number)', ['str', 2, 5]); // false + +// Object properties: +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2}); // false +typeCheck('{x: Number, y: Maybe Boolean}', {x: 2}); // true +typeCheck('{x: Number, y: Boolean}', {x: 2, y: false, z: 3}); // false +typeCheck('{x: Number, y: Boolean, ...}', {x: 2, y: false, z: 3}); // true + +// A particular type AND object properties: +typeCheck('RegExp{source: String, ...}', /re/i); // true +typeCheck('RegExp{source: String, ...}', {source: 're'}); // false + + + +console.log("===>testing custom types"); +// Custom types: +var opt = {customTypes: + {Even: { typeOf: 'Number', + validate: function(x:number) { console.log("=>testing even"); return x % 2 === 0; } +}}}; +typeCheck('Even', 2, opt); // true + + +opt = {customTypes: +{Odd : { typeOf: 'Number', + validate: function(x:number) { console.log("=>testing odd");return x % 2 !== 0; } +}}}; +typeCheck('Odd', 3, opt); // true + + +console.log("===>testing nested types"); +// Nested: +var type = '{a: (String, [Number], {y: Array, ...}), b: Error{message: String, ...}}' +typeCheck(type, {a: ['hi', [1, 2, 3], {y: [1, 'ms']}], b: new Error('oh no')}); // true + + + + + +console.log("===>testing parseType function"); +// parseType(type); +var parsedType = parseType( 'Number'); // object +console.log("===>testing parsedTypeCheck function"); +// parsedTypeCheck(parsedType, input, options); +parsedTypeCheck(parsedType, 2); // true diff --git a/type-check/type-check.d.ts b/type-check/type-check.d.ts new file mode 100644 index 000000000..12b7de594 --- /dev/null +++ b/type-check/type-check.d.ts @@ -0,0 +1,33 @@ +// Type definitions for type-check v0.3.1 +// Project: https://github.com/gkz/type-check +// Definitions by: Hans Windhoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module TypeCheck { + + export interface CustomType { + [typeName: string]: { + typeOf: string; + validate: (x: any)=> any; + } + } + + export interface Options { + customTypes: CustomType; + } + + export interface TC{ + VERSION: string; + typeCheck: (typeDescription: string , inst: any, options?: Options) => boolean; + parseType: (typeDescription: string) => Object; + parsedTypeCheck: (parsedType: any, obj: any) => boolean; + + } +} + +declare var typecheck: TypeCheck.TC; + +declare module "type-check" { + export=typecheck; +} From 05b8636b50e52f265bd49f42a411f9f92edd799e Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Tue, 19 May 2015 16:40:08 -0600 Subject: [PATCH 238/534] adapt test --- type-check/type-check-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/type-check/type-check-tests.ts b/type-check/type-check-tests.ts index d0c40ba8b..b1d629309 100644 --- a/type-check/type-check-tests.ts +++ b/type-check/type-check-tests.ts @@ -2,7 +2,7 @@ /// import tchecker = require("type-check"); -var typeCheck = (i1:string|string[],i2:any,i3?: TypeCheck.Options ) => { +var typeCheck = (i1:string,i2:any,i3?: TypeCheck.Options ) => { console.log(tchecker.typeCheck(i1,i2,i3)); } ; var parseType = (i1:string) => { From c1dcab7dc47e2abbe5bdf560f8129f4fa44d5ae9 Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Tue, 19 May 2015 16:34:16 -0700 Subject: [PATCH 239/534] Updating browser-sync to 2.6.0 This primarily adds watch options --- browser-sync/browser-sync-tests.ts | 10 ++ browser-sync/browser-sync.d.ts | 187 ++++++++++++++++------------- 2 files changed, 112 insertions(+), 85 deletions(-) diff --git a/browser-sync/browser-sync-tests.ts b/browser-sync/browser-sync-tests.ts index 2f5459c2f..0af5dfc00 100644 --- a/browser-sync/browser-sync-tests.ts +++ b/browser-sync/browser-sync-tests.ts @@ -70,3 +70,13 @@ evt.on("init", function () { }); browserSync(config); + +var bs = browserSync.create(); + +bs.init({ + server: "./app" +}); + +bs.reload(); + + diff --git a/browser-sync/browser-sync.d.ts b/browser-sync/browser-sync.d.ts index 4b0cd72c0..db9f3ad3b 100644 --- a/browser-sync/browser-sync.d.ts +++ b/browser-sync/browser-sync.d.ts @@ -3,96 +3,113 @@ // Definitions by: Asana // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// /// declare module "browser-sync" { + import chokidar = require("chokidar"); + import fs = require("fs"); import http = require("http"); - - function BrowserSync(config?: BrowserSync.Options, callback?: (err: Error, bs: Object) => any): void; - - module BrowserSync { - export function reload(): void; - export function reload(file: string): void; - export function reload(files: string[]): void; - export function reload(options: {stream: boolean}): NodeJS.ReadWriteStream; - export function notify(message: string, timeout?: number): void; - - export function exit(): void; - - export var active: boolean; - - export var emitter: NodeJS.EventEmitter; - - interface Options { - files?: string | string[]; - watchOptions?: GazeOptions; - server?: ServerOptions; - proxy?: string | boolean; - port?: number; - https?: boolean; - ghostMode?: GhostOptions | boolean; - logLevel?: string; - logPrefix?: string; - logConnections?: boolean; - logFileChanges?: boolean; - logSnippet?: boolean; - snippetOptions?: SnippetOptions; - tunnel?: string | boolean; - online?: boolean; - open?: string | boolean; - browser?: string | string[]; - xip?: boolean; - notify?: boolean; - scrollProportionally?: boolean; - scrollThrottle?: number; - reloadDelay?: number; - injectChanges?: boolean; - startPath?: string; - minify?: boolean; - host?: string; - codeSync?: boolean; - timestamps?: boolean; - scriptPath?: (path: string) => string; - socket?: SocketOptions; - } - - interface GazeOptions { - interval?: number; - debounceDelay?: number; - mode?: string; - cwd?: string; - } - - interface ServerOptions { - baseDir?: string | string[]; - directory?: boolean; - index?: string; - routes?: {[path: string]: string}; - middleware?: MiddlewareHandler[]; - } - - interface MiddlewareHandler { - (req: http.ServerRequest, res: http.ServerResponse, next: Function): any; - } - - interface GhostOptions { - clicks?: boolean; - scroll?: boolean; - forms?: boolean; - } - - interface SnippetOptions { - ignorePaths?: string; - rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any}; - } - - interface SocketOptions { - path?: string; - clientPath?: string; - namespace?: string; - } + interface Options { + files?: string | string[]; + watchOptions?: GazeOptions; + server?: ServerOptions; + proxy?: string | boolean; + port?: number; + https?: boolean; + ghostMode?: GhostOptions | boolean; + logLevel?: string; + logPrefix?: string; + logConnections?: boolean; + logFileChanges?: boolean; + logSnippet?: boolean; + snippetOptions?: SnippetOptions; + rewriteRules?: boolean | RewriteRules[]; + tunnel?: string | boolean; + online?: boolean; + open?: string | boolean; + browser?: string | string[]; + xip?: boolean; + notify?: boolean; + scrollProportionally?: boolean; + scrollThrottle?: number; + reloadDelay?: number; + reloadDebounce?: number; + plugins?: any[]; + injectChanges?: boolean; + startPath?: string; + minify?: boolean; + host?: string; + codeSync?: boolean; + timestamps?: boolean; + scriptPath?: (path: string) => string; + socket?: SocketOptions; } - export = BrowserSync; + interface GazeOptions { + interval?: number; + debounceDelay?: number; + mode?: string; + cwd?: string; + } + + interface ServerOptions { + baseDir?: string | string[]; + directory?: boolean; + index?: string; + routes?: {[path: string]: string}; + middleware?: MiddlewareHandler[]; + } + + interface MiddlewareHandler { + (req: http.ServerRequest, res: http.ServerResponse, next: Function): any; + } + + interface GhostOptions { + clicks?: boolean; + scroll?: boolean; + forms?: boolean; + } + + interface SnippetOptions { + ignorePaths?: string; + rule?: {match?: RegExp; fn?: (snippet: string, match: string) => any}; + } + + interface SocketOptions { + path?: string; + clientPath?: string; + namespace?: string; + } + + interface RewriteRules { + match: RegExp; + fn: (match: string) => string; + } + + interface BrowserSync { + init(config?: Options, callback?: (err: Error, bs: Object) => any): void; + reload(): void; + reload(file: string): void; + reload(files: string[]): void; + reload(options: {stream: boolean}): NodeJS.ReadWriteStream; + notify(message: string, timeout?: number): void; + exit(): void; + watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any): NodeJS.EventEmitter; + pause(): void; + resume(): void; + emitter: NodeJS.EventEmitter; + active: boolean; + paused: boolean; + } + + interface Exports extends BrowserSync { + create(): BrowserSync; + (config?: Options, callback?: (err: Error, bs: Object) => any): void; + } + + var browserSync: Exports; + + export = browserSync; } From a358c640e7f7110d950f84c419190ee7a11fe5df Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Wed, 20 May 2015 01:21:44 +0100 Subject: [PATCH 240/534] #4372 - add `should` support for fluent & `should` extras --- chai-subset/chai-subset.d.ts | 6 +- chai/chai-tests.ts | 346 +++++++++++++++++++++++++++++++++++ chai/chai.d.ts | 27 ++- 3 files changed, 373 insertions(+), 6 deletions(-) diff --git a/chai-subset/chai-subset.d.ts b/chai-subset/chai-subset.d.ts index 44bbef9cc..b9605241b 100644 --- a/chai-subset/chai-subset.d.ts +++ b/chai-subset/chai-subset.d.ts @@ -1,6 +1,6 @@ // Type definitions for chai-subset 1.0.0 // Project: https://github.com/e-conomic/chai-subset -// Definitions by: Sam Noedel +// Definitions by: Sam Noedel , Andrew Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -11,10 +11,6 @@ declare module Chai { } } -interface Object { - should: Chai.Assertion; -} - declare module "chai-subset" { function chaiSubset(chai: any, utils: any): void; export = chaiSubset; diff --git a/chai/chai-tests.ts b/chai/chai-tests.ts index c3f6fe06a..fdd23da16 100644 --- a/chai/chai-tests.ts +++ b/chai/chai-tests.ts @@ -5,290 +5,416 @@ import chai = require('chai'); var expect = chai.expect; var assert = chai.assert; +var should = chai.should(); declare var err: Function; function chaiVersion() { expect(chai).to.have.property('version'); + (<{}>chai).should.have.property('version'); } function assertion() { expect('test').to.be.a('string'); + 'test'.should.be.a('string'); expect('foo').to.equal('foo'); + 'foo'.should.equal('foo'); + should.equal('foo', 'foo'); +} + +function fail() { + err(() => { + should.fail('foo', 'bar'); + }, 'expected fail to throw an AssertionError'); + err(() => { + should.fail('foo', 'bar', 'should fail'); + }, 'expected fail to throw an AssertionError'); + err(() => { + should.fail('foo', 'bar', 'should fail', 'equal'); + }, 'expected fail to throw an AssertionError'); } // ReSharper disable once InconsistentNaming function _true() { expect(true).to.be.true; + true.should.be.true; expect(false).to.not.be.true; + false.should.not.be.true; expect(1).to.not.be.true; + (1).should.not.be.true; err(() => { expect('test').to.be.true; + 'test'.should.be.true; }, 'expected \'test\' to be true'); } function ok() { expect(true).to.be.ok; + true.should.be.ok; expect(false).to.not.be.ok; + false.should.not.be.ok; expect(1).to.be.ok; + (1).should.be.ok; expect(0).to.not.be.ok; + (0).should.not.be.ok; err(() => { expect('').to.be.ok; + ''.should.be.ok; }, 'expected \'\' to be truthy'); err(() => { expect('test').to.not.be.ok; + 'test'.should.not.be.ok; }, 'expected \'test\' to be falsy'); } function _false() { expect(false).to.be.false; + false.should.be.false; expect(true).to.not.be.false; + true.should.not.be.false; expect(0).to.not.be.false; + (0).should.not.be.false; err(() => { expect('').to.be.false; + ''.should.be.false; }, 'expected \'\' to be false'); } function _null() { expect(null).to.be.null; + should.equal(null, null); expect(false).to.not.be.null; + false.should.not.be.null; err(() => { expect('').to.be.null; + ''.should.be.null; }, 'expected \'\' to be null'); } function _undefined() { expect(undefined).to.be.undefined; + should.equal(undefined, undefined); expect(null).to.not.be.undefined; + should.not.equal(null, undefined); err(() => { expect('').to.be.undefined; + ''.should.be.undefined; }, 'expected \'\' to be undefined'); } function exist() { var foo = 'bar'; expect(foo).to.exist; + should.exist(foo); expect(void(0)).to.not.exist; + should.not.exist(void (0)); } function arguments() { var args = arguments; expect(args).to.be.arguments; + args.should.be.arguments; expect([]).to.not.be.arguments; + [].should.not.be.arguments; expect(args).to.be.an('arguments').and.be.arguments; + args.should.be.an('arguments').and.be.arguments; expect([]).to.be.an('array').and.not.be.Arguments; + [].should.be.an('array').and.not.be.Arguments; } function equal() { expect(undefined).to.equal(void(0)); + should.equal(undefined, void(0)); } function _typeof() { expect('test').to.be.a('string'); + 'test'.should.be.a('string'); err(() => { expect('test').to.not.be.a('string'); + 'test'.should.not.be.a('string'); }, 'expected \'test\' not to be a string'); expect(arguments).to.be.an('arguments'); + arguments.should.be.an('arguments'); expect(5).to.be.a('number'); + (5).should.be.a('number'); + expect(new Number(1)).to.be.a('number'); + (new Number(1)).should.be.a('number'); expect(Number(1)).to.be.a('number'); + Number(1).should.be.a('number'); expect(true).to.be.a('boolean'); + true.should.be.a('boolean'); expect(new Array()).to.be.a('array'); + (new Array()).should.be.a('array'); expect(new Object()).to.be.a('object'); + (new Object()).should.be.a('object'); expect({}).to.be.a('object'); + ({}).should.be.a('object'); expect([]).to.be.a('array'); + [].should.be.a('array'); expect(() => { }).to.be.a('function'); + (() => { }).should.be.a('function'); expect(null).to.be.a('null'); + // N.B. previous line has no should equivalent err(() => { expect(5).to.not.be.a('number', 'blah'); + (5).should.not.be.a('number', 'blah'); }, 'blah: expected 5 not to be a number'); } class Foo { } function _instanceof() { expect(new Foo()).to.be.an.instanceof(Foo); + (new Foo()).should.be.an.instanceof(Foo); err(() => { expect(3).to.an.instanceof(Foo, 'blah'); + (3).should.an.instanceof(Foo, 'blah'); }, 'blah: expected 3 to be an instance of Foo'); } function within() { expect(5).to.be.within(5, 10); + (5).should.be.within(5, 10); expect(5).to.be.within(3, 6); + (5).should.be.within(3, 6); expect(5).to.be.within(3, 5); + (5).should.be.within(3, 5); expect(5).to.not.be.within(1, 3); + (5).should.not.be.within(1, 3); expect('foo').to.have.length.within(2, 4); + 'foo'.should.have.length.within(2, 4); expect([1, 2, 3]).to.have.length.within(2, 4); + [1, 2, 3].should.have.length.within(2, 4); err(() => { expect(5).to.not.be.within(4, 6, 'blah'); + (5).should.not.be.within(4, 6, 'blah'); }, 'blah: expected 5 to not be within 4..6', 'blah'); err(() => { expect(10).to.be.within(50, 100, 'blah'); + (10).should.be.within(50, 100, 'blah'); }, 'blah: expected 10 to be within 50..100'); err(() => { expect('foo').to.have.length.within(5, 7, 'blah'); + 'foo'.should.have.length.within(5, 7, 'blah'); }, 'blah: expected \'foo\' to have a length within 5..7'); err(() => { expect([1, 2, 3]).to.have.length.within(5, 7, 'blah'); + [1, 2, 3].should.have.length.within(5, 7, 'blah'); }, 'blah: expected [ 1, 2, 3 ] to have a length within 5..7'); } function above() { expect(5).to.be.above(2); + (5).should.be.above(2); expect(5).to.be.greaterThan(2); + (5).should.be.greaterThan(2); expect(5).to.not.be.above(5); + (5).should.not.be.above(5); expect(5).to.not.be.above(6); + (5).should.not.be.above(6); expect('foo').to.have.length.above(2); + 'foo'.should.have.length.above(2); expect([1, 2, 3]).to.have.length.above(2); + [1, 2, 3].should.have.length.above(2); err(() => { expect(5).to.be.above(6, 'blah'); + (5).should.be.above(6, 'blah'); }, 'blah: expected 5 to be above 6', 'blah'); err(() => { expect(10).to.not.be.above(6, 'blah'); + (10).should.not.be.above(6, 'blah'); }, 'blah: expected 10 to be at most 6'); err(() => { expect('foo').to.have.length.above(4, 'blah'); + 'foo'.should.have.length.above(4, 'blah'); }, 'blah: expected \'foo\' to have a length above 4 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.above(4, 'blah'); + [1, 2, 3].should.have.length.above(4, 'blah'); }, 'blah: expected [ 1, 2, 3 ] to have a length above 4 but got 3'); } function least() { expect(5).to.be.at.least(2); + (5).should.be.at.least(2); expect(5).to.be.at.least(5); + (5).should.be.at.least(5); expect(5).to.not.be.at.least(6); + (5).should.not.be.at.least(6); expect('foo').to.have.length.of.at.least(2); + 'foo'.should.have.length.of.at.least(2); expect([1, 2, 3]).to.have.length.of.at.least(2); + [1, 2, 3].should.have.length.of.at.least(2); err(() => { expect(5).to.be.at.least(6, 'blah'); + (5).should.be.at.least(6, 'blah'); }, 'blah: expected 5 to be at least 6', 'blah'); err(() => { expect(10).to.not.be.at.least(6, 'blah'); + (10).should.not.be.at.least(6, 'blah'); }, 'blah: expected 10 to be below 6'); err(() => { expect('foo').to.have.length.of.at.least(4, 'blah'); + 'foo'.should.have.length.of.at.least(4, 'blah'); }, 'blah: expected \'foo\' to have a length at least 4 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.of.at.least(4, 'blah'); + [1, 2, 3].should.have.length.of.at.least(4, 'blah'); }, 'blah: expected [ 1, 2, 3 ] to have a length at least 4 but got 3'); err(() => { expect([1, 2, 3, 4]).to.not.have.length.of.at.least(4, 'blah'); + [1, 2, 3, 4].should.not.have.length.of.at.least(4, 'blah'); }, 'blah: expected [ 1, 2, 3, 4 ] to have a length below 4'); } function below() { expect(2).to.be.below(5); + (2).should.be.below(5); expect(2).to.be.lessThan(5); + (2).should.be.lessThan(5); expect(2).to.not.be.below(2); + (2).should.not.be.below(2); expect(2).to.not.be.below(1); + (2).should.not.be.below(1); expect('foo').to.have.length.below(4); + 'foo'.should.have.length.below(4); expect([1, 2, 3]).to.have.length.below(4); + [1, 2, 3].should.have.length.below(4); err(() => { expect(6).to.be.below(5, 'blah'); + (6).should.be.below(5, 'blah'); }, 'blah: expected 6 to be below 5'); err(() => { expect(6).to.not.be.below(10, 'blah'); + (6).should.not.be.below(10, 'blah'); }, 'blah: expected 6 to be at least 10'); err(() => { expect('foo').to.have.length.below(2, 'blah'); + 'foo'.should.have.length.below(2, 'blah'); }, 'blah: expected \'foo\' to have a length below 2 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.below(2, 'blah'); + [1, 2, 3].should.have.length.below(2, 'blah'); }, 'blah: expected [ 1, 2, 3 ] to have a length below 2 but got 3'); } function most() { expect(2).to.be.at.most(5); + (2).should.be.at.most(5); expect(2).to.be.at.most(2); + (2).should.be.at.most(2); expect(2).to.not.be.at.most(1); + (2).should.not.be.at.most(1); expect(2).to.not.be.at.most(1); + (2).should.not.be.at.most(1); expect('foo').to.have.length.of.at.most(4); + 'foo'.should.have.length.of.at.most(4); expect([1, 2, 3]).to.have.length.of.at.most(4); + [1, 2, 3].should.have.length.of.at.most(4); err(() => { expect(6).to.be.at.most(5, 'blah'); + (6).should.be.at.most(5, 'blah'); }, 'blah: expected 6 to be at most 5'); err(() => { expect(6).to.not.be.at.most(10, 'blah'); + (6).should.not.be.at.most(10, 'blah'); }, 'blah: expected 6 to be above 10'); err(() => { expect('foo').to.have.length.of.at.most(2, 'blah'); + 'foo'.should.have.length.of.at.most(2, 'blah'); }, 'blah: expected \'foo\' to have a length at most 2 but got 3'); err(() => { expect([1, 2, 3]).to.have.length.of.at.most(2, 'blah'); + [1, 2, 3].should.have.length.of.at.most(2, 'blah'); }, 'blah: expected [ 1, 2, 3 ] to have a length at most 2 but got 3'); err(() => { expect([1, 2]).to.not.have.length.of.at.most(2, 'blah'); + [1, 2].should.not.have.length.of.at.most(2, 'blah'); }, 'blah: expected [ 1, 2 ] to have a length above 2'); } function match() { expect('foobar').to.match(/^foo/); + 'foobar'.should.match(/^foo/); expect('foobar').to.not.match(/^bar/); + 'foobar'.should.not.match(/^bar/); err(() => { expect('foobar').to.match(/^bar/i, 'blah'); + 'foobar'.should.match(/^bar/i, 'blah'); }, 'blah: expected \'foobar\' to match /^bar/i'); err(() => { expect('foobar').to.not.match(/^foo/i, 'blah'); + 'foobar'.should.not.match(/^foo/i, 'blah'); }, 'blah: expected \'foobar\' not to match /^foo/i'); } function length2() { expect('test').to.have.length(4); + 'test'.should.have.length(4); expect('test').to.not.have.length(3); + 'test'.should.not.have.length(3); expect([1, 2, 3]).to.have.length(3); + [1, 2, 3].should.have.length(3); err(() => { expect(4).to.have.length(3, 'blah'); + (4).should.have.length(3, 'blah'); }, 'blah: expected 4 to have a property \'length\''); err(() => { expect('asd').to.not.have.length(3, 'blah'); + 'asd'.should.not.have.length(3, 'blah'); }, 'blah: expected \'asd\' to not have a length of 3'); } function eql() { expect('test').to.eql('test'); + 'test'.should.eql('test'); expect({ foo: 'bar' }).to.eql({ foo: 'bar' }); + ({ foo: 'bar' }).should.eql({ foo: 'bar' }); expect(1).to.eql(1); + (1).should.eql(1); expect('4').to.not.eql(4); + '4'.should.not.eql(4); err(() => { expect(4).to.eql(3, 'blah'); + (4).should.eql(3, 'blah'); }, 'blah: expected 4 to deeply equal 3'); } @@ -298,39 +424,54 @@ class Buffer { } function buffer() { expect(new Buffer([1])).to.eql(new Buffer([1])); + (new Buffer([1])).should.eql(new Buffer([1])); err(() => { expect(new Buffer([0])).to.eql(new Buffer([1])); + (new Buffer([0])).should.eql(new Buffer([1])); }, 'expected to deeply equal '); } function equal2() { expect('test').to.equal('test'); + 'test'.should.equal('test'); + should.equal('test', 'test'); expect(1).to.equal(1); + (1).should.equal(1); + should.equal(1, 1); err(() => { expect(4).to.equal(3, 'blah'); + (4).should.equal(3, 'blah'); + should.equal(4, 3, 'blah'); }, 'blah: expected 4 to equal 3'); err(() => { expect('4').to.equal(4, 'blah'); + '4'.should.equal(4, 'blah'); + should.equal(4, 4, 'blah'); }, 'blah: expected \'4\' to equal 4'); } function deepEqual() { expect({ foo: 'bar' }).to.deep.equal({ foo: 'bar' }); + ({ foo: 'bar' }).should.deep.equal({ foo: 'bar' }); expect({ foo: 'bar' }).not.to.deep.equal({ foo: 'baz' }); } function deepEqual2() { expect(/a/).to.deep.equal(/a/); + /a/.should.deep.equal(/a/); expect(/a/).not.to.deep.equal(/b/); expect(/a/).not.to.deep.equal({}); expect(/a/g).to.deep.equal(/a/g); + /a/g.should.deep.equal(/a/g); expect(/a/g).not.to.deep.equal(/b/g); expect(/a/i).to.deep.equal(/a/i); + /a/i.should.deep.equal(/a/i); expect(/a/i).not.to.deep.equal(/b/i); expect(/a/m).to.deep.equal(/a/m); + /a/m.should.deep.equal(/a/m); expect(/a/m).not.to.deep.equal(/b/m); } @@ -339,13 +480,18 @@ function deepEqual3() { var a = new Date(1, 2, 3); var b = new Date(4, 5, 6); expect(a).to.deep.equal(a); + a.should.deep.equal(a); expect(a).not.to.deep.equal(b); + a.should.not.deep.equal(b); expect(a).not.to.deep.equal({}); + a.should.not.deep.equal({}); } function deepInclude() { expect(['foo', 'bar']).to.deep.include(['bar', 'foo']); + ['foo', 'bar'].should.deep.include(['bar', 'foo']); expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz' ]); + ['foo', 'bar'].should.not.deep.equal(['foo', 'baz' ]); } class FakeArgs { @@ -356,239 +502,332 @@ function empty() { FakeArgs.prototype.length = 0; expect('').to.be.empty; + + ''.should.be.empty; expect('foo').not.to.be.empty; + 'foo'.should.not.be.empty; expect([]).to.be.empty; + [].should.be.empty; expect(['foo']).not.to.be.empty; + ['foo'].should.not.be.empty; expect(new FakeArgs).to.be.empty; + (new FakeArgs).should.be.empty; expect({ arguments: 0 }).not.to.be.empty; + ({ arguments: 0 }).should.not.be.empty; expect({}).to.be.empty; + ({}).should.be.empty; expect({ foo: 'bar' }).not.to.be.empty; + ({ foo: 'bar' }).should.not.be.empty; err(() => { expect('').not.to.be.empty; + ''.should.not.be.empty; }, 'expected \'\' not to be empty'); err(() => { expect('foo').to.be.empty; + 'foo'.should.be.empty; + 'foo'.should.be.empty; }, 'expected \'foo\' to be empty'); err(() => { expect([]).not.to.be.empty; + [].should.not.be.empty; }, 'expected [] not to be empty'); err(() => { expect(['foo']).to.be.empty; + ['foo'].should.be.empty; }, 'expected [ \'foo\' ] to be empty'); err(() => { expect(new FakeArgs).not.to.be.empty; + (new FakeArgs).should.not.be.empty; }, 'expected { length: 0 } not to be empty'); err(() => { expect({ arguments: 0 }).to.be.empty; + ({ arguments: 0 }).should.be.empty; }, 'expected { arguments: 0 } to be empty'); err(() => { expect({}).not.to.be.empty; + ({}).should.not.be.empty; }, 'expected {} not to be empty'); err(() => { expect({ foo: 'bar' }).to.be.empty; + ({ foo: 'bar' }).should.be.empty; }, 'expected { foo: \'bar\' } to be empty'); } function property() { expect('test').to.have.property('length'); + 'test'.should.have.property('length'); expect(4).to.not.have.property('length'); + (4).should.not.have.property('length'); expect({ 'foo.bar': 'baz' }) .to.have.property('foo.bar'); + ({ 'foo.bar': 'baz' }).should.have.property('foo.bar'); expect({ foo: { bar: 'baz' } }) .to.not.have.property('foo.bar'); + ({ foo: { bar: 'baz' } }).should.not.have.property('foo.bar'); err(() => { expect('asd').to.have.property('foo'); + 'asd'.should.have.property('foo'); }, 'expected \'asd\' to have a property \'foo\''); err(() => { expect({ foo: { bar: 'baz' } }) .to.have.property('foo.bar'); + ({ foo: { bar: 'baz' } }).should.have.property('foo.bar'); }, 'expected { foo: { bar: \'baz\' } } to have a property \'foo.bar\''); } function deepProperty() { expect({ 'foo.bar': 'baz' }) .to.not.have.deep.property('foo.bar'); + ({ 'foo.bar': 'baz' }).should + .not.have.deep.property('foo.bar'); expect({ foo: { bar: 'baz' } }) .to.have.deep.property('foo.bar'); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar'); err(() => { expect({ 'foo.bar': 'baz' }) .to.have.deep.property('foo.bar'); + ({ 'foo.bar': 'baz' }).should + .have.deep.property('foo.bar'); }, 'expected { \'foo.bar\': \'baz\' } to have a deep property \'foo.bar\''); } function property2() { expect('test').to.have.property('length', 4); + 'test'.should.have.property('length', 4); expect('asd').to.have.property('constructor', String); + 'asd'.should.have.property('constructor', String); err(() => { expect('asd').to.have.property('length', 4, 'blah'); + 'asd'.should.have.property('length', 4, 'blah'); }, 'blah: expected \'asd\' to have a property \'length\' of 4, but got 3'); err(() => { expect('asd').to.not.have.property('length', 3, 'blah'); + 'asd'.should.not.have.property('length', 3, 'blah'); }, 'blah: expected \'asd\' to not have a property \'length\' of 3'); err(() => { expect('asd').to.not.have.property('foo', 3, 'blah'); + 'asd'.should.not.have.property('foo', 3, 'blah'); }, 'blah: \'asd\' has no property \'foo\''); err(() => { expect('asd').to.have.property('constructor', Number, 'blah'); + 'asd'.should.have.property('constructor', Number, 'blah'); }, 'blah: expected \'asd\' to have a property \'constructor\' of [Function: Number], but got [Function: String]'); } function deepProperty2() { expect({ foo: { bar: 'baz' } }) .to.have.deep.property('foo.bar', 'baz'); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar', 'baz'); err(() => { expect({ foo: { bar: 'baz' } }) .to.have.deep.property('foo.bar', 'quux', 'blah'); + ({ foo: { bar: 'baz' } }).should + .have.deep.property('foo.bar', 'quux', 'blah'); }, 'blah: expected { foo: { bar: \'baz\' } } to have a deep property \'foo.bar\' of \'quux\', but got \'baz\''); err(() => { expect({ foo: { bar: 'baz' } }) .to.not.have.deep.property('foo.bar', 'baz', 'blah'); + ({ foo: { bar: 'baz' } }).should + .not.have.deep.property('foo.bar', 'baz', 'blah'); }, 'blah: expected { foo: { bar: \'baz\' } } to not have a deep property \'foo.bar\' of \'baz\''); err(() => { expect({ foo: 5 }) .to.not.have.deep.property('foo.bar', 'baz', 'blah'); + ({ foo: 5 }).should + .not.have.deep.property('foo.bar', 'baz', 'blah'); }, 'blah: { foo: 5 } has no deep property \'foo.bar\''); } function ownProperty() { expect('test').to.have.ownProperty('length'); + 'test'.should.have.ownProperty('length'); expect('test').to.haveOwnProperty('length'); + 'test'.should.haveOwnProperty('length'); expect({ length: 12 }).to.have.ownProperty('length'); + ({ length: 12 }).should.have.ownProperty('length'); err(() => { expect({ length: 12 }).to.not.have.ownProperty('length', 'blah'); + ({ length: 12 }).should.not.have.ownProperty('length', 'blah'); }, 'blah: expected { length: 12 } to not have own property \'length\''); } function string() { expect('foobar').to.have.string('bar'); + 'foobar'.should.have.string('bar'); expect('foobar').to.have.string('foo'); + 'foobar'.should.have.string('foo'); expect('foobar').to.not.have.string('baz'); + 'foobar'.should.not.have.string('baz'); err(() => { expect(3).to.have.string('baz'); + (3).should.have.string('baz'); }, 'expected 3 to be a string'); err(() => { expect('foobar').to.have.string('baz', 'blah'); + 'foobar'.should.have.string('baz', 'blah'); }, 'blah: expected \'foobar\' to contain \'baz\''); err(() => { expect('foobar').to.not.have.string('bar', 'blah'); + 'foobar'.should.not.have.string('bar', 'blah'); }, 'blah: expected \'foobar\' to not contain \'bar\''); } function include() { expect(['foo', 'bar']).to.include('foo'); + ['foo', 'bar'].should.include('foo'); expect(['foo', 'bar']).to.include('foo'); + ['foo', 'bar'].should.include('foo'); expect(['foo', 'bar']).to.include('bar'); + ['foo', 'bar'].should.include('bar'); expect([1, 2]).to.include(1); + [1, 2].should.include(1); expect(['foo', 'bar']).to.not.include('baz'); + ['foo', 'bar'].should.not.include('baz'); expect(['foo', 'bar']).to.not.include(1); + ['foo', 'bar'].should.not.include(1); err(() => { expect(['foo']).to.include('bar', 'blah'); + ['foo'].should.include('bar', 'blah'); }, 'blah: expected [ \'foo\' ] to include \'bar\''); err(() => { expect(['bar', 'foo']).to.not.include('foo', 'blah'); + ['bar', 'foo'].should.not.include('foo', 'blah'); }, 'blah: expected [ \'bar\', \'foo\' ] to not include \'foo\''); } function keys() { expect({ foo: 1 }).to.have.keys(['foo']); + ({ foo: 1 }).should.have.keys(['foo']); expect({ foo: 1, bar: 2 }).to.have.keys(['foo', 'bar']); + ({ foo: 1, bar: 2 }).should.have.keys(['foo', 'bar']); expect({ foo: 1, bar: 2 }).to.have.keys('foo', 'bar'); + ({ foo: 1, bar: 2 }).should.have.keys('foo', 'bar'); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('foo', 'bar'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('foo', 'bar'); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('bar', 'foo'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('bar', 'foo'); expect({ foo: 1, bar: 2, baz: 3 }).to.contain.keys('baz'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.keys('baz'); expect({ foo: 1, bar: 2 }).to.contain.keys('foo'); + ({ foo: 1, bar: 2 }).should.contain.keys('foo'); expect({ foo: 1, bar: 2 }).to.contain.keys('bar', 'foo'); + ({ foo: 1, bar: 2 }).should.contain.keys('bar', 'foo'); expect({ foo: 1, bar: 2 }).to.contain.keys(['foo']); + ({ foo: 1, bar: 2 }).should.contain.keys(['foo']); expect({ foo: 1, bar: 2 }).to.contain.keys(['bar']); + ({ foo: 1, bar: 2 }).should.contain.keys(['bar']); expect({ foo: 1, bar: 2 }).to.contain.keys(['bar', 'foo']); + ({ foo: 1, bar: 2 }).should.contain.keys(['bar', 'foo']); expect({ foo: 1, bar: 2 }).to.not.have.keys('baz'); + ({ foo: 1, bar: 2 }).should.not.have.keys('baz'); expect({ foo: 1, bar: 2 }).to.not.have.keys('foo', 'baz'); + ({ foo: 1, bar: 2 }).should.not.have.keys('foo', 'baz'); expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('baz'); expect({ foo: 1, bar: 2 }).to.not.contain.keys('foo', 'baz'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('foo', 'baz'); expect({ foo: 1, bar: 2 }).to.not.contain.keys('baz', 'foo'); + ({ foo: 1, bar: 2 }).should.not.contain.keys('baz', 'foo'); err(() => { expect({ foo: 1 }).to.have.keys(); + ({ foo: 1 }).should.have.keys(); }, 'keys required'); err(() => { expect({ foo: 1 }).to.have.keys([]); + ({ foo: 1 }).should.have.keys([]); }, 'keys required'); err(() => { expect({ foo: 1 }).to.not.have.keys([]); + ({ foo: 1 }).should.not.have.keys([]); }, 'keys required'); err(() => { expect({ foo: 1 }).to.contain.keys([]); + ({ foo: 1 }).should.contain.keys([]); }, 'keys required'); err(() => { expect({ foo: 1 }).to.have.keys(['bar']); + ({ foo: 1 }).should.have.keys(['bar']); }, 'expected { foo: 1 } to have key \'bar\''); err(() => { expect({ foo: 1 }).to.have.keys(['bar', 'baz']); + ({ foo: 1 }).should.have.keys(['bar', 'baz']); }, 'expected { foo: 1 } to have keys \'bar\', and \'baz\''); err(() => { expect({ foo: 1 }).to.have.keys(['foo', 'bar', 'baz']); + ({ foo: 1 }).should.have.keys(['foo', 'bar', 'baz']); }, 'expected { foo: 1 } to have keys \'foo\', \'bar\', and \'baz\''); err(() => { expect({ foo: 1 }).to.not.have.keys(['foo']); + ({ foo: 1 }).should.not.have.keys(['foo']); }, 'expected { foo: 1 } to not have key \'foo\''); err(() => { expect({ foo: 1 }).to.not.have.keys(['foo']); + ({ foo: 1 }).should.not.have.keys(['foo']); }, 'expected { foo: 1 } to not have key \'foo\''); err(() => { expect({ foo: 1, bar: 2 }).to.not.have.keys(['foo', 'bar']); + ({ foo: 1, bar: 2 }).should.not.have.keys(['foo', 'bar']); }, 'expected { foo: 1, bar: 2 } to not have keys \'foo\', and \'bar\''); err(() => { expect({ foo: 1 }).to.not.contain.keys(['foo']); + ({ foo: 1 }).should.not.contain.keys(['foo']); }, 'expected { foo: 1 } to not contain key \'foo\''); err(() => { expect({ foo: 1 }).to.contain.keys('foo', 'bar'); + ({ foo: 1 }).should.contain.keys('foo', 'bar'); }, 'expected { foo: 1 } to contain keys \'foo\', and \'bar\''); } function chaining() { var tea = { name: 'chai', extras: ['milk', 'sugar', 'smile'] }; expect(tea).to.have.property('extras').with.lengthOf(3); + tea.should.have.property('extras').with.lengthOf(3); err(() => { expect(tea).to.have.property('extras').with.lengthOf(4); + tea.should.have.property('extras').with.lengthOf(4); }, 'expected [ \'milk\', \'sugar\', \'smile\' ] to have a length of 4 but got 3'); expect(tea).to.be.a('object').and.have.property('name', 'chai'); + tea.should.be.a('object').and.have.property('name', 'chai'); } class PoorlyConstructedError {} @@ -607,97 +846,180 @@ function _throw() { , specificErrFn = () => { throw specificError; }; expect(goodFn).to.not.throw(); + goodFn.should.not.throw(); + should.not.throw(goodFn); expect(goodFn).to.not.throw(Error); + goodFn.should.not.throw(Error); + should.not.throw(goodFn, Error); expect(goodFn).to.not.throw(specificError); + goodFn.should.not.throw(specificError); + should.not.throw(goodFn, specificError); + expect(badFn).to.throw(); + badFn.should.throw(); + should.throw(badFn); expect(badFn).to.throw(Error); + badFn.should.throw(Error); + should.throw(badFn, Error); expect(badFn).to.not.throw(ReferenceError); + badFn.should.not.throw(ReferenceError); + should.not.throw(badFn, ReferenceError); expect(badFn).to.not.throw(specificError); + badFn.should.not.throw(specificError); + should.not.throw(badFn, specificError); + expect(refErrFn).to.throw(); + refErrFn.should.throw(); + should.throw(refErrFn); expect(refErrFn).to.throw(ReferenceError); + refErrFn.should.throw(ReferenceError); + should.throw(refErrFn, ReferenceError); expect(refErrFn).to.throw(Error); + refErrFn.should.throw(Error); + should.throw(refErrFn, Error); expect(refErrFn).to.not.throw(TypeError); + refErrFn.should.not.throw(TypeError); + should.not.throw(refErrFn, TypeError); expect(refErrFn).to.not.throw(specificError); + refErrFn.should.not.throw(specificError); + should.not.throw(refErrFn, specificError); + expect(ickyErrFn).to.throw(); + ickyErrFn.should.throw(); + should.throw(ickyErrFn); expect(ickyErrFn).to.throw(PoorlyConstructedError); + ickyErrFn.should.throw(PoorlyConstructedError); + should.throw(ickyErrFn, PoorlyConstructedError); expect(ickyErrFn).to.throw(Error); + ickyErrFn.should.throw(Error); + should.throw(ickyErrFn, Error); expect(ickyErrFn).to.not.throw(specificError); + ickyErrFn.should.not.throw(specificError); + should.not.throw(ickyErrFn, specificError); expect(specificErrFn).to.throw(specificError); + specificErrFn.should.throw(specificError); + should.throw(ickyErrFn, specificError); expect(badFn).to.throw(/testing/); + badFn.should.throw(/testing/); + should.throw(badFn, /testing/); expect(badFn).to.not.throw(/hello/); + badFn.should.not.throw(/hello/); + should.not.throw(badFn, /hello/); expect(badFn).to.throw('testing'); + badFn.should.throw('testing'); + should.throw(badFn, 'testing'); expect(badFn).to.not.throw('hello'); + badFn.should.not.throw('hello'); + should.not.throw(badFn, 'hello'); expect(badFn).to.throw(Error, /testing/); + badFn.should.throw(Error, /testing/); + should.throw(badFn, Error, /testing/); expect(badFn).to.throw(Error, 'testing'); + badFn.should.throw(Error, 'testing'); + should.throw(badFn, Error, 'testing'); err(() => { expect(goodFn).to.throw(); + goodFn.should.throw(); + should.throw(goodFn); }, 'expected [Function] to throw an error'); err(() => { expect(goodFn).to.throw(ReferenceError); + goodFn.should.throw(ReferenceError); + should.throw(goodFn, ReferenceError); }, 'expected [Function] to throw ReferenceError'); err(() => { expect(goodFn).to.throw(specificError); + goodFn.should.throw(specificError); + should.throw(goodFn, specificError); }, 'expected [Function] to throw [RangeError: boo]'); err(() => { expect(badFn).to.not.throw(); + badFn.should.not.throw(); + should.not.throw(badFn); }, 'expected [Function] to not throw an error but [Error: testing] was thrown'); err(() => { expect(badFn).to.throw(ReferenceError); + badFn.should.throw(ReferenceError); + should.throw(badFn, ReferenceError); }, 'expected [Function] to throw \'ReferenceError\' but [Error: testing] was thrown'); err(() => { expect(badFn).to.throw(specificError); + badFn.should.throw(specificError); + should.throw(badFn, specificError); }, 'expected [Function] to throw [RangeError: boo] but [Error: testing] was thrown'); err(() => { expect(badFn).to.not.throw(Error); + badFn.should.not.throw(Error); + should.not.throw(badFn, Error); }, 'expected [Function] to not throw \'Error\' but [Error: testing] was thrown'); err(() => { expect(refErrFn).to.not.throw(ReferenceError); + refErrFn.should.not.throw(ReferenceError); + should.not.throw(refErrFn, ReferenceError); }, 'expected [Function] to not throw \'ReferenceError\' but [ReferenceError: hello] was thrown'); err(() => { expect(badFn).to.throw(PoorlyConstructedError); + badFn.should.throw(PoorlyConstructedError); + should.throw(badFn, PoorlyConstructedError); }, 'expected [Function] to throw \'PoorlyConstructedError\' but [Error: testing] was thrown'); err(() => { expect(ickyErrFn).to.not.throw(PoorlyConstructedError); + ickyErrFn.should.not.throw(PoorlyConstructedError); + should.not.throw(ickyErrFn, PoorlyConstructedError); }, /^(expected \[Function\] to not throw 'PoorlyConstructedError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); err(() => { expect(ickyErrFn).to.throw(ReferenceError); + ickyErrFn.should.throw(ReferenceError); + should.throw(ickyErrFn, ReferenceError); }, /^(expected \[Function\] to throw 'ReferenceError' but)(.*)(PoorlyConstructedError|\{ Object \()(.*)(was thrown)$/); err(() => { expect(specificErrFn).to.throw(new ReferenceError('eek')); + specificErrFn.should.throw(new ReferenceError('eek')); + should.throw(specificErrFn, new ReferenceError('eek')); }, 'expected [Function] to throw [ReferenceError: eek] but [RangeError: boo] was thrown'); err(() => { expect(specificErrFn).to.not.throw(specificError); + specificErrFn.should.not.throw(specificError); + should.not.throw(specificErrFn, specificError); }, 'expected [Function] to not throw [RangeError: boo]'); err(() => { expect(badFn).to.not.throw(/testing/); + badFn.should.not.throw(/testing/); + should.not.throw(badFn, /testing/); }, 'expected [Function] to throw error not matching /testing/'); err(() => { expect(badFn).to.throw(/hello/); + badFn.should.throw(/hello/); + should.throw(badFn, /hello/); }, 'expected [Function] to throw error matching /hello/ but got \'testing\''); err(() => { expect(badFn).to.throw(Error, /hello/, 'blah'); + badFn.should.throw(Error, /hello/, 'blah'); + should.throw(badFn, Error, /hello/, 'blah'); }, 'blah: expected [Function] to throw error matching /hello/ but got \'testing\''); err(() => { expect(badFn).to.throw(Error, 'hello', 'blah'); + badFn.should.throw(Error, 'hello', 'blah'); + should.throw(badFn, Error, 'hello', 'blah'); }, 'blah: expected [Function] to throw error including \'hello\' but got \'testing\''); } @@ -712,18 +1034,23 @@ function respondTo() { var bar = {}; expect(Foo).to.respondTo('bar'); + Foo.should.respondTo('bar'); expect(Foo).to.not.respondTo('foo'); + Foo.should.not.respondTo('foo'); expect(Foo).itself.to.respondTo('func'); expect(Foo).itself.not.to.respondTo('bar'); expect(bar).to.respondTo('foo'); + bar.should.respondTo('foo'); err(() => { expect(Foo).to.respondTo('baz', 'constructor'); + Foo.should.respondTo('baz', 'constructor'); }, /^(constructor: expected)(.*)(\[Function: Foo\])(.*)(to respond to \'baz\')$/); err(() => { expect(bar).to.respondTo('baz', 'object'); + bar.should.respondTo('baz', 'object'); }, /^(object: expected)(.*)(\{ foo: \[Function\] \}|\{ Object \()(.*)(to respond to \'baz\')$/); } @@ -733,43 +1060,62 @@ function satisfy() { } expect(1).to.satisfy(matcher); + (1).should.satisfy(matcher); err(() => { expect(2).to.satisfy(matcher, 'blah'); + (2).should.satisfy(matcher, 'blah'); }, 'blah: expected 2 to satisfy [Function: matcher]'); } function closeTo() { expect(1.5).to.be.closeTo(1.0, 0.5); + (1.5).should.be.closeTo(1.0, 0.5); expect(10).to.be.closeTo(20, 20); + (10).should.be.closeTo(20, 20); expect(-10).to.be.closeTo(20, 30); + (-10).should.be.closeTo(20, 30); err(() => { expect(2).to.be.closeTo(1.0, 0.5, 'blah'); + (2).should.be.closeTo(1.0, 0.5, 'blah'); }, 'blah: expected 2 to be close to 1 +/- 0.5'); err(() => { expect(-10).to.be.closeTo(20, 29, 'blah'); + (-10).should.be.closeTo(20, 29, 'blah'); }, 'blah: expected -10 to be close to 20 +/- 29'); } function includeMembers() { expect([1, 2, 3]).to.include.members([]); + [1, 2, 3].should.include.members([]); expect([1, 2, 3]).to.include.members([3, 2]); + [1, 2, 3].should.include.members([3, 2]); + expect([1, 2, 3]).to.not.include.members([8, 4]); + [1, 2, 3].should.not.include.members([8, 4]); + expect([1, 2, 3]).to.not.include.members([1, 2, 3, 4]); + + [1, 2, 3].should.not.include.members([1, 2, 3, 4]); } function sameMembers() { expect([5, 4]).to.have.same.members([4, 5]); + [5, 4].should.have.same.members([4, 5]); expect([5, 4]).to.have.same.members([5, 4]); + [5, 4].should.have.same.members([5, 4]); expect([5, 4]).to.not.have.same.members([]); + [5, 4].should.not.have.same.members([]); expect([5, 4]).to.not.have.same.members([6, 3]); + [5, 4].should.not.have.same.members([6, 3]); expect([5, 4]).to.not.have.same.members([5, 4, 2]); + [5, 4].should.not.have.same.members([5, 4, 2]); } function members() { diff --git a/chai/chai.d.ts b/chai/chai.d.ts index 1134b137d..f693582c5 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -1,12 +1,15 @@ // Type definitions for chai 2.0.0 // Project: http://chaijs.com/ -// Definitions by: Jed Mao , Bart van der Schoor +// Definitions by: Jed Mao , +// Bart van der Schoor , +// Andrew Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module Chai { interface ChaiStatic { expect: ExpectStatic; + should(): Should; /** * Provides a way to extend the internals of Chai */ @@ -25,6 +28,24 @@ declare module Chai { (target: any, message?: string): Assertion; } + interface ShouldAssertion { + equal(value1: any, value2: any, message?: string): void; + Throw: ShouldThrow; + throw: ShouldThrow; + exist(value: any, message?: string): void; + } + + interface Should extends ShouldAssertion { + not: ShouldAssertion; + fail(actual: any, expected: any, message?: string, operator?: string): void; + } + + interface ShouldThrow { + (actual: Function): void; + (actual: Function, expected: string|RegExp, message?: string): void; + (actual: Function, constructor: Error|Function, expected?: string|RegExp, message?: string): void; + } + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { not: Assertion; deep: Deep; @@ -281,3 +302,7 @@ declare var chai: Chai.ChaiStatic; declare module "chai" { export = chai; } + +interface Object { + should: Chai.Assertion; +} From 908713394efc3c1e8e7ae131c7f7e4d6410551fb Mon Sep 17 00:00:00 2001 From: Sammy Chu Date: Wed, 20 May 2015 13:16:08 +0800 Subject: [PATCH 241/534] update moment-timezone constructor definition, to align the constructor definition of moment --- moment-timezone/moment-timezone-tests.ts | 32 ++++++++++++++++++++++-- moment-timezone/moment-timezone.d.ts | 18 +++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/moment-timezone/moment-timezone-tests.ts b/moment-timezone/moment-timezone-tests.ts index 6e818c742..7173b0257 100644 --- a/moment-timezone/moment-timezone-tests.ts +++ b/moment-timezone/moment-timezone-tests.ts @@ -12,14 +12,42 @@ var d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto" a.tz(); -var arr = [2013, 5, 1], +var num = 1367337600000, + arr = [2013, 5, 1], str = "2013-12-01", - obj = { year : 2013, month : 5, day : 1 }; + date = new Date(2013, 4, 1), + mo = moment([2013, 4, 1]), + obj = { year : 2013, month : 5, day : 1 }, + format = "YYYY-MM-DD", + formats = ["YYYY-MM-DD", "YYYY/MM/DD"], + formatsIncludingSpecial: ["YYYY-MM-DD", moment.ISO_8601], + language = "en"; +moment.tz(); moment.tz("America/Los_Angeles"); +moment.tz(num, "America/Los_Angeles"); moment.tz(arr, "America/Los_Angeles"); moment.tz(str, "America/Los_Angeles"); +moment.tz(str, format, "America/Los_Angeles"); +moment.tz(str, format, true, "America/Los_Angeles"); +moment.tz(str, format, language, "America/Los_Angeles"); +moment.tz(str, format, language, true, "America/Los_Angeles"); +moment.tz(str, formats, "America/Los_Angeles"); +moment.tz(str, formats, true, "America/Los_Angeles"); +moment.tz(str, formats, language, "America/Los_Angeles"); +moment.tz(str, formats, language, true, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, true, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, language, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, language, true, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, true, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, language, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, language, true, "America/Los_Angeles"); + +moment.tz(date, "America/Los_Angeles"); +moment.tz(mo, "America/Los_Angeles"); moment.tz(obj, "America/Los_Angeles"); moment.tz.zone('America/Los_Angeles').abbr(1403465838805); diff --git a/moment-timezone/moment-timezone.d.ts b/moment-timezone/moment-timezone.d.ts index 02d72ac2e..ef9a41142 100644 --- a/moment-timezone/moment-timezone.d.ts +++ b/moment-timezone/moment-timezone.d.ts @@ -28,11 +28,25 @@ interface MomentZone { } interface MomentTimezone { - (timezone: string): moment.Moment; (date: number, timezone: string): moment.Moment; (date: number[], timezone: string): moment.Moment; + (date: string, timezone: string): moment.Moment; (date: string, format: string, timezone: string): moment.Moment; - (date: string, format: string, useStrict: boolean, timezone: string): moment.Moment; + (date: string, format: string, strict: boolean, timezone: string): moment.Moment; + (date: string, format: string, language: string, timezone: string): moment.Moment; + (date: string, format: string, language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, formats: string[], timezone: string): moment.Moment; + (date: string, formats: string[], strict: boolean, timezone: string): moment.Moment; + (date: string, formats: string[], language: string, timezone: string): moment.Moment; + (date: string, formats: string[], language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, strict: boolean, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, language: string, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], strict: boolean, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], language: string, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], language: string, strict: boolean, timezone: string): moment.Moment; (date: Date, timezone: string): moment.Moment; (date: moment.Moment, timezone: string): moment.Moment; (date: Object, timezone: string): moment.Moment; From 379e9c0805bca2d0361dc6e9b5206801471fd709 Mon Sep 17 00:00:00 2001 From: Sammy Chu Date: Wed, 20 May 2015 13:16:08 +0800 Subject: [PATCH 242/534] update moment-timezone constructor definition, to align the constructor definition of moment --- moment-timezone/moment-timezone-tests.ts | 32 ++++++++++++++++++++++-- moment-timezone/moment-timezone.d.ts | 18 +++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/moment-timezone/moment-timezone-tests.ts b/moment-timezone/moment-timezone-tests.ts index 6e818c742..b7624b63a 100644 --- a/moment-timezone/moment-timezone-tests.ts +++ b/moment-timezone/moment-timezone-tests.ts @@ -12,14 +12,42 @@ var d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto" a.tz(); -var arr = [2013, 5, 1], +var num = 1367337600000, + arr = [2013, 5, 1], str = "2013-12-01", - obj = { year : 2013, month : 5, day : 1 }; + date = new Date(2013, 4, 1), + mo = moment([2013, 4, 1]), + obj = { year : 2013, month : 5, day : 1 }, + format = "YYYY-MM-DD", + formats = ["YYYY-MM-DD", "YYYY/MM/DD"], + formatsIncludingSpecial = ["YYYY-MM-DD", moment.ISO_8601], + language = "en"; +moment.tz(); moment.tz("America/Los_Angeles"); +moment.tz(num, "America/Los_Angeles"); moment.tz(arr, "America/Los_Angeles"); moment.tz(str, "America/Los_Angeles"); +moment.tz(str, format, "America/Los_Angeles"); +moment.tz(str, format, true, "America/Los_Angeles"); +moment.tz(str, format, language, "America/Los_Angeles"); +moment.tz(str, format, language, true, "America/Los_Angeles"); +moment.tz(str, formats, "America/Los_Angeles"); +moment.tz(str, formats, true, "America/Los_Angeles"); +moment.tz(str, formats, language, "America/Los_Angeles"); +moment.tz(str, formats, language, true, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, true, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, language, "America/Los_Angeles"); +moment.tz(str, moment.ISO_8601, language, true, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, true, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, language, "America/Los_Angeles"); +moment.tz(str, formatsIncludingSpecial, language, true, "America/Los_Angeles"); + +moment.tz(date, "America/Los_Angeles"); +moment.tz(mo, "America/Los_Angeles"); moment.tz(obj, "America/Los_Angeles"); moment.tz.zone('America/Los_Angeles').abbr(1403465838805); diff --git a/moment-timezone/moment-timezone.d.ts b/moment-timezone/moment-timezone.d.ts index 02d72ac2e..ef9a41142 100644 --- a/moment-timezone/moment-timezone.d.ts +++ b/moment-timezone/moment-timezone.d.ts @@ -28,11 +28,25 @@ interface MomentZone { } interface MomentTimezone { - (timezone: string): moment.Moment; (date: number, timezone: string): moment.Moment; (date: number[], timezone: string): moment.Moment; + (date: string, timezone: string): moment.Moment; (date: string, format: string, timezone: string): moment.Moment; - (date: string, format: string, useStrict: boolean, timezone: string): moment.Moment; + (date: string, format: string, strict: boolean, timezone: string): moment.Moment; + (date: string, format: string, language: string, timezone: string): moment.Moment; + (date: string, format: string, language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, formats: string[], timezone: string): moment.Moment; + (date: string, formats: string[], strict: boolean, timezone: string): moment.Moment; + (date: string, formats: string[], language: string, timezone: string): moment.Moment; + (date: string, formats: string[], language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, strict: boolean, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, language: string, timezone: string): moment.Moment; + (date: string, specialFormat: () => void, language: string, strict: boolean, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], strict: boolean, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], language: string, timezone: string): moment.Moment; + (date: string, formatsIncludingSpecial: any[], language: string, strict: boolean, timezone: string): moment.Moment; (date: Date, timezone: string): moment.Moment; (date: moment.Moment, timezone: string): moment.Moment; (date: Object, timezone: string): moment.Moment; From f8a90040348e83926f44e690b209769c4f88b961 Mon Sep 17 00:00:00 2001 From: Sammy Chu Date: Wed, 20 May 2015 13:28:42 +0800 Subject: [PATCH 243/534] update moment-timezone constructor definition, to align the constructor definition of moment --- moment-timezone/moment-timezone.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/moment-timezone/moment-timezone.d.ts b/moment-timezone/moment-timezone.d.ts index ef9a41142..2ac473057 100644 --- a/moment-timezone/moment-timezone.d.ts +++ b/moment-timezone/moment-timezone.d.ts @@ -28,6 +28,8 @@ interface MomentZone { } interface MomentTimezone { + (): moment.Moment; + (timezone: string): moment.Moment; (date: number, timezone: string): moment.Moment; (date: number[], timezone: string): moment.Moment; (date: string, timezone: string): moment.Moment; From 5e2826c8a55004946b0b00fd8823063912b8128f Mon Sep 17 00:00:00 2001 From: John Reilly Date: Wed, 20 May 2015 10:39:52 +0100 Subject: [PATCH 244/534] Update angular.d.ts - JSDoc-ed the $cacheFactory --- angularjs/angular.d.ts | 87 +++++++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 13 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 7d1f3140b..92784af38 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1032,37 +1032,98 @@ declare module angular { disableAutoScrolling(): void; } - /////////////////////////////////////////////////////////////////////////// - // CacheFactoryService - // see http://docs.angularjs.org/api/ng.$cacheFactory - /////////////////////////////////////////////////////////////////////////// + /** + * $cacheFactory - service in module ng + * + * Factory that constructs Cache objects and gives access to them. + * + * see https://docs.angularjs.org/api/ng/service/$cacheFactory + */ interface ICacheFactoryService { - // Lets not foce the optionsMap to have the capacity member. Even though - // it's the ONLY option considered by the implementation today, a consumer - // might find it useful to associate some other options to the cache object. - //(cacheId: string, optionsMap?: { capacity: number; }): CacheObject; - (cacheId: string, optionsMap?: { capacity: number; }): ICacheObject; + /** + * Factory that constructs Cache objects and gives access to them. + * + * @param cacheId Name or id of the newly created cache. + * @param optionsMap Options object that specifies the cache behavior. Properties: + * + * capacity — turns the cache into LRU cache. + */ + (cacheId: string, optionsMap?: { capacity?: number; }): ICacheObject; - // Methods bellow are not documented + /** + * Get information about all the caches that have been created. + * @returns key-value map of cacheId to the result of calling cache#info + */ info(): any; + + /** + * Get access to a cache object by the cacheId used when it was created. + * + * @param cacheId Name or id of a cache to access. + */ get(cacheId: string): ICacheObject; } + /** + * $cacheFactory.Cache - type in module ng + * + * A cache object used to store and retrieve data, primarily used by $http and the script directive to cache templates and other data. + * + * see https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache + */ interface ICacheObject { + /** + * Retrieve information regarding a particular Cache. + */ info(): { + /** + * the id of the cache instance + */ id: string; + + /** + * the number of entries kept in the cache instance + */ size: number; - // Not garanteed to have, since it's a non-mandatory option - //capacity: number; + //...: any additional properties from the options object when creating the cache. }; + + /** + * Inserts a named entry into the Cache object to be retrieved later, and incrementing the size of the cache if the key was not already present in the cache. If behaving like an LRU cache, it will also remove stale entries from the set. + * + * It will not insert undefined values into the cache. + * + * @param key the key under which the cached data is stored. + * @param value the value to store alongside the key. If it is undefined, the key will not be stored. + */ put(key: string, value?: T): T; + + /** + * Retrieves named data stored in the Cache object. + * + * @param key the key of the data to be retrieved + */ get(key: string): any; + + /** + * Removes an entry from the Cache object. + * + * @param key the key of the entry to be removed + */ remove(key: string): void; + + /** + * Clears the cache object of any entries. + */ removeAll(): void; + + /** + * Destroys the Cache object entirely, removing it from the $cacheFactory set. + */ destroy(): void; } - + /////////////////////////////////////////////////////////////////////////// // CompileService // see http://docs.angularjs.org/api/ng.$compile From f275bd2ed5814e1c881b47f8211852c56db9d826 Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Wed, 20 May 2015 08:37:26 -0400 Subject: [PATCH 245/534] (angular-file-upload) Adding missing a typedef for progress event --- angular-file-upload/angular-file-upload.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts index bd76a6e7e..635180a54 100644 --- a/angular-file-upload/angular-file-upload.d.ts +++ b/angular-file-upload/angular-file-upload.d.ts @@ -23,4 +23,9 @@ declare module angular.angularFileUpload { file: File; fileName?: string; } + + interface IFileProgressEvent extends ProgressEvent { + + config: IFileUploadConfig; + } } From 0daffc5de026726e3248ac99165da6c3c1719d2d Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Wed, 20 May 2015 09:01:09 -0400 Subject: [PATCH 246/534] Updating tests to match new defs & updating links in the defs --- .../angular-file-upload-tests.ts | 48 ++++++++++--------- angular-file-upload/angular-file-upload.d.ts | 10 ++-- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/angular-file-upload/angular-file-upload-tests.ts b/angular-file-upload/angular-file-upload-tests.ts index d59e65b4e..8b8fe7490 100644 --- a/angular-file-upload/angular-file-upload-tests.ts +++ b/angular-file-upload/angular-file-upload-tests.ts @@ -10,35 +10,37 @@ module controllers { static $inject = ["$upload"]; constructor( - private $upload: ng.angularFileUpload.IUploadService + private $upload: angular.angularFileUpload.IUploadService ) { } onFileSelect($files: File[]) { - //$files: an array of files selected, each file has name, size, and type. - var uploads: ng.IPromise[] = []; + // $files: an array of files selected, each file has name, size, and type. for (var i = 0; i < $files.length; i++) { var file = $files[i]; - uploads.push(this.$upload.upload({ - url: "/api/upload", - method: "POST", - data: { - extraData: { - fileName: file.name, test: "anything" - } - }, - file: file - }) - .progress((evt: any) => { - console.log('progress'); - }) - .then(success => { - // file is uploaded successfully - console.log(success.data); - }) - .catch(err => { - console.error(err); - })); + this.$upload.upload({ + url: "/api/upload", + method: "POST", + data: { + extraData: { + fileName: file.name, + test: "anything" + } + }, + file: file + }) + .progress((evt: angular.angularFileUpload.IFileProgressEvent) => { + var percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10); + console.log("upload progress: " + percent + "% for " + evt.config.file.name); + }) + .error((data: any, status: number, response: any, headers: any) => { + console.error(data, status, response, headers); + }) + .success((data: any, status: number, headers: any, config: angular.angularFileUpload.IFileUploadConfig) => { + // file is uploaded successfully + console.log("Success!", data, status, headers, config); + }); + } } } diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts index 635180a54..499fdf185 100644 --- a/angular-file-upload/angular-file-upload.d.ts +++ b/angular-file-upload/angular-file-upload.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Angular File Upload 1.6.7 -// Project: https://github.com/danialfarid/angular-file-upload -// Definitions by: John Reilly +// Type definitions for Angular File Upload 4.2.1 +// Project: https://github.com/danialfarid/ng-file-upload +// Definitions by: John Reilly & Chris Barr // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -23,9 +23,9 @@ declare module angular.angularFileUpload { file: File; fileName?: string; } - + interface IFileProgressEvent extends ProgressEvent { config: IFileUploadConfig; } -} +} \ No newline at end of file From e1210e53158790023ab52a15207762f2e7b2e917 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 May 2015 19:26:58 +0200 Subject: [PATCH 247/534] jasmine ajax defs --- jasmine-ajax/jasmine-ajax-tests.ts | 1818 ++++++++++++++++++ jasmine-ajax/jasmine-ajax-tests.ts.tscparams | 1 + jasmine-ajax/jasmine-ajax.d.ts | 77 + 3 files changed, 1896 insertions(+) create mode 100644 jasmine-ajax/jasmine-ajax-tests.ts create mode 100644 jasmine-ajax/jasmine-ajax-tests.ts.tscparams create mode 100644 jasmine-ajax/jasmine-ajax.d.ts diff --git a/jasmine-ajax/jasmine-ajax-tests.ts b/jasmine-ajax/jasmine-ajax-tests.ts new file mode 100644 index 000000000..b5134d2cf --- /dev/null +++ b/jasmine-ajax/jasmine-ajax-tests.ts @@ -0,0 +1,1818 @@ +/** + * Tests adapted from: https://github.com/jasmine/jasmine-ajax + * By Louis Grignon + */ + +/// +/// + +describe('StubTracker', function() { + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxStubTracker(); + this.tracker = new Constructor(); + }); + + it('finds nothing if no stubs are added', function() { + expect(this.tracker.findStub()).toBeUndefined(); + }); + + it('finds an added stub', function() { + var stub = { matches: function() { return true; } }; + this.tracker.addStub(stub); + + expect(this.tracker.findStub()).toBe(stub); + }); + + it('skips an added stub that does not match', function() { + var stub = { matches: function() { return false; } }; + this.tracker.addStub(stub); + + expect(this.tracker.findStub()).toBeUndefined(); + }); + + it('passes url, data, and method to the stub', function() { + var stub = { matches: jasmine.createSpy('matches') }; + this.tracker.addStub(stub); + + this.tracker.findStub('url', 'data', 'method'); + + expect(stub.matches).toHaveBeenCalledWith('url', 'data', 'method'); + }); + + it('can clear out all stubs', function() { + var stub = { matches: jasmine.createSpy('matches') }; + this.tracker.addStub(stub); + + this.tracker.findStub(); + + expect(stub.matches).toHaveBeenCalled(); + + this.tracker.reset(); + stub.matches.calls.reset(); + + this.tracker.findStub(); + + expect(stub.matches).not.toHaveBeenCalled(); + }); + + it('uses the most recently added stub that matches', function() { + var stub1 = { matches: function() { return true; } }; + var stub2 = { matches: function() { return true; } }; + var stub3 = { matches: function() { return false; } }; + + this.tracker.addStub(stub1); + this.tracker.addStub(stub2); + this.tracker.addStub(stub3); + + expect(this.tracker.findStub()).toBe(stub2); + }); +}); + +describe('FakeRequest', function() { + beforeEach(function() { + this.requestTracker = { track: jasmine.createSpy('trackRequest') }; + this.stubTracker = { findStub: function() {} }; + var parserInstance = this.parserInstance = jasmine.createSpy('parse'); + this.paramParser = { findParser: function() { return { parse: parserInstance }; } }; + var eventBus = this.fakeEventBus = { + addEventListener: jasmine.createSpy('addEventListener'), + trigger: jasmine.createSpy('trigger'), + removeEventListener: jasmine.createSpy('removeEventListener') + }; + this.eventBusFactory = function() { + return eventBus; + }; + this.fakeGlobal = { + XMLHttpRequest: function() { + this.extraAttribute = 'my cool attribute'; + }, + DOMParser: window['DOMParser'], + ActiveXObject: window['ActiveXObject'] + }; + this.FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(this.fakeGlobal, this.requestTracker, this.stubTracker, this.paramParser); + }); + + it('extends from the global XMLHttpRequest', function() { + var request = new this.FakeRequest(); + + expect(request.extraAttribute).toEqual('my cool attribute'); + }); + + it('skips XMLHttpRequest attributes that IE does not want copied', function() { + // use real window here so it will correctly go red on IE if it breaks + var FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(window, this.requestTracker, this.stubTracker, this.paramParser); + var request = new FakeRequest(); + + expect(request.responseBody).toBeUndefined(); + expect(request.responseXML).toBeUndefined(); + expect(request.statusText).toBeUndefined(); + }); + + it('tracks the request', function() { + var request = new this.FakeRequest(); + + expect(this.requestTracker.track).toHaveBeenCalledWith(request); + }); + + it('has default request headers and override mime type', function() { + var request = new this.FakeRequest(); + + expect(request.requestHeaders).toEqual({}); + expect(request.overriddenMimeType).toBeNull(); + }); + + it('saves request information when opened', function() { + var request = new this.FakeRequest(); + request.open('METHOD', 'URL', 'ignore_async', 'USERNAME', 'PASSWORD'); + + expect(request.method).toEqual('METHOD'); + expect(request.url).toEqual('URL'); + expect(request.username).toEqual('USERNAME'); + expect(request.password).toEqual('PASSWORD'); + }); + + it('saves an override mime type', function() { + var request = new this.FakeRequest(); + + request.overrideMimeType('application/text; charset: utf-8'); + + expect(request.overriddenMimeType).toBe('application/text; charset: utf-8'); + }); + + it('saves request headers', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('X-Header-1', 'value1'); + request.setRequestHeader('X-Header-2', 'value2'); + + expect(request.requestHeaders).toEqual({ + 'X-Header-1': 'value1', + 'X-Header-2': 'value2' + }); + }); + + it('combines request headers with the same header name', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('X-Header', 'value1'); + request.setRequestHeader('X-Header', 'value2'); + + expect(request.requestHeaders['X-Header']).toEqual('value1, value2'); + }); + + it('finds the content-type request header', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('ContEnt-tYPe', 'application/text+xml'); + + expect(request.contentType()).toEqual('application/text+xml'); + }); + + describe('managing readyState', function() { + beforeEach(function() { + this.request = new this.FakeRequest(); + }); + + it('has an initial ready state of 0 (uninitialized)', function() { + expect(this.request.readyState).toBe(0); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalled(); + }); + + it('has a ready state of 1 (open) when opened', function() { + this.request.open(); + + expect(this.request.readyState).toBe(1); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 0 (uninitialized) when aborted', function() { + this.request.open(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.abort(); + + expect(this.request.readyState).toBe(0); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 1 (sent) when sent', function() { + this.request.open(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.send(); + + expect(this.request.readyState).toBe(1); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 4 (loaded) when timed out', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + jasmine.clock().install(); + this.request.responseTimeout(); + jasmine.clock().uninstall(); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); + }); + + it('has a ready state of 4 (loaded) when network erroring', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.responseError(); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 4 (loaded) when responding', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.respondWith({}); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 2, then 4 (loaded) when responding', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + var request = this.request; + var events = []; + var headers = [ + { name: 'X-Header', value: 'foo' } + ]; + + this.fakeEventBus.trigger.and.callFake(function(event) { + if (event === 'readystatechange') { + events.push({ + readyState: request.readyState, + status: request.status, + statusText: request.statusText, + responseHeaders: request.responseHeaders + }); + } + }); + + this.request.respondWith({ + status: 200, + statusText: 'OK', + responseHeaders: headers + }); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(events.length).toBe(2); + expect(events).toEqual([ + { readyState: 2, status: 200, statusText: 'OK', responseHeaders: headers }, + { readyState: 4, status: 200, statusText: 'OK', responseHeaders: headers } + ]); + }); + + it('throws an error when timing out a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.responseTimeout(); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + + it('throws an error when responding to a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.respondWith({}); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + + it('throws an error when erroring a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.responseError({}); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + }); + + it('registers on-style callback with the event bus', function() { + this.request = new this.FakeRequest(); + + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('readystatechange', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadstart', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('progress', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('abort', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('error', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('load', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('timeout', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadend', jasmine.any(Function)); + + this.request.onreadystatechange = jasmine.createSpy('readystatechange'); + this.request.onloadstart = jasmine.createSpy('loadstart'); + this.request.onprogress = jasmine.createSpy('progress'); + this.request.onabort = jasmine.createSpy('abort'); + this.request.onerror = jasmine.createSpy('error'); + this.request.onload = jasmine.createSpy('load'); + this.request.ontimeout = jasmine.createSpy('timeout'); + this.request.onloadend = jasmine.createSpy('loadend'); + + var args = this.fakeEventBus.addEventListener.calls.allArgs(); + for (var i = 0; i < args.length; i++) { + var eventName = args[i][0], + busCallback = args[i][1]; + + busCallback(); + expect(this.request['on' + eventName]).toHaveBeenCalled(); + } + }); + + it('delegates addEventListener to the eventBus', function() { + this.request = new this.FakeRequest(); + + this.request.addEventListener('foo', 'bar'); + + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('foo', 'bar'); + }); + + it('delegates removeEventListener to the eventBus', function() { + this.request = new this.FakeRequest(); + + this.request.removeEventListener('foo', 'bar'); + + expect(this.fakeEventBus.removeEventListener).toHaveBeenCalledWith('foo', 'bar'); + }); + + describe('triggering progress events', function() { + beforeEach(function() { + this.request = new this.FakeRequest(); + }); + + it('should not trigger any events to start', function() { + this.request.open(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('should trigger loadstart when sent', function() { + this.request.open(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.send(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadend'); + }); + + it('should trigger abort, progress, loadend when aborted', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.abort(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + + it('should trigger error, progress, loadend when network error', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.responseError(); + + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + + it('should trigger timeout, progress, loadend when timing out', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + jasmine.clock().install(); + this.request.responseTimeout(); + jasmine.clock().uninstall(); + + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + + it('should trigger load, progress, loadend when responding', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.respondWith({ status: 200 }); + + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + }); + + it('ticks the jasmine clock on timeout', function() { + var clock = { tick: jasmine.createSpy('tick') }; + spyOn(jasmine, 'clock').and.returnValue(clock); + + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.responseTimeout(); + + expect(clock.tick).toHaveBeenCalledWith(30000); + }); + + it('has an initial status of null', function() { + var request = new this.FakeRequest(); + + expect(request.status).toBeNull(); + }); + + it('has an aborted status', function() { + var request = new this.FakeRequest(); + + request.abort(); + + expect(request.status).toBe(0); + expect(request.statusText).toBe('abort'); + }); + + it('has a status from the response', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.status).toBe(200); + expect(request.statusText).toBe(''); + }); + + it('has a statusText from the response', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, statusText: 'OK' }); + + expect(request.status).toBe(200); + expect(request.statusText).toBe('OK'); + }); + + it('saves off any data sent to the server', function() { + var request = new this.FakeRequest(); + request.open(); + request.send('foo=bar&baz=quux'); + + expect(request.params).toBe('foo=bar&baz=quux'); + }); + + it('parses data sent to the server', function() { + var request = new this.FakeRequest(); + request.open(); + request.send('foo=bar&baz=quux'); + + this.parserInstance.and.returnValue('parsed'); + + expect(request.data()).toBe('parsed'); + }); + + it('skips parsing if no data was sent', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + expect(request.data()).toEqual({}); + expect(this.parserInstance).not.toHaveBeenCalled(); + }); + + it('saves responseText', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foobar' }); + + expect(request.responseText).toBe('foobar'); + }); + + it('defaults responseText if none is given', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.responseText).toBe(''); + }); + + it('retrieves individual response headers', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: { + 'X-Header': 'foo' + } + }); + + expect(request.getResponseHeader('X-Header')).toBe('foo'); + }); + + it('retrieves individual response headers case-insensitively', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: { + 'X-Header': 'foo' + } + }); + + expect(request.getResponseHeader('x-header')).toBe('foo'); + }); + + it('retrieves a combined response header', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: [ + { name: 'X-Header', value: 'foo' }, + { name: 'X-Header', value: 'bar' } + ] + }); + + expect(request.getResponseHeader('x-header')).toBe('foo, bar'); + }); + + it("doesn't pollute the response headers of other XHRs", function() { + var request1 = new this.FakeRequest(); + request1.open(); + request1.send(); + + var request2 = new this.FakeRequest(); + request2.open(); + request2.send(); + + request1.respondWith({ status: 200, responseHeaders: { 'X-Foo': 'bar' } }); + request2.respondWith({ status: 200, responseHeaders: { 'X-Baz': 'quux' } }); + + expect(request1.getAllResponseHeaders()).toBe("X-Foo: bar\r\n"); + expect(request2.getAllResponseHeaders()).toBe("X-Baz: quux\r\n"); + }); + + it('retrieves all response headers', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: [ + { name: 'X-Header-1', value: 'foo' }, + { name: 'X-Header-2', value: 'bar' }, + { name: 'X-Header-1', value: 'baz' } + ] + }); + + expect(request.getAllResponseHeaders()).toBe("X-Header-1: foo\r\nX-Header-2: bar\r\nX-Header-1: baz\r\n"); + }); + + it('sets the content-type header to the specified contentType when no other headers are supplied', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'text/plain' }); + + expect(request.getResponseHeader('content-type')).toBe('text/plain'); + expect(request.getAllResponseHeaders()).toBe("Content-Type: text/plain\r\n"); + }); + + it('sets a default content-type header if no contentType and headers are supplied', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.getResponseHeader('content-type')).toBe('application/json'); + expect(request.getAllResponseHeaders()).toBe("Content-Type: application/json\r\n"); + }); + + it('has no responseXML by default', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.responseXML).toBeNull(); + }); + + it('parses a text/xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'text/xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('parses an application/xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'application/xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('parses a custom blah+xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'application/text+xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('defaults the response attribute to the responseText', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo' }); + + expect(request.response).toEqual('foo'); + }); + + it('has a text response when the responseType is blank', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo', responseType: '' }); + + expect(request.response).toEqual('foo'); + }); + + it('has a text response when the responseType is text', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo', responseType: 'text' }); + + expect(request.response).toEqual('foo'); + }); +}); + + +describe("Jasmine Mock Ajax (for toplevel)", function() { + var request, anotherRequest, response; + var success, error, complete; + var client, onreadystatechange; + var sharedContext: any = {}; + var fakeGlobal, mockAjax; + + beforeEach(function() { + var fakeXMLHttpRequest = jasmine.createSpy('realFakeXMLHttpRequest'); + fakeGlobal = { + XMLHttpRequest: fakeXMLHttpRequest, + DOMParser: window['DOMParser'], + ActiveXObject: window['ActiveXObject'] + }; + mockAjax = new MockAjax(fakeGlobal); + mockAjax.install(); + + success = jasmine.createSpy("onSuccess"); + error = jasmine.createSpy("onFailure"); + complete = jasmine.createSpy("onComplete"); + + onreadystatechange = function() { + if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE + if (this.status === 200) { + success(this.responseText, this.textStatus, this); + } else { + error(this, this.textStatus, ''); + } + + complete(this, this.textStatus); + } + }; + }); + + describe("when making a request", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + request = mockAjax.requests.mostRecent(); + }); + + it("should store URL and transport", function() { + expect(request.url).toEqual("example.com/someApi"); + }); + + it("should queue the request", function() { + expect(mockAjax.requests.count()).toEqual(1); + }); + + it("should allow access to the queued request", function() { + expect(mockAjax.requests.first()).toEqual(request); + }); + + it("should allow access to the queued request via index", function() { + expect(mockAjax.requests.at(0)).toEqual(request); + }); + + describe("and then another request", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + + anotherRequest = mockAjax.requests.mostRecent(); + }); + + it("should queue the next request", function() { + expect(mockAjax.requests.count()).toEqual(2); + }); + + it("should allow access to the other queued request", function() { + expect(mockAjax.requests.first()).toEqual(request); + expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); + }); + }); + + describe("mockAjax.requests.mostRecent()", function () { + + describe("when there is one request queued", function () { + it("should return the request", function() { + expect(mockAjax.requests.mostRecent()).toEqual(request); + }); + }); + + describe("when there is more than one request", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + anotherRequest = mockAjax.requests.mostRecent(); + }); + + it("should return the most recent request", function() { + expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); + }); + }); + + describe("when there are no requests", function () { + beforeEach(function() { + mockAjax.requests.reset(); + }); + + it("should return null", function() { + expect(mockAjax.requests.mostRecent()).toBeUndefined(); + }); + }); + }); + + describe("clearAjaxRequests()", function () { + beforeEach(function() { + mockAjax.requests.reset(); + }); + + it("should remove all requests", function() { + expect(mockAjax.requests.count()).toEqual(0); + expect(mockAjax.requests.mostRecent()).toBeUndefined(); + }); + }); + }); + + describe("when simulating a response with request.response", function () { + describe("and the response is Success", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = {status: 200, statusText: "OK", contentType: "text/html", responseText: "OK!"}; + request.respondWith(response); + + sharedContext.responseCallback = success; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the response is Success, but with JSON", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = {status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: "json"}; + + request.respondWith(responseObject); + + sharedContext.responseCallback = success; + sharedContext.status = responseObject.status; + sharedContext.statusText = responseObject.statusText; + sharedContext.contentType = responseObject.contentType; + sharedContext.responseText = responseObject.responseText; + sharedContext.responseType = responseObject.responseType; + + response = success.calls.mostRecent().args[2]; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + it("should return a JavaScript object for XHR2 response", function() { + var responseText = sharedContext.responseText; + expect(success.calls.mostRecent().args[0]).toEqual(responseText); + + expect(response.responseText).toEqual(responseText); + expect(response.response).toEqual({foo: "bar"}); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the response is Success, and response is overriden", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = {status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: 'json'}; + + request.respondWith(responseObject); + + sharedContext.responseCallback = success; + sharedContext.status = responseObject.status; + sharedContext.statusText = responseObject.statusText; + sharedContext.contentType = responseObject.contentType; + sharedContext.responseText = responseObject.responseText; + sharedContext.responseType = responseObject.responseType; + + response = success.calls.mostRecent().args[2]; + }); + + it("should return the provided override for the XHR2 response", function() { + var responseText = sharedContext.responseText; + + expect(response.responseText).toEqual(responseText); + expect(response.response).toEqual({foo: "bar"}); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("response with unique header names using an object", function () { + beforeEach(function () { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = {status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: { + 'X-Header1': 'header 1 value', + 'X-Header2': 'header 2 value', + 'X-Header3': 'header 3 value' + }}; + request.respondWith(responseObject); + response = success.calls.mostRecent().args[2]; + }); + + it("getResponseHeader should return the each value", function () { + expect(response.getResponseHeader('X-Header1')).toBe('header 1 value'); + expect(response.getResponseHeader('X-Header2')).toBe('header 2 value'); + expect(response.getResponseHeader('X-Header3')).toBe('header 3 value'); + }); + + it("getAllResponseHeaders should return all values", function () { + expect(response.getAllResponseHeaders()).toBe([ + "X-Header1: header 1 value", + "X-Header2: header 2 value", + "X-Header3: header 3 value" + ].join("\r\n") + "\r\n"); + }); + }); + + describe("response with multiple headers of the same name using an array of objects", function () { + beforeEach(function () { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = {status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: [ + { name: 'X-Header', value: 'header value 1' }, + { name: 'X-Header', value: 'header value 2' } + ]}; + request.respondWith(responseObject); + response = success.calls.mostRecent().args[2]; + }); + + it("getResponseHeader should return all values comma separated", function () { + expect(response.getResponseHeader('X-Header')).toBe('header value 1, header value 2'); + }); + + it("getAllResponseHeaders should return all values", function () { + expect(response.getAllResponseHeaders()).toBe([ + "X-Header: header value 1", + "X-Header: header value 2" + ].join("\r\n") + "\r\n"); + }); + }); + + describe("the content type defaults to application/json", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = {status: 200, statusText: "OK", responseText: '{"foo": "valid JSON, dammit."}', responseType: 'json'}; + request.respondWith(response); + + sharedContext.responseCallback = success; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = "application/json"; + sharedContext.responseType = response.responseType; + sharedContext.responseText = response.responseText; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the status/response code is 0", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = {status: 0, statusText: "ABORT", responseText: '{"foo": "whoops!"}'}; + request.respondWith(response); + + sharedContext.responseCallback = error; + sharedContext.status = 0; + sharedContext.statusText = response.statusText; + sharedContext.contentType = 'application/json'; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); + }); + }); + + describe("and the response is error", function () { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = {status: 500, statusText: "SERVER ERROR", contentType: "text/html", responseText: "(._){"}; + request.respondWith(response); + + sharedContext.responseCallback = error; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should not call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); + }); + + describe('when simulating a response with request.responseTimeout', function() { + beforeEach(function() { + jasmine.clock().install(); + + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = {contentType: "text/html", response: "(._){response", responseText: "(._){", responseType: "text"}; + request.responseTimeout(response); + + sharedContext.responseCallback = error; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); + + it("should not call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + }); +}); + + +function sharedAjaxResponseBehaviorForZepto_Success(context) { + describe("the success response", function () { + var xhr; + beforeEach(function() { + xhr = context.responseCallback.calls.mostRecent().args[2]; + }); + + it("should have the expected status code", function() { + expect(xhr.status).toEqual(context.status); + }); + + it("should have the expected content type", function() { + expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); + }); + + it("should have the expected xhr2 response", function() { + var expected = context.response || context.responseType === 'json' ? JSON.parse(context.responseText) : context.responseText; + expect(xhr.response).toEqual(expected); + }); + + it("should have the expected response text", function() { + expect(xhr.responseText).toEqual(context.responseText); + }); + + it("should have the expected status text", function() { + expect(xhr.statusText).toEqual(context.statusText); + }); + }); +} + +function sharedAjaxResponseBehaviorForZepto_Failure(context) { + describe("the failure response", function () { + var xhr; + beforeEach(function() { + xhr = context.responseCallback.calls.mostRecent().args[0]; + }); + + it("should have the expected status code", function() { + expect(xhr.status).toEqual(context.status); + }); + + it("should have the expected content type", function() { + expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); + }); + + it("should have the expected xhr2 response", function() { + var expected = context.response || xhr.responseType === 'json' ? JSON.parse(xhr.responseText) : xhr.responseText; + expect(xhr.response).toEqual(expected); + }); + + it("should have the expected response text", function() { + expect(xhr.responseText).toEqual(context.responseText); + }); + + it("should have the expected status text", function() { + expect(xhr.statusText).toEqual(context.statusText); + }); + }); +} + +describe('ParamParser', function() { + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxParamParser(); + expect(Constructor).toEqual(jasmine.any(Function)); + this.parser = new Constructor(); + }); + + it('has a default parser', function() { + var parser = this.parser.findParser({ contentType: function() {} }), + parsed = parser.parse('3+stooges=shemp&3+stooges=larry%20%26%20moe%20%26%20curly&some%3Dthing=else+entirely'); + + expect(parsed).toEqual({ + '3 stooges': ['shemp', 'larry & moe & curly'], + 'some=thing': ['else entirely'] + }); + }); + + it('should detect and parse json', function() { + var data = { + foo: 'bar', + baz: ['q', 'u', 'u', 'x'], + nested: { + object: { + containing: 'stuff' + } + } + }, + parser = this.parser.findParser({ contentType: function() { return 'application/json'; } }), + parsed = parser.parse(JSON.stringify(data)); + + expect(parsed).toEqual(data); + }); + + it('should parse json with further qualifiers on content-type', function() { + var data = { + foo: 'bar', + baz: ['q', 'u', 'u', 'x'], + nested: { + object: { + containing: 'stuff' + } + } + }, + parser = this.parser.findParser({ contentType: function() { return 'application/json; charset=utf-8'; } }), + parsed = parser.parse(JSON.stringify(data)); + + expect(parsed).toEqual(data); + }); + + it('should have custom parsers take precedence', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(true), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; + + this.parser.add(custom); + + var parser = this.parser.findParser({ contentType: function() {} }), + parsed = parser.parse('custom_format'); + + expect(parsed).toEqual('parsedFormat'); + expect(custom.test).toHaveBeenCalled(); + expect(custom.parse).toHaveBeenCalledWith('custom_format'); + }); + + it('should skip custom parsers that do not match', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(false), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; + + this.parser.add(custom); + + var parser = this.parser.findParser({ contentType: function() {} }), + parsed = parser.parse('custom_format'); + + expect(parsed).toEqual({ custom_format: [ 'undefined' ] }); + expect(custom.test).toHaveBeenCalled(); + expect(custom.parse).not.toHaveBeenCalled(); + }); + + it('removes custom parsers when reset', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(true), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; + + this.parser.add(custom); + + var parser = this.parser.findParser({ contentType: function() {} }), + parsed = parser.parse('custom_format'); + + expect(parsed).toEqual('parsedFormat'); + + custom.test['calls'].reset(); + custom.parse['calls'].reset(); + + this.parser.reset(); + + parser = this.parser.findParser({ contentType: function() {} }); + parsed = parser.parse('custom_format'); + + expect(parsed).toEqual({ custom_format: [ 'undefined' ] }); + expect(custom.test).not.toHaveBeenCalled(); + expect(custom.parse).not.toHaveBeenCalled(); + }); +}); + +describe('RequestStub', function() { + beforeEach(function() { + this.RequestStub = getJasmineRequireObj().AjaxRequestStub(); + + jasmine.addMatchers({ + toMatchRequest: function() { + return { + compare: function(actual) { + return { + pass: actual.matches.apply(actual, Array.prototype.slice.call(arguments, 1)) + }; + } + }; + } + }); + }); + + it('matches just by exact url', function() { + var stub = new this.RequestStub('www.example.com/foo'); + + expect(stub)['toMatchRequest']('www.example.com/foo'); + }); + + it('does not match if the url differs', function() { + var stub = new this.RequestStub('www.example.com/foo'); + + expect(stub).not['toMatchRequest']('www.example.com/bar'); + }); + + it('matches unordered query params', function() { + var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); + + expect(stub)['toMatchRequest']('www.example.com?baz=quux&foo=bar'); + }); + + it('requires all specified query params to be there', function() { + var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); + + expect(stub).not['toMatchRequest']('www.example.com?foo=bar'); + }); + + it('can match the url with a RegExp', function() { + var stub = new this.RequestStub(/ba[rz]/); + + expect(stub)['toMatchRequest']('bar'); + expect(stub)['toMatchRequest']('baz'); + expect(stub).not['toMatchRequest']('foo'); + }); + + it('requires the method to match if supplied', function() { + var stub = new this.RequestStub('www.example.com/foo', null, 'POST'); + + expect(stub).not['toMatchRequest']('www.example.com/foo'); + expect(stub).not['toMatchRequest']('www.example.com/foo', null, 'GET'); + expect(stub)['toMatchRequest']('www.example.com/foo', null, 'POST'); + }); + + it('requires the data submitted to match if supplied', function() { + var stub = new this.RequestStub('/foo', 'foo=bar&baz=quux'); + + expect(stub)['toMatchRequest']('/foo', 'baz=quux&foo=bar'); + expect(stub).not['toMatchRequest']('/foo', 'foo=bar'); + }); +}); + +describe('RequestTracker', function() { + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxRequestTracker(); + this.tracker = new Constructor(); + }); + + it('tracks the number of times ajax requests are made', function() { + expect(this.tracker.count()).toBe(0); + + this.tracker.track(); + + expect(this.tracker.count()).toBe(1); + }); + + it('simplifies access to the last (most recent) request', function() { + this.tracker.track(); + this.tracker.track('request'); + + expect(this.tracker.mostRecent()).toEqual('request'); + }); + + it('returns a useful falsy value when there is no last (most recent) request', function() { + expect(this.tracker.mostRecent()).toBeFalsy(); + }); + + it('simplifies access to the first (oldest) request', function() { + this.tracker.track('request'); + this.tracker.track(); + + expect(this.tracker.first()).toEqual('request'); + }); + + it('returns a useful falsy value when there is no first (oldest) request', function() { + expect(this.tracker.first()).toBeFalsy(); + }); + + it('allows the requests list to be reset', function() { + this.tracker.track(); + this.tracker.track(); + + expect(this.tracker.count()).toBe(2); + + this.tracker.reset(); + + expect(this.tracker.count()).toBe(0); + }); + + it('allows retrieval of an arbitrary request by index', function() { + this.tracker.track('1'); + this.tracker.track('2'); + this.tracker.track('3'); + + expect(this.tracker.at(1)).toEqual('2'); + }); + + it('allows retrieval of all requests that are for a given url', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); + + expect(this.tracker.filter('bar')).toEqual([{ url: 'bar' }]); + }); + + it('allows retrieval of all requests that match a given RegExp', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); + this.tracker.track({ url: 'baz' }); + + expect(this.tracker.filter(/ba[rz]/)).toEqual([{ url: 'bar' }, { url: 'baz' }]); + }); + + it('allows retrieval of all requests that match based on a function', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); + this.tracker.track({ url: 'baz' }); + + var func = function(request) { + return request.url === 'bar'; + }; + + expect(this.tracker.filter(func)).toEqual([{ url: 'bar' }]); + }); + + it('filters to nothing if no requests have been tracked', function() { + expect(this.tracker.filter('foo')).toEqual([]); + }); +}); + +describe('EventBus', function() { + beforeEach(function() { + this.bus = getJasmineRequireObj().AjaxEventBus()(); + }); + + it('calls an event listener', function() { + var callback = jasmine.createSpy('callback'); + + this.bus.addEventListener('foo', callback); + this.bus.trigger('foo'); + + expect(callback).toHaveBeenCalled(); + }); + + it('calls an event listener with additional arguments', function() { + var callback = jasmine.createSpy('callback'); + + this.bus.addEventListener('foo', callback); + this.bus.trigger('foo', 'bar'); + + expect(callback).toHaveBeenCalledWith('bar'); + }); + + it('only triggers callbacks for the specified event', function() { + var fooCallback = jasmine.createSpy('foo'), + barCallback = jasmine.createSpy('bar'); + + this.bus.addEventListener('foo', fooCallback); + this.bus.addEventListener('bar', barCallback); + + this.bus.trigger('foo'); + + expect(fooCallback).toHaveBeenCalled(); + expect(barCallback).not.toHaveBeenCalled(); + }); + + it('calls all the callbacks for the specified event', function() { + var callback1 = jasmine.createSpy('callback'); + var callback2 = jasmine.createSpy('otherCallback'); + + this.bus.addEventListener('foo', callback1); + this.bus.addEventListener('foo', callback2); + + this.bus.trigger('foo'); + + expect(callback1).toHaveBeenCalled(); + expect(callback2).toHaveBeenCalled(); + }); + + it('works if there are no callbacks for the event', function() { + var bus = this.bus; + expect(function() { + bus.trigger('notActuallyThere'); + }).not.toThrow(); + }); + + it('does not call listeners that have been removed', function() { + var callback = jasmine.createSpy('callback'); + + this.bus.addEventListener('foo', callback); + this.bus.removeEventListener('foo', callback); + this.bus.trigger('foo'); + + expect(callback).not.toHaveBeenCalled(); + }); + + it('only removes the specified callback', function() { + var callback1 = jasmine.createSpy('callback'); + var callback2 = jasmine.createSpy('otherCallback'); + + this.bus.addEventListener('foo', callback1); + this.bus.addEventListener('foo', callback2); + this.bus.removeEventListener('foo', callback2); + + this.bus.trigger('foo'); + + expect(callback1).toHaveBeenCalled(); + expect(callback2).not.toHaveBeenCalled(); + }); +}); + +describe("Webmock style mocking", function() { + var successSpy, errorSpy, response, fakeGlobal, mockAjax; + + var sendRequest = function(fakeGlobal, url?, method?) { + url = url || "http://example.com/someApi"; + method = method || 'GET'; + var xhr = new fakeGlobal.XMLHttpRequest(); + xhr.onreadystatechange = function(args) { + if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE + response = this; + successSpy(); + } + }; + + xhr.open(method, url); + xhr.send(); + }; + + beforeEach(function() { + successSpy = jasmine.createSpy('success'); + fakeGlobal = {XMLHttpRequest: jasmine.createSpy('realXMLHttpRequest')}; + mockAjax = new MockAjax(fakeGlobal); + mockAjax.install(); + + mockAjax.stubRequest("http://example.com/someApi").andReturn({responseText: "hi!"}); + }); + + it("allows a url to be setup as a stub", function() { + sendRequest(fakeGlobal); + expect(successSpy).toHaveBeenCalled(); + }); + + it("should allow you to clear all the ajax stubs", function() { + mockAjax.stubs.reset(); + sendRequest(fakeGlobal); + expect(successSpy).not.toHaveBeenCalled(); + }); + + it("should set the contentType", function() { + sendRequest(fakeGlobal); + expect(response.getResponseHeader('Content-Type')).toEqual('application/json'); + }); + + it("should set the responseText", function() { + sendRequest(fakeGlobal); + expect(response.responseText).toEqual('hi!'); + }); + + it("should default the status to 200", function() { + sendRequest(fakeGlobal); + expect(response.status).toEqual(200); + }); + + it("should set the responseHeaders", function() { + mockAjax.stubRequest("http://example.com/someApi").andReturn({ + responseText: "hi!", + responseHeaders: [{name: "X-Custom", value: "header value"}] + }); + sendRequest(fakeGlobal); + expect(response.getResponseHeader('X-Custom')).toEqual('header value'); + }); + + describe("with another stub for the same url", function() { + beforeEach(function() { + mockAjax.stubRequest("http://example.com/someApi").andReturn({responseText: "no", status: 403}); + sendRequest(fakeGlobal); + }); + + it("should set the status", function() { + expect(response.status).toEqual(403); + }); + + it("should allow the latest stub to win", function() { + expect(response.responseText).toEqual('no'); + }); + }); +}); + +describe("withMock", function() { + var sendRequest = function(fakeGlobal) { + var xhr = new fakeGlobal.XMLHttpRequest(); + + xhr.open("GET", "http://example.com/someApi"); + xhr.send(); + }; + + it("installs the mock for passed in function, and uninstalls when complete", function() { + var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), + xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), + fakeGlobal = {XMLHttpRequest: xmlHttpRequestCtor}, + mockAjax = new MockAjax(fakeGlobal); + + mockAjax.withMock(function() { + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).not.toHaveBeenCalled(); + }); + + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).toHaveBeenCalled(); + }); + + it("properly uninstalls when the passed in function throws", function() { + var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), + xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), + fakeGlobal = {XMLHttpRequest: xmlHttpRequestCtor}, + mockAjax = new MockAjax(fakeGlobal); + + expect(function() { + mockAjax.withMock(function() { + throw "error"; + }); + }).toThrow("error"); + + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).toHaveBeenCalled(); + }); +}); + +describe("mockAjax", function() { + it("throws an error if installed multiple times", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + function doubleInstall() { + mockAjax.install(); + mockAjax.install(); + } + + expect(doubleInstall).toThrow(); + }); + + it("does not throw an error if uninstalled between installs", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + function sequentialInstalls() { + mockAjax.install(); + mockAjax.uninstall(); + mockAjax.install(); + } + + expect(sequentialInstalls).not.toThrow(); + }); + + it("does not replace XMLHttpRequest until it is installed", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); + fakeXmlHttpRequest.calls.reset(); + + mockAjax.install(); + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).not.toHaveBeenCalled(); + }); + + it("replaces the global XMLHttpRequest on uninstall", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + mockAjax.install(); + mockAjax.uninstall(); + + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); + }); + + it("clears requests and stubs upon uninstall", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + mockAjax.install(); + + mockAjax.requests.track({url: '/testurl'}); + mockAjax.stubRequest('/bobcat'); + + expect(mockAjax.requests.count()).toEqual(1); + expect(mockAjax.stubs.findStub('/bobcat')).toBeDefined(); + + mockAjax.uninstall(); + + expect(mockAjax.requests.count()).toEqual(0); + expect(mockAjax.stubs.findStub('/bobcat')).not.toBeDefined(); + }); + + it("allows the httpRequest to be retrieved", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + mockAjax.install(); + var request = new (fakeGlobal.XMLHttpRequest)(); + + expect(mockAjax.requests.count()).toBe(1); + expect(mockAjax.requests.mostRecent()).toBe(request); + }); + + it("allows the httpRequests to be cleared", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); + + mockAjax.install(); + var request = new (fakeGlobal.XMLHttpRequest)(); + + expect(mockAjax.requests.mostRecent()).toBe(request); + mockAjax.requests.reset(); + expect(mockAjax.requests.count()).toBe(0); + }); +}); diff --git a/jasmine-ajax/jasmine-ajax-tests.ts.tscparams b/jasmine-ajax/jasmine-ajax-tests.ts.tscparams new file mode 100644 index 000000000..d3f5a12fa --- /dev/null +++ b/jasmine-ajax/jasmine-ajax-tests.ts.tscparams @@ -0,0 +1 @@ + diff --git a/jasmine-ajax/jasmine-ajax.d.ts b/jasmine-ajax/jasmine-ajax.d.ts new file mode 100644 index 000000000..70ca2f57c --- /dev/null +++ b/jasmine-ajax/jasmine-ajax.d.ts @@ -0,0 +1,77 @@ +// Type definitions for jasmine-ajax 3.1.1 +// Project: https://github.com/jasmine/jasmine-ajax +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface JasmineAjaxResponse { + status?: string; + statusText?: string; + responseText?: string; + response?: string; + responseType?: string; + contentType?: string; + responseHeaders?: { [key: string]: string }; +} + +interface JasmineAjaxRequest { + url: string; + respondWith(response: JasmineAjaxResponse): void; +} + +interface JasmineAjaxRequestTracker { + track(request: JasmineAjaxRequest): void; + first(): JasmineAjaxRequest; + count(): number; + reset(): void; + mostRecent(): JasmineAjaxRequest; + at(index: number): JasmineAjaxRequest; + filter(urlToMatch: RegExp): JasmineAjaxRequest[]; + filter(urlToMatch: Function): JasmineAjaxRequest[]; + filter(urlToMatch: string): JasmineAjaxRequest[]; +} + +interface JasmineAjaxRequestStubReturnOptions { + status?: number; + contentType?: string; + response?: string; + responseText?: string; + responseHeaders?: { [key: string]: string }; +} + +interface JasmineAjaxRequestStub { + data?: string; + method?: string; + andReturn(options: JasmineAjaxRequestStubReturnOptions): void; + matches(fullUrl: string, data: string, method: string): boolean; +} + +interface JasmineAjaxStubTracker { + addStub(stub: JasmineAjaxRequestStub): void; + reset(): void; + findStub(url: string, data?: string, method?: string): JasmineAjaxRequestStub; +} + +interface JasmineAjaxParamParser { + test(xhr: XMLHttpRequest): boolean; + parse(paramString: string): any; +} + +declare class MockAjax { + constructor(globals); + + install(): void; + uninstall(): void; + + withMock(closure: () => void): void; + addCustomParamParser(parser: JasmineAjaxParamParser): void; + + stubRequest(url: RegExp, data?: string, method?: string): JasmineAjaxRequestStub; + stubRequest(url: string, data?: string, method?: string): JasmineAjaxRequestStub; + + requests: JasmineAjaxRequestTracker; + stubs: JasmineAjaxStubTracker; +} + +declare module jasmine { + export var Ajax: MockAjax; +} From c0bb2b179811977f9a4d71285071989acf5a75b0 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 May 2015 21:15:47 +0200 Subject: [PATCH 248/534] fixed dependencies and errors --- jasmine-ajax/jasmine-ajax-tests.ts | 3197 ++++++++++++++-------------- jasmine-ajax/jasmine-ajax.d.ts | 11 +- 2 files changed, 1610 insertions(+), 1598 deletions(-) diff --git a/jasmine-ajax/jasmine-ajax-tests.ts b/jasmine-ajax/jasmine-ajax-tests.ts index b5134d2cf..6b5c50b1b 100644 --- a/jasmine-ajax/jasmine-ajax-tests.ts +++ b/jasmine-ajax/jasmine-ajax-tests.ts @@ -6,1813 +6,1820 @@ /// /// +declare function getJasmineRequireObj(); + describe('StubTracker', function() { - beforeEach(function() { - var Constructor = getJasmineRequireObj().AjaxStubTracker(); - this.tracker = new Constructor(); - }); + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxStubTracker(); + this.tracker = new Constructor(); + }); - it('finds nothing if no stubs are added', function() { - expect(this.tracker.findStub()).toBeUndefined(); - }); + it('finds nothing if no stubs are added', function() { + expect(this.tracker.findStub()).toBeUndefined(); + }); - it('finds an added stub', function() { - var stub = { matches: function() { return true; } }; - this.tracker.addStub(stub); + it('finds an added stub', function() { + var stub = { matches: function() { return true; } }; + this.tracker.addStub(stub); - expect(this.tracker.findStub()).toBe(stub); - }); + expect(this.tracker.findStub()).toBe(stub); + }); - it('skips an added stub that does not match', function() { - var stub = { matches: function() { return false; } }; - this.tracker.addStub(stub); + it('skips an added stub that does not match', function() { + var stub = { matches: function() { return false; } }; + this.tracker.addStub(stub); - expect(this.tracker.findStub()).toBeUndefined(); - }); + expect(this.tracker.findStub()).toBeUndefined(); + }); - it('passes url, data, and method to the stub', function() { - var stub = { matches: jasmine.createSpy('matches') }; - this.tracker.addStub(stub); + it('passes url, data, and method to the stub', function() { + var stub = { matches: jasmine.createSpy('matches') }; + this.tracker.addStub(stub); - this.tracker.findStub('url', 'data', 'method'); + this.tracker.findStub('url', 'data', 'method'); - expect(stub.matches).toHaveBeenCalledWith('url', 'data', 'method'); - }); + expect(stub.matches).toHaveBeenCalledWith('url', 'data', 'method'); + }); - it('can clear out all stubs', function() { - var stub = { matches: jasmine.createSpy('matches') }; - this.tracker.addStub(stub); + it('can clear out all stubs', function() { + var stub = { matches: jasmine.createSpy('matches') }; + this.tracker.addStub(stub); - this.tracker.findStub(); + this.tracker.findStub(); - expect(stub.matches).toHaveBeenCalled(); + expect(stub.matches).toHaveBeenCalled(); - this.tracker.reset(); - stub.matches.calls.reset(); + this.tracker.reset(); + stub.matches.calls.reset(); - this.tracker.findStub(); + this.tracker.findStub(); - expect(stub.matches).not.toHaveBeenCalled(); - }); + expect(stub.matches).not.toHaveBeenCalled(); + }); - it('uses the most recently added stub that matches', function() { - var stub1 = { matches: function() { return true; } }; - var stub2 = { matches: function() { return true; } }; - var stub3 = { matches: function() { return false; } }; + it('uses the most recently added stub that matches', function() { + var stub1 = { matches: function() { return true; } }; + var stub2 = { matches: function() { return true; } }; + var stub3 = { matches: function() { return false; } }; - this.tracker.addStub(stub1); - this.tracker.addStub(stub2); - this.tracker.addStub(stub3); + this.tracker.addStub(stub1); + this.tracker.addStub(stub2); + this.tracker.addStub(stub3); - expect(this.tracker.findStub()).toBe(stub2); - }); + expect(this.tracker.findStub()).toBe(stub2); + }); }); describe('FakeRequest', function() { - beforeEach(function() { - this.requestTracker = { track: jasmine.createSpy('trackRequest') }; - this.stubTracker = { findStub: function() {} }; - var parserInstance = this.parserInstance = jasmine.createSpy('parse'); - this.paramParser = { findParser: function() { return { parse: parserInstance }; } }; - var eventBus = this.fakeEventBus = { - addEventListener: jasmine.createSpy('addEventListener'), - trigger: jasmine.createSpy('trigger'), - removeEventListener: jasmine.createSpy('removeEventListener') - }; - this.eventBusFactory = function() { - return eventBus; - }; - this.fakeGlobal = { - XMLHttpRequest: function() { - this.extraAttribute = 'my cool attribute'; - }, - DOMParser: window['DOMParser'], - ActiveXObject: window['ActiveXObject'] - }; - this.FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(this.fakeGlobal, this.requestTracker, this.stubTracker, this.paramParser); - }); - - it('extends from the global XMLHttpRequest', function() { - var request = new this.FakeRequest(); - - expect(request.extraAttribute).toEqual('my cool attribute'); - }); - - it('skips XMLHttpRequest attributes that IE does not want copied', function() { - // use real window here so it will correctly go red on IE if it breaks - var FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(window, this.requestTracker, this.stubTracker, this.paramParser); - var request = new FakeRequest(); - - expect(request.responseBody).toBeUndefined(); - expect(request.responseXML).toBeUndefined(); - expect(request.statusText).toBeUndefined(); - }); - - it('tracks the request', function() { - var request = new this.FakeRequest(); - - expect(this.requestTracker.track).toHaveBeenCalledWith(request); - }); - - it('has default request headers and override mime type', function() { - var request = new this.FakeRequest(); - - expect(request.requestHeaders).toEqual({}); - expect(request.overriddenMimeType).toBeNull(); - }); - - it('saves request information when opened', function() { - var request = new this.FakeRequest(); - request.open('METHOD', 'URL', 'ignore_async', 'USERNAME', 'PASSWORD'); - - expect(request.method).toEqual('METHOD'); - expect(request.url).toEqual('URL'); - expect(request.username).toEqual('USERNAME'); - expect(request.password).toEqual('PASSWORD'); - }); - - it('saves an override mime type', function() { - var request = new this.FakeRequest(); - - request.overrideMimeType('application/text; charset: utf-8'); - - expect(request.overriddenMimeType).toBe('application/text; charset: utf-8'); - }); - - it('saves request headers', function() { - var request = new this.FakeRequest(); - - request.setRequestHeader('X-Header-1', 'value1'); - request.setRequestHeader('X-Header-2', 'value2'); - - expect(request.requestHeaders).toEqual({ - 'X-Header-1': 'value1', - 'X-Header-2': 'value2' - }); - }); - - it('combines request headers with the same header name', function() { - var request = new this.FakeRequest(); - - request.setRequestHeader('X-Header', 'value1'); - request.setRequestHeader('X-Header', 'value2'); - - expect(request.requestHeaders['X-Header']).toEqual('value1, value2'); - }); - - it('finds the content-type request header', function() { - var request = new this.FakeRequest(); - - request.setRequestHeader('ContEnt-tYPe', 'application/text+xml'); - - expect(request.contentType()).toEqual('application/text+xml'); - }); - - describe('managing readyState', function() { - beforeEach(function() { - this.request = new this.FakeRequest(); - }); - - it('has an initial ready state of 0 (uninitialized)', function() { - expect(this.request.readyState).toBe(0); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalled(); - }); - - it('has a ready state of 1 (open) when opened', function() { - this.request.open(); - - expect(this.request.readyState).toBe(1); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - }); - - it('has a ready state of 0 (uninitialized) when aborted', function() { - this.request.open(); - this.fakeEventBus.trigger.calls.reset(); - - this.request.abort(); - - expect(this.request.readyState).toBe(0); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - }); - - it('has a ready state of 1 (sent) when sent', function() { - this.request.open(); - this.fakeEventBus.trigger.calls.reset(); - - this.request.send(); - - expect(this.request.readyState).toBe(1); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); - }); - - it('has a ready state of 4 (loaded) when timed out', function() { - this.request.open(); - this.request.send(); - this.fakeEventBus.trigger.calls.reset(); - - jasmine.clock().install(); - this.request.responseTimeout(); - jasmine.clock().uninstall(); - - expect(this.request.readyState).toBe(4); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); - }); - - it('has a ready state of 4 (loaded) when network erroring', function() { - this.request.open(); - this.request.send(); - this.fakeEventBus.trigger.calls.reset(); - - this.request.responseError(); - - expect(this.request.readyState).toBe(4); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - }); - - it('has a ready state of 4 (loaded) when responding', function() { - this.request.open(); - this.request.send(); - this.fakeEventBus.trigger.calls.reset(); - - this.request.respondWith({}); - - expect(this.request.readyState).toBe(4); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - }); - - it('has a ready state of 2, then 4 (loaded) when responding', function() { - this.request.open(); - this.request.send(); - this.fakeEventBus.trigger.calls.reset(); - - var request = this.request; - var events = []; - var headers = [ - { name: 'X-Header', value: 'foo' } - ]; - - this.fakeEventBus.trigger.and.callFake(function(event) { - if (event === 'readystatechange') { - events.push({ - readyState: request.readyState, - status: request.status, - statusText: request.statusText, - responseHeaders: request.responseHeaders - }); - } - }); - - this.request.respondWith({ - status: 200, - statusText: 'OK', - responseHeaders: headers - }); - - expect(this.request.readyState).toBe(4); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - expect(events.length).toBe(2); - expect(events).toEqual([ - { readyState: 2, status: 200, statusText: 'OK', responseHeaders: headers }, - { readyState: 4, status: 200, statusText: 'OK', responseHeaders: headers } - ]); - }); - - it('throws an error when timing out a request that has completed', function() { - this.request.open(); - this.request.send(); - this.request.respondWith({}); - var request = this.request; - - expect(function() { - request.responseTimeout(); - }).toThrowError('FakeXMLHttpRequest already completed'); - }); - - it('throws an error when responding to a request that has completed', function() { - this.request.open(); - this.request.send(); - this.request.respondWith({}); - var request = this.request; - - expect(function() { - request.respondWith({}); - }).toThrowError('FakeXMLHttpRequest already completed'); - }); - - it('throws an error when erroring a request that has completed', function() { - this.request.open(); - this.request.send(); - this.request.respondWith({}); - var request = this.request; - - expect(function() { - request.responseError({}); - }).toThrowError('FakeXMLHttpRequest already completed'); - }); - }); - - it('registers on-style callback with the event bus', function() { - this.request = new this.FakeRequest(); - - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('readystatechange', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadstart', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('progress', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('abort', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('error', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('load', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('timeout', jasmine.any(Function)); - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadend', jasmine.any(Function)); - - this.request.onreadystatechange = jasmine.createSpy('readystatechange'); - this.request.onloadstart = jasmine.createSpy('loadstart'); - this.request.onprogress = jasmine.createSpy('progress'); - this.request.onabort = jasmine.createSpy('abort'); - this.request.onerror = jasmine.createSpy('error'); - this.request.onload = jasmine.createSpy('load'); - this.request.ontimeout = jasmine.createSpy('timeout'); - this.request.onloadend = jasmine.createSpy('loadend'); - - var args = this.fakeEventBus.addEventListener.calls.allArgs(); - for (var i = 0; i < args.length; i++) { - var eventName = args[i][0], - busCallback = args[i][1]; - - busCallback(); - expect(this.request['on' + eventName]).toHaveBeenCalled(); - } - }); - - it('delegates addEventListener to the eventBus', function() { - this.request = new this.FakeRequest(); - - this.request.addEventListener('foo', 'bar'); - - expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('foo', 'bar'); - }); - - it('delegates removeEventListener to the eventBus', function() { - this.request = new this.FakeRequest(); - - this.request.removeEventListener('foo', 'bar'); - - expect(this.fakeEventBus.removeEventListener).toHaveBeenCalledWith('foo', 'bar'); - }); - - describe('triggering progress events', function() { - beforeEach(function() { - this.request = new this.FakeRequest(); - }); - - it('should not trigger any events to start', function() { - this.request.open(); - - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - }); - - it('should trigger loadstart when sent', function() { - this.request.open(); - - this.fakeEventBus.trigger.calls.reset(); - - this.request.send(); - - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('progress'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadend'); - }); - - it('should trigger abort, progress, loadend when aborted', function() { - this.request.open(); - this.request.send(); - - this.fakeEventBus.trigger.calls.reset(); - - this.request.abort(); - - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('abort'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); - }); - - it('should trigger error, progress, loadend when network error', function() { - this.request.open(); - this.request.send(); - - this.fakeEventBus.trigger.calls.reset(); - - this.request.responseError(); - - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('error'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); - }); + beforeEach(function() { + this.requestTracker = { track: jasmine.createSpy('trackRequest') }; + this.stubTracker = { findStub: function() { } }; + var parserInstance = this.parserInstance = jasmine.createSpy('parse'); + this.paramParser = { findParser: function() { return { parse: parserInstance }; } }; + var eventBus = this.fakeEventBus = { + addEventListener: jasmine.createSpy('addEventListener'), + trigger: jasmine.createSpy('trigger'), + removeEventListener: jasmine.createSpy('removeEventListener') + }; + this.eventBusFactory = function() { + return eventBus; + }; + this.fakeGlobal = { + XMLHttpRequest: function() { + this.extraAttribute = 'my cool attribute'; + }, + DOMParser: window['DOMParser'], + ActiveXObject: window['ActiveXObject'] + }; + this.FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(this.fakeGlobal, this.requestTracker, this.stubTracker, this.paramParser); + }); + + it('extends from the global XMLHttpRequest', function() { + var request = new this.FakeRequest(); + + expect(request.extraAttribute).toEqual('my cool attribute'); + }); + + it('skips XMLHttpRequest attributes that IE does not want copied', function() { + // use real window here so it will correctly go red on IE if it breaks + var FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(window, this.requestTracker, this.stubTracker, this.paramParser); + var request = new FakeRequest(); + + expect(request.responseBody).toBeUndefined(); + expect(request.responseXML).toBeUndefined(); + expect(request.statusText).toBeUndefined(); + }); + + it('tracks the request', function() { + var request = new this.FakeRequest(); + + expect(this.requestTracker.track).toHaveBeenCalledWith(request); + }); + + it('has default request headers and override mime type', function() { + var request = new this.FakeRequest(); + + expect(request.requestHeaders).toEqual({}); + expect(request.overriddenMimeType).toBeNull(); + }); + + it('saves request information when opened', function() { + var request = new this.FakeRequest(); + request.open('METHOD', 'URL', 'ignore_async', 'USERNAME', 'PASSWORD'); + + expect(request.method).toEqual('METHOD'); + expect(request.url).toEqual('URL'); + expect(request.username).toEqual('USERNAME'); + expect(request.password).toEqual('PASSWORD'); + }); + + it('saves an override mime type', function() { + var request = new this.FakeRequest(); + + request.overrideMimeType('application/text; charset: utf-8'); + + expect(request.overriddenMimeType).toBe('application/text; charset: utf-8'); + }); + + it('saves request headers', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('X-Header-1', 'value1'); + request.setRequestHeader('X-Header-2', 'value2'); + + expect(request.requestHeaders).toEqual({ + 'X-Header-1': 'value1', + 'X-Header-2': 'value2' + }); + }); + + it('combines request headers with the same header name', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('X-Header', 'value1'); + request.setRequestHeader('X-Header', 'value2'); + + expect(request.requestHeaders['X-Header']).toEqual('value1, value2'); + }); + + it('finds the content-type request header', function() { + var request = new this.FakeRequest(); + + request.setRequestHeader('ContEnt-tYPe', 'application/text+xml'); + + expect(request.contentType()).toEqual('application/text+xml'); + }); + + describe('managing readyState', function() { + beforeEach(function() { + this.request = new this.FakeRequest(); + }); + + it('has an initial ready state of 0 (uninitialized)', function() { + expect(this.request.readyState).toBe(0); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalled(); + }); + + it('has a ready state of 1 (open) when opened', function() { + this.request.open(); + + expect(this.request.readyState).toBe(1); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 0 (uninitialized) when aborted', function() { + this.request.open(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.abort(); + + expect(this.request.readyState).toBe(0); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 1 (sent) when sent', function() { + this.request.open(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.send(); + + expect(this.request.readyState).toBe(1); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 4 (loaded) when timed out', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + jasmine.clock().install(); + this.request.responseTimeout(); + jasmine.clock().uninstall(); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); + }); + + it('has a ready state of 4 (loaded) when network erroring', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.responseError(); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 4 (loaded) when responding', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + this.request.respondWith({}); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('has a ready state of 2, then 4 (loaded) when responding', function() { + this.request.open(); + this.request.send(); + this.fakeEventBus.trigger.calls.reset(); + + var request = this.request; + var events = []; + var headers = [ + { name: 'X-Header', value: 'foo' } + ]; + + this.fakeEventBus.trigger.and.callFake(function(event) { + if (event === 'readystatechange') { + events.push({ + readyState: request.readyState, + status: request.status, + statusText: request.statusText, + responseHeaders: request.responseHeaders + }); + } + }); + + this.request.respondWith({ + status: 200, + statusText: 'OK', + responseHeaders: headers + }); + + expect(this.request.readyState).toBe(4); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(events.length).toBe(2); + expect(events).toEqual([ + { readyState: 2, status: 200, statusText: 'OK', responseHeaders: headers }, + { readyState: 4, status: 200, statusText: 'OK', responseHeaders: headers } + ]); + }); + + it('throws an error when timing out a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.responseTimeout(); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + + it('throws an error when responding to a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.respondWith({}); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + + it('throws an error when erroring a request that has completed', function() { + this.request.open(); + this.request.send(); + this.request.respondWith({}); + var request = this.request; + + expect(function() { + request.responseError({}); + }).toThrowError('FakeXMLHttpRequest already completed'); + }); + }); + + it('registers on-style callback with the event bus', function() { + this.request = new this.FakeRequest(); + + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('readystatechange', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadstart', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('progress', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('abort', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('error', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('load', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('timeout', jasmine.any(Function)); + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('loadend', jasmine.any(Function)); + + this.request.onreadystatechange = jasmine.createSpy('readystatechange'); + this.request.onloadstart = jasmine.createSpy('loadstart'); + this.request.onprogress = jasmine.createSpy('progress'); + this.request.onabort = jasmine.createSpy('abort'); + this.request.onerror = jasmine.createSpy('error'); + this.request.onload = jasmine.createSpy('load'); + this.request.ontimeout = jasmine.createSpy('timeout'); + this.request.onloadend = jasmine.createSpy('loadend'); + + var args = this.fakeEventBus.addEventListener.calls.allArgs(); + for (var i = 0; i < args.length; i++) { + var eventName = args[i][0], + busCallback = args[i][1]; + + busCallback(); + expect(this.request['on' + eventName]).toHaveBeenCalled(); + } + }); + + it('delegates addEventListener to the eventBus', function() { + this.request = new this.FakeRequest(); + + this.request.addEventListener('foo', 'bar'); + + expect(this.fakeEventBus.addEventListener).toHaveBeenCalledWith('foo', 'bar'); + }); + + it('delegates removeEventListener to the eventBus', function() { + this.request = new this.FakeRequest(); + + this.request.removeEventListener('foo', 'bar'); + + expect(this.fakeEventBus.removeEventListener).toHaveBeenCalledWith('foo', 'bar'); + }); + + describe('triggering progress events', function() { + beforeEach(function() { + this.request = new this.FakeRequest(); + }); + + it('should not trigger any events to start', function() { + this.request.open(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + }); + + it('should trigger loadstart when sent', function() { + this.request.open(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.send(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadend'); + }); + + it('should trigger abort, progress, loadend when aborted', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.abort(); + + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + + it('should trigger error, progress, loadend when network error', function() { + this.request.open(); + this.request.send(); + + this.fakeEventBus.trigger.calls.reset(); + + this.request.responseError(); + + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); - it('should trigger timeout, progress, loadend when timing out', function() { - this.request.open(); - this.request.send(); + it('should trigger timeout, progress, loadend when timing out', function() { + this.request.open(); + this.request.send(); - this.fakeEventBus.trigger.calls.reset(); + this.fakeEventBus.trigger.calls.reset(); - jasmine.clock().install(); - this.request.responseTimeout(); - jasmine.clock().uninstall(); + jasmine.clock().install(); + this.request.responseTimeout(); + jasmine.clock().uninstall(); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('timeout'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); - }); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange', 'timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); - it('should trigger load, progress, loadend when responding', function() { - this.request.open(); - this.request.send(); + it('should trigger load, progress, loadend when responding', function() { + this.request.open(); + this.request.send(); - this.fakeEventBus.trigger.calls.reset(); + this.fakeEventBus.trigger.calls.reset(); - this.request.respondWith({ status: 200 }); + this.request.respondWith({ status: 200 }); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('load'); - expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); - expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); - }); - }); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('loadstart'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('readystatechange'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('progress'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('abort'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('error'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('load'); + expect(this.fakeEventBus.trigger).not.toHaveBeenCalledWith('timeout'); + expect(this.fakeEventBus.trigger).toHaveBeenCalledWith('loadend'); + }); + }); - it('ticks the jasmine clock on timeout', function() { - var clock = { tick: jasmine.createSpy('tick') }; - spyOn(jasmine, 'clock').and.returnValue(clock); + it('ticks the jasmine clock on timeout', function() { + var clock = { tick: jasmine.createSpy('tick') }; + spyOn(jasmine, 'clock').and.returnValue(clock); - var request = new this.FakeRequest(); - request.open(); - request.send(); + var request = new this.FakeRequest(); + request.open(); + request.send(); - request.responseTimeout(); + request.responseTimeout(); - expect(clock.tick).toHaveBeenCalledWith(30000); - }); + expect(clock.tick).toHaveBeenCalledWith(30000); + }); - it('has an initial status of null', function() { - var request = new this.FakeRequest(); - - expect(request.status).toBeNull(); - }); - - it('has an aborted status', function() { - var request = new this.FakeRequest(); - - request.abort(); + it('has an initial status of null', function() { + var request = new this.FakeRequest(); + + expect(request.status).toBeNull(); + }); + + it('has an aborted status', function() { + var request = new this.FakeRequest(); + + request.abort(); - expect(request.status).toBe(0); - expect(request.statusText).toBe('abort'); - }); + expect(request.status).toBe(0); + expect(request.statusText).toBe('abort'); + }); - it('has a status from the response', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200 }); - - expect(request.status).toBe(200); - expect(request.statusText).toBe(''); - }); - - it('has a statusText from the response', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, statusText: 'OK' }); - - expect(request.status).toBe(200); - expect(request.statusText).toBe('OK'); - }); - - it('saves off any data sent to the server', function() { - var request = new this.FakeRequest(); - request.open(); - request.send('foo=bar&baz=quux'); - - expect(request.params).toBe('foo=bar&baz=quux'); - }); - - it('parses data sent to the server', function() { - var request = new this.FakeRequest(); - request.open(); - request.send('foo=bar&baz=quux'); - - this.parserInstance.and.returnValue('parsed'); + it('has a status from the response', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.status).toBe(200); + expect(request.statusText).toBe(''); + }); + + it('has a statusText from the response', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, statusText: 'OK' }); + + expect(request.status).toBe(200); + expect(request.statusText).toBe('OK'); + }); + + it('saves off any data sent to the server', function() { + var request = new this.FakeRequest(); + request.open(); + request.send('foo=bar&baz=quux'); + + expect(request.params).toBe('foo=bar&baz=quux'); + }); + + it('parses data sent to the server', function() { + var request = new this.FakeRequest(); + request.open(); + request.send('foo=bar&baz=quux'); + + this.parserInstance.and.returnValue('parsed'); - expect(request.data()).toBe('parsed'); - }); - - it('skips parsing if no data was sent', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - expect(request.data()).toEqual({}); - expect(this.parserInstance).not.toHaveBeenCalled(); - }); - - it('saves responseText', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, responseText: 'foobar' }); + expect(request.data()).toBe('parsed'); + }); + + it('skips parsing if no data was sent', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + expect(request.data()).toEqual({}); + expect(this.parserInstance).not.toHaveBeenCalled(); + }); + + it('saves responseText', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foobar' }); - expect(request.responseText).toBe('foobar'); - }); + expect(request.responseText).toBe('foobar'); + }); - it('defaults responseText if none is given', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200 }); + it('defaults responseText if none is given', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); - expect(request.responseText).toBe(''); - }); + expect(request.responseText).toBe(''); + }); - it('retrieves individual response headers', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); + it('retrieves individual response headers', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); - request.respondWith({ - status: 200, - responseHeaders: { - 'X-Header': 'foo' - } - }); + request.respondWith({ + status: 200, + responseHeaders: { + 'X-Header': 'foo' + } + }); - expect(request.getResponseHeader('X-Header')).toBe('foo'); - }); + expect(request.getResponseHeader('X-Header')).toBe('foo'); + }); - it('retrieves individual response headers case-insensitively', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); + it('retrieves individual response headers case-insensitively', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); - request.respondWith({ - status: 200, - responseHeaders: { - 'X-Header': 'foo' - } - }); - - expect(request.getResponseHeader('x-header')).toBe('foo'); - }); - - it('retrieves a combined response header', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ - status: 200, - responseHeaders: [ - { name: 'X-Header', value: 'foo' }, - { name: 'X-Header', value: 'bar' } - ] - }); - - expect(request.getResponseHeader('x-header')).toBe('foo, bar'); - }); - - it("doesn't pollute the response headers of other XHRs", function() { - var request1 = new this.FakeRequest(); - request1.open(); - request1.send(); - - var request2 = new this.FakeRequest(); - request2.open(); - request2.send(); - - request1.respondWith({ status: 200, responseHeaders: { 'X-Foo': 'bar' } }); - request2.respondWith({ status: 200, responseHeaders: { 'X-Baz': 'quux' } }); - - expect(request1.getAllResponseHeaders()).toBe("X-Foo: bar\r\n"); - expect(request2.getAllResponseHeaders()).toBe("X-Baz: quux\r\n"); - }); - - it('retrieves all response headers', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ - status: 200, - responseHeaders: [ - { name: 'X-Header-1', value: 'foo' }, - { name: 'X-Header-2', value: 'bar' }, - { name: 'X-Header-1', value: 'baz' } - ] - }); - - expect(request.getAllResponseHeaders()).toBe("X-Header-1: foo\r\nX-Header-2: bar\r\nX-Header-1: baz\r\n"); - }); - - it('sets the content-type header to the specified contentType when no other headers are supplied', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, contentType: 'text/plain' }); - - expect(request.getResponseHeader('content-type')).toBe('text/plain'); - expect(request.getAllResponseHeaders()).toBe("Content-Type: text/plain\r\n"); - }); - - it('sets a default content-type header if no contentType and headers are supplied', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200 }); - - expect(request.getResponseHeader('content-type')).toBe('application/json'); - expect(request.getAllResponseHeaders()).toBe("Content-Type: application/json\r\n"); - }); - - it('has no responseXML by default', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200 }); - - expect(request.responseXML).toBeNull(); - }); - - it('parses a text/xml document into responseXML', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, contentType: 'text/xml', responseText: '' }); - - if (typeof window['Document'] !== 'undefined') { - expect(request.responseXML instanceof window['Document']).toBe(true); - expect(request.response instanceof window['Document']).toBe(true); - } else { - // IE 8 - expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); - expect(request.response instanceof window['ActiveXObject']).toBe(true); - } - }); - - it('parses an application/xml document into responseXML', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, contentType: 'application/xml', responseText: '' }); - - if (typeof window['Document'] !== 'undefined') { - expect(request.responseXML instanceof window['Document']).toBe(true); - expect(request.response instanceof window['Document']).toBe(true); - } else { - // IE 8 - expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); - expect(request.response instanceof window['ActiveXObject']).toBe(true); - } - }); - - it('parses a custom blah+xml document into responseXML', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, contentType: 'application/text+xml', responseText: '' }); - - if (typeof window['Document'] !== 'undefined') { - expect(request.responseXML instanceof window['Document']).toBe(true); - expect(request.response instanceof window['Document']).toBe(true); - } else { - // IE 8 - expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); - expect(request.response instanceof window['ActiveXObject']).toBe(true); - } - }); - - it('defaults the response attribute to the responseText', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, responseText: 'foo' }); - - expect(request.response).toEqual('foo'); - }); - - it('has a text response when the responseType is blank', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, responseText: 'foo', responseType: '' }); - - expect(request.response).toEqual('foo'); - }); - - it('has a text response when the responseType is text', function() { - var request = new this.FakeRequest(); - request.open(); - request.send(); - - request.respondWith({ status: 200, responseText: 'foo', responseType: 'text' }); - - expect(request.response).toEqual('foo'); - }); + request.respondWith({ + status: 200, + responseHeaders: { + 'X-Header': 'foo' + } + }); + + expect(request.getResponseHeader('x-header')).toBe('foo'); + }); + + it('retrieves a combined response header', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: [ + { name: 'X-Header', value: 'foo' }, + { name: 'X-Header', value: 'bar' } + ] + }); + + expect(request.getResponseHeader('x-header')).toBe('foo, bar'); + }); + + it("doesn't pollute the response headers of other XHRs", function() { + var request1 = new this.FakeRequest(); + request1.open(); + request1.send(); + + var request2 = new this.FakeRequest(); + request2.open(); + request2.send(); + + request1.respondWith({ status: 200, responseHeaders: { 'X-Foo': 'bar' } }); + request2.respondWith({ status: 200, responseHeaders: { 'X-Baz': 'quux' } }); + + expect(request1.getAllResponseHeaders()).toBe("X-Foo: bar\r\n"); + expect(request2.getAllResponseHeaders()).toBe("X-Baz: quux\r\n"); + }); + + it('retrieves all response headers', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ + status: 200, + responseHeaders: [ + { name: 'X-Header-1', value: 'foo' }, + { name: 'X-Header-2', value: 'bar' }, + { name: 'X-Header-1', value: 'baz' } + ] + }); + + expect(request.getAllResponseHeaders()).toBe("X-Header-1: foo\r\nX-Header-2: bar\r\nX-Header-1: baz\r\n"); + }); + + it('sets the content-type header to the specified contentType when no other headers are supplied', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'text/plain' }); + + expect(request.getResponseHeader('content-type')).toBe('text/plain'); + expect(request.getAllResponseHeaders()).toBe("Content-Type: text/plain\r\n"); + }); + + it('sets a default content-type header if no contentType and headers are supplied', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.getResponseHeader('content-type')).toBe('application/json'); + expect(request.getAllResponseHeaders()).toBe("Content-Type: application/json\r\n"); + }); + + it('has no responseXML by default', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200 }); + + expect(request.responseXML).toBeNull(); + }); + + it('parses a text/xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'text/xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('parses an application/xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'application/xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('parses a custom blah+xml document into responseXML', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, contentType: 'application/text+xml', responseText: '' }); + + if (typeof window['Document'] !== 'undefined') { + expect(request.responseXML instanceof window['Document']).toBe(true); + expect(request.response instanceof window['Document']).toBe(true); + } else { + // IE 8 + expect(request.responseXML instanceof window['ActiveXObject']).toBe(true); + expect(request.response instanceof window['ActiveXObject']).toBe(true); + } + }); + + it('defaults the response attribute to the responseText', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo' }); + + expect(request.response).toEqual('foo'); + }); + + it('has a text response when the responseType is blank', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo', responseType: '' }); + + expect(request.response).toEqual('foo'); + }); + + it('has a text response when the responseType is text', function() { + var request = new this.FakeRequest(); + request.open(); + request.send(); + + request.respondWith({ status: 200, responseText: 'foo', responseType: 'text' }); + + expect(request.response).toEqual('foo'); + }); }); describe("Jasmine Mock Ajax (for toplevel)", function() { - var request, anotherRequest, response; - var success, error, complete; - var client, onreadystatechange; - var sharedContext: any = {}; - var fakeGlobal, mockAjax; - - beforeEach(function() { - var fakeXMLHttpRequest = jasmine.createSpy('realFakeXMLHttpRequest'); - fakeGlobal = { - XMLHttpRequest: fakeXMLHttpRequest, - DOMParser: window['DOMParser'], - ActiveXObject: window['ActiveXObject'] - }; - mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); - - success = jasmine.createSpy("onSuccess"); - error = jasmine.createSpy("onFailure"); - complete = jasmine.createSpy("onComplete"); - - onreadystatechange = function() { - if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE - if (this.status === 200) { - success(this.responseText, this.textStatus, this); - } else { - error(this, this.textStatus, ''); - } - - complete(this, this.textStatus); - } - }; - }); - - describe("when making a request", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.send(); - request = mockAjax.requests.mostRecent(); - }); - - it("should store URL and transport", function() { - expect(request.url).toEqual("example.com/someApi"); - }); - - it("should queue the request", function() { - expect(mockAjax.requests.count()).toEqual(1); - }); - - it("should allow access to the queued request", function() { - expect(mockAjax.requests.first()).toEqual(request); - }); - - it("should allow access to the queued request via index", function() { - expect(mockAjax.requests.at(0)).toEqual(request); - }); - - describe("and then another request", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.send(); - - anotherRequest = mockAjax.requests.mostRecent(); - }); - - it("should queue the next request", function() { - expect(mockAjax.requests.count()).toEqual(2); - }); - - it("should allow access to the other queued request", function() { - expect(mockAjax.requests.first()).toEqual(request); - expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); - }); - }); - - describe("mockAjax.requests.mostRecent()", function () { - - describe("when there is one request queued", function () { - it("should return the request", function() { - expect(mockAjax.requests.mostRecent()).toEqual(request); - }); - }); - - describe("when there is more than one request", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.send(); - anotherRequest = mockAjax.requests.mostRecent(); - }); - - it("should return the most recent request", function() { - expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); - }); - }); - - describe("when there are no requests", function () { - beforeEach(function() { - mockAjax.requests.reset(); - }); - - it("should return null", function() { - expect(mockAjax.requests.mostRecent()).toBeUndefined(); - }); - }); - }); - - describe("clearAjaxRequests()", function () { - beforeEach(function() { - mockAjax.requests.reset(); - }); - - it("should remove all requests", function() { - expect(mockAjax.requests.count()).toEqual(0); - expect(mockAjax.requests.mostRecent()).toBeUndefined(); - }); - }); - }); - - describe("when simulating a response with request.response", function () { - describe("and the response is Success", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "text/plain"); - client.send(); - - request = mockAjax.requests.mostRecent(); - response = {status: 200, statusText: "OK", contentType: "text/html", responseText: "OK!"}; - request.respondWith(response); - - sharedContext.responseCallback = success; - sharedContext.status = response.status; - sharedContext.statusText = response.statusText; - sharedContext.contentType = response.contentType; - sharedContext.responseText = response.responseText; - sharedContext.responseType = response.responseType; - }); - - it("should call the success handler", function() { - expect(success).toHaveBeenCalled(); - }); - - it("should not call the failure handler", function() { - expect(error).not.toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - - sharedAjaxResponseBehaviorForZepto_Success(sharedContext); - }); - - describe("and the response is Success, but with JSON", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "application/json"); - client.send(); - - request = mockAjax.requests.mostRecent(); - var responseObject = {status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: "json"}; - - request.respondWith(responseObject); - - sharedContext.responseCallback = success; - sharedContext.status = responseObject.status; - sharedContext.statusText = responseObject.statusText; - sharedContext.contentType = responseObject.contentType; - sharedContext.responseText = responseObject.responseText; - sharedContext.responseType = responseObject.responseType; - - response = success.calls.mostRecent().args[2]; - }); - - it("should call the success handler", function() { - expect(success).toHaveBeenCalled(); - }); - - it("should not call the failure handler", function() { - expect(error).not.toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - - it("should return a JavaScript object for XHR2 response", function() { - var responseText = sharedContext.responseText; - expect(success.calls.mostRecent().args[0]).toEqual(responseText); - - expect(response.responseText).toEqual(responseText); - expect(response.response).toEqual({foo: "bar"}); - }); - - sharedAjaxResponseBehaviorForZepto_Success(sharedContext); - }); - - describe("and the response is Success, and response is overriden", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "application/json"); - client.send(); - - request = mockAjax.requests.mostRecent(); - var responseObject = {status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: 'json'}; - - request.respondWith(responseObject); - - sharedContext.responseCallback = success; - sharedContext.status = responseObject.status; - sharedContext.statusText = responseObject.statusText; - sharedContext.contentType = responseObject.contentType; - sharedContext.responseText = responseObject.responseText; - sharedContext.responseType = responseObject.responseType; - - response = success.calls.mostRecent().args[2]; - }); - - it("should return the provided override for the XHR2 response", function() { - var responseText = sharedContext.responseText; - - expect(response.responseText).toEqual(responseText); - expect(response.response).toEqual({foo: "bar"}); - }); - - sharedAjaxResponseBehaviorForZepto_Success(sharedContext); - }); - - describe("response with unique header names using an object", function () { - beforeEach(function () { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com"); - client.send(); - - request = mockAjax.requests.mostRecent(); - var responseObject = {status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: { - 'X-Header1': 'header 1 value', - 'X-Header2': 'header 2 value', - 'X-Header3': 'header 3 value' - }}; - request.respondWith(responseObject); - response = success.calls.mostRecent().args[2]; - }); - - it("getResponseHeader should return the each value", function () { - expect(response.getResponseHeader('X-Header1')).toBe('header 1 value'); - expect(response.getResponseHeader('X-Header2')).toBe('header 2 value'); - expect(response.getResponseHeader('X-Header3')).toBe('header 3 value'); - }); - - it("getAllResponseHeaders should return all values", function () { - expect(response.getAllResponseHeaders()).toBe([ - "X-Header1: header 1 value", - "X-Header2: header 2 value", - "X-Header3: header 3 value" - ].join("\r\n") + "\r\n"); - }); - }); - - describe("response with multiple headers of the same name using an array of objects", function () { - beforeEach(function () { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com"); - client.send(); - - request = mockAjax.requests.mostRecent(); - var responseObject = {status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: [ - { name: 'X-Header', value: 'header value 1' }, - { name: 'X-Header', value: 'header value 2' } - ]}; - request.respondWith(responseObject); - response = success.calls.mostRecent().args[2]; - }); - - it("getResponseHeader should return all values comma separated", function () { - expect(response.getResponseHeader('X-Header')).toBe('header value 1, header value 2'); - }); - - it("getAllResponseHeaders should return all values", function () { - expect(response.getAllResponseHeaders()).toBe([ - "X-Header: header value 1", - "X-Header: header value 2" - ].join("\r\n") + "\r\n"); - }); - }); - - describe("the content type defaults to application/json", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "application/json"); - client.send(); - - request = mockAjax.requests.mostRecent(); - response = {status: 200, statusText: "OK", responseText: '{"foo": "valid JSON, dammit."}', responseType: 'json'}; - request.respondWith(response); - - sharedContext.responseCallback = success; - sharedContext.status = response.status; - sharedContext.statusText = response.statusText; - sharedContext.contentType = "application/json"; - sharedContext.responseType = response.responseType; - sharedContext.responseText = response.responseText; - }); - - it("should call the success handler", function() { - expect(success).toHaveBeenCalled(); - }); - - it("should not call the failure handler", function() { - expect(error).not.toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - - sharedAjaxResponseBehaviorForZepto_Success(sharedContext); - }); - - describe("and the status/response code is 0", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "text/plain"); - client.send(); - - request = mockAjax.requests.mostRecent(); - response = {status: 0, statusText: "ABORT", responseText: '{"foo": "whoops!"}'}; - request.respondWith(response); - - sharedContext.responseCallback = error; - sharedContext.status = 0; - sharedContext.statusText = response.statusText; - sharedContext.contentType = 'application/json'; - sharedContext.responseText = response.responseText; - sharedContext.responseType = response.responseType; - }); - - it("should call the success handler", function() { - expect(success).not.toHaveBeenCalled(); - }); - - it("should not call the failure handler", function() { - expect(error).toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - - sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); - }); - }); - - describe("and the response is error", function () { - beforeEach(function() { - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "text/plain"); - client.send(); - - request = mockAjax.requests.mostRecent(); - response = {status: 500, statusText: "SERVER ERROR", contentType: "text/html", responseText: "(._){"}; - request.respondWith(response); - - sharedContext.responseCallback = error; - sharedContext.status = response.status; - sharedContext.statusText = response.statusText; - sharedContext.contentType = response.contentType; - sharedContext.responseText = response.responseText; - sharedContext.responseType = response.responseType; - }); - - it("should not call the success handler", function() { - expect(success).not.toHaveBeenCalled(); - }); - - it("should call the failure handler", function() { - expect(error).toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - - sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); - }); - - describe('when simulating a response with request.responseTimeout', function() { - beforeEach(function() { - jasmine.clock().install(); - - client = new fakeGlobal.XMLHttpRequest(); - client.onreadystatechange = onreadystatechange; - client.open("GET", "example.com/someApi"); - client.setRequestHeader("Content-Type", "text/plain"); - client.send(); - - request = mockAjax.requests.mostRecent(); - response = {contentType: "text/html", response: "(._){response", responseText: "(._){", responseType: "text"}; - request.responseTimeout(response); - - sharedContext.responseCallback = error; - sharedContext.status = response.status; - sharedContext.statusText = response.statusText; - sharedContext.contentType = response.contentType; - sharedContext.responseText = response.responseText; - sharedContext.responseType = response.responseType; - }); - - afterEach(function() { - jasmine.clock().uninstall(); - }); - - it("should not call the success handler", function() { - expect(success).not.toHaveBeenCalled(); - }); - - it("should call the failure handler", function() { - expect(error).toHaveBeenCalled(); - }); - - it("should call the complete handler", function() { - expect(complete).toHaveBeenCalled(); - }); - }); + var request, anotherRequest, response; + var success, error, complete; + var client, onreadystatechange; + var sharedContext: any = {}; + var fakeGlobal, mockAjax; + + beforeEach(function() { + var fakeXMLHttpRequest = jasmine.createSpy('realFakeXMLHttpRequest'); + fakeGlobal = { + XMLHttpRequest: fakeXMLHttpRequest, + DOMParser: window['DOMParser'], + ActiveXObject: window['ActiveXObject'] + }; + mockAjax = new MockAjax(fakeGlobal); + mockAjax.install(); + + success = jasmine.createSpy("onSuccess"); + error = jasmine.createSpy("onFailure"); + complete = jasmine.createSpy("onComplete"); + + onreadystatechange = function() { + if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE + if (this.status === 200) { + success(this.responseText, this.textStatus, this); + } else { + error(this, this.textStatus, ''); + } + + complete(this, this.textStatus); + } + }; + }); + + describe("when making a request", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + request = mockAjax.requests.mostRecent(); + }); + + it("should store URL and transport", function() { + expect(request.url).toEqual("example.com/someApi"); + }); + + it("should queue the request", function() { + expect(mockAjax.requests.count()).toEqual(1); + }); + + it("should allow access to the queued request", function() { + expect(mockAjax.requests.first()).toEqual(request); + }); + + it("should allow access to the queued request via index", function() { + expect(mockAjax.requests.at(0)).toEqual(request); + }); + + describe("and then another request", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + + anotherRequest = mockAjax.requests.mostRecent(); + }); + + it("should queue the next request", function() { + expect(mockAjax.requests.count()).toEqual(2); + }); + + it("should allow access to the other queued request", function() { + expect(mockAjax.requests.first()).toEqual(request); + expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); + }); + }); + + describe("mockAjax.requests.mostRecent()", function() { + + describe("when there is one request queued", function() { + it("should return the request", function() { + expect(mockAjax.requests.mostRecent()).toEqual(request); + }); + }); + + describe("when there is more than one request", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.send(); + anotherRequest = mockAjax.requests.mostRecent(); + }); + + it("should return the most recent request", function() { + expect(mockAjax.requests.mostRecent()).toEqual(anotherRequest); + }); + }); + + describe("when there are no requests", function() { + beforeEach(function() { + mockAjax.requests.reset(); + }); + + it("should return null", function() { + expect(mockAjax.requests.mostRecent()).toBeUndefined(); + }); + }); + }); + + describe("clearAjaxRequests()", function() { + beforeEach(function() { + mockAjax.requests.reset(); + }); + + it("should remove all requests", function() { + expect(mockAjax.requests.count()).toEqual(0); + expect(mockAjax.requests.mostRecent()).toBeUndefined(); + }); + }); + }); + + describe("when simulating a response with request.response", function() { + describe("and the response is Success", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = { status: 200, statusText: "OK", contentType: "text/html", responseText: "OK!" }; + request.respondWith(response); + + sharedContext.responseCallback = success; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the response is Success, but with JSON", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: "json" }; + + request.respondWith(responseObject); + + sharedContext.responseCallback = success; + sharedContext.status = responseObject.status; + sharedContext.statusText = responseObject.statusText; + sharedContext.contentType = responseObject.contentType; + sharedContext.responseText = responseObject.responseText; + sharedContext.responseType = responseObject.responseType; + + response = success.calls.mostRecent().args[2]; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + it("should return a JavaScript object for XHR2 response", function() { + var responseText = sharedContext.responseText; + expect(success.calls.mostRecent().args[0]).toEqual(responseText); + + expect(response.responseText).toEqual(responseText); + expect(response.response).toEqual({ foo: "bar" }); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the response is Success, and response is overriden", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: 'json' }; + + request.respondWith(responseObject); + + sharedContext.responseCallback = success; + sharedContext.status = responseObject.status; + sharedContext.statusText = responseObject.statusText; + sharedContext.contentType = responseObject.contentType; + sharedContext.responseText = responseObject.responseText; + sharedContext.responseType = responseObject.responseType; + + response = success.calls.mostRecent().args[2]; + }); + + it("should return the provided override for the XHR2 response", function() { + var responseText = sharedContext.responseText; + + expect(response.responseText).toEqual(responseText); + expect(response.response).toEqual({ foo: "bar" }); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("response with unique header names using an object", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = { + status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: { + 'X-Header1': 'header 1 value', + 'X-Header2': 'header 2 value', + 'X-Header3': 'header 3 value' + } + }; + request.respondWith(responseObject); + response = success.calls.mostRecent().args[2]; + }); + + it("getResponseHeader should return the each value", function() { + expect(response.getResponseHeader('X-Header1')).toBe('header 1 value'); + expect(response.getResponseHeader('X-Header2')).toBe('header 2 value'); + expect(response.getResponseHeader('X-Header3')).toBe('header 3 value'); + }); + + it("getAllResponseHeaders should return all values", function() { + expect(response.getAllResponseHeaders()).toBe([ + "X-Header1: header 1 value", + "X-Header2: header 2 value", + "X-Header3: header 3 value" + ].join("\r\n") + "\r\n"); + }); + }); + + describe("response with multiple headers of the same name using an array of objects", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com"); + client.send(); + + request = mockAjax.requests.mostRecent(); + var responseObject = { + status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: [ + { name: 'X-Header', value: 'header value 1' }, + { name: 'X-Header', value: 'header value 2' } + ] + }; + request.respondWith(responseObject); + response = success.calls.mostRecent().args[2]; + }); + + it("getResponseHeader should return all values comma separated", function() { + expect(response.getResponseHeader('X-Header')).toBe('header value 1, header value 2'); + }); + + it("getAllResponseHeaders should return all values", function() { + expect(response.getAllResponseHeaders()).toBe([ + "X-Header: header value 1", + "X-Header: header value 2" + ].join("\r\n") + "\r\n"); + }); + }); + + describe("the content type defaults to application/json", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "application/json"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = { status: 200, statusText: "OK", responseText: '{"foo": "valid JSON, dammit."}', responseType: 'json' }; + request.respondWith(response); + + sharedContext.responseCallback = success; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = "application/json"; + sharedContext.responseType = response.responseType; + sharedContext.responseText = response.responseText; + }); + + it("should call the success handler", function() { + expect(success).toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).not.toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Success(sharedContext); + }); + + describe("and the status/response code is 0", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = { status: 0, statusText: "ABORT", responseText: '{"foo": "whoops!"}' }; + request.respondWith(response); + + sharedContext.responseCallback = error; + sharedContext.status = 0; + sharedContext.statusText = response.statusText; + sharedContext.contentType = 'application/json'; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should not call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); + }); + }); + + describe("and the response is error", function() { + beforeEach(function() { + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = { status: 500, statusText: "SERVER ERROR", contentType: "text/html", responseText: "(._){" }; + request.respondWith(response); + + sharedContext.responseCallback = error; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + it("should not call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + + sharedAjaxResponseBehaviorForZepto_Failure(sharedContext); + }); + + describe('when simulating a response with request.responseTimeout', function() { + beforeEach(function() { + jasmine.clock().install(); + + client = new fakeGlobal.XMLHttpRequest(); + client.onreadystatechange = onreadystatechange; + client.open("GET", "example.com/someApi"); + client.setRequestHeader("Content-Type", "text/plain"); + client.send(); + + request = mockAjax.requests.mostRecent(); + response = { contentType: "text/html", response: "(._){response", responseText: "(._){", responseType: "text" }; + request.responseTimeout(response); + + sharedContext.responseCallback = error; + sharedContext.status = response.status; + sharedContext.statusText = response.statusText; + sharedContext.contentType = response.contentType; + sharedContext.responseText = response.responseText; + sharedContext.responseType = response.responseType; + }); + + afterEach(function() { + jasmine.clock().uninstall(); + }); + + it("should not call the success handler", function() { + expect(success).not.toHaveBeenCalled(); + }); + + it("should call the failure handler", function() { + expect(error).toHaveBeenCalled(); + }); + + it("should call the complete handler", function() { + expect(complete).toHaveBeenCalled(); + }); + }); }); function sharedAjaxResponseBehaviorForZepto_Success(context) { - describe("the success response", function () { - var xhr; - beforeEach(function() { - xhr = context.responseCallback.calls.mostRecent().args[2]; - }); + describe("the success response", function() { + var xhr; + beforeEach(function() { + xhr = context.responseCallback.calls.mostRecent().args[2]; + }); - it("should have the expected status code", function() { - expect(xhr.status).toEqual(context.status); - }); + it("should have the expected status code", function() { + expect(xhr.status).toEqual(context.status); + }); - it("should have the expected content type", function() { - expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); - }); + it("should have the expected content type", function() { + expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); + }); - it("should have the expected xhr2 response", function() { - var expected = context.response || context.responseType === 'json' ? JSON.parse(context.responseText) : context.responseText; - expect(xhr.response).toEqual(expected); - }); + it("should have the expected xhr2 response", function() { + var expected = context.response || context.responseType === 'json' ? JSON.parse(context.responseText) : context.responseText; + expect(xhr.response).toEqual(expected); + }); - it("should have the expected response text", function() { - expect(xhr.responseText).toEqual(context.responseText); - }); + it("should have the expected response text", function() { + expect(xhr.responseText).toEqual(context.responseText); + }); - it("should have the expected status text", function() { - expect(xhr.statusText).toEqual(context.statusText); - }); - }); + it("should have the expected status text", function() { + expect(xhr.statusText).toEqual(context.statusText); + }); + }); } function sharedAjaxResponseBehaviorForZepto_Failure(context) { - describe("the failure response", function () { - var xhr; - beforeEach(function() { - xhr = context.responseCallback.calls.mostRecent().args[0]; - }); + describe("the failure response", function() { + var xhr; + beforeEach(function() { + xhr = context.responseCallback.calls.mostRecent().args[0]; + }); - it("should have the expected status code", function() { - expect(xhr.status).toEqual(context.status); - }); + it("should have the expected status code", function() { + expect(xhr.status).toEqual(context.status); + }); - it("should have the expected content type", function() { - expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); - }); + it("should have the expected content type", function() { + expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType); + }); - it("should have the expected xhr2 response", function() { - var expected = context.response || xhr.responseType === 'json' ? JSON.parse(xhr.responseText) : xhr.responseText; - expect(xhr.response).toEqual(expected); - }); + it("should have the expected xhr2 response", function() { + var expected = context.response || xhr.responseType === 'json' ? JSON.parse(xhr.responseText) : xhr.responseText; + expect(xhr.response).toEqual(expected); + }); - it("should have the expected response text", function() { - expect(xhr.responseText).toEqual(context.responseText); - }); + it("should have the expected response text", function() { + expect(xhr.responseText).toEqual(context.responseText); + }); - it("should have the expected status text", function() { - expect(xhr.statusText).toEqual(context.statusText); - }); - }); + it("should have the expected status text", function() { + expect(xhr.statusText).toEqual(context.statusText); + }); + }); } describe('ParamParser', function() { - beforeEach(function() { - var Constructor = getJasmineRequireObj().AjaxParamParser(); - expect(Constructor).toEqual(jasmine.any(Function)); - this.parser = new Constructor(); - }); + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxParamParser(); + expect(Constructor).toEqual(jasmine.any(Function)); + this.parser = new Constructor(); + }); - it('has a default parser', function() { - var parser = this.parser.findParser({ contentType: function() {} }), - parsed = parser.parse('3+stooges=shemp&3+stooges=larry%20%26%20moe%20%26%20curly&some%3Dthing=else+entirely'); + it('has a default parser', function() { + var parser = this.parser.findParser({ contentType: function() { } }), + parsed = parser.parse('3+stooges=shemp&3+stooges=larry%20%26%20moe%20%26%20curly&some%3Dthing=else+entirely'); - expect(parsed).toEqual({ - '3 stooges': ['shemp', 'larry & moe & curly'], - 'some=thing': ['else entirely'] - }); - }); + expect(parsed).toEqual({ + '3 stooges': ['shemp', 'larry & moe & curly'], + 'some=thing': ['else entirely'] + }); + }); - it('should detect and parse json', function() { - var data = { - foo: 'bar', - baz: ['q', 'u', 'u', 'x'], - nested: { - object: { - containing: 'stuff' - } - } + it('should detect and parse json', function() { + var data = { + foo: 'bar', + baz: ['q', 'u', 'u', 'x'], + nested: { + object: { + containing: 'stuff' + } + } }, - parser = this.parser.findParser({ contentType: function() { return 'application/json'; } }), - parsed = parser.parse(JSON.stringify(data)); + parser = this.parser.findParser({ contentType: function() { return 'application/json'; } }), + parsed = parser.parse(JSON.stringify(data)); - expect(parsed).toEqual(data); - }); + expect(parsed).toEqual(data); + }); - it('should parse json with further qualifiers on content-type', function() { - var data = { - foo: 'bar', - baz: ['q', 'u', 'u', 'x'], - nested: { - object: { - containing: 'stuff' - } - } + it('should parse json with further qualifiers on content-type', function() { + var data = { + foo: 'bar', + baz: ['q', 'u', 'u', 'x'], + nested: { + object: { + containing: 'stuff' + } + } }, - parser = this.parser.findParser({ contentType: function() { return 'application/json; charset=utf-8'; } }), - parsed = parser.parse(JSON.stringify(data)); + parser = this.parser.findParser({ contentType: function() { return 'application/json; charset=utf-8'; } }), + parsed = parser.parse(JSON.stringify(data)); - expect(parsed).toEqual(data); - }); + expect(parsed).toEqual(data); + }); - it('should have custom parsers take precedence', function() { - var custom = { - test: jasmine.createSpy('test').and.returnValue(true), - parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') - }; + it('should have custom parsers take precedence', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(true), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; - this.parser.add(custom); + this.parser.add(custom); - var parser = this.parser.findParser({ contentType: function() {} }), - parsed = parser.parse('custom_format'); + var parser = this.parser.findParser({ contentType: function() { } }), + parsed = parser.parse('custom_format'); - expect(parsed).toEqual('parsedFormat'); - expect(custom.test).toHaveBeenCalled(); - expect(custom.parse).toHaveBeenCalledWith('custom_format'); - }); + expect(parsed).toEqual('parsedFormat'); + expect(custom.test).toHaveBeenCalled(); + expect(custom.parse).toHaveBeenCalledWith('custom_format'); + }); - it('should skip custom parsers that do not match', function() { - var custom = { - test: jasmine.createSpy('test').and.returnValue(false), - parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') - }; + it('should skip custom parsers that do not match', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(false), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; - this.parser.add(custom); + this.parser.add(custom); - var parser = this.parser.findParser({ contentType: function() {} }), - parsed = parser.parse('custom_format'); + var parser = this.parser.findParser({ contentType: function() { } }), + parsed = parser.parse('custom_format'); - expect(parsed).toEqual({ custom_format: [ 'undefined' ] }); - expect(custom.test).toHaveBeenCalled(); - expect(custom.parse).not.toHaveBeenCalled(); - }); + expect(parsed).toEqual({ custom_format: ['undefined'] }); + expect(custom.test).toHaveBeenCalled(); + expect(custom.parse).not.toHaveBeenCalled(); + }); - it('removes custom parsers when reset', function() { - var custom = { - test: jasmine.createSpy('test').and.returnValue(true), - parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') - }; + it('removes custom parsers when reset', function() { + var custom = { + test: jasmine.createSpy('test').and.returnValue(true), + parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') + }; - this.parser.add(custom); + this.parser.add(custom); - var parser = this.parser.findParser({ contentType: function() {} }), - parsed = parser.parse('custom_format'); + var parser = this.parser.findParser({ contentType: function() { } }), + parsed = parser.parse('custom_format'); - expect(parsed).toEqual('parsedFormat'); + expect(parsed).toEqual('parsedFormat'); - custom.test['calls'].reset(); - custom.parse['calls'].reset(); + custom.test['calls'].reset(); + custom.parse['calls'].reset(); - this.parser.reset(); + this.parser.reset(); - parser = this.parser.findParser({ contentType: function() {} }); - parsed = parser.parse('custom_format'); + parser = this.parser.findParser({ contentType: function() { } }); + parsed = parser.parse('custom_format'); - expect(parsed).toEqual({ custom_format: [ 'undefined' ] }); - expect(custom.test).not.toHaveBeenCalled(); - expect(custom.parse).not.toHaveBeenCalled(); - }); + expect(parsed).toEqual({ custom_format: ['undefined'] }); + expect(custom.test).not.toHaveBeenCalled(); + expect(custom.parse).not.toHaveBeenCalled(); + }); }); describe('RequestStub', function() { - beforeEach(function() { - this.RequestStub = getJasmineRequireObj().AjaxRequestStub(); + beforeEach(function() { + this.RequestStub = getJasmineRequireObj().AjaxRequestStub(); - jasmine.addMatchers({ - toMatchRequest: function() { - return { - compare: function(actual) { - return { - pass: actual.matches.apply(actual, Array.prototype.slice.call(arguments, 1)) - }; - } - }; - } - }); - }); + jasmine.addMatchers({ + toMatchRequest: function(a, b) { + return { + compare: function(actual): jasmine.CustomMatcherResult { + return { + message: '', + pass: actual.matches.apply(actual, Array.prototype.slice.call(arguments, 1)) + }; + } + }; + } + }); + }); - it('matches just by exact url', function() { - var stub = new this.RequestStub('www.example.com/foo'); + it('matches just by exact url', function() { + var stub = new this.RequestStub('www.example.com/foo'); - expect(stub)['toMatchRequest']('www.example.com/foo'); - }); + expect(stub)['toMatchRequest']('www.example.com/foo'); + }); - it('does not match if the url differs', function() { - var stub = new this.RequestStub('www.example.com/foo'); + it('does not match if the url differs', function() { + var stub = new this.RequestStub('www.example.com/foo'); - expect(stub).not['toMatchRequest']('www.example.com/bar'); - }); + expect(stub).not['toMatchRequest']('www.example.com/bar'); + }); - it('matches unordered query params', function() { - var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); + it('matches unordered query params', function() { + var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); - expect(stub)['toMatchRequest']('www.example.com?baz=quux&foo=bar'); - }); + expect(stub)['toMatchRequest']('www.example.com?baz=quux&foo=bar'); + }); - it('requires all specified query params to be there', function() { - var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); + it('requires all specified query params to be there', function() { + var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); - expect(stub).not['toMatchRequest']('www.example.com?foo=bar'); - }); + expect(stub).not['toMatchRequest']('www.example.com?foo=bar'); + }); - it('can match the url with a RegExp', function() { - var stub = new this.RequestStub(/ba[rz]/); + it('can match the url with a RegExp', function() { + var stub = new this.RequestStub(/ba[rz]/); - expect(stub)['toMatchRequest']('bar'); - expect(stub)['toMatchRequest']('baz'); - expect(stub).not['toMatchRequest']('foo'); - }); + expect(stub)['toMatchRequest']('bar'); + expect(stub)['toMatchRequest']('baz'); + expect(stub).not['toMatchRequest']('foo'); + }); - it('requires the method to match if supplied', function() { - var stub = new this.RequestStub('www.example.com/foo', null, 'POST'); + it('requires the method to match if supplied', function() { + var stub = new this.RequestStub('www.example.com/foo', null, 'POST'); - expect(stub).not['toMatchRequest']('www.example.com/foo'); - expect(stub).not['toMatchRequest']('www.example.com/foo', null, 'GET'); - expect(stub)['toMatchRequest']('www.example.com/foo', null, 'POST'); - }); + expect(stub).not['toMatchRequest']('www.example.com/foo'); + expect(stub).not['toMatchRequest']('www.example.com/foo', null, 'GET'); + expect(stub)['toMatchRequest']('www.example.com/foo', null, 'POST'); + }); - it('requires the data submitted to match if supplied', function() { - var stub = new this.RequestStub('/foo', 'foo=bar&baz=quux'); + it('requires the data submitted to match if supplied', function() { + var stub = new this.RequestStub('/foo', 'foo=bar&baz=quux'); - expect(stub)['toMatchRequest']('/foo', 'baz=quux&foo=bar'); - expect(stub).not['toMatchRequest']('/foo', 'foo=bar'); - }); + expect(stub)['toMatchRequest']('/foo', 'baz=quux&foo=bar'); + expect(stub).not['toMatchRequest']('/foo', 'foo=bar'); + }); }); describe('RequestTracker', function() { - beforeEach(function() { - var Constructor = getJasmineRequireObj().AjaxRequestTracker(); - this.tracker = new Constructor(); - }); + beforeEach(function() { + var Constructor = getJasmineRequireObj().AjaxRequestTracker(); + this.tracker = new Constructor(); + }); - it('tracks the number of times ajax requests are made', function() { - expect(this.tracker.count()).toBe(0); + it('tracks the number of times ajax requests are made', function() { + expect(this.tracker.count()).toBe(0); - this.tracker.track(); + this.tracker.track(); - expect(this.tracker.count()).toBe(1); - }); + expect(this.tracker.count()).toBe(1); + }); - it('simplifies access to the last (most recent) request', function() { - this.tracker.track(); - this.tracker.track('request'); + it('simplifies access to the last (most recent) request', function() { + this.tracker.track(); + this.tracker.track('request'); - expect(this.tracker.mostRecent()).toEqual('request'); - }); + expect(this.tracker.mostRecent()).toEqual('request'); + }); - it('returns a useful falsy value when there is no last (most recent) request', function() { - expect(this.tracker.mostRecent()).toBeFalsy(); - }); + it('returns a useful falsy value when there is no last (most recent) request', function() { + expect(this.tracker.mostRecent()).toBeFalsy(); + }); - it('simplifies access to the first (oldest) request', function() { - this.tracker.track('request'); - this.tracker.track(); + it('simplifies access to the first (oldest) request', function() { + this.tracker.track('request'); + this.tracker.track(); - expect(this.tracker.first()).toEqual('request'); - }); + expect(this.tracker.first()).toEqual('request'); + }); - it('returns a useful falsy value when there is no first (oldest) request', function() { - expect(this.tracker.first()).toBeFalsy(); - }); + it('returns a useful falsy value when there is no first (oldest) request', function() { + expect(this.tracker.first()).toBeFalsy(); + }); - it('allows the requests list to be reset', function() { - this.tracker.track(); - this.tracker.track(); + it('allows the requests list to be reset', function() { + this.tracker.track(); + this.tracker.track(); - expect(this.tracker.count()).toBe(2); + expect(this.tracker.count()).toBe(2); - this.tracker.reset(); + this.tracker.reset(); - expect(this.tracker.count()).toBe(0); - }); + expect(this.tracker.count()).toBe(0); + }); - it('allows retrieval of an arbitrary request by index', function() { - this.tracker.track('1'); - this.tracker.track('2'); - this.tracker.track('3'); + it('allows retrieval of an arbitrary request by index', function() { + this.tracker.track('1'); + this.tracker.track('2'); + this.tracker.track('3'); - expect(this.tracker.at(1)).toEqual('2'); - }); + expect(this.tracker.at(1)).toEqual('2'); + }); - it('allows retrieval of all requests that are for a given url', function() { - this.tracker.track({ url: 'foo' }); - this.tracker.track({ url: 'bar' }); + it('allows retrieval of all requests that are for a given url', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); - expect(this.tracker.filter('bar')).toEqual([{ url: 'bar' }]); - }); + expect(this.tracker.filter('bar')).toEqual([{ url: 'bar' }]); + }); - it('allows retrieval of all requests that match a given RegExp', function() { - this.tracker.track({ url: 'foo' }); - this.tracker.track({ url: 'bar' }); - this.tracker.track({ url: 'baz' }); + it('allows retrieval of all requests that match a given RegExp', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); + this.tracker.track({ url: 'baz' }); - expect(this.tracker.filter(/ba[rz]/)).toEqual([{ url: 'bar' }, { url: 'baz' }]); - }); + expect(this.tracker.filter(/ba[rz]/)).toEqual([{ url: 'bar' }, { url: 'baz' }]); + }); - it('allows retrieval of all requests that match based on a function', function() { - this.tracker.track({ url: 'foo' }); - this.tracker.track({ url: 'bar' }); - this.tracker.track({ url: 'baz' }); + it('allows retrieval of all requests that match based on a function', function() { + this.tracker.track({ url: 'foo' }); + this.tracker.track({ url: 'bar' }); + this.tracker.track({ url: 'baz' }); - var func = function(request) { - return request.url === 'bar'; - }; + var func = function(request) { + return request.url === 'bar'; + }; - expect(this.tracker.filter(func)).toEqual([{ url: 'bar' }]); - }); + expect(this.tracker.filter(func)).toEqual([{ url: 'bar' }]); + }); - it('filters to nothing if no requests have been tracked', function() { - expect(this.tracker.filter('foo')).toEqual([]); - }); + it('filters to nothing if no requests have been tracked', function() { + expect(this.tracker.filter('foo')).toEqual([]); + }); }); describe('EventBus', function() { - beforeEach(function() { - this.bus = getJasmineRequireObj().AjaxEventBus()(); - }); + beforeEach(function() { + this.bus = getJasmineRequireObj().AjaxEventBus()(); + }); - it('calls an event listener', function() { - var callback = jasmine.createSpy('callback'); + it('calls an event listener', function() { + var callback = jasmine.createSpy('callback'); - this.bus.addEventListener('foo', callback); - this.bus.trigger('foo'); + this.bus.addEventListener('foo', callback); + this.bus.trigger('foo'); - expect(callback).toHaveBeenCalled(); - }); + expect(callback).toHaveBeenCalled(); + }); - it('calls an event listener with additional arguments', function() { - var callback = jasmine.createSpy('callback'); + it('calls an event listener with additional arguments', function() { + var callback = jasmine.createSpy('callback'); - this.bus.addEventListener('foo', callback); - this.bus.trigger('foo', 'bar'); + this.bus.addEventListener('foo', callback); + this.bus.trigger('foo', 'bar'); - expect(callback).toHaveBeenCalledWith('bar'); - }); + expect(callback).toHaveBeenCalledWith('bar'); + }); - it('only triggers callbacks for the specified event', function() { - var fooCallback = jasmine.createSpy('foo'), - barCallback = jasmine.createSpy('bar'); + it('only triggers callbacks for the specified event', function() { + var fooCallback = jasmine.createSpy('foo'), + barCallback = jasmine.createSpy('bar'); - this.bus.addEventListener('foo', fooCallback); - this.bus.addEventListener('bar', barCallback); + this.bus.addEventListener('foo', fooCallback); + this.bus.addEventListener('bar', barCallback); - this.bus.trigger('foo'); + this.bus.trigger('foo'); - expect(fooCallback).toHaveBeenCalled(); - expect(barCallback).not.toHaveBeenCalled(); - }); + expect(fooCallback).toHaveBeenCalled(); + expect(barCallback).not.toHaveBeenCalled(); + }); - it('calls all the callbacks for the specified event', function() { - var callback1 = jasmine.createSpy('callback'); - var callback2 = jasmine.createSpy('otherCallback'); + it('calls all the callbacks for the specified event', function() { + var callback1 = jasmine.createSpy('callback'); + var callback2 = jasmine.createSpy('otherCallback'); - this.bus.addEventListener('foo', callback1); - this.bus.addEventListener('foo', callback2); + this.bus.addEventListener('foo', callback1); + this.bus.addEventListener('foo', callback2); - this.bus.trigger('foo'); + this.bus.trigger('foo'); - expect(callback1).toHaveBeenCalled(); - expect(callback2).toHaveBeenCalled(); - }); + expect(callback1).toHaveBeenCalled(); + expect(callback2).toHaveBeenCalled(); + }); - it('works if there are no callbacks for the event', function() { - var bus = this.bus; - expect(function() { - bus.trigger('notActuallyThere'); - }).not.toThrow(); - }); + it('works if there are no callbacks for the event', function() { + var bus = this.bus; + expect(function() { + bus.trigger('notActuallyThere'); + }).not.toThrow(); + }); - it('does not call listeners that have been removed', function() { - var callback = jasmine.createSpy('callback'); + it('does not call listeners that have been removed', function() { + var callback = jasmine.createSpy('callback'); - this.bus.addEventListener('foo', callback); - this.bus.removeEventListener('foo', callback); - this.bus.trigger('foo'); + this.bus.addEventListener('foo', callback); + this.bus.removeEventListener('foo', callback); + this.bus.trigger('foo'); - expect(callback).not.toHaveBeenCalled(); - }); + expect(callback).not.toHaveBeenCalled(); + }); - it('only removes the specified callback', function() { - var callback1 = jasmine.createSpy('callback'); - var callback2 = jasmine.createSpy('otherCallback'); + it('only removes the specified callback', function() { + var callback1 = jasmine.createSpy('callback'); + var callback2 = jasmine.createSpy('otherCallback'); - this.bus.addEventListener('foo', callback1); - this.bus.addEventListener('foo', callback2); - this.bus.removeEventListener('foo', callback2); + this.bus.addEventListener('foo', callback1); + this.bus.addEventListener('foo', callback2); + this.bus.removeEventListener('foo', callback2); - this.bus.trigger('foo'); + this.bus.trigger('foo'); - expect(callback1).toHaveBeenCalled(); - expect(callback2).not.toHaveBeenCalled(); - }); + expect(callback1).toHaveBeenCalled(); + expect(callback2).not.toHaveBeenCalled(); + }); }); describe("Webmock style mocking", function() { - var successSpy, errorSpy, response, fakeGlobal, mockAjax; + var successSpy, errorSpy, response, fakeGlobal, mockAjax; - var sendRequest = function(fakeGlobal, url?, method?) { - url = url || "http://example.com/someApi"; - method = method || 'GET'; - var xhr = new fakeGlobal.XMLHttpRequest(); - xhr.onreadystatechange = function(args) { - if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE - response = this; - successSpy(); - } - }; + var sendRequest = function(fakeGlobal, url?, method?) { + url = url || "http://example.com/someApi"; + method = method || 'GET'; + var xhr = new fakeGlobal.XMLHttpRequest(); + xhr.onreadystatechange = function(args) { + if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE + response = this; + successSpy(); + } + }; - xhr.open(method, url); - xhr.send(); - }; + xhr.open(method, url); + xhr.send(); + }; - beforeEach(function() { - successSpy = jasmine.createSpy('success'); - fakeGlobal = {XMLHttpRequest: jasmine.createSpy('realXMLHttpRequest')}; - mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); + beforeEach(function() { + successSpy = jasmine.createSpy('success'); + fakeGlobal = { XMLHttpRequest: jasmine.createSpy('realXMLHttpRequest') }; + mockAjax = new MockAjax(fakeGlobal); + mockAjax.install(); - mockAjax.stubRequest("http://example.com/someApi").andReturn({responseText: "hi!"}); - }); + mockAjax.stubRequest("http://example.com/someApi").andReturn({ responseText: "hi!" }); + }); - it("allows a url to be setup as a stub", function() { - sendRequest(fakeGlobal); - expect(successSpy).toHaveBeenCalled(); - }); + it("allows a url to be setup as a stub", function() { + sendRequest(fakeGlobal); + expect(successSpy).toHaveBeenCalled(); + }); - it("should allow you to clear all the ajax stubs", function() { - mockAjax.stubs.reset(); - sendRequest(fakeGlobal); - expect(successSpy).not.toHaveBeenCalled(); - }); + it("should allow you to clear all the ajax stubs", function() { + mockAjax.stubs.reset(); + sendRequest(fakeGlobal); + expect(successSpy).not.toHaveBeenCalled(); + }); - it("should set the contentType", function() { - sendRequest(fakeGlobal); - expect(response.getResponseHeader('Content-Type')).toEqual('application/json'); - }); + it("should set the contentType", function() { + sendRequest(fakeGlobal); + expect(response.getResponseHeader('Content-Type')).toEqual('application/json'); + }); - it("should set the responseText", function() { - sendRequest(fakeGlobal); - expect(response.responseText).toEqual('hi!'); - }); + it("should set the responseText", function() { + sendRequest(fakeGlobal); + expect(response.responseText).toEqual('hi!'); + }); - it("should default the status to 200", function() { - sendRequest(fakeGlobal); - expect(response.status).toEqual(200); - }); + it("should default the status to 200", function() { + sendRequest(fakeGlobal); + expect(response.status).toEqual(200); + }); - it("should set the responseHeaders", function() { - mockAjax.stubRequest("http://example.com/someApi").andReturn({ - responseText: "hi!", - responseHeaders: [{name: "X-Custom", value: "header value"}] - }); - sendRequest(fakeGlobal); - expect(response.getResponseHeader('X-Custom')).toEqual('header value'); - }); + it("should set the responseHeaders", function() { + mockAjax.stubRequest("http://example.com/someApi").andReturn({ + responseText: "hi!", + responseHeaders: [{ name: "X-Custom", value: "header value" }] + }); + sendRequest(fakeGlobal); + expect(response.getResponseHeader('X-Custom')).toEqual('header value'); + }); - describe("with another stub for the same url", function() { - beforeEach(function() { - mockAjax.stubRequest("http://example.com/someApi").andReturn({responseText: "no", status: 403}); - sendRequest(fakeGlobal); - }); + describe("with another stub for the same url", function() { + beforeEach(function() { + mockAjax.stubRequest("http://example.com/someApi").andReturn({ responseText: "no", status: 403 }); + sendRequest(fakeGlobal); + }); - it("should set the status", function() { - expect(response.status).toEqual(403); - }); + it("should set the status", function() { + expect(response.status).toEqual(403); + }); - it("should allow the latest stub to win", function() { - expect(response.responseText).toEqual('no'); - }); - }); + it("should allow the latest stub to win", function() { + expect(response.responseText).toEqual('no'); + }); + }); }); describe("withMock", function() { - var sendRequest = function(fakeGlobal) { - var xhr = new fakeGlobal.XMLHttpRequest(); + var sendRequest = function(fakeGlobal) { + var xhr = new fakeGlobal.XMLHttpRequest(); - xhr.open("GET", "http://example.com/someApi"); - xhr.send(); - }; + xhr.open("GET", "http://example.com/someApi"); + xhr.send(); + }; - it("installs the mock for passed in function, and uninstalls when complete", function() { - var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), - xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), - fakeGlobal = {XMLHttpRequest: xmlHttpRequestCtor}, - mockAjax = new MockAjax(fakeGlobal); + it("installs the mock for passed in function, and uninstalls when complete", function() { + var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), + xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), + fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor }, + mockAjax = new MockAjax(fakeGlobal); - mockAjax.withMock(function() { - sendRequest(fakeGlobal); - expect(xmlHttpRequest.open).not.toHaveBeenCalled(); - }); + mockAjax.withMock(function() { + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).not.toHaveBeenCalled(); + }); - sendRequest(fakeGlobal); - expect(xmlHttpRequest.open).toHaveBeenCalled(); - }); + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).toHaveBeenCalled(); + }); - it("properly uninstalls when the passed in function throws", function() { - var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), - xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), - fakeGlobal = {XMLHttpRequest: xmlHttpRequestCtor}, - mockAjax = new MockAjax(fakeGlobal); + it("properly uninstalls when the passed in function throws", function() { + var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), + xmlHttpRequestCtor = spyOn(window, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), + fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor }, + mockAjax = new MockAjax(fakeGlobal); - expect(function() { - mockAjax.withMock(function() { - throw "error"; - }); - }).toThrow("error"); + expect(function() { + mockAjax.withMock(function() { + throw "error"; + }); + }).toThrow("error"); - sendRequest(fakeGlobal); - expect(xmlHttpRequest.open).toHaveBeenCalled(); - }); + sendRequest(fakeGlobal); + expect(xmlHttpRequest.open).toHaveBeenCalled(); + }); }); describe("mockAjax", function() { - it("throws an error if installed multiple times", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("throws an error if installed multiple times", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - function doubleInstall() { - mockAjax.install(); - mockAjax.install(); - } + function doubleInstall() { + mockAjax.install(); + mockAjax.install(); + } - expect(doubleInstall).toThrow(); - }); + expect(doubleInstall).toThrow(); + }); - it("does not throw an error if uninstalled between installs", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("does not throw an error if uninstalled between installs", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - function sequentialInstalls() { - mockAjax.install(); - mockAjax.uninstall(); - mockAjax.install(); - } + function sequentialInstalls() { + mockAjax.install(); + mockAjax.uninstall(); + mockAjax.install(); + } - expect(sequentialInstalls).not.toThrow(); - }); + expect(sequentialInstalls).not.toThrow(); + }); - it("does not replace XMLHttpRequest until it is installed", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("does not replace XMLHttpRequest until it is installed", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - fakeGlobal.XMLHttpRequest('foo'); - expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); - fakeXmlHttpRequest.calls.reset(); + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); + fakeXmlHttpRequest.calls.reset(); - mockAjax.install(); - fakeGlobal.XMLHttpRequest('foo'); - expect(fakeXmlHttpRequest).not.toHaveBeenCalled(); - }); + mockAjax.install(); + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).not.toHaveBeenCalled(); + }); - it("replaces the global XMLHttpRequest on uninstall", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("replaces the global XMLHttpRequest on uninstall", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); - mockAjax.uninstall(); + mockAjax.install(); + mockAjax.uninstall(); - fakeGlobal.XMLHttpRequest('foo'); - expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); - }); + fakeGlobal.XMLHttpRequest('foo'); + expect(fakeXmlHttpRequest).toHaveBeenCalledWith('foo'); + }); - it("clears requests and stubs upon uninstall", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("clears requests and stubs upon uninstall", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); + mockAjax.install(); - mockAjax.requests.track({url: '/testurl'}); - mockAjax.stubRequest('/bobcat'); + mockAjax.requests.track({ url: '/testurl' }); + mockAjax.stubRequest('/bobcat'); - expect(mockAjax.requests.count()).toEqual(1); - expect(mockAjax.stubs.findStub('/bobcat')).toBeDefined(); + expect(mockAjax.requests.count()).toEqual(1); + expect(mockAjax.stubs.findStub('/bobcat')).toBeDefined(); - mockAjax.uninstall(); + mockAjax.uninstall(); - expect(mockAjax.requests.count()).toEqual(0); - expect(mockAjax.stubs.findStub('/bobcat')).not.toBeDefined(); - }); + expect(mockAjax.requests.count()).toEqual(0); + expect(mockAjax.stubs.findStub('/bobcat')).not.toBeDefined(); + }); - it("allows the httpRequest to be retrieved", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("allows the httpRequest to be retrieved", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); - var request = new (fakeGlobal.XMLHttpRequest)(); + mockAjax.install(); + var request = new (fakeGlobal.XMLHttpRequest)(); - expect(mockAjax.requests.count()).toBe(1); - expect(mockAjax.requests.mostRecent()).toBe(request); - }); + expect(mockAjax.requests.count()).toBe(1); + expect(mockAjax.requests.mostRecent()).toBe(request); + }); - it("allows the httpRequests to be cleared", function() { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), - fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, - mockAjax = new MockAjax(fakeGlobal); + it("allows the httpRequests to be cleared", function() { + var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, + mockAjax = new MockAjax(fakeGlobal); - mockAjax.install(); - var request = new (fakeGlobal.XMLHttpRequest)(); + mockAjax.install(); + var request = new (fakeGlobal.XMLHttpRequest)(); - expect(mockAjax.requests.mostRecent()).toBe(request); - mockAjax.requests.reset(); - expect(mockAjax.requests.count()).toBe(0); - }); + expect(mockAjax.requests.mostRecent()).toBe(request); + mockAjax.requests.reset(); + expect(mockAjax.requests.count()).toBe(0); + }); }); diff --git a/jasmine-ajax/jasmine-ajax.d.ts b/jasmine-ajax/jasmine-ajax.d.ts index 70ca2f57c..657ec3374 100644 --- a/jasmine-ajax/jasmine-ajax.d.ts +++ b/jasmine-ajax/jasmine-ajax.d.ts @@ -4,17 +4,22 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped interface JasmineAjaxResponse { - status?: string; + status?: number; statusText?: string; responseText?: string; response?: string; - responseType?: string; contentType?: string; responseHeaders?: { [key: string]: string }; } -interface JasmineAjaxRequest { +interface JasmineAjaxRequest extends XMLHttpRequest { url: string; + method: string; + username: string; + password: string; + requestHeaders: { [key: string]: string }; + overriddenMimeType: string; + respondWith(response: JasmineAjaxResponse): void; } From 0c58c5a9ebf79e0585b3fb0aec7dc109889d154a Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 20 May 2015 20:35:41 +0200 Subject: [PATCH 249/534] added type definition file for PapaParse --- papaparse/papaparse-tests.ts | 55 +++++++++++++ papaparse/papaparse.d.ts | 144 +++++++++++++++++++++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 papaparse/papaparse-tests.ts create mode 100644 papaparse/papaparse.d.ts diff --git a/papaparse/papaparse-tests.ts b/papaparse/papaparse-tests.ts new file mode 100644 index 000000000..14cc40bb3 --- /dev/null +++ b/papaparse/papaparse-tests.ts @@ -0,0 +1,55 @@ +/// + +import Papa = require("papaparse"); + +/** + * Parsing + */ +var res = Papa.parse("3,3,3"); + +res.errors[0].code; + +Papa.parse("3,3,3", { + delimiter: ';', + comments: false, + + step: function(results, p) { + p.abort(); + results.data.length; + } +}); + +var file = new File(); + +Papa.parse(file, { + complete: function(a, b) { + a.meta.fields; + b.name; + } +}); + +/** + * Unparsing + */ +Papa.unparse([{a: 1, b: 1, c: 1}]); +Papa.unparse([[1, 2, 3], [4, 5, 6]]); +Papa.unparse({ + fields: ["3"], + data: [] +}); + + + +/** + * Properties + */ +Papa.SCRIPT_PATH; +Papa.LocalChunkSize; + +/** + * Parser + */ +var parser = new Papa.Parser({}) +parser.getCharIndex(); +parser.abort(); +parser.parse("", 0, false); \ No newline at end of file diff --git a/papaparse/papaparse.d.ts b/papaparse/papaparse.d.ts new file mode 100644 index 000000000..028dd2aab --- /dev/null +++ b/papaparse/papaparse.d.ts @@ -0,0 +1,144 @@ +// Type definitions for PapaParse v4.1 +// Project: https://github.com/mholt/PapaParse +// Definitions by: Pedro Flemming +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module PapaParse { + interface Static { + /** + * Parse a csv string or a csv file + */ + parse(csvString: string, config?: ParseConfig): ParseResult; + + parse(file: File, config?: ParseConfig): ParseResult; + + /** + * Unparses javascript data objects and returns a csv string + */ + unparse(data: Array, config?: UnparseConfig): string; + + unparse(data: Array>, config?: UnparseConfig): string; + + unparse(data: UnparseObject, config?: UnparseConfig): string; + + /** + * Read-Only Properties + */ + // An array of characters that are not allowed as delimiters. + BAD_DELIMETERS: Array; + + // The true delimiter. Invisible. ASCII code 30. Should be doing the job we strangely rely upon commas and tabs for. + RECORD_SEP: string; + + // Also sometimes used as a delimiting character. ASCII code 31. + UNIT_SEP: string; + + // Whether or not the browser supports HTML5 Web Workers. If false, worker: true will have no effect. + WORKERS_SUPPORTED: boolean; + + // The relative path to Papa Parse. This is automatically detected when Papa Parse is loaded synchronously. + SCRIPT_PATH: string; + + /** + * Configurable Properties + */ + // The size in bytes of each file chunk. Used when streaming files obtained from the DOM that exist on the local computer. Default 10 MB. + LocalChunkSize: string; + + // Same as LocalChunkSize, but for downloading files from remote locations. Default 5 MB. + RemoteChunkSize: string; + + // The delimiter used when it is left unspecified and cannot be detected automatically. Default is comma. + DefaultDelimiter: string; + + /** + * On Papa there are actually more classes exposed + * but none of them are officially documented + * Since we can interact with the Parser from one of the callbacks + * I have included the API for this class. + */ + Parser: ParserConstructor; + } + + interface ParseConfig { + delimiter?: string; // default: "" + newline?: string; // default: "" + header?: boolean; // default: false + dynamicTyping?: boolean; // default: false + preview?: number; // default: 0 + encoding?: string; // default: "" + worker?: boolean; // default: false + comments?: boolean; // default: false + download?: boolean; // default: false + skipEmptyLines?: boolean; // default: false + fastMode?: boolean; // default: undefined + + // Callbacks + step?(results: ParseResult, parser: Parser): void; // default: undefined + complete?(results: ParseResult, file?: File): void; // default: undefined + error?(error: ParseError, file?: File): void; // default: undefined + chunk?(results: ParseResult, parser: Parser): void; // default: undefined + beforeFirstChunk?(chunk: string): string|void; // default: undefined + } + + interface UnparseConfig { + quotes: boolean; // default: false + delimiter: string; // default: "," + newline: string; // default: "\r\n" + } + + interface UnparseObject { + fields: Array; + data: string | Array; + } + + interface ParseError { + type: string; // A generalization of the error + code: string; // Standardized error code + message: string; // Human-readable details + row: number; // Row index of parsed data where error is + } + + interface ParseMeta { + delimiter: string; // Delimiter used + linebreak: string; // Line break sequence used + aborted: boolean; // Whether process was aborted + fields: Array; // Array of field names + truncated: boolean; // Whether preview consumed all input + } + + /** + * @interface ParseResult + * + * data: is an array of rows. If header is false, rows are arrays; otherwise they are objects of data keyed by the field name. + * errors: is an array of errors + * meta: contains extra information about the parse, such as delimiter used, the newline sequence, whether the process was aborted, etc. Properties in this object are not guaranteed to exist in all situations + */ + interface ParseResult { + data: Array; + errors: Array; + meta: ParseMeta; + } + + /** + * Parser + */ + interface ParserConstructor { new(config: ParseConfig): Parser; } + interface Parser { + // Parses the input + parse(input: string, baseIndex: number, ignoreLastRow: boolean): any; + + // Sets the abort flag + abort(): void; + + // Gets the cursor position + getCharIndex(): number; + } +} + +declare var Papa: PapaParse.Static; + +declare module "papaparse" { + var Papa: PapaParse.Static; + export = Papa; +} From 8bc91d57f68517ccea6c50b30f4a3e8ffe2bd97b Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Wed, 20 May 2015 17:00:13 -0700 Subject: [PATCH 250/534] Adding autoprefixer-core This is actually more useful than autoprefixer since this is the programmatic interface --- autoprefixer-core/autoprefixer-core-tests.ts | 9 ++++ autoprefixer-core/autoprefixer-core.d.ts | 44 ++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 autoprefixer-core/autoprefixer-core-tests.ts create mode 100644 autoprefixer-core/autoprefixer-core.d.ts diff --git a/autoprefixer-core/autoprefixer-core-tests.ts b/autoprefixer-core/autoprefixer-core-tests.ts new file mode 100644 index 000000000..9ff4e7695 --- /dev/null +++ b/autoprefixer-core/autoprefixer-core-tests.ts @@ -0,0 +1,9 @@ +/// +import autoprefixer = require("autoprefixer-core"); + +var css: string; + +var prefixed = autoprefixer.process(css).css; + +var processor = autoprefixer({ browsers: ['> 1%', 'IE 7'], cascade: false }); +console.log(processor.info()); diff --git a/autoprefixer-core/autoprefixer-core.d.ts b/autoprefixer-core/autoprefixer-core.d.ts new file mode 100644 index 000000000..905447acf --- /dev/null +++ b/autoprefixer-core/autoprefixer-core.d.ts @@ -0,0 +1,44 @@ +// Type definitions for Autoprefixer Core 5.1.11 +// Project: https://github.com/postcss/autoprefixer-core +// Definitions by: Asana +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "autoprefixer-core" { + interface Config { + browsers?: string[]; + cascade?: boolean; + remove?: boolean; + } + + interface Options { + from?: string; + to?: string; + safe?: boolean; + map?: { + inline?: boolean; + prev?: string | Object; + } + } + + interface Result { + css: string; + map: string; + opts: Options; + } + + interface Processor { + postcss: any; + info(): string; + process(css: string, opts?: Options): Result; + } + + interface Exports { + (config: Config): Processor; + postcss: any; + info(): string; + process(css: string, opts?: Options): Result; + } + + var exports: Exports; + export = exports; +} From cfc0247741abbad9d12472cac7ec4a6e97f1f474 Mon Sep 17 00:00:00 2001 From: Phips Peter Date: Wed, 20 May 2015 17:12:21 -0700 Subject: [PATCH 251/534] Adding type definitions for node-sass --- node-sass/node-sass-tests.ts | 71 ++++++++++++++++++++++++++++++++++++ node-sass/node-sass.d.ts | 56 ++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 node-sass/node-sass-tests.ts create mode 100644 node-sass/node-sass.d.ts diff --git a/node-sass/node-sass-tests.ts b/node-sass/node-sass-tests.ts new file mode 100644 index 000000000..a7c1477cb --- /dev/null +++ b/node-sass/node-sass-tests.ts @@ -0,0 +1,71 @@ +/// +import sass = require('node-sass'); +sass.render({ + file: '/path/to/myFile.scss', + data: 'body{background:blue; a{color:black;}}', + importer: function(url, prev, done) { + // url is the path in import as is, which libsass encountered. + // prev is the previously resolved path. + // done is an optional callback, either consume it or return value synchronously. + // this.options contains this options hash, this.callback contains the node-style callback + someAsyncFunction(url, prev, function(result) { + done({ + file: result.path, // only one of them is required, see section Sepcial Behaviours. + contents: result.data + }); + }); + // OR + var result = someSyncFunction(url, prev); + return { file: result.path, contents: result.data }; + }, + includePaths: ['lib/', 'mod/'], + outputStyle: 'compressed' +}, function(error, result) { // node-style callback from v3.0.0 onwards + if (error) { + console.log(error.status); // used to be "code" in v2x and below + console.log(error.column); + console.log(error.message); + console.log(error.line); + } + else { + console.log(result.css.toString()); + + console.log(result.stats); + + console.log(result.map.toString()); + // or better + console.log(JSON.stringify(result.map)); // note, JSON.stringify accepts Buffer too + } +}); +// OR +var result = sass.renderSync({ + file: '/path/to/file.scss', + data: 'body{background:blue; a{color:black;}}', + outputStyle: 'compressed', + outFile: '/to/my/output.css', + sourceMap: true, // or an absolute or relative (to outFile) path + importer: function(url, prev, done) { + // url is the path in import as is, which libsass encountered. + // prev is the previously resolved path. + // done is an optional callback, either consume it or return value synchronously. + // this.options contains this options hash + someAsyncFunction(url, prev, function(result) { + done({ + file: result.path, // only one of them is required, see section Sepcial Behaviours. + contents: result.data + }); + }); + // OR + var result = someSyncFunction(url, prev); + return { file: result.path, contents: result.data }; + }, +}); + +console.log(result.css); +console.log(result.map); +console.log(result.stats); + +function someAsyncFunction(url: string, prev: string, callback: (result: { path: string; data: string }) => void): void {} +function someSyncFunction(url: string, prev: string): { path: string; data: string} { + return null; +} diff --git a/node-sass/node-sass.d.ts b/node-sass/node-sass.d.ts new file mode 100644 index 000000000..09ea71d4e --- /dev/null +++ b/node-sass/node-sass.d.ts @@ -0,0 +1,56 @@ +// Type definitions for Node Sass +// Project: https://github.com/sass/node-sass +// Definitions by: Asana +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "node-sass" { + interface Importer { + (url: string, prev: string, done: (data: { file: string; contents: string; }) => void): void; + } + + interface Options { + file?: string; + data?: string; + importer?: Importer | Importer[]; + functions?: { [key: string]: Function }; + includePaths?: string[]; + indentedSyntax?: boolean; + indentType?: string; + indentWidth?: number; + linefeed?: string; + omitSourceMapUrl?: boolean; + outFile?: string; + outputStyle?: string; + precision?: number; + sourceComments?: boolean; + sourceMap?: boolean | string; + sourceMapContents?: boolean; + sourceMapEmbed?: boolean; + sourceMapRoot?: boolean; + } + + interface SassError extends Error { + message: string; + line: number; + column: number; + status: number; + file: string; + } + + interface Result { + css: Buffer; + map: Buffer; + stats: { + entry: string; + start: number; + end: number; + duration: number; + includedFiles: string[]; + } + } + + export function render(options: Options, callback: (err: SassError, result: Result) => any): void; + export function renderSync(options: Options): Result; +} From 720878aee7051a9bed9c6e63eb1e41e77c37cf57 Mon Sep 17 00:00:00 2001 From: Inez Korczynski Date: Wed, 20 May 2015 17:31:28 -0700 Subject: [PATCH 252/534] Transition.then - it's optional, really is, to pass "onRejected" callback --- ember/ember.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index a35d51eb9..48aa81aa2 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -58,7 +58,7 @@ declare module EmberStates { @arg {String} label optional string for labeling the promise. Useful for tooling. @return {Promise} */ - then(onFulfilled: Function, onRejected: Function, label?: string): Ember.RSVP.Promise; + then(onFulfilled: Function, onRejected?: Function, label?: string): Ember.RSVP.Promise; /** Forwards to the internal `promise` property which you can From b003ec5aef9063d5a99c834612d213f109b1b56a Mon Sep 17 00:00:00 2001 From: Stefan Profanter Date: Tue, 19 May 2015 15:16:33 +0200 Subject: [PATCH 253/534] Vortex Web Client definitions --- vortex-web-client/vortex-web-client-tests.ts | 23 + vortex-web-client/vortex-web-client.d.ts | 488 +++++++++++++++++++ 2 files changed, 511 insertions(+) create mode 100644 vortex-web-client/vortex-web-client-tests.ts create mode 100644 vortex-web-client/vortex-web-client.d.ts diff --git a/vortex-web-client/vortex-web-client-tests.ts b/vortex-web-client/vortex-web-client-tests.ts new file mode 100644 index 000000000..216e268c5 --- /dev/null +++ b/vortex-web-client/vortex-web-client-tests.ts @@ -0,0 +1,23 @@ +/// + +var runtime = new dds.runtime.Runtime(); +runtime.connect("ws://localhost:9000", "user:pass"); + +var tqos = new dds.TopicQos(); +var chatTopic = new dds.Topic(0, 'ChatMessage', tqos); +runtime.registerTopic(chatTopic); + +var writerQos = new dds.DataWriterQos(); +var writer = new dds.DataWriter(runtime, chatTopic, writerQos); + +writer.write({ + user: "John Smith", + msg : "Hello World!" +}); + +var readerQos = new dds.DataReaderQos(); +var reader = new dds.DataReader(runtime, chatTopic, readerQos); + +reader.addListener(function(msg) { + console.log(JSON.stringify(msg)); +}); diff --git a/vortex-web-client/vortex-web-client.d.ts b/vortex-web-client/vortex-web-client.d.ts new file mode 100644 index 000000000..de665c780 --- /dev/null +++ b/vortex-web-client/vortex-web-client.d.ts @@ -0,0 +1,488 @@ +// Type definitions for Vortex Web 1.2.0p1 +// Project: http://www.prismtech.com/vortex/vortex-web +// Definitions by: Stefan Profanter +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/* + Vortex Web + + This software and documentation are Copyright 2010 to 2015 PrismTech + Limited and its licensees. All rights reserved. See file: + + docs/LICENSE.html + + for full copyright notice and license terms. + */ + +declare module DDS { + + + /** + * Base class for all policies + */ + interface Policy { + + } + + /** + * History policy + */ + export enum HistoryKind { + KeepAll = 0, + KeepLast = 1 + } + + /** + * History policy + */ + export class History implements Policy { + /** + * KeepAll - KEEP_ALL qos policy + */ + KeepAll:any; + /** + * KeepLast - KEEP_LAST qos policy + */ + KeepLast:any; + } + + /** + * Reliability Policy + * @example var qos = Reliability.Reliable + */ + export enum ReliabilityKind { + Reliable = 0, + BestEffort = 1 + } + + /** + * History policy + */ + export class Reliability implements Policy { + /** + * Reliable - 'Reliable' reliability policy + */ + Reliable:any; + /** + * BestEffort - 'BestEffort' reliability policy + */ + BestEffort:any; + } + + /** + * Partition policy + */ + export class Partition implements Policy { + /** + * Create new partition policy + * + * @param policies - partition names + * @example var qos = Partition('p1', 'p2') + */ + constructor(...policies:string[]); + } + + /** + * Content Filter policy + */ + export class ContentFilter implements Policy { + /** + * Create new content filter policy + * + * @param expr - filter expression + * @example var filter = ContentFilter("x>10 AND y<50") + */ + constructor(expr:string); + } + + /** + * Time Filter policy + */ + export class TimeFilter implements Policy { + /** + * Create new content filter policy + * + * @param period - time duration (unit ?) + * @example var filter = TimeFilter(100) + */ + constructor(period:number); + } + + /** + * Durability Policy + */ + export enum DurabilityKind { + Volatile = 0, + TransientLocal = 1, + Transient = 2, + Persistent = 3 + } + + /** + * Durability Qos Policy + */ + export class Durability implements Policy { + /** + * Volatile - Volatile durability policy + */ + Volatile:any; + /** + * TransientLocal - TransientLocal durability policy + */ + TransientLocal:any; + /** + * Transient - Transient durability policy + */ + Transient:any; + /** + * Persistent - Persistent durability policy + */ + Persistent:any; + } + + + interface EntityQos { + /** + * Creates any of the DDS entities quality of service, including DataReaderQos and DataWriterQos. + * + * @param policies - list of policies for the Qos entity + */ + new (...policies:Policy[]): EntityQos; + + /** + * Adds the given policy to this instance. + * @param policy - the policy to add + * @return A new copy of this instance with the combined policies + */ + add (policy:Policy): EntityQos; + } + + + /** + * Topic quality of service object + */ + export var TopicQos:EntityQos; + /** + * DataReader quality of service object + */ + export var DataReaderQos:EntityQos; + + /** + * DataWriter quality of service object + */ + export var DataWriterQos:EntityQos; + + export class Topic { + /** + * Creates a `Topic` in the domain `did`, named `tname`, having `qos` Qos, + * for the type `ttype` whose registered name is `tregtype` + * @param {number} did - DDS domain ID + * @param {string} tname - topic name + * @param {TopicQos} qos - topic Qos + * @param {string} ttype - topic type. If not specified, a generic type is used. + * @param {string} tregtype - topic registered type name. If not specified, 'ttype' is used. + */ + constructor(did:number, tname:string, qos:EntityQos, ttype?:string, tregtype?:string); + + /** + * Called when topic gets registered in the runtime + */ + onregistered():void; + + /** + * Called when topic gets unregistered in the runtime + */ + onunregistered():void; + } + + export class DataReader { + /** + * Creates a `DataReader` for a given topic and a specific in a specific DDS runtime. + * + * A `DataReader` allows to read data for a given topic with a specific QoS. A `DataReader` + * * goes through different states, it is intially disconnected and changes to the connected state + * when the underlying transport connection is successfully established with the server. At this point + * a `DataReader` can be explicitely closed or disconnected. A disconnection can happen as the result + * of a network failure or server failure. Disconnection and reconnections are managed by the runtime. + * + * @param runtime - DDS Runtime + * @param topic - DDS Topic + * @param qos - DataReader quality of service + */ + constructor(runtime:Runtime, topic:Topic, qos:EntityQos); + + resetStats():void; + + /** + * Attaches the listener `l` to this data reader and returns + * the id associated to the listener. + * @param l - listener code + * @returns listener handle + */ + addListener(l:(msg:any) => void):number; + + /** + * removes a listener from this data reader. + * @param idx - listener id + */ + removeListener(idx:number):void; + + /** + * closes the DataReader + */ + close():void; + } + + export class DataWriter { + /** + * Creates a `DataWriter` for a given topic and a specific in a specific DDS runtime + * + * defines a DDS data writer. This type + * is used to write data for a specific topic with a given QoS. + * A `DataWriter` goes through different states, it is intially disconnected and changes to the connected + * state when the underlying transport connection is successfully established with the server. + * At this point a `DataWriter` can be explicitely closed or disconnected. A disconnection can happen + * as the result of a network failure or server failure. Disconnection and reconnections are managed by the + * runtime. + * + * @param runtime - DDS Runtime + * @param topic - DDS Topic + * @param qos - DataWriter quality of service + */ + constructor(runtime:Runtime, topic:Topic, qos:EntityQos); + + /** + * Writes one or more samples. + * @param ds - data sample + */ + write(...ds:any[]):void; + + /** + * Closes the DataWriter + */ + close():void; + } + + + export class DataCache { + /** + * Constructs a `DataCache` with a given `depth`. If the `cache` parameter + * is present, then the current cache is initialized with this parameter. + * + * Provides a way of storing and flexibly accessing the + * data received through a `DataReader`. A `DataCache` is organized as + * a map of queues. The depth of the queues is specified at construction + * time. + * + * @param depth - cache size + * @param cache - cache data structure + */ + constructor(depth:number, cache:any); + + /** + * Register a listener to be notified whenever data which matches a predicate is written into the cache. + * If no predicate is provided then the listeners is always notified upon data inserion. + * + * @param l - listener function + * @param p - predicate + */ + addListener(l:(data:any) => void, p?:(data:any) => boolean):void; + + /** + * Write the element `data` with key `k` into the cache. + * + * @param k - data key + * @param data - data value + * @returns the written data value + */ + write(k:any, data:any):any; + + /** + * Same as forEach but applied, for each key, only to the first `n` samples of the cache + * + * @param f - the function to be applied + * @param n - samples set size + */ + forEachN(f:(data:any) => any, n:number):any[]; + + /** + * Execute the function `f` for each element of the cache. + * + * @memberof! dds.DataCache# + * @param f - the function to be applied + * @returns results of the function execution + */ + forEach(f:(data:any) => any):any[]; + + /** + * Returns a cache that is the result of applying `f` to each element of the cache. + * + * @param f - the function to be applied + * @returns A cache holding the results of the function execution + */ + map(f:(data:any) => any):DataCache; + + /** + * Returns the list of elements in the cache that satisfy the predicate `f`. + * + * @param f - the predicate to be applied to filter the cache values + * @returns An array holding the filtered values + */ + filter(f:(data:any) => boolean):any[]; + + /** + * Returns the list of elements in the cache that doesn't satisfy the predicate `f`. + * + * @returns An array holding the filtered values + * @see DataCache#filter + */ + filterNot(f:(data:any) => boolean):any[]; + + /** + * Returns the values included in the cache as an array. + * + * @return All the cache values + */ + read():any[]; + + /** + * Returns the last value of the cache in an array. + * + * @return the last value of the cache + */ + readLast():any; + + /** + * Returns all the values included in the cache as an array and empties the cache. + * + * @return All the cache values + */ + takeAll():any[]; + + /** + * Returns the `K`ith value of the cache as Monad, ie: `coffez.Some` if it exists, `coffez.None` if not. + * + * @return the 'k'th value + */ + take():any; + + /** + * Takes elements from the cache up to when the predicate `f` is satisfied + * + * @param f - the predicate + * @return taken cache values + */ + takeWithFilter(f:(data:any) => boolean):any[]; + + /** + * Return `coffez.Some(v)` if there is an element in the cache corresponding to the + * key `k` otherwise it returns `coffez.None`. + * + * @param k - key + */ + get(k:any):any; + + /** + * Return `coffez.Some(v)` if there is an element in the cache corresponding to the + * key `k` otherwise executes `f` and returns its result. + * + * @param k - key + * @param f - the function to apply + */ + getOrElse(k:any, f:(data:any)=> any):any; + + /** + * folds the element of the cache using `z` as the `zero` element and + * `f` as the binary operator. + * + * @param z - initial value + * @param {function} f - reduce function + */ + fold(z:any, f:(data:any) => any):void; + + /** + * clears the data cache + */ + clear():void; + + } + + interface Runtime { + /** + * Constructs a DDS Runtime object + * + * maintains the connection with the server, re-establish the connection + * if dropped and mediates the `DataReader` and `DataWriter` communication. + */ + new (): Runtime; + + /** + * Connect the runtime to the server. If the runtime is already connected an exception is thrown + * + * @param srv - Vortex Web server WebSocket URL + * @param authToken - Authorization token + */ + connect(server:string, authToken?:string): void; + + /** + * Disconnects, withouth closing, a `Runtime`. Notice that upon re-connection all existing + * subscriptions and publications will be re-restablished. + */ + disconnect(): void; + + /** + * Registers the provided Topic. + * + * @param t - Topic to be registered + */ + registerTopic(t:Topic): void; + + /** + * Function called when runtime is connected. + * + * @param e + */ + onconnect(e:any): void; + + + /** + * Function called when runtime is disconnected. + * + * @param e + */ + ondisconnect(e:any): void; + + /** + * Closes the DDS runtime and as a consequence all the `DataReaders` and `DataWriters` that belong to this runtime. + * + */ + close(): void; + + /** + * Checks whether the Runtime is connected. + * @return `true` if connected, `false` if not + */ + isConnected() : boolean; + + /** + * Checks whether the Runtime is closed. + * @return `true` if connected, `false` if not + */ + isClosed() : boolean; + } + + export var runtime:{ + Runtime : Runtime; + } + + export var VERSION:string; +} + +/** + * Defines the core Vortex-Web-Client javascript library. It includes the JavaScript API for DDS. This API allows + * web applications to share data among them as well as with native DDS applications. + */ +declare +var dds:typeof DDS; + + From 2c3f84a797387fb4b275b027d946694c4326ec11 Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Thu, 21 May 2015 19:14:33 +1000 Subject: [PATCH 254/534] getTabSize returns number --- ace/ace.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ace/ace.d.ts b/ace/ace.d.ts index 29fadf3bc..9866e1e28 100644 --- a/ace/ace.d.ts +++ b/ace/ace.d.ts @@ -576,7 +576,7 @@ declare module AceAjax { /** * Returns the current tab size. **/ - getTabSize(): string; + getTabSize(): number; /** * Returns `true` if the character at the position is a soft tab. From 16c5267ec4c4611949ce77e381a9b416cb5a3f36 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 21 May 2015 11:18:08 +0200 Subject: [PATCH 255/534] fixed implicit any --- jasmine-ajax/jasmine-ajax.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jasmine-ajax/jasmine-ajax.d.ts b/jasmine-ajax/jasmine-ajax.d.ts index 657ec3374..d10f67ad4 100644 --- a/jasmine-ajax/jasmine-ajax.d.ts +++ b/jasmine-ajax/jasmine-ajax.d.ts @@ -62,7 +62,7 @@ interface JasmineAjaxParamParser { } declare class MockAjax { - constructor(globals); + constructor(globals: any); install(): void; uninstall(): void; From bfbc30d83298099af8743b114d1a9065220a1fdd Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Thu, 21 May 2015 19:31:40 +1000 Subject: [PATCH 256/534] Editor is an event emitter --- ace/ace.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ace/ace.d.ts b/ace/ace.d.ts index 9866e1e28..410df1039 100644 --- a/ace/ace.d.ts +++ b/ace/ace.d.ts @@ -1035,6 +1035,8 @@ declare module AceAjax { **/ export interface Editor { + addEventListener(ev: string, callback: Function); + inMultiSelectMode: boolean; selectMoreLines(n: number); From ecc3f26f9cdaaa9db07504495ac05ccb0afb0ace Mon Sep 17 00:00:00 2001 From: Danyil Bohdan Date: Thu, 21 May 2015 12:58:12 +0300 Subject: [PATCH 257/534] Add missing typing for utcOffset for Moment --- moment/moment-external-tests.ts | 1 + moment/moment-tests.ts | 1 + moment/moment.d.ts | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/moment/moment-external-tests.ts b/moment/moment-external-tests.ts index 1b1d083ba..c5855c12c 100644 --- a/moment/moment-external-tests.ts +++ b/moment/moment-external-tests.ts @@ -188,6 +188,7 @@ moment(1318874398806).valueOf(); moment(1318874398806).unix(); moment([2000]).isLeapYear(); moment().zone(); +moment().utcOffset(); moment("2012-2", "YYYY-MM").daysInMonth(); moment([2011, 2, 12]).isDST(); diff --git a/moment/moment-tests.ts b/moment/moment-tests.ts index dc11eeac8..16490d2e1 100644 --- a/moment/moment-tests.ts +++ b/moment/moment-tests.ts @@ -188,6 +188,7 @@ moment(1318874398806).valueOf(); moment(1318874398806).unix(); moment([2000]).isLeapYear(); moment().zone(); +moment().utcOffset(); moment("2012-2", "YYYY-MM").daysInMonth(); moment([2011, 2, 12]).isDST(); diff --git a/moment/moment.d.ts b/moment/moment.d.ts index d26834a03..e09aab1d5 100644 --- a/moment/moment.d.ts +++ b/moment/moment.d.ts @@ -224,7 +224,7 @@ declare module moment { diff(b: Moment): number; diff(b: Moment, unitOfTime: string): number; diff(b: Moment, unitOfTime: string, round: boolean): number; - + toArray(): number[]; toDate(): Date; toISOString(): string; @@ -235,6 +235,9 @@ declare module moment { zone(): number; zone(b: number): Moment; zone(b: string): Moment; + utcOffset(): number; + utcOffset(b: number): Moment; + utcOffset(b: string): Moment; daysInMonth(): number; isDST(): boolean; @@ -318,7 +321,7 @@ declare module moment { } - interface BaseMomentLanguage { + interface BaseMomentLanguage { months ?: any; monthsShort ?: any; weekdays ?: any; From 2aac6c6f5072c58ed6055c71f15705ed8bbcb90d Mon Sep 17 00:00:00 2001 From: Emiliano Marino Date: Thu, 21 May 2015 10:47:22 -0300 Subject: [PATCH 258/534] added $setDirty method to INgModelController (added in v1.3.15+) For Angular version 1.3.15+ INgModelController brings $setDirty method. --- angularjs/angular.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 92784af38..719e84139 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -474,6 +474,7 @@ declare module angular { // types do work and it's common to use them. $setViewValue(value: any, trigger?: string): void; $setPristine(): void; + $setDirty(): void; $validate(): void; $setTouched(): void; $setUntouched(): void; From c5a17104d40e0c0f6cc26fe02172ba6dcff0bae0 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Fri, 22 May 2015 00:50:44 +0900 Subject: [PATCH 259/534] readBytes fix --- winrt/winrt.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winrt/winrt.d.ts b/winrt/winrt.d.ts index 883860b00..1247d0940 100644 --- a/winrt/winrt.d.ts +++ b/winrt/winrt.d.ts @@ -9268,7 +9268,7 @@ declare module Windows { unconsumedBufferLength: number; unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; readByte(): number; - readBytes(): Uint8Array; + readBytes(value: Uint8Array): void; readBuffer(length: number): Windows.Storage.Streams.IBuffer; readBoolean(): boolean; readGuid(): string; @@ -9297,7 +9297,7 @@ declare module Windows { unconsumedBufferLength: number; unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; readByte(): number; - readBytes(): Uint8Array; + readBytes(value: Uint8Array): void; readBuffer(length: number): Windows.Storage.Streams.IBuffer; readBoolean(): boolean; readGuid(): string; From 92e29d7ca898ab585f8dd2304dc78aa001e421e6 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Fri, 22 May 2015 01:12:41 +0900 Subject: [PATCH 260/534] readBytes/writeBytes receives array of number --- winrt/winrt.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/winrt/winrt.d.ts b/winrt/winrt.d.ts index 1247d0940..ed4f33e77 100644 --- a/winrt/winrt.d.ts +++ b/winrt/winrt.d.ts @@ -9268,6 +9268,7 @@ declare module Windows { unconsumedBufferLength: number; unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; readByte(): number; + readBytes(value: number[]): void; readBytes(value: Uint8Array): void; readBuffer(length: number): Windows.Storage.Streams.IBuffer; readBoolean(): boolean; @@ -9297,6 +9298,7 @@ declare module Windows { unconsumedBufferLength: number; unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; readByte(): number; + readBytes(value: number[]): void; readBytes(value: Uint8Array): void; readBuffer(length: number): Windows.Storage.Streams.IBuffer; readBoolean(): boolean; @@ -9345,6 +9347,7 @@ declare module Windows { unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; unstoredBufferLength: number; writeByte(value: number): void; + writeBytes(value: number[]): void; writeBytes(value: Uint8Array): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer, start: number, count: number): void; @@ -9377,6 +9380,7 @@ declare module Windows { unicodeEncoding: Windows.Storage.Streams.UnicodeEncoding; unstoredBufferLength: number; writeByte(value: number): void; + writeBytes(value: number[]): void; writeBytes(value: Uint8Array): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer): void; writeBuffer(buffer: Windows.Storage.Streams.IBuffer, start: number, count: number): void; From 9a8c0ea74e849c796d4a01e42b42dc5d2761b41c Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Fri, 22 May 2015 18:00:08 +1000 Subject: [PATCH 261/534] feat(ace) specialize 'change' --- ace/ace.d.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ace/ace.d.ts b/ace/ace.d.ts index 410df1039..72fefbc6e 100644 --- a/ace/ace.d.ts +++ b/ace/ace.d.ts @@ -1034,9 +1034,10 @@ declare module AceAjax { * Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them. **/ export interface Editor { - - addEventListener(ev: string, callback: Function); + addEventListener(ev: 'change', callback: (ev: EditorChangeEvent) => any); + addEventListener(ev: string, callback: Function); + inMultiSelectMode: boolean; selectMoreLines(n: number); @@ -1712,6 +1713,13 @@ declare module AceAjax { **/ new(renderer: VirtualRenderer, session?: IEditSession): Editor; } + + interface EditorChangeEvent { + start: Position; + end: Position; + action: string; // insert, remove + lines: any[]; + } //////////////////////////////// /// PlaceHolder From c3125d7aebd46b9bd024287b12eaf3438cc500c1 Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Fri, 22 May 2015 07:50:50 -0400 Subject: [PATCH 262/534] Fixing header format --- angular-file-upload/angular-file-upload.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts index 499fdf185..fa7aaa54e 100644 --- a/angular-file-upload/angular-file-upload.d.ts +++ b/angular-file-upload/angular-file-upload.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular File Upload 4.2.1 // Project: https://github.com/danialfarid/ng-file-upload -// Definitions by: John Reilly & Chris Barr +// Definitions by: John Reilly // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From f42164e284d20bfebdea9a6283dc387359f1a46a Mon Sep 17 00:00:00 2001 From: Sascha Thiel Date: Fri, 22 May 2015 14:19:45 +0200 Subject: [PATCH 263/534] fixed the collection TModel workaround. --- backbone/backbone.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 7de8eb807..9d54361d5 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -169,9 +169,7 @@ declare module Backbone { **/ private static extend(properties: any, classProperties?: any): any; - // TODO: this really has to be typeof TModel - //model: typeof TModel; - model: { new(): TModel; }; // workaround + model: new (...args:any[]) => TModel; models: TModel[]; length: number; From 0deb573197c1be1859e9433012b4df6f78fa9795 Mon Sep 17 00:00:00 2001 From: Sascha Thiel Date: Fri, 22 May 2015 15:00:44 +0200 Subject: [PATCH 264/534] added the missing ui property --- marionette/marionette.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 2b9b25635..4a2bfac10 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -1291,6 +1291,15 @@ declare module Marionette { options: any; + /** + * Behaviors can have their own ui hash, which will be mixed into the ui + * hash of its associated View instance. ui elements defined on either the + * Behavior or the View will be made available within events and triggers. + * They also are attached directly to the Behavior and can be accessed within + * Behavior methods as this.ui. + */ + ui: any; + /** * Any triggers you define on the Behavior will be triggered in response to the appropriate event on the view. */ From fcec5c68577433516aaf6ea2dd95bf9264928ada Mon Sep 17 00:00:00 2001 From: jandic Date: Fri, 22 May 2015 15:25:46 +0200 Subject: [PATCH 265/534] Fixed - Parameters made optional Some parameters were mandatory while they were supposed to be optional --- dojo/dojo.d.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/dojo/dojo.d.ts b/dojo/dojo.d.ts index 7b95efdfa..e39db0583 100644 --- a/dojo/dojo.d.ts +++ b/dojo/dojo.d.ts @@ -4873,7 +4873,7 @@ declare module dojo { * @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met. * @param thisObject Optionalmay be used to scope the call to callback */ - every(arr: any[], callback: Function, thisObject: Object): boolean; + every(arr: any[], callback: Function, thisObject?: Object): boolean; /** * Determines whether or not every item in arr satisfies the * condition implemented by callback. @@ -4887,7 +4887,7 @@ declare module dojo { * @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met. * @param thisObject Optionalmay be used to scope the call to callback */ - every(arr: String, callback: Function, thisObject: Object): boolean; + every(arr: String, callback: Function, thisObject?: Object): boolean; /** * Determines whether or not every item in arr satisfies the * condition implemented by callback. @@ -4901,7 +4901,7 @@ declare module dojo { * @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met. * @param thisObject Optionalmay be used to scope the call to callback */ - every(arr: any[], callback: String, thisObject: Object): boolean; + every(arr: any[], callback: String, thisObject?: Object): boolean; /** * Determines whether or not every item in arr satisfies the * condition implemented by callback. @@ -4915,7 +4915,7 @@ declare module dojo { * @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met. * @param thisObject Optionalmay be used to scope the call to callback */ - every(arr: String, callback: String, thisObject: Object): boolean; + every(arr: String, callback: String, thisObject?: Object): boolean; /** * Returns a new Array with those items from arr that match the * condition implemented by callback. @@ -4929,7 +4929,7 @@ declare module dojo { * @param callback a function that is invoked with three arguments (item,index, array). The return of this function is expected tobe a boolean which determines whether the passed-in itemwill be included in the returned array. * @param thisObject Optionalmay be used to scope the call to callback */ - filter(arr: any[], callback: Function, thisObject: Object): any[]; + filter(arr: any[], callback: Function, thisObject?: Object): any[]; /** * Returns a new Array with those items from arr that match the * condition implemented by callback. @@ -4943,7 +4943,7 @@ declare module dojo { * @param callback a function that is invoked with three arguments (item,index, array). The return of this function is expected tobe a boolean which determines whether the passed-in itemwill be included in the returned array. * @param thisObject Optionalmay be used to scope the call to callback */ - filter(arr: any[], callback: String, thisObject: Object): any[]; + filter(arr: any[], callback: String, thisObject?: Object): any[]; /** * for every item in arr, callback is invoked. Return values are ignored. * If you want to break out of the loop, consider using array.every() or array.some(). @@ -5020,7 +5020,7 @@ declare module dojo { * @param fromIndex Optional * @param findLast OptionalMakes indexOf() work like lastIndexOf(). Used internally; not meant for external usage. */ - indexOf(arr: any[], value: Object, fromIndex: number, findLast: boolean): number; + indexOf(arr: any[], value: Object, fromIndex?: number, findLast?: boolean): number; /** * locates the last index of the provided value in the passed * array. If the value is not found, -1 is returned. @@ -5036,7 +5036,7 @@ declare module dojo { * @param value * @param fromIndex Optional */ - lastIndexOf(arr: any, value: any, fromIndex: number): number; + lastIndexOf(arr: any, value: any, fromIndex?: number): number; /** * applies callback to each element of arr and returns * an Array with the results @@ -5051,7 +5051,7 @@ declare module dojo { * @param thisObject Optionalmay be used to scope the call to callback * @param Ctr */ - map(arr: any[], callback: Function, thisObject: Object, Ctr: any): any[]; + map(arr: any[], callback: Function, thisObject?: Object, Ctr: any): any[]; /** * applies callback to each element of arr and returns * an Array with the results @@ -5066,7 +5066,7 @@ declare module dojo { * @param thisObject Optionalmay be used to scope the call to callback * @param Ctr */ - map(arr: String, callback: Function, thisObject: Object, Ctr: any): any[]; + map(arr: String, callback: Function, thisObject?: Object, Ctr: any): any[]; /** * applies callback to each element of arr and returns * an Array with the results @@ -5081,7 +5081,7 @@ declare module dojo { * @param thisObject Optionalmay be used to scope the call to callback * @param Ctr */ - map(arr: any[], callback: String, thisObject: Object, Ctr: any): any[]; + map(arr: any[], callback: String, thisObject?: Object, Ctr: any): any[]; /** * applies callback to each element of arr and returns * an Array with the results @@ -5096,7 +5096,7 @@ declare module dojo { * @param thisObject Optionalmay be used to scope the call to callback * @param Ctr */ - map(arr: String, callback: String, thisObject: Object, Ctr: any): any[]; + map(arr: String, callback: String, thisObject?: Object, Ctr: any): any[]; /** * Determines whether or not any item in arr satisfies the * condition implemented by callback. @@ -5110,7 +5110,7 @@ declare module dojo { * @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met. * @param thisObject Optionalmay be used to scope the call to callback */ - some(arr: any[], callback: Function, thisObject: Object): boolean; + some(arr: any[], callback: Function, thisObject?: Object): boolean; /** * Determines whether or not any item in arr satisfies the * condition implemented by callback. @@ -5124,7 +5124,7 @@ declare module dojo { * @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met. * @param thisObject Optionalmay be used to scope the call to callback */ - some(arr: String, callback: Function, thisObject: Object): boolean; + some(arr: String, callback: Function, thisObject?: Object): boolean; /** * Determines whether or not any item in arr satisfies the * condition implemented by callback. @@ -5138,7 +5138,7 @@ declare module dojo { * @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met. * @param thisObject Optionalmay be used to scope the call to callback */ - some(arr: any[], callback: String, thisObject: Object): boolean; + some(arr: any[], callback: String, thisObject?: Object): boolean; /** * Determines whether or not any item in arr satisfies the * condition implemented by callback. @@ -5152,7 +5152,7 @@ declare module dojo { * @param callback a function is invoked with three arguments: item, index,and array and returns true if the condition is met. * @param thisObject Optionalmay be used to scope the call to callback */ - some(arr: String, callback: String, thisObject: Object): boolean; + some(arr: String, callback: String, thisObject?: Object): boolean; } /** * Permalink: http://dojotoolkit.org/api/1.9/dojo/_base/connect.html From 95eac2d4ed66828e43fe10e0bd09515d5f5a62fe Mon Sep 17 00:00:00 2001 From: jandic Date: Fri, 22 May 2015 15:46:23 +0200 Subject: [PATCH 266/534] Fixed compilation issue --- dojo/dojo.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dojo/dojo.d.ts b/dojo/dojo.d.ts index e39db0583..8ec115654 100644 --- a/dojo/dojo.d.ts +++ b/dojo/dojo.d.ts @@ -5051,7 +5051,7 @@ declare module dojo { * @param thisObject Optionalmay be used to scope the call to callback * @param Ctr */ - map(arr: any[], callback: Function, thisObject?: Object, Ctr: any): any[]; + map(arr: any[], callback: Function, thisObject: Object, Ctr: any): any[]; /** * applies callback to each element of arr and returns * an Array with the results @@ -5066,7 +5066,7 @@ declare module dojo { * @param thisObject Optionalmay be used to scope the call to callback * @param Ctr */ - map(arr: String, callback: Function, thisObject?: Object, Ctr: any): any[]; + map(arr: String, callback: Function, thisObject: Object, Ctr: any): any[]; /** * applies callback to each element of arr and returns * an Array with the results @@ -5081,7 +5081,7 @@ declare module dojo { * @param thisObject Optionalmay be used to scope the call to callback * @param Ctr */ - map(arr: any[], callback: String, thisObject?: Object, Ctr: any): any[]; + map(arr: any[], callback: String, thisObject: Object, Ctr: any): any[]; /** * applies callback to each element of arr and returns * an Array with the results @@ -5096,7 +5096,7 @@ declare module dojo { * @param thisObject Optionalmay be used to scope the call to callback * @param Ctr */ - map(arr: String, callback: String, thisObject?: Object, Ctr: any): any[]; + map(arr: String, callback: String, thisObject: Object, Ctr: any): any[]; /** * Determines whether or not any item in arr satisfies the * condition implemented by callback. From 043288c68ebef1b3c4c11cb1b96a04f8129405ae Mon Sep 17 00:00:00 2001 From: Slavo Vojacek Date: Fri, 22 May 2015 17:23:41 +0100 Subject: [PATCH 267/534] Update gapi.d.ts I am using Google+ Sign-In on one of my applications and I needed to add a couple of definitions into this file. The update is based on https://developers.google.com/+/web/signin/reference#javascript_api. --- gapi/gapi.d.ts | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/gapi/gapi.d.ts b/gapi/gapi.d.ts index d9d6fb90b..8c50826d4 100644 --- a/gapi/gapi.d.ts +++ b/gapi/gapi.d.ts @@ -65,6 +65,45 @@ declare module gapi.auth { * @param token The token to set. */ export function setToken(token: GoogleApiOAuth2TokenObject): void; + /** + * Initiates the client-side Google+ Sign-In OAuth 2.0 flow. + * When the method is called, the OAuth 2.0 authorization dialog is displayed to the user and when they accept, the callback function is called. + * @param params + */ + export function signIn(params: { + /** + * Your OAuth 2.0 client ID that you obtained from the Google Developers Console. + */ + clientid?: string; + /** + * Directs the sign-in button to store user and session information in a session cookie and HTML5 session storage on the user's client for the purpose of minimizing HTTP traffic and distinguishing between multiple Google accounts a user might be signed into. + */ + cookiepolicy?: string; + /** + * A function in the global namespace, which is called when the sign-in button is rendered and also called after a sign-in flow completes. + */ + callback?: Function; + /** + * If true, all previously granted scopes remain granted in each incremental request, for incremental authorization. The default value true is correct for most use cases; use false only if employing delegated auth, where you pass the bearer token to a less-trusted component with lower programmatic authority. + */ + includegrantedscopes?: boolean; + /** + * If your app will write moments, list the full URI of the types of moments that you intend to write. + */ + requestvisibleactions?: any; + /** + * The OAuth 2.0 scopes for the APIs that you would like to use as a space-delimited list. + */ + scope?: any; + /** + * If you have an Android app, you can drive automatic Android downloads from your web sign-in flow. + */ + apppackagename?: string; + }): void; + /** + * Signs a user out of your app without logging the user out of Google. This method will only work when the user is signed in with Google+ Sign-In. + */ + export function signOut(): void; } declare module gapi.client { From dd10c1a6f9b2e243b34544334f160af03ab80459 Mon Sep 17 00:00:00 2001 From: Tom Hasner Date: Fri, 22 May 2015 15:47:41 -0400 Subject: [PATCH 268/534] scoping exported interfaces with an `Interact` module --- interactjs/interact.d.ts | 468 +++++++++++++++++++-------------------- 1 file changed, 234 insertions(+), 234 deletions(-) diff --git a/interactjs/interact.d.ts b/interactjs/interact.d.ts index 1ad864607..495e5e1a3 100644 --- a/interactjs/interact.d.ts +++ b/interactjs/interact.d.ts @@ -1,245 +1,245 @@ // Type definitions for Interacting for interact.js v1.0.25 // Project: https://github.com/taye/interact.js -// Definitions by: Douglas Eichelberger , Adi Dahiya +// Definitions by: Douglas Eichelberger , Adi Dahiya , Tom Hasner // Definitions: https://github.com/borisyankov/DefinitelyTyped // API documentation: http://interactjs.io/docs -interface Interactable { - // returns Element or string - accept(): any; - accept(newValue: Element): Interactable; - accept(newValue: string): Interactable; - actionChecker(): Function; - actionChecker(checker: Function): Interactable; - // returns boolean or {[key: string]: any} - autoScroll(): any; - autoScroll(options: boolean): Interactable; - autoScroll(options: {[key: string]: any}): Interactable; - context(): Node; - defaultActionChecker(event: any): string; - deltaSource(): string; - // returns Interactable if newValue is "page" or "client", otherwise returns string - deltaSource(newValue: String): Interactable; - draggable(): boolean; - draggable(options: boolean): Interactable; - draggable(options: {[key: string]: any}): Interactable; - dropCheck(event: MouseEvent): boolean; - dropCheck(event: TouchEvent): boolean; - dropChecker(): Function; - dropChecker(checker: Function): Interactable; - // returns boolean or {[key: string]: any} - dropzone(): any; - dropzone(options: boolean): Interactable; - dropzone(options: {[key: string]: any}): Interactable; - // return HTMLElement or SVGElement - element(): Element; - fire(iEvent: InteractEvent): Interactable; - // returns boolean or {[key: string]: any} - gesturable(): any; - gesturable(options: boolean): Interactable; - gesturable(options: {[key: string]: any}): Interactable; - getRect(): ClientRect; - // returns Element or string - ignoreFrom(): any; - ignoreFrom(newValue: string): Interactable; - ignoreFrom(newValue: Element): Interactable; - // returns boolean or {[key: string]: any} - inertia(): any; - inertia(options: boolean): Interactable; - inertia(options: {[key: string]: any}): Interactable; - off(eventType: string, listener: Function, useCapture?: boolean): Interactable; - on(eventType: string, listener: Function, useCapture?: boolean): Interactable; - origin(): Point; - origin(newValue: HTMLElement): Interactable; - origin(newValue: SVGElement): Interactable; - origin(newValue: Point): Interactable; - rectChecker(): Function; - rectChecker(newValue: Function): Interactable; - resizable(): Interactable; - resizable(options: boolean): Interactable; - resizable(options: {[key: string]: any}): Interactable; - restrict(): Restrict; - restrict(newValue: Restrict): Interactable; - set(options: {[key: string]: any}): Interactable; - // returns boolean or {[key: string]: any} - snap(): any; - snap(options: boolean): Interactable; - snap(options: {[key: string]: any}): Interactable; - squareResize(): boolean; - squareResize(newValue: boolean): Interactable; - styleCursor(): boolean; - styleCursor(newValue: boolean): Interactable; - unset(): InteractStatic; - validateSetting(context: string, option: string, value: any): any; +declare module Interact { + interface Interactable { + // returns Element or string + accept(): any; + accept(newValue: Element): Interactable; + accept(newValue: string): Interactable; + actionChecker(): Function; + actionChecker(checker: Function): Interactable; + // returns boolean or {[key: string]: any} + autoScroll(): any; + autoScroll(options: boolean): Interactable; + autoScroll(options: {[key: string]: any}): Interactable; + context(): Node; + defaultActionChecker(event: any): string; + deltaSource(): string; + // returns Interactable if newValue is "page" or "client", otherwise returns string + deltaSource(newValue: String): Interactable; + draggable(): boolean; + draggable(options: boolean): Interactable; + draggable(options: {[key: string]: any}): Interactable; + dropCheck(event: MouseEvent): boolean; + dropCheck(event: TouchEvent): boolean; + dropChecker(): Function; + dropChecker(checker: Function): Interactable; + // returns boolean or {[key: string]: any} + dropzone(): any; + dropzone(options: boolean): Interactable; + dropzone(options: {[key: string]: any}): Interactable; + // return HTMLElement or SVGElement + element(): Element; + fire(iEvent: InteractEvent): Interactable; + // returns boolean or {[key: string]: any} + gesturable(): any; + gesturable(options: boolean): Interactable; + gesturable(options: {[key: string]: any}): Interactable; + getRect(): ClientRect; + // returns Element or string + ignoreFrom(): any; + ignoreFrom(newValue: string): Interactable; + ignoreFrom(newValue: Element): Interactable; + // returns boolean or {[key: string]: any} + inertia(): any; + inertia(options: boolean): Interactable; + inertia(options: {[key: string]: any}): Interactable; + off(eventType: string, listener: Function, useCapture?: boolean): Interactable; + on(eventType: string, listener: Function, useCapture?: boolean): Interactable; + origin(): Point; + origin(newValue: HTMLElement): Interactable; + origin(newValue: SVGElement): Interactable; + origin(newValue: Point): Interactable; + rectChecker(): Function; + rectChecker(newValue: Function): Interactable; + resizable(): Interactable; + resizable(options: boolean): Interactable; + resizable(options: {[key: string]: any}): Interactable; + restrict(): Restrict; + restrict(newValue: Restrict): Interactable; + set(options: {[key: string]: any}): Interactable; + // returns boolean or {[key: string]: any} + snap(): any; + snap(options: boolean): Interactable; + snap(options: {[key: string]: any}): Interactable; + squareResize(): boolean; + squareResize(newValue: boolean): Interactable; + styleCursor(): boolean; + styleCursor(newValue: boolean): Interactable; + unset(): InteractStatic; + validateSetting(context: string, option: string, value: any): any; + } + + interface Coordinates { + clientX: number; + clientY: number; + pageX: number; + pageY: number; + timeStamp: number; + } + + interface Debug { + target: any; + dragging: any; + resizing: any; + gesturing: any; + prepared: any; + + prevCoords: Coordinates; + downCoords: Coordinates; + + pointerIds: any[]; + pointerMoves: any[]; + addPointer: any; + removePointer: any; + recordPointers: any; + + inertia: InertiaStatus; + + downTime: any; + downEvent: any; + prevEvent: any; + + Interactable: any; + IOptions: any; + interactables: any; + dropzones: any; + pointerIsDown: any; + defaultOptions: any; + defaultActionChecker: any; + + actions: any; + dragMove: any; + resizeMove: any; + gestureMove: any; + pointerUp: any; + pointerDown: any; + pointerMove: any; + pointerHover: any; + + events: any; + globalEvents: any; + delegatedEvents: any; + } + + interface InertiaStatus { + active: boolean; + target: any; + targetElement: any; + + startEvent: any; + pointerUp: any + + xe: number; + ye: number; + duration: number; + + t0: number; + vx0: number; + vys: number; + + lambda_v0: number; + one_ve_v0: number; + i: any; + } + + interface Point { + x: number; + y: number; + } + + // value types are either ClientRect or Element + interface Restrict { + drag?: any; + gesture?: any; + resize?: any; + elementRect?: {[direction: string]: number}; + } + + interface InteractEvent { + altKey: boolean; + axes: string; + button: number + clientX0: number; + clientX: number + clientY0: number; + clientY: number + ctrlKey: boolean + dt: number; + duration: number; + dx: number; + dy: number; + metaKey: boolean; + pageX: number; + pageY: number; + shiftKey: boolean; + speed: number; + t0: number; + target: any; + timeStamp: number; + type: string; + velocityX: number; + velocityY: number; + x0: number; + y0: number; + } + + interface TouchEvent { + pageX: number; + pageY: number; + type: string; + } + + interface InteractStatic { + (element: HTMLElement): Interactable; + (element: SVGElement): Interactable; + (element: string): Interactable; + // returns boolean or {[key: string]: any} + autoScroll(): any; + autoScroll(options: boolean): InteractStatic; + autoScroll(options: {[key: string]: any}): InteractStatic; + currentAction(): string + debug(): Debug; + deltaSource(): string; + // "page" and "client" are the valid parameters + deltaSource(newValue: string): InteractStatic; + dynamicDrop(): boolean; + dynamicDrop(newValue: boolean): InteractStatic; + enableDragging(): boolean; + enableDragging(newValue: boolean): InteractStatic; + enableGesturing(): boolean; + enableGesturing(newValue: boolean): InteractStatic; + enableResizing(): boolean; + enableResizing(newValue: boolean): InteractStatic; + // returns boolean or {[key: string]: any} + inertia(): any; + inertia(options: boolean): InteractStatic; + inertia(options: {[key: string]: any}): InteractStatic; + isSet(element: Element): boolean; + margin(): number; + margin(newvalue: number): InteractStatic; + off(type: string, listener: Function, useCapture?: boolean): InteractStatic; + on(type: string, listener: Function, useCapture?: boolean): InteractStatic; + restrict(): Restrict; + restrict(newValue: Restrict): InteractStatic; + simulate(action: string, element: Element, pointerEvent?: any): InteractStatic; + // returns boolean or {[key: string]: any} + snap(): any; + snap(options: boolean): InteractStatic; + snap(options: {[key: string]: any}): InteractStatic; + stop(event: Event): InteractStatic; + styleCursor(): boolean; + styleCursor(newValue: boolean): InteractStatic; + supportsTouch(): boolean + } } -interface Coordinates { - clientX: number; - clientY: number; - pageX: number; - pageY: number; - timeStamp: number; -} - -interface Debug { - target: any; - dragging: any; - resizing: any; - gesturing: any; - prepared: any; - - prevCoords: Coordinates; - downCoords: Coordinates; - - pointerIds: any[]; - pointerMoves: any[]; - addPointer: any; - removePointer: any; - recordPointers: any; - - inertia: InertiaStatus; - - downTime: any; - downEvent: any; - prevEvent: any; - - Interactable: any; - IOptions: any; - interactables: any; - dropzones: any; - pointerIsDown: any; - defaultOptions: any; - defaultActionChecker: any; - - actions: any; - dragMove: any; - resizeMove: any; - gestureMove: any; - pointerUp: any; - pointerDown: any; - pointerMove: any; - pointerHover: any; - - events: any; - globalEvents: any; - delegatedEvents: any; -} - -interface InertiaStatus { - active: boolean; - target: any; - targetElement: any; - - startEvent: any; - pointerUp: any - - xe: number; - ye: number; - duration: number; - - t0: number; - vx0: number; - vys: number; - - lambda_v0: number; - one_ve_v0: number; - i: any; -} - -interface Point { - x: number; - y: number; -} - -// value types are either ClientRect or Element -interface Restrict { - drag?: any; - gesture?: any; - resize?: any; - elementRect?: {[direction: string]: number}; -} - -interface InteractEvent { - altKey: boolean; - axes: string; - button: number - clientX0: number; - clientX: number - clientY0: number; - clientY: number - ctrlKey: boolean - dt: number; - duration: number; - dx: number; - dy: number; - metaKey: boolean; - pageX: number; - pageY: number; - shiftKey: boolean; - speed: number; - t0: number; - target: any; - timeStamp: number; - type: string; - velocityX: number; - velocityY: number; - x0: number; - y0: number; -} - -interface TouchEvent { - changedTouches: any[]; - pageX: number; - pageY: number; - touches: any[]; - type: string; -} - -interface InteractStatic { - (element: HTMLElement): Interactable; - (element: SVGElement): Interactable; - (element: string): Interactable; - // returns boolean or {[key: string]: any} - autoScroll(): any; - autoScroll(options: boolean): InteractStatic; - autoScroll(options: {[key: string]: any}): InteractStatic; - currentAction(): string - debug(): Debug; - deltaSource(): string; - // "page" and "client" are the valid parameters - deltaSource(newValue: string): InteractStatic; - dynamicDrop(): boolean; - dynamicDrop(newValue: boolean): InteractStatic; - enableDragging(): boolean; - enableDragging(newValue: boolean): InteractStatic; - enableGesturing(): boolean; - enableGesturing(newValue: boolean): InteractStatic; - enableResizing(): boolean; - enableResizing(newValue: boolean): InteractStatic; - // returns boolean or {[key: string]: any} - inertia(): any; - inertia(options: boolean): InteractStatic; - inertia(options: {[key: string]: any}): InteractStatic; - isSet(element: Element): boolean; - margin(): number; - margin(newvalue: number): InteractStatic; - off(type: string, listener: Function, useCapture?: boolean): InteractStatic; - on(type: string, listener: Function, useCapture?: boolean): InteractStatic; - restrict(): Restrict; - restrict(newValue: Restrict): InteractStatic; - simulate(action: string, element: Element, pointerEvent?: any): InteractStatic; - // returns boolean or {[key: string]: any} - snap(): any; - snap(options: boolean): InteractStatic; - snap(options: {[key: string]: any}): InteractStatic; - stop(event: Event): InteractStatic; - styleCursor(): boolean; - styleCursor(newValue: boolean): InteractStatic; - supportsTouch(): boolean -} - -declare var interact: InteractStatic; +declare var interact: Interact.InteractStatic; declare module "interact" { export = interact; From 92c408d7d8f7bf7d91f6e494a589362cc3a2316c Mon Sep 17 00:00:00 2001 From: Daniel Beckwith Date: Fri, 22 May 2015 16:55:48 -0400 Subject: [PATCH 269/534] Added bootstrap-slider --- bootstrap-slider/bootstrap-slider-tests.ts | 120 +++++++++++++ bootstrap-slider/bootstrap-slider.d.ts | 200 +++++++++++++++++++++ 2 files changed, 320 insertions(+) create mode 100644 bootstrap-slider/bootstrap-slider-tests.ts create mode 100644 bootstrap-slider/bootstrap-slider.d.ts diff --git a/bootstrap-slider/bootstrap-slider-tests.ts b/bootstrap-slider/bootstrap-slider-tests.ts new file mode 100644 index 000000000..0524323e0 --- /dev/null +++ b/bootstrap-slider/bootstrap-slider-tests.ts @@ -0,0 +1,120 @@ +/// +/// + +$(function() { + // examples from http://seiyria.github.io/bootstrap-slider/ + + $('#ex1').slider({ + formatter: function(value) { + return 'Current value: ' + value; + } + }); + + + + $("#ex2").slider({}); + + var RGBChange = function() { + $('#RGB').css('background', 'rgb('+r.getValue()+','+g.getValue()+','+b.getValue()+')') + }; + + var r = $('#R').slider() + .on('slide', RGBChange) + .data('slider'); + var g = $('#G').slider() + .on('slide', RGBChange) + .data('slider'); + var b = $('#B').slider() + .on('slide', RGBChange) + .data('slider'); + + + + $("#ex4").slider({ + reversed : true + }); + + + + $("#ex5").slider(); + + $("#destroyEx5Slider").click(function() { + $("#ex5").slider('destroy'); + }); + + + + $("#ex6").slider(); + $("#ex6").on("slide", function(slideEvt) { + $("#ex6SliderVal").text(slideEvt.value); + }); + + + + $("#ex7").slider(); + + $("#ex7-enabled").click(function() { + if(this.checked) { + // With JQuery + $("#ex7").slider("enable"); + } + else { + // With JQuery + $("#ex7").slider("disable"); + } + }); + + + + $("#ex8").slider({ + tooltip: 'always' + }); + + + + $("#ex9").slider({ + precision: 2, + value: 8.115 // Slider will instantiate showing 8.12 due to specified precision + }); + + + + $("#ex11").slider({step: 20000, min: 0, max: 200000}); + + + + $("#ex12a").slider({ id: "slider12a", min: 0, max: 10, value: 5 }); + $("#ex12b").slider({ id: "slider12b", min: 0, max: 10, range: true, value: [3, 7] }); + $("#ex12c").slider({ id: "slider12c", min: 0, max: 10, range: true, value: [3, 7] }); + + + + $("#ex13").slider({ + ticks: [0, 100, 200, 300, 400], + ticks_labels: ['$0', '$100', '$200', '$300', '$400'], + ticks_snap_bounds: 30 + }); + + + + $("#ex14").slider({ + ticks: [0, 100, 200, 300, 400], + ticks_positions: [0, 30, 60, 70, 90, 100], + ticks_labels: ['$0', '$100', '$200', '$300', '$400'], + ticks_snap_bounds: 30 + }); + + + + $("#ex15").slider({ + min: 1000, + max: 10000000, + scale: 'logarithmic', + step: 10 + }); + + + + $("#ex16a").slider({ min: 0, max: 10, value: 0, focus: true }); + $("#ex16b").slider({ min: 0, max: 10, value: [0, 10], focus: true }); +}); diff --git a/bootstrap-slider/bootstrap-slider.d.ts b/bootstrap-slider/bootstrap-slider.d.ts new file mode 100644 index 000000000..e92e2fae2 --- /dev/null +++ b/bootstrap-slider/bootstrap-slider.d.ts @@ -0,0 +1,200 @@ +// Type definitions for bootstrap-slider.js 4.8.3 +// Project: https://github.com/seiyria/bootstrap-slider +// Definitions by: Daniel Beckwith +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface SliderOptions { + /** + * Default: '' + * set the id of the slider element when it's created + */ + id?: string; + /** + * Default: 0 + * minimum possible value + */ + min?: number; + /** + * Default: 10 + * maximum possible value + */ + max?: number; + /** + * Default: 1 + * increment step + */ + step?: number; + /** + * Default: number of digits after the decimal of step value + * The number of digits shown after the decimal. Defaults to the number of digits after the decimal of step value. + */ + precision?: number; + /** + * Default: 'horizontal' + * set the orientation. Accepts 'vertical' or 'horizontal' + */ + orientation?: number; + /** + * Default: 5 + * initial value. Use array to have a range slider. + */ + value?: number|number[]; + /** + * Default: false + * make range slider. Optional if initial value is an array. If initial value is scalar, max will be used for second value. + */ + range?: boolean; + /** + * Default: 'before' + * selection placement. Accepts: 'before', 'after' or 'none'. In case of a range slider, the selection will be placed between the handles + */ + selection?: string; + /** + * Default: 'show' + * whether to show the tooltip on drag, hide the tooltip, or always show the tooltip. Accepts: 'show', 'hide', or 'always' + */ + tooltip?: string; + /** + * Default: false + * if false show one tootip if true show two tooltips one for each handler + */ + tooltip_split?: boolean; + /** + * Default: 'round' + * handle shape. Accepts: 'round', 'square', 'triangle' or 'custom' + */ + handle?: string; + /** + * Default: false + * whether or not the slider should be reversed + */ + reversed?: boolean; + /** + * Default: true + * whether or not the slider is initially enabled + */ + enabled?: boolean; + /** + * Default: returns the plain value + * formatter callback. Return the value wanted to be displayed in the tooltip + * @param number the current value to display + */ + formatter?(number): string; + /** + * Default: false + * The natural order is used for the arrow keys. Arrow up select the upper slider value for vertical sliders, arrow right the righter slider value for a horizontal slider - no matter if the slider was reversed or not. By default the arrow keys are oriented by arrow up/right to the higher slider value, arrow down/left to the lower slider value. + */ + natural_arrow_keys?: boolean; + /** + * Default: [ ] + * Used to define the values of ticks. Tick marks are indicators to denote special values in the range. This option overwrites min and max options. + */ + ticks?: number[]; + /** + * Default: [ ] + * Defines the positions of the tick values in percentages. The first value should alwasy be 0, the last value should always be 100 percent. + */ + ticks_positions?: number[]; + /** + * Default: [ ] + * Defines the labels below the tick marks. Accepts HTML input. + */ + ticks_labels?: number[]; + /** + * Default: 0 + * Used to define the snap bounds of a tick. Snaps to the tick if value is within these bounds. + */ + ticks_snap_bounds?: number; + /** + * Default: 'linear' + * Set to 'logarithmic' to use a logarithmic scale. + */ + scale?: string; + /** + * Default: false + * Focus the appropriate slider handle after a value change. + */ + focus?: boolean; +} + +interface JQuery { + /** + * Creates a slider from the current element. + * @param options + */ + slider(options?:SliderOptions): JQuery; + slider(methodName:string, ...args:any[]): JQuery; +} + +interface ChangeValue { + oldValue: number; + newValue: number; +} + +interface JQueryEventObject { + value: number|ChangeValue; +} + +/** + * This class is actually not used when using the jQuery version of bootstrap-slider + * The method documentation is still here thouh. + * When using jQuery, slider methods like setValue(3, true) have to be called like $slider.slider('setValue', 3, true) + */ +interface Slider extends JQuery { + /** + * Get the current value from the slider + */ + getValue(): number; + /** + * Set a new value for the slider. If optional triggerSlideEvent parameter is true, 'slide' events will be triggered. If optional triggerChangeEvent parameter is true, 'change' events will be triggered. + * @param newValue + * @param triggerSlideEvent + * @param triggerChangeEvent + */ + setValue(newValue:number, triggerSlideEvent?:boolean, triggerChangeEvent?:boolean): void; + /** + * Properly clean up and remove the slider instance + */ + destroy(): void; + /** + * Disables the slider and prevents the user from changing the value + */ + disable(): void; + /** + * Enables the slider + */ + enable(): void; + /** + * Returns true if enabled, false if disabled + */ + isEnabled(): boolean; + /** + * Updates the slider's attributes + * @param attribute + * @param value + */ + setAttribute(attribute:string, value:any): void; + /** + * Get the slider's attributes + * @param attribute + */ + getAttribute(attribute:string): any; + /** + * Refreshes the current slider + */ + refresh(): void; + /** + * Renders the tooltip again, after initialization. Useful in situations when the slider and tooltip are initially hidden. + */ + relayout(): void; + on: { + (eventType:string, callback:(eventObject:JQueryEventObject, ...args:any[]) => any): Slider; + (eventType:string, data:any, callback:(eventObject:JQueryEventObject, ...args:any[]) => any): Slider; + (eventType:string, selector:string, callback:(eventObject:JQueryEventObject, ...eventData:any[]) => any): Slider; + (eventType:string, selector:string, data:any, callback:(eventObject:JQueryEventObject, ...eventData:any[]) => any): Slider; + (eventType:{ [key: string]: any; }, selector?:string, data?:any): Slider; + (eventType:{ [key: string]: any; }, data?:any): Slider; + } +} From 7e901c0f96d50cc6ae1de5391f60cad03385565c Mon Sep 17 00:00:00 2001 From: Daniel Beckwith Date: Fri, 22 May 2015 17:05:12 -0400 Subject: [PATCH 270/534] Fixed build errors. --- bootstrap-slider/bootstrap-slider-tests.ts | 2 +- bootstrap-slider/bootstrap-slider.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap-slider/bootstrap-slider-tests.ts b/bootstrap-slider/bootstrap-slider-tests.ts index 0524323e0..548d909a6 100644 --- a/bootstrap-slider/bootstrap-slider-tests.ts +++ b/bootstrap-slider/bootstrap-slider-tests.ts @@ -46,7 +46,7 @@ $(function() { $("#ex6").slider(); $("#ex6").on("slide", function(slideEvt) { - $("#ex6SliderVal").text(slideEvt.value); + $("#ex6SliderVal").text(slideEvt.value); }); diff --git a/bootstrap-slider/bootstrap-slider.d.ts b/bootstrap-slider/bootstrap-slider.d.ts index e92e2fae2..78aeb645c 100644 --- a/bootstrap-slider/bootstrap-slider.d.ts +++ b/bootstrap-slider/bootstrap-slider.d.ts @@ -79,9 +79,9 @@ interface SliderOptions { /** * Default: returns the plain value * formatter callback. Return the value wanted to be displayed in the tooltip - * @param number the current value to display + * @param val the current value to display */ - formatter?(number): string; + formatter?(val:number): string; /** * Default: false * The natural order is used for the arrow keys. Arrow up select the upper slider value for vertical sliders, arrow right the righter slider value for a horizontal slider - no matter if the slider was reversed or not. By default the arrow keys are oriented by arrow up/right to the higher slider value, arrow down/left to the lower slider value. @@ -101,7 +101,7 @@ interface SliderOptions { * Default: [ ] * Defines the labels below the tick marks. Accepts HTML input. */ - ticks_labels?: number[]; + ticks_labels?: string[]; /** * Default: 0 * Used to define the snap bounds of a tick. Snaps to the tick if value is within these bounds. From d930a8fc40d653b1c48a89538f45d9c645d87f28 Mon Sep 17 00:00:00 2001 From: cherrydev Date: Fri, 22 May 2015 17:26:33 -0700 Subject: [PATCH 271/534] Add strictDi() to angular.mocks.inject --- angularjs/angular-mocks.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts index db551ee3d..1e412cb8c 100644 --- a/angularjs/angular-mocks.d.ts +++ b/angularjs/angular-mocks.d.ts @@ -39,8 +39,11 @@ declare module angular { dump(obj: any): string; // see http://docs.angularjs.org/api/angular.mock.inject - inject(...fns: Function[]): any; - inject(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works + inject: { + (...fns: Function[]): any; + (...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works + strictDi(val: boolean): void; + } // see http://docs.angularjs.org/api/angular.mock.module module(...modules: any[]): any; From e3e6c4d8fee264dbdfb6d28a75dc2a1b1083fad7 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 00:57:06 -0300 Subject: [PATCH 272/534] Added Zynga Scroller library --- zynga-scroller/zynga-scroller-tests.ts | 36 +++++++++++++++++++ zynga-scroller/zynga-scroller.ts | 49 ++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 zynga-scroller/zynga-scroller-tests.ts create mode 100644 zynga-scroller/zynga-scroller.ts diff --git a/zynga-scroller/zynga-scroller-tests.ts b/zynga-scroller/zynga-scroller-tests.ts new file mode 100644 index 000000000..575c8f3fc --- /dev/null +++ b/zynga-scroller/zynga-scroller-tests.ts @@ -0,0 +1,36 @@ +/// + +var scroller: Scroller = new Scroller((left, top, zoom) => { }); +scroller = new Scroller((left, top, zoom) => { }, { + scrollingX: true, + scrollingY: true, + animating: true, + animationDuration: 400, + bouncing: false, + locking: false, + paging: false, + snapping: true, + zooming: 10, + minZoom: 1, + maxZoom: 2, +}); + +scroller.setDimensions(10, 10, 10, 10); +scroller.setPosition(200, 300); +scroller.setSnapSize(300, 300); +scroller.activatePullToRefresh(200, () => { }, () => { }, () => { }); +scroller.finishPullToRefresh(); +var data: { + left: number, + top: number, + zoom: number +} = scroller.getValues(); +scroller.zoomTo(10); +scroller.zoomBy(10); +scroller.doMouseZoom(10, 10, 10, 10); +scroller.doTouchStart({ + pageX: 10, + pageY: 20 +}, 200); +scroller.doTouchMove([10], 200); +scroller.doTouchEnd(300); \ No newline at end of file diff --git a/zynga-scroller/zynga-scroller.ts b/zynga-scroller/zynga-scroller.ts new file mode 100644 index 000000000..9e1e4bb92 --- /dev/null +++ b/zynga-scroller/zynga-scroller.ts @@ -0,0 +1,49 @@ +// Type definitions for Zynga Scroller +// Definitions by: Marcelo Haskell Camargo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class Scroller { + constructor(a: (left: number, top: number, zoom: number) => void, b?: { + scrollingX?: boolean, + scrollingY?: boolean, + animating?: boolean, + animationDuration?: number, + bouncing?: boolean, + locking?: boolean, + paging?: boolean, + snapping?: boolean, + zooming?: number, + minZoom?: number, + maxZoom?: number + }); + setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, + contentHeight: number): void; + setPosition(clientLeft: number, clientTop: number): void; + setSnapSize(width: number, height: number); + activatePullToRefresh(height: number, activate: () => void, + deactivate: () => void, start: () => void); + finishPullToRefresh(): void; + getValues(): { + left: number, + top: number, + zoom: number + }; + zoomTo(level: number, animate?: boolean, originLeft?: number, + originTop?: number): void; + zoomBy(factor: number, animate?: boolean, originLeft?:number, + originTop?: number): void; + scrollTo(left: number, top: number, animate?: boolean): void; + scrollBy(leftOffset: number, topOffset: number, animate?: boolean): void; + doMouseZoom(wheelData: number, timeStamp: number, pageX: number, + pageY: number): void; + doTouchStart(touches: { + pageX: number, + pageY: number, + }, timeStamp: number): void; + doTouchMove(touches: { + pageX: number, + pageY: number, + }, timeStamp: number, scale?: number): void; + doTouchMove(touches: [any], timeStamp: number); + doTouchEnd(timeStamp: number): void; +} \ No newline at end of file From 4e88cdc797a21e9fb260a949a779e78e773306c3 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:10:36 -0300 Subject: [PATCH 273/534] Fixed issue in filename to pass on Travis --- zynga-scroller/zynga-scroller.d.ts | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 zynga-scroller/zynga-scroller.d.ts diff --git a/zynga-scroller/zynga-scroller.d.ts b/zynga-scroller/zynga-scroller.d.ts new file mode 100644 index 000000000..9e1e4bb92 --- /dev/null +++ b/zynga-scroller/zynga-scroller.d.ts @@ -0,0 +1,49 @@ +// Type definitions for Zynga Scroller +// Definitions by: Marcelo Haskell Camargo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class Scroller { + constructor(a: (left: number, top: number, zoom: number) => void, b?: { + scrollingX?: boolean, + scrollingY?: boolean, + animating?: boolean, + animationDuration?: number, + bouncing?: boolean, + locking?: boolean, + paging?: boolean, + snapping?: boolean, + zooming?: number, + minZoom?: number, + maxZoom?: number + }); + setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, + contentHeight: number): void; + setPosition(clientLeft: number, clientTop: number): void; + setSnapSize(width: number, height: number); + activatePullToRefresh(height: number, activate: () => void, + deactivate: () => void, start: () => void); + finishPullToRefresh(): void; + getValues(): { + left: number, + top: number, + zoom: number + }; + zoomTo(level: number, animate?: boolean, originLeft?: number, + originTop?: number): void; + zoomBy(factor: number, animate?: boolean, originLeft?:number, + originTop?: number): void; + scrollTo(left: number, top: number, animate?: boolean): void; + scrollBy(leftOffset: number, topOffset: number, animate?: boolean): void; + doMouseZoom(wheelData: number, timeStamp: number, pageX: number, + pageY: number): void; + doTouchStart(touches: { + pageX: number, + pageY: number, + }, timeStamp: number): void; + doTouchMove(touches: { + pageX: number, + pageY: number, + }, timeStamp: number, scale?: number): void; + doTouchMove(touches: [any], timeStamp: number); + doTouchEnd(timeStamp: number): void; +} \ No newline at end of file From 6f02b8773fc194bcfdc0b583b76330e0f566cb10 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:16:51 -0300 Subject: [PATCH 274/534] Fixed issue with semicolons --- zynga-scroller/zynga-scroller.ts | 49 -------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 zynga-scroller/zynga-scroller.ts diff --git a/zynga-scroller/zynga-scroller.ts b/zynga-scroller/zynga-scroller.ts deleted file mode 100644 index 9e1e4bb92..000000000 --- a/zynga-scroller/zynga-scroller.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Type definitions for Zynga Scroller -// Definitions by: Marcelo Haskell Camargo -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -declare class Scroller { - constructor(a: (left: number, top: number, zoom: number) => void, b?: { - scrollingX?: boolean, - scrollingY?: boolean, - animating?: boolean, - animationDuration?: number, - bouncing?: boolean, - locking?: boolean, - paging?: boolean, - snapping?: boolean, - zooming?: number, - minZoom?: number, - maxZoom?: number - }); - setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, - contentHeight: number): void; - setPosition(clientLeft: number, clientTop: number): void; - setSnapSize(width: number, height: number); - activatePullToRefresh(height: number, activate: () => void, - deactivate: () => void, start: () => void); - finishPullToRefresh(): void; - getValues(): { - left: number, - top: number, - zoom: number - }; - zoomTo(level: number, animate?: boolean, originLeft?: number, - originTop?: number): void; - zoomBy(factor: number, animate?: boolean, originLeft?:number, - originTop?: number): void; - scrollTo(left: number, top: number, animate?: boolean): void; - scrollBy(leftOffset: number, topOffset: number, animate?: boolean): void; - doMouseZoom(wheelData: number, timeStamp: number, pageX: number, - pageY: number): void; - doTouchStart(touches: { - pageX: number, - pageY: number, - }, timeStamp: number): void; - doTouchMove(touches: { - pageX: number, - pageY: number, - }, timeStamp: number, scale?: number): void; - doTouchMove(touches: [any], timeStamp: number); - doTouchEnd(timeStamp: number): void; -} \ No newline at end of file From d83732dc9e6e3ea81b68f019e3621e761f4a6019 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:17:23 -0300 Subject: [PATCH 275/534] Fixed issue with semicolons --- zynga-scroller/zynga-scroller.d.ts | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/zynga-scroller/zynga-scroller.d.ts b/zynga-scroller/zynga-scroller.d.ts index 9e1e4bb92..7d1f6dfa1 100644 --- a/zynga-scroller/zynga-scroller.d.ts +++ b/zynga-scroller/zynga-scroller.d.ts @@ -4,45 +4,45 @@ declare class Scroller { constructor(a: (left: number, top: number, zoom: number) => void, b?: { - scrollingX?: boolean, - scrollingY?: boolean, - animating?: boolean, - animationDuration?: number, - bouncing?: boolean, - locking?: boolean, - paging?: boolean, - snapping?: boolean, - zooming?: number, - minZoom?: number, + scrollingX?: boolean; + scrollingY?: boolean; + animating?: boolean; + animationDuration?: number; + bouncing?: boolean; + locking?: boolean; + paging?: boolean; + snapping?: boolean; + zooming?: number; + minZoom?: number; maxZoom?: number }); setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, - contentHeight: number): void; + contentHeight: number): void; setPosition(clientLeft: number, clientTop: number): void; setSnapSize(width: number, height: number); activatePullToRefresh(height: number, activate: () => void, - deactivate: () => void, start: () => void); + deactivate: () => void, start: () => void); finishPullToRefresh(): void; getValues(): { - left: number, - top: number, + left: number; + top: number; zoom: number }; zoomTo(level: number, animate?: boolean, originLeft?: number, originTop?: number): void; - zoomBy(factor: number, animate?: boolean, originLeft?:number, + zoomBy(factor: number, animate?: boolean, originLeft?: number, originTop?: number): void; scrollTo(left: number, top: number, animate?: boolean): void; scrollBy(leftOffset: number, topOffset: number, animate?: boolean): void; doMouseZoom(wheelData: number, timeStamp: number, pageX: number, pageY: number): void; doTouchStart(touches: { - pageX: number, - pageY: number, + pageX: number; + pageY: number }, timeStamp: number): void; doTouchMove(touches: { - pageX: number, - pageY: number, + pageX: number; + pageY: number }, timeStamp: number, scale?: number): void; doTouchMove(touches: [any], timeStamp: number); doTouchEnd(timeStamp: number): void; From 0983e639167136453c52d573117290946d090886 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:18:17 -0300 Subject: [PATCH 276/534] Fixed issue with semicolons in tests --- zynga-scroller/zynga-scroller-tests.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/zynga-scroller/zynga-scroller-tests.ts b/zynga-scroller/zynga-scroller-tests.ts index 575c8f3fc..f888bf64c 100644 --- a/zynga-scroller/zynga-scroller-tests.ts +++ b/zynga-scroller/zynga-scroller-tests.ts @@ -2,17 +2,17 @@ var scroller: Scroller = new Scroller((left, top, zoom) => { }); scroller = new Scroller((left, top, zoom) => { }, { - scrollingX: true, - scrollingY: true, - animating: true, - animationDuration: 400, - bouncing: false, - locking: false, - paging: false, - snapping: true, - zooming: 10, - minZoom: 1, - maxZoom: 2, + scrollingX: true; + scrollingY: true; + animating: true; + animationDuration: 400; + bouncing: false; + locking: false; + paging: false; + snapping: true; + zooming: 10; + minZoom: 1; + maxZoom: 2 }); scroller.setDimensions(10, 10, 10, 10); @@ -21,8 +21,8 @@ scroller.setSnapSize(300, 300); scroller.activatePullToRefresh(200, () => { }, () => { }, () => { }); scroller.finishPullToRefresh(); var data: { - left: number, - top: number, + left: number; + top: number; zoom: number } = scroller.getValues(); scroller.zoomTo(10); From cf984a7d53f1618be1439599d6e7e6ddd1003a06 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:22:22 -0300 Subject: [PATCH 277/534] Added project annotation and explicit return --- zynga-scroller/zynga-scroller-tests.ts | 20 ++++++++++---------- zynga-scroller/zynga-scroller.d.ts | 7 ++++--- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/zynga-scroller/zynga-scroller-tests.ts b/zynga-scroller/zynga-scroller-tests.ts index f888bf64c..412765671 100644 --- a/zynga-scroller/zynga-scroller-tests.ts +++ b/zynga-scroller/zynga-scroller-tests.ts @@ -2,16 +2,16 @@ var scroller: Scroller = new Scroller((left, top, zoom) => { }); scroller = new Scroller((left, top, zoom) => { }, { - scrollingX: true; - scrollingY: true; - animating: true; - animationDuration: 400; - bouncing: false; - locking: false; - paging: false; - snapping: true; - zooming: 10; - minZoom: 1; + scrollingX: true, + scrollingY: true, + animating: true, + animationDuration: 400, + bouncing: false, + locking: false, + paging: false, + snapping: true, + zooming: 10, + minZoom: 1, maxZoom: 2 }); diff --git a/zynga-scroller/zynga-scroller.d.ts b/zynga-scroller/zynga-scroller.d.ts index 7d1f6dfa1..f4b9501ed 100644 --- a/zynga-scroller/zynga-scroller.d.ts +++ b/zynga-scroller/zynga-scroller.d.ts @@ -1,4 +1,5 @@ // Type definitions for Zynga Scroller +// Project: Zynga Scroller // Definitions by: Marcelo Haskell Camargo // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -19,9 +20,9 @@ declare class Scroller { setDimensions(clientWidth: number, clientHeight: number, contentWidth: number, contentHeight: number): void; setPosition(clientLeft: number, clientTop: number): void; - setSnapSize(width: number, height: number); + setSnapSize(width: number, height: number): void; activatePullToRefresh(height: number, activate: () => void, - deactivate: () => void, start: () => void); + deactivate: () => void, start: () => void): void; finishPullToRefresh(): void; getValues(): { left: number; @@ -44,6 +45,6 @@ declare class Scroller { pageX: number; pageY: number }, timeStamp: number, scale?: number): void; - doTouchMove(touches: [any], timeStamp: number); + doTouchMove(touches: [any], timeStamp: number): void; doTouchEnd(timeStamp: number): void; } \ No newline at end of file From 9796c3973d9fbbd214142ec3da32f952ab9dfd74 Mon Sep 17 00:00:00 2001 From: Haskell Camargo Date: Sat, 23 May 2015 01:24:25 -0300 Subject: [PATCH 278/534] Added URL to project label --- zynga-scroller/zynga-scroller.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zynga-scroller/zynga-scroller.d.ts b/zynga-scroller/zynga-scroller.d.ts index f4b9501ed..04b82b577 100644 --- a/zynga-scroller/zynga-scroller.d.ts +++ b/zynga-scroller/zynga-scroller.d.ts @@ -1,5 +1,5 @@ // Type definitions for Zynga Scroller -// Project: Zynga Scroller +// Project: http://zynga.github.com/scroller/ // Definitions by: Marcelo Haskell Camargo // Definitions: https://github.com/borisyankov/DefinitelyTyped From 978b3e6c748257e4d25c7fa8b9aab2531eb3852f Mon Sep 17 00:00:00 2001 From: Markus Peloso Date: Sat, 23 May 2015 11:41:46 +0200 Subject: [PATCH 279/534] Update type definitons to SweetAlert 1.0.1 --- sweetalert/sweetalert-tests.ts | 8 ++++++-- sweetalert/sweetalert.d.ts | 10 ++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/sweetalert/sweetalert-tests.ts b/sweetalert/sweetalert-tests.ts index 9523bc010..ca0faacbf 100644 --- a/sweetalert/sweetalert-tests.ts +++ b/sweetalert/sweetalert-tests.ts @@ -63,7 +63,10 @@ swal({ text: "I will close in 2 seconds.", timer: 2000, showConfirmButton: false -}); +}, + function () { + swal("Time Out!", "The time is out of joint.", "success"); + }); // A replacement for the "prompt" function swal({ @@ -73,7 +76,8 @@ swal({ showCancelButton: true, closeOnConfirm: false, animation: "slide-from-top", - inputPlaceholder: "Write something" + inputPlaceholder: "Write something plx", + inputValue: "Write something" }, function (inputValue) { if (inputValue === false) return false; diff --git a/sweetalert/sweetalert.d.ts b/sweetalert/sweetalert.d.ts index 108e2b906..61b643c32 100644 --- a/sweetalert/sweetalert.d.ts +++ b/sweetalert/sweetalert.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SweetAlert 1.0.0-beta +// Type definitions for SweetAlert 1.0.1 // Project: https://github.com/t4t5/sweetalert/ // Definitions by: Markus Peloso // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -97,7 +97,7 @@ declare module SweetAlert { imageSize?: string; /** - * Auto close timer of the modal.Set in ms (milliseconds). + * Auto close timer of the modal. Set in ms (milliseconds). * Default: null */ timer?: number; @@ -125,6 +125,12 @@ declare module SweetAlert { * Default: null */ inputPlaceholder?: string; + + /** + * Specify a default text value that you want your input to show when using type: "input" + * Default: null + */ + inputValue?: string; } interface Settings extends SettingsBase { From 8caaea8d482f2da0834fd5d249fddcd728c9ce63 Mon Sep 17 00:00:00 2001 From: Michael Zabka Date: Sat, 23 May 2015 14:12:24 +0200 Subject: [PATCH 280/534] Fix numeric properties of node-each object --- each/each-tests.ts | 6 +++--- each/each.d.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/each/each-tests.ts b/each/each-tests.ts index 370e6ac39..4b07c694d 100644 --- a/each/each-tests.ts +++ b/each/each-tests.ts @@ -6,9 +6,9 @@ function testEach() { return { paused: true, readable: false, - started: true, - done: true, - total: true, + started: 11, + done: 12, + total: 22, on: function (eventName: string, cb: (a: any, b?: () => void) => void) { return EachStaticClass([]); }, diff --git a/each/each.d.ts b/each/each.d.ts index 65d0a3f9d..0e9b900dc 100644 --- a/each/each.d.ts +++ b/each/each.d.ts @@ -6,9 +6,9 @@ interface Each { paused: boolean; readable: boolean; - started: boolean; - done: boolean; - total: boolean; + started: number; + done: number; + total: number; on(eventName: string, onCallback: Function): Each; on(eventName: "item", onItem: (item: any, next: (error?: Error) => void) => void): Each; on(eventName: "error", onError: (error: Error[]) => void): Each; @@ -36,4 +36,4 @@ declare var each: EachStatic; declare module "each" { export = each; -} \ No newline at end of file +} From 7d5e63e281dfdf0405bacd8efcdc251feae8baca Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Fri, 22 May 2015 03:54:12 -0400 Subject: [PATCH 281/534] Add typings for raygun4js --- raygun4js/raygun4js-tests.ts | 48 ++++++++++++++++++ raygun4js/raygun4js.d.ts | 97 ++++++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 raygun4js/raygun4js-tests.ts create mode 100644 raygun4js/raygun4js.d.ts diff --git a/raygun4js/raygun4js-tests.ts b/raygun4js/raygun4js-tests.ts new file mode 100644 index 000000000..56577765c --- /dev/null +++ b/raygun4js/raygun4js-tests.ts @@ -0,0 +1,48 @@ +/// + +var client: raygun.RaygunStatic = Raygun.noConflict(); + +var newClient: raygun.RaygunStatic = client.constructNewRaygun(); + +client.init('api-key'); +client.init('api-key', { allowInsecureSubmissions: true }); +client.init('api-key', { allowInsecureSubmissions: true }, { some: 'data' }); + +client.withCustomData({ some: 'data' }); + +client.withTags(['tag1', 'tag2']); + +client.attach().detach(); + +client.send(new Error('a error')); +client.send(new Error('a error'), ['tag1', 'tag2']); + +try { + throw new Error('oops'); +} +catch (e) { + client.send(e); +} + +client.setUser('username'); +client.setUser('username', true); +client.setUser('username', false, 'user@email.com', 'Robbie Robot'); +client.setUser('username', false, 'user@email.com', 'Robbie Robot', 'Robbie'); +client.setUser('username', false, 'user@email.com', 'Robbie Robot', 'Robbie', '8ae89fc9-1144-42d6-9629-bf085dab18d2'); + +client.resetAnonymousUser(); + +client.setVersion('1.2.3.4'); + +client.saveIfOffline(true); + +client.filterSensitiveData(['field1', 'field2']); + +client.setFilterScope('all'); + +client.whitelistCrossOriginDomains(['domain1', 'domain2']); + +client.onBeforeSend(payload=> { + payload.OccurredOn = new Date(); + return payload; +}); \ No newline at end of file diff --git a/raygun4js/raygun4js.d.ts b/raygun4js/raygun4js.d.ts new file mode 100644 index 000000000..a3c2feeb4 --- /dev/null +++ b/raygun4js/raygun4js.d.ts @@ -0,0 +1,97 @@ +// Type definitions for raygun4js 1.18.3 +// Project: https://github.com/MindscapeHQ/raygun4js +// Definitions by: Brian Surowiec +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module raygun { + + // https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L533-539 + interface IStackTrace { + LineNumber: number; + ColumnNumber: number; + ClassName: string; + FileName: string; + MethodName: string; + } + + // https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L598-637 + interface IPayload { + OccurredOn: Date; + Details: { + Error: { + ClassName: string; + Message: string; + StackTrace: IStackTrace[]; + }; + Environment: { + UtcOffset: number; + 'User-Language': string; + 'Document-Mode': number; + 'Browser-Width': number; + 'Browser-Height': number; + 'Screen-Width': number; + 'Screen-Height': number; + 'Color-Depth': number; + Browser: string; + 'Browser-Name': string; + 'Browser-Version': string; + Platform: string; + }; + Client: { + Name: string; + Version: string; + }; + UserCustomData: any; + Tags: string[]; + Request: { + Url: string; + QueryString: string; + Headers: { + 'User-Agent': string; + Referer: string; + Host: string; + }; + }; + Version: string; + }; + } + + // https://github.com/MindscapeHQ/raygun4js/blob/c7d8880045214ab6d403d5cc613c207f696a3cdd/src/raygun.js#L61-82 + interface IRaygunOptions { + allowInsecureSubmissions?: boolean; + ignoreAjaxAbort?: boolean; + ignoreAjaxError?: boolean; + disableAnonymousUserTracking?: boolean; + excludedHostnames?: boolean; + excludedUserAgents?: boolean; + wrapAsynchronousCallbacks?: boolean; + debugMode?: boolean; + ignore3rdPartyErrors?: boolean; + } + + interface RaygunStatic { + noConflict(): RaygunStatic; + constructNewRaygun(): RaygunStatic; + init(apiKey: string, options?: IRaygunOptions, customdata?: any): RaygunStatic; + withCustomData(customdata: any): RaygunStatic; + withTags(tags: string[]): RaygunStatic; + attach(): RaygunStatic; + detach(): RaygunStatic; + send(e: Error, customData?: any, tags?: string[]): RaygunStatic; + setUser(user: string, isAnonymous?: boolean, email?: string, fullName?: string, firstName?: string, uuid?: string): RaygunStatic; + resetAnonymousUser(): void; + setVersion(version: string): RaygunStatic; + saveIfOffline(enableOffline: boolean): RaygunStatic; + filterSensitiveData(filteredKeys: string[]): RaygunStatic; + setFilterScope(scope: string): RaygunStatic; + whitelistCrossOriginDomains(whitelist: string[]): RaygunStatic; + onBeforeSend(callback: (payload: IPayload) => IPayload): RaygunStatic; + } + +} + +declare var Raygun: raygun.RaygunStatic; + +declare module 'Raygun' { + export = Raygun; +} \ No newline at end of file From e4ff3c73efd626d2b8887c195451ab61d2d5907f Mon Sep 17 00:00:00 2001 From: Tom Hasner Date: Sun, 24 May 2015 13:18:15 -0400 Subject: [PATCH 282/534] fixing interact tests --- interactjs/interact-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interactjs/interact-tests.ts b/interactjs/interact-tests.ts index b57a02c97..90f43a966 100644 --- a/interactjs/interact-tests.ts +++ b/interactjs/interact-tests.ts @@ -16,9 +16,9 @@ var interactable = interact(button); interactable.draggable(); interactable.draggable(true); interactable.draggable({ - onstart: (event: InteractEvent) => {}, - onmove : (event: InteractEvent) => {}, - onend : (event: InteractEvent) => {} + onstart: (event: Interact.InteractEvent) => {}, + onmove : (event: Interact.InteractEvent) => {}, + onend : (event: Interact.InteractEvent) => {} }); interactable.dropzone(); interactable.dropzone(true); @@ -45,7 +45,7 @@ interactable.inertia({ }); interactable.inertia(true); interactable.actionChecker(); -interactable.actionChecker((event: MouseEvent, defaultAction: string, interactable2: Interactable) => defaultAction); +interactable.actionChecker((event: MouseEvent, defaultAction: string, interactable2: Interact.Interactable) => defaultAction); var rect: ClientRect = interactable.getRect(); interactable.rectChecker(); interactable.styleCursor(); From da4009486dc74e251946c524d86d87b84c767076 Mon Sep 17 00:00:00 2001 From: cherrydev Date: Sun, 24 May 2015 10:21:22 -0700 Subject: [PATCH 283/534] Update angular-mocks.d.ts --- angularjs/angular-mocks.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-mocks.d.ts b/angularjs/angular-mocks.d.ts index 1e412cb8c..1c1966c1b 100644 --- a/angularjs/angular-mocks.d.ts +++ b/angularjs/angular-mocks.d.ts @@ -42,7 +42,7 @@ declare module angular { inject: { (...fns: Function[]): any; (...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works - strictDi(val: boolean): void; + strictDi(val?: boolean): void; } // see http://docs.angularjs.org/api/angular.mock.module From cb587e2dff0c587cc8c72f9358b30a876cf59f62 Mon Sep 17 00:00:00 2001 From: Mathias Rodriguez Date: Fri, 22 May 2015 01:34:39 -0300 Subject: [PATCH 284/534] Add definitions for markerclustererplus. --- .../markerclustererplus-tests.ts | 2217 +++++++++++++++++ markerclustererplus/markerclustererplus.d.ts | 834 +++++++ 2 files changed, 3051 insertions(+) create mode 100644 markerclustererplus/markerclustererplus-tests.ts create mode 100644 markerclustererplus/markerclustererplus.d.ts diff --git a/markerclustererplus/markerclustererplus-tests.ts b/markerclustererplus/markerclustererplus-tests.ts new file mode 100644 index 000000000..c710727aa --- /dev/null +++ b/markerclustererplus/markerclustererplus-tests.ts @@ -0,0 +1,2217 @@ +/// +/// + +module MarkerClusterApp { + export function simple_test() { + var center = new google.maps.LatLng(37.4419, -122.1419); + var map = new google.maps.Map(document.getElementById('map'), { + zoom: 3, + center: center, + mapTypeId: google.maps.MapTypeId.ROADMAP + }); + + var markers: google.maps.Marker[] = []; + for (var i = 0; i < 100; i++) { + var dataPhoto = data.photos[i]; + var latLng = new google.maps.LatLng(dataPhoto.latitude, dataPhoto.longitude); + var marker = new google.maps.Marker({ position: latLng }); + markers.push(marker); + } + var markerCluster = new MarkerClusterer(map, markers); + } + + export function init() { + google.maps.event.addDomListener(window, 'load', simple_test); + } + + // Dummy data from http://cdn.rawgit.com/mahnunchik/markerclustererplus/master/src/data.json + var data = { + "count": 10785236, + "photos": [{"photo_id": 27932, "photo_title": "Atardecer en Embalse", "photo_url": "http://www.panoramio.com/photo/27932", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/27932.jpg", "longitude": -64.404945, "latitude": -32.202924, "width": 500, "height": 375, "upload_date": "25 June 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 522084, "photo_title": "In Memoriam Antoine de Saint Exupéry", "photo_url": "http://www.panoramio.com/photo/522084", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522084.jpg", "longitude": 17.470493, "latitude": 47.867077, "width": 500, "height": 350, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1578881, "photo_title": "Rosina Lamberti,Sunset,Templestowe , Victoria, Australia", "photo_url": "http://www.panoramio.com/photo/1578881", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1578881.jpg", "longitude": 145.141754, "latitude": -37.766372, "width": 500, "height": 474, "upload_date": "01 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 97671, "photo_title": "kin-dza-dza", "photo_url": "http://www.panoramio.com/photo/97671", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97671.jpg", "longitude": 30.785408, "latitude": 46.639301, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 13058, "owner_name": "Kyryl", "owner_url": "http://www.panoramio.com/user/13058"} + , + {"photo_id": 25514, "photo_title": "Arenal", "photo_url": "http://www.panoramio.com/photo/25514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/25514.jpg", "longitude": -84.693432, "latitude": 10.479372, "width": 500, "height": 375, "upload_date": "17 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 57823, "photo_title": "Maria Alm", "photo_url": "http://www.panoramio.com/photo/57823", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57823.jpg", "longitude": 12.900009, "latitude": 47.409968, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 532693, "photo_title": "Wheatfield in afternoon light", "photo_url": "http://www.panoramio.com/photo/532693", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532693.jpg", "longitude": 11.272659, "latitude": 59.637472, "width": 500, "height": 333, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 57819, "photo_title": "Burg Hohenwerfen", "photo_url": "http://www.panoramio.com/photo/57819", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57819.jpg", "longitude": 13.189259, "latitude": 47.483221, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1282387, "photo_title": "Thunderstorm in Martinique", "photo_url": "http://www.panoramio.com/photo/1282387", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1282387.jpg", "longitude": -61.013432, "latitude": 14.493688, "width": 500, "height": 400, "upload_date": "12 March 2007", "owner_id": 49870, "owner_name": "Jean-Michel Raggioli", "owner_url": "http://www.panoramio.com/user/49870"} + , + {"photo_id": 945976, "photo_title": "Al tard", "photo_url": "http://www.panoramio.com/photo/945976", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945976.jpg", "longitude": 0.490866, "latitude": 40.903783, "width": 335, "height": 500, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 73514, "photo_title": "Hintersee bei Ramsau", "photo_url": "http://www.panoramio.com/photo/73514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73514.jpg", "longitude": 12.852459, "latitude": 47.609519, "width": 500, "height": 333, "upload_date": "30 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 298967, "photo_title": "Antelope Canyon, Ray of Light", "photo_url": "http://www.panoramio.com/photo/298967", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/298967.jpg", "longitude": -111.407890, "latitude": 36.894037, "width": 500, "height": 375, "upload_date": "04 January 2007", "owner_id": 64388, "owner_name": "Artusi", "owner_url": "http://www.panoramio.com/user/64388"} + , + {"photo_id": 88151, "photo_title": "Val Verzasca - Switzerland", "photo_url": "http://www.panoramio.com/photo/88151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88151.jpg", "longitude": 8.838158, "latitude": 46.257746, "width": 500, "height": 375, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 6463, "photo_title": "Guggenheim and spider", "photo_url": "http://www.panoramio.com/photo/6463", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6463.jpg", "longitude": -2.933736, "latitude": 43.269159, "width": 500, "height": 375, "upload_date": "09 January 2006", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 107980, "photo_title": "Mostar", "photo_url": "http://www.panoramio.com/photo/107980", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/107980.jpg", "longitude": 17.815200, "latitude": 43.337255, "width": 369, "height": 500, "upload_date": "10 December 2006", "owner_id": 12954, "owner_name": "ZiÄ™bol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 9439, "photo_title": "Bora Bora", "photo_url": "http://www.panoramio.com/photo/9439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9439.jpg", "longitude": -151.750000, "latitude": -16.500000, "width": 500, "height": 375, "upload_date": "02 February 2006", "owner_id": 1600, "owner_name": "heavenearth", "owner_url": "http://www.panoramio.com/user/1600"} + , + {"photo_id": 673131, "photo_title": "Nivane in Ørsta", "photo_url": "http://www.panoramio.com/photo/673131", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/673131.jpg", "longitude": 6.108742, "latitude": 62.226676, "width": 500, "height": 334, "upload_date": "03 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 346269, "photo_title": "italy-toscany", "photo_url": "http://www.panoramio.com/photo/346269", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/346269.jpg", "longitude": 11.616282, "latitude": 43.064389, "width": 500, "height": 334, "upload_date": "08 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 290039, "photo_title": "Gentoo Penguins at Sunrise", "photo_url": "http://www.panoramio.com/photo/290039", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290039.jpg", "longitude": -59.070311, "latitude": -52.430295, "width": 500, "height": 284, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 1870141, "photo_title": "Les Mines", "photo_url": "http://www.panoramio.com/photo/1870141", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1870141.jpg", "longitude": 1.314712, "latitude": 45.922199, "width": 500, "height": 379, "upload_date": "21 April 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 516809, "photo_title": "Az Å‘rszem", "photo_url": "http://www.panoramio.com/photo/516809", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516809.jpg", "longitude": 18.239279, "latitude": 47.535341, "width": 500, "height": 286, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 67347, "photo_title": "Amanecer en el Salar de Uyuni", "photo_url": "http://www.panoramio.com/photo/67347", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67347.jpg", "longitude": -67.549438, "latitude": -20.552438, "width": 500, "height": 375, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 405822, "photo_title": "tulip", "photo_url": "http://www.panoramio.com/photo/405822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405822.jpg", "longitude": 139.011619, "latitude": 37.871500, "width": 500, "height": 386, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 233619, "photo_title": "Warsaw Bridge 01 [www.wierzchon.com]", "photo_url": "http://www.panoramio.com/photo/233619", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/233619.jpg", "longitude": 21.035728, "latitude": 52.242353, "width": 500, "height": 500, "upload_date": "25 December 2006", "owner_id": 47836, "owner_name": "Andrzej Wierzchon", "owner_url": "http://www.panoramio.com/user/47836"} + , + {"photo_id": 1516726, "photo_title": "Облако над вулканом Камень. www.photo-sturm.ru", "photo_url": "http://www.panoramio.com/photo/1516726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1516726.jpg", "longitude": 160.587502, "latitude": 56.081999, "width": 414, "height": 500, "upload_date": "27 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 70975, "photo_title": "Hospiz", "photo_url": "http://www.panoramio.com/photo/70975", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70975.jpg", "longitude": 8.024461, "latitude": 46.245801, "width": 500, "height": 500, "upload_date": "26 October 2006", "owner_id": 9379, "owner_name": "Davide Bernacchi", "owner_url": "http://www.panoramio.com/user/9379"} + , + {"photo_id": 882660, "photo_title": "icy_chains_1_hdr_web", "photo_url": "http://www.panoramio.com/photo/882660", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/882660.jpg", "longitude": -79.798197, "latitude": 43.321353, "width": 500, "height": 333, "upload_date": "18 February 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 9363990, "photo_title": "Marble Cave", "photo_url": "http://www.panoramio.com/photo/9363990", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9363990.jpg", "longitude": -72.607527, "latitude": -46.647138, "width": 500, "height": 375, "upload_date": "14 April 2008", "owner_id": 947917, "owner_name": "Dejah", "owner_url": "http://www.panoramio.com/user/947917"} + , + {"photo_id": 1884507, "photo_title": "fukushimagata", "photo_url": "http://www.panoramio.com/photo/1884507", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1884507.jpg", "longitude": 139.243813, "latitude": 37.909669, "width": 500, "height": 384, "upload_date": "22 April 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1343502, "photo_title": "вулкан КарымÑкий", "photo_url": "http://www.panoramio.com/photo/1343502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343502.jpg", "longitude": 159.480114, "latitude": 54.025419, "width": 500, "height": 334, "upload_date": "16 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 97723, "photo_title": "Torrent de pareis", "photo_url": "http://www.panoramio.com/photo/97723", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97723.jpg", "longitude": 2.805762, "latitude": 39.852352, "width": 401, "height": 500, "upload_date": "09 December 2006", "owner_id": 13121, "owner_name": "Andreas G.M.", "owner_url": "http://www.panoramio.com/user/13121"} + , + {"photo_id": 537672, "photo_title": "Sr. da Pedra", "photo_url": "http://www.panoramio.com/photo/537672", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/537672.jpg", "longitude": -8.659008, "latitude": 41.068821, "width": 500, "height": 366, "upload_date": "23 January 2007", "owner_id": 115618, "owner_name": "Paulo J Moreira", "owner_url": "http://www.panoramio.com/user/115618"} + , + {"photo_id": 204924, "photo_title": "zaldiak", "photo_url": "http://www.panoramio.com/photo/204924", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/204924.jpg", "longitude": -1.806951, "latitude": 43.245140, "width": 500, "height": 346, "upload_date": "21 December 2006", "owner_id": 2575, "owner_name": "mikel ortega", "owner_url": "http://www.panoramio.com/user/2575"} + , + {"photo_id": 114795, "photo_title": "TIBAUM-BIZZAR", "photo_url": "http://www.panoramio.com/photo/114795", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/114795.jpg", "longitude": 7.706180, "latitude": 51.665741, "width": 334, "height": 500, "upload_date": "11 December 2006", "owner_id": 13121, "owner_name": "Andreas G.M.", "owner_url": "http://www.panoramio.com/user/13121"} + , + {"photo_id": 1287881, "photo_title": "Aurora borealis", "photo_url": "http://www.panoramio.com/photo/1287881", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1287881.jpg", "longitude": 44.215508, "latitude": 65.829148, "width": 500, "height": 205, "upload_date": "12 March 2007", "owner_id": 75359, "owner_name": "Andrey Larin", "owner_url": "http://www.panoramio.com/user/75359"} + , + {"photo_id": 1781717, "photo_title": "Water Cuts Rock", "photo_url": "http://www.panoramio.com/photo/1781717", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781717.jpg", "longitude": -113.047771, "latitude": 37.312154, "width": 333, "height": 500, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 196103, "photo_title": "albufera", "photo_url": "http://www.panoramio.com/photo/196103", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196103.jpg", "longitude": -0.323882, "latitude": 39.349166, "width": 332, "height": 500, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 266224, "photo_title": "Boulzojavri", "photo_url": "http://www.panoramio.com/photo/266224", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/266224.jpg", "longitude": 24.373169, "latitude": 68.908534, "width": 500, "height": 334, "upload_date": "30 December 2006", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 6126294, "photo_title": "Richmond Deer", "photo_url": "http://www.panoramio.com/photo/6126294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126294.jpg", "longitude": -0.275195, "latitude": 51.445890, "width": 489, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 168032, "photo_title": "Buci Seine - Looking Up", "photo_url": "http://www.panoramio.com/photo/168032", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/168032.jpg", "longitude": 2.336990, "latitude": 48.853891, "width": 500, "height": 357, "upload_date": "16 December 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 1370932, "photo_title": "Mercury Bay Sunrise", "photo_url": "http://www.panoramio.com/photo/1370932", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1370932.jpg", "longitude": 175.699196, "latitude": -36.817685, "width": 500, "height": 470, "upload_date": "17 March 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 120844, "photo_title": "Adelie-Prat- Kratzmaier", "photo_url": "http://www.panoramio.com/photo/120844", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/120844.jpg", "longitude": -59.683228, "latitude": -62.485684, "width": 500, "height": 351, "upload_date": "12 December 2006", "owner_id": 19856, "owner_name": "Juan Kratzmaier", "owner_url": "http://www.panoramio.com/user/19856"} + , + {"photo_id": 940294, "photo_title": "Infrared Mediterranean Heat", "photo_url": "http://www.panoramio.com/photo/940294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/940294.jpg", "longitude": 25.376015, "latitude": 36.461537, "width": 500, "height": 332, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 4446084, "photo_title": "Vizivarázs", "photo_url": "http://www.panoramio.com/photo/4446084", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4446084.jpg", "longitude": 17.504482, "latitude": 47.842773, "width": 367, "height": 500, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 498352, "photo_title": "Wave", "photo_url": "http://www.panoramio.com/photo/498352", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/498352.jpg", "longitude": -112.005315, "latitude": 36.995972, "width": 500, "height": 333, "upload_date": "20 January 2007", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 775893, "photo_title": "Leoparden", "photo_url": "http://www.panoramio.com/photo/775893", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/775893.jpg", "longitude": 36.046829, "latitude": -3.818353, "width": 500, "height": 336, "upload_date": "11 February 2007", "owner_id": 164434, "owner_name": "Achim Mittler", "owner_url": "http://www.panoramio.com/user/164434"} + , + {"photo_id": 665502, "photo_title": "Sunset Beach Walker", "photo_url": "http://www.panoramio.com/photo/665502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/665502.jpg", "longitude": -124.077530, "latitude": 44.519888, "width": 500, "height": 340, "upload_date": "03 February 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 9021415, "photo_title": "Wat Suwan Kuha or Wat Tham, Phang Nga, Winner Unusual Location April 2008", "photo_url": "http://www.panoramio.com/photo/9021415", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9021415.jpg", "longitude": 98.471628, "latitude": 8.428840, "width": 500, "height": 334, "upload_date": "31 March 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 287244, "photo_title": "Landwasser-Viadukt - This is an unofficial photo point. Just follow the footpath up from the official one, until the clearing.", "photo_url": "http://www.panoramio.com/photo/287244", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/287244.jpg", "longitude": 9.675007, "latitude": 46.681229, "width": 337, "height": 500, "upload_date": "03 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 677366, "photo_title": "Oak tree in winter", "photo_url": "http://www.panoramio.com/photo/677366", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/677366.jpg", "longitude": 10.771065, "latitude": 59.663926, "width": 358, "height": 500, "upload_date": "03 February 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 196086, "photo_title": "albufera", "photo_url": "http://www.panoramio.com/photo/196086", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196086.jpg", "longitude": -0.323882, "latitude": 39.349166, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 4340931, "photo_title": "Cold morning", "photo_url": "http://www.panoramio.com/photo/4340931", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4340931.jpg", "longitude": 12.113349, "latitude": 49.342559, "width": 500, "height": 333, "upload_date": "31 August 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 488, "photo_title": "Lagos de Montebello, México", "photo_url": "http://www.panoramio.com/photo/488", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/488.jpg", "longitude": -91.677904, "latitude": 16.111297, "width": 500, "height": 345, "upload_date": "31 August 2005", "owner_id": 7, "owner_name": "Eduardo Manchón", "owner_url": "http://www.panoramio.com/user/7"} + , + {"photo_id": 723666, "photo_title": "Majestically Still", "photo_url": "http://www.panoramio.com/photo/723666", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723666.jpg", "longitude": -116.175613, "latitude": 51.327608, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1081710, "photo_title": "Gjevilvatnet lake in Oppdal", "photo_url": "http://www.panoramio.com/photo/1081710", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1081710.jpg", "longitude": 9.412537, "latitude": 62.686749, "width": 500, "height": 333, "upload_date": "28 February 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 22575, "photo_title": "Lijiang River, near Yangshuo, China", "photo_url": "http://www.panoramio.com/photo/22575", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/22575.jpg", "longitude": 110.454826, "latitude": 24.962716, "width": 500, "height": 333, "upload_date": "05 June 2006", "owner_id": 3557, "owner_name": "Placebo", "owner_url": "http://www.panoramio.com/user/3557"} + , + {"photo_id": 2735754, "photo_title": "Después de la lluvia", "photo_url": "http://www.panoramio.com/photo/2735754", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2735754.jpg", "longitude": -73.241998, "latitude": -39.809583, "width": 360, "height": 500, "upload_date": "13 June 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 73515, "photo_title": "Kloster Höglwörth", "photo_url": "http://www.panoramio.com/photo/73515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73515.jpg", "longitude": 12.850227, "latitude": 47.815575, "width": 500, "height": 333, "upload_date": "30 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 723015, "photo_title": "Cape Flattery (infrared)", "photo_url": "http://www.panoramio.com/photo/723015", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723015.jpg", "longitude": -124.726700, "latitude": 48.385898, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1288595, "photo_title": "O'Keeffe ?", "photo_url": "http://www.panoramio.com/photo/1288595", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1288595.jpg", "longitude": 72.920637, "latitude": 4.038162, "width": 332, "height": 500, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1008304, "photo_title": "nyhavn", "photo_url": "http://www.panoramio.com/photo/1008304", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1008304.jpg", "longitude": 12.591190, "latitude": 55.679762, "width": 500, "height": 333, "upload_date": "24 February 2007", "owner_id": 2659, "owner_name": "ozalph", "owner_url": "http://www.panoramio.com/user/2659"} + , + {"photo_id": 19547, "photo_title": "Embarcador 1", "photo_url": "http://www.panoramio.com/photo/19547", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/19547.jpg", "longitude": 0.493140, "latitude": 40.904172, "width": 500, "height": 335, "upload_date": "07 May 2006", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 98115, "photo_title": "FREE-SPIRIT", "photo_url": "http://www.panoramio.com/photo/98115", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/98115.jpg", "longitude": 9.908917, "latitude": 50.487112, "width": 500, "height": 304, "upload_date": "10 December 2006", "owner_id": 13121, "owner_name": "Andreas G.M.", "owner_url": "http://www.panoramio.com/user/13121"} + , + {"photo_id": 9822056, "photo_title": "Reflection under the Bridge", "photo_url": "http://www.panoramio.com/photo/9822056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9822056.jpg", "longitude": 103.853851, "latitude": 1.286973, "width": 333, "height": 500, "upload_date": "01 May 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 9117094, "photo_title": "Baron's Haugh, Scotland", "photo_url": "http://www.panoramio.com/photo/9117094", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9117094.jpg", "longitude": -3.986835, "latitude": 55.773532, "width": 500, "height": 337, "upload_date": "05 April 2008", "owner_id": 165346, "owner_name": "Alan Knox", "owner_url": "http://www.panoramio.com/user/165346"} + , + {"photo_id": 5342534, "photo_title": "Åszi pompa", "photo_url": "http://www.panoramio.com/photo/5342534", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5342534.jpg", "longitude": 15.964594, "latitude": 47.875426, "width": 500, "height": 334, "upload_date": "16 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2346129, "photo_title": "Pipacsálom", "photo_url": "http://www.panoramio.com/photo/2346129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2346129.jpg", "longitude": 17.521820, "latitude": 47.748558, "width": 500, "height": 378, "upload_date": "22 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3749005, "photo_title": "Once in a Blue Moon....", "photo_url": "http://www.panoramio.com/photo/3749005", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3749005.jpg", "longitude": -105.654080, "latitude": 40.294560, "width": 374, "height": 500, "upload_date": "05 August 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 1360629, "photo_title": "Frente a la Cascada de Gujuli -103 m.-", "photo_url": "http://www.panoramio.com/photo/1360629", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1360629.jpg", "longitude": -2.909800, "latitude": 42.976199, "width": 333, "height": 500, "upload_date": "17 March 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 6129915, "photo_title": "A vadon szava", "photo_url": "http://www.panoramio.com/photo/6129915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6129915.jpg", "longitude": 17.521133, "latitude": 47.854408, "width": 500, "height": 325, "upload_date": "25 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 67183, "photo_title": "Laguna verde e Vulcano Licancabur", "photo_url": "http://www.panoramio.com/photo/67183", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67183.jpg", "longitude": -67.819161, "latitude": -22.787696, "width": 500, "height": 370, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 507571, "photo_title": "Mikor a harangszó is szebben hallik", "photo_url": "http://www.panoramio.com/photo/507571", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507571.jpg", "longitude": 17.684383, "latitude": 47.587873, "width": 396, "height": 500, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6685422, "photo_title": "Dawn at Bagan, Myanmar (Burma)", "photo_url": "http://www.panoramio.com/photo/6685422", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6685422.jpg", "longitude": 94.860935, "latitude": 21.169045, "width": 500, "height": 333, "upload_date": "25 December 2007", "owner_id": 1221287, "owner_name": "TS Jeung", "owner_url": "http://www.panoramio.com/user/1221287"} + , + {"photo_id": 3513121, "photo_title": "Báláim", "photo_url": "http://www.panoramio.com/photo/3513121", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3513121.jpg", "longitude": 17.481651, "latitude": 47.457576, "width": 419, "height": 500, "upload_date": "24 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 10574161, "photo_title": "Silhouette", "photo_url": "http://www.panoramio.com/photo/10574161", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10574161.jpg", "longitude": 148.662905, "latitude": -35.304724, "width": 500, "height": 346, "upload_date": "25 May 2008", "owner_id": 766550, "owner_name": "VFedele", "owner_url": "http://www.panoramio.com/user/766550"} + , + {"photo_id": 89190, "photo_title": "Mount Ararat, Yerevan, Armenia", "photo_url": "http://www.panoramio.com/photo/89190", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/89190.jpg", "longitude": 44.483900, "latitude": 40.195299, "width": 500, "height": 375, "upload_date": "30 November 2006", "owner_id": 11226, "owner_name": "Ardani", "owner_url": "http://www.panoramio.com/user/11226"} + , + {"photo_id": 1182305, "photo_title": "Dobel, Albrecht-Hütte", "photo_url": "http://www.panoramio.com/photo/1182305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1182305.jpg", "longitude": 8.500500, "latitude": 48.793465, "width": 500, "height": 375, "upload_date": "05 March 2007", "owner_id": 66229, "owner_name": "Mast", "owner_url": "http://www.panoramio.com/user/66229"} + , + {"photo_id": 4258015, "photo_title": "Fényözön", "photo_url": "http://www.panoramio.com/photo/4258015", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4258015.jpg", "longitude": 16.391602, "latitude": 46.851269, "width": 333, "height": 500, "upload_date": "28 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1413, "photo_title": "Champlain Lookout", "photo_url": "http://www.panoramio.com/photo/1413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1413.jpg", "longitude": -75.912872, "latitude": 45.507640, "width": 500, "height": 375, "upload_date": "06 October 2005", "owner_id": 273, "owner_name": "JC", "owner_url": "http://www.panoramio.com/user/273"} + , + {"photo_id": 1526763, "photo_title": "Gizeh Pyramids, Cairo", "photo_url": "http://www.panoramio.com/photo/1526763", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1526763.jpg", "longitude": 31.133537, "latitude": 29.966721, "width": 500, "height": 333, "upload_date": "27 March 2007", "owner_id": 59919, "owner_name": "xflo:w (http://www.xflo.net)", "owner_url": "http://www.panoramio.com/user/59919"} + , + {"photo_id": 8802900, "photo_title": "Martigues, miroir aux oiseaux", "photo_url": "http://www.panoramio.com/photo/8802900", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8802900.jpg", "longitude": 5.054559, "latitude": 43.405079, "width": 387, "height": 500, "upload_date": "24 March 2008", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 459515, "photo_title": "fire works", "photo_url": "http://www.panoramio.com/photo/459515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459515.jpg", "longitude": 138.423271, "latitude": 38.069312, "width": 500, "height": 385, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 749464, "photo_title": "Gondola", "photo_url": "http://www.panoramio.com/photo/749464", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/749464.jpg", "longitude": 12.336917, "latitude": 45.434053, "width": 500, "height": 332, "upload_date": "09 February 2007", "owner_id": 159455, "owner_name": "©Franco Truscello", "owner_url": "http://www.panoramio.com/user/159455"} + , + {"photo_id": 422608, "photo_title": "tanada", "photo_url": "http://www.panoramio.com/photo/422608", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/422608.jpg", "longitude": 139.047089, "latitude": 37.449787, "width": 383, "height": 500, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 85617, "photo_title": "Parque Natural de Calblanque", "photo_url": "http://www.panoramio.com/photo/85617", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85617.jpg", "longitude": -0.739861, "latitude": 37.594104, "width": 332, "height": 500, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 1089235, "photo_title": "NyáridézÅ‘", "photo_url": "http://www.panoramio.com/photo/1089235", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1089235.jpg", "longitude": 18.207092, "latitude": 47.318578, "width": 500, "height": 282, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 505229, "photo_title": "Etangs près de Dijon", "photo_url": "http://www.panoramio.com/photo/505229", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/505229.jpg", "longitude": 5.168552, "latitude": 47.312642, "width": 350, "height": 500, "upload_date": "20 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 679343, "photo_title": "melbourne sunset over the yarra river", "photo_url": "http://www.panoramio.com/photo/679343", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679343.jpg", "longitude": 144.968119, "latitude": -37.819616, "width": 500, "height": 500, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 436336, "photo_title": "myoujyousan", "photo_url": "http://www.panoramio.com/photo/436336", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436336.jpg", "longitude": 137.831554, "latitude": 36.911608, "width": 500, "height": 362, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 9733680, "photo_title": "Sydney", "photo_url": "http://www.panoramio.com/photo/9733680", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9733680.jpg", "longitude": 151.209834, "latitude": -33.848588, "width": 333, "height": 500, "upload_date": "28 April 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 7415625, "photo_title": "Në fushë të Pallaticesë", "photo_url": "http://www.panoramio.com/photo/7415625", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7415625.jpg", "longitude": 21.077271, "latitude": 42.011550, "width": 437, "height": 500, "upload_date": "28 January 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 5358174, "photo_title": "Morning Glory", "photo_url": "http://www.panoramio.com/photo/5358174", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5358174.jpg", "longitude": -110.843537, "latitude": 44.475020, "width": 500, "height": 348, "upload_date": "16 October 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 316199, "photo_title": "A lake on Gasherbrum glacier", "photo_url": "http://www.panoramio.com/photo/316199", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/316199.jpg", "longitude": 76.732550, "latitude": 35.877298, "width": 500, "height": 375, "upload_date": "06 January 2007", "owner_id": 65672, "owner_name": "www.turclubmai.ru", "owner_url": "http://www.panoramio.com/user/65672"} + , + {"photo_id": 400536, "photo_title": "Half Dome Mtn, Yosemite Nat Park, CA", "photo_url": "http://www.panoramio.com/photo/400536", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/400536.jpg", "longitude": -119.495888, "latitude": 37.811411, "width": 500, "height": 333, "upload_date": "12 January 2007", "owner_id": 85489, "owner_name": "Bruce MacIver", "owner_url": "http://www.panoramio.com/user/85489"} + , + {"photo_id": 2942693, "photo_title": "Tulips and Windmills", "photo_url": "http://www.panoramio.com/photo/2942693", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2942693.jpg", "longitude": 4.864798, "latitude": 52.594393, "width": 500, "height": 500, "upload_date": "25 June 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 9733633, "photo_title": "Oper-Sydney", "photo_url": "http://www.panoramio.com/photo/9733633", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9733633.jpg", "longitude": 151.216968, "latitude": -33.851702, "width": 500, "height": 333, "upload_date": "28 April 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 1800454, "photo_title": "Bombay Beach, Salton Sea, CA", "photo_url": "http://www.panoramio.com/photo/1800454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1800454.jpg", "longitude": -115.729235, "latitude": 33.347316, "width": 500, "height": 407, "upload_date": "16 April 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 2558057, "photo_title": "Kin-dza-dza 2", "photo_url": "http://www.panoramio.com/photo/2558057", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2558057.jpg", "longitude": 30.785751, "latitude": 46.639301, "width": 500, "height": 375, "upload_date": "03 June 2007", "owner_id": 13058, "owner_name": "Kyryl", "owner_url": "http://www.panoramio.com/user/13058"} + , + {"photo_id": 7768089, "photo_title": "Isteni színjáték", "photo_url": "http://www.panoramio.com/photo/7768089", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7768089.jpg", "longitude": 17.507057, "latitude": 47.776425, "width": 500, "height": 334, "upload_date": "12 February 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1213006, "photo_title": "Twilight Drive", "photo_url": "http://www.panoramio.com/photo/1213006", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1213006.jpg", "longitude": -114.481916, "latitude": 51.095841, "width": 500, "height": 335, "upload_date": "07 March 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 395800, "photo_title": "Pic de Bure depuis le Pic de Gleize", "photo_url": "http://www.panoramio.com/photo/395800", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/395800.jpg", "longitude": 6.055870, "latitude": 44.610146, "width": 500, "height": 350, "upload_date": "12 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 11073609, "photo_title": "Sunrise in Koroni, by Kostas Andreopoulos", "photo_url": "http://www.panoramio.com/photo/11073609", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11073609.jpg", "longitude": 21.952747, "latitude": 36.797775, "width": 500, "height": 375, "upload_date": "09 June 2008", "owner_id": 1690483, "owner_name": "k.andre", "owner_url": "http://www.panoramio.com/user/1690483"} + , + {"photo_id": 6564418, "photo_title": "Baron's Haugh, Scotland", "photo_url": "http://www.panoramio.com/photo/6564418", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6564418.jpg", "longitude": -3.989239, "latitude": 55.772808, "width": 500, "height": 337, "upload_date": "19 December 2007", "owner_id": 165346, "owner_name": "Alan Knox", "owner_url": "http://www.panoramio.com/user/165346"} + , + {"photo_id": 10158925, "photo_title": "Lluvia púrpura ( Purple rain )", "photo_url": "http://www.panoramio.com/photo/10158925", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10158925.jpg", "longitude": -0.476360, "latitude": 39.612565, "width": 500, "height": 333, "upload_date": "12 May 2008", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 121574, "photo_title": "Moscú/Moscow - Catedral de San Basilio", "photo_url": "http://www.panoramio.com/photo/121574", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/121574.jpg", "longitude": 37.621951, "latitude": 55.753033, "width": 500, "height": 375, "upload_date": "12 December 2006", "owner_id": 17212, "owner_name": "javier herranz", "owner_url": "http://www.panoramio.com/user/17212"} + , + {"photo_id": 6012915, "photo_title": "Erleuchtung in Venedig", "photo_url": "http://www.panoramio.com/photo/6012915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012915.jpg", "longitude": 12.340747, "latitude": 45.433364, "width": 500, "height": 333, "upload_date": "19 November 2007", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 346687, "photo_title": "namibia desert", "photo_url": "http://www.panoramio.com/photo/346687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/346687.jpg", "longitude": 15.408325, "latitude": -24.729370, "width": 500, "height": 334, "upload_date": "08 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 1913758, "photo_title": "Cortona - Via Gino Severini", "photo_url": "http://www.panoramio.com/photo/1913758", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1913758.jpg", "longitude": 11.988916, "latitude": 43.273659, "width": 500, "height": 498, "upload_date": "24 April 2007", "owner_id": 193913, "owner_name": "Klesitz Piroska", "owner_url": "http://www.panoramio.com/user/193913"} + , + {"photo_id": 405843, "photo_title": "siroiwa", "photo_url": "http://www.panoramio.com/photo/405843", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405843.jpg", "longitude": 138.789682, "latitude": 37.726398, "width": 500, "height": 338, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 91375, "photo_title": "Burj Al Arab At Night", "photo_url": "http://www.panoramio.com/photo/91375", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91375.jpg", "longitude": 55.187416, "latitude": 25.140312, "width": 255, "height": 500, "upload_date": "03 December 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 940792, "photo_title": "Moraine Branch", "photo_url": "http://www.panoramio.com/photo/940792", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/940792.jpg", "longitude": -116.177502, "latitude": 51.325946, "width": 500, "height": 332, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 58287, "photo_title": "Schloß Anif", "photo_url": "http://www.panoramio.com/photo/58287", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58287.jpg", "longitude": 13.068817, "latitude": 47.744540, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 194118, "photo_title": "Mount Fuji: Fuji-San", "photo_url": "http://www.panoramio.com/photo/194118", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/194118.jpg", "longitude": 138.727455, "latitude": 35.377294, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 27882, "owner_name": "taoy", "owner_url": "http://www.panoramio.com/user/27882"} + , + {"photo_id": 5158892, "photo_title": "prati di Tires Alto Adige Südtirol south tyrol", "photo_url": "http://www.panoramio.com/photo/5158892", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5158892.jpg", "longitude": 11.557188, "latitude": 46.471044, "width": 500, "height": 429, "upload_date": "08 October 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 280123, "photo_title": "kaouki05", "photo_url": "http://www.panoramio.com/photo/280123", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/280123.jpg", "longitude": -9.799418, "latitude": 31.355662, "width": 328, "height": 500, "upload_date": "01 January 2007", "owner_id": 58867, "owner_name": "Lachaud Franck", "owner_url": "http://www.panoramio.com/user/58867"} + , + {"photo_id": 6789223, "photo_title": "Exploding sky", "photo_url": "http://www.panoramio.com/photo/6789223", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6789223.jpg", "longitude": -69.930505, "latitude": 12.522579, "width": 500, "height": 333, "upload_date": "30 December 2007", "owner_id": 89499, "owner_name": "Michael Braxenthaler", "owner_url": "http://www.panoramio.com/user/89499"} + , + {"photo_id": 3722547, "photo_title": "Morning fog in the Alps", "photo_url": "http://www.panoramio.com/photo/3722547", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3722547.jpg", "longitude": 10.591164, "latitude": 47.521142, "width": 500, "height": 333, "upload_date": "04 August 2007", "owner_id": 89499, "owner_name": "Michael Braxenthaler", "owner_url": "http://www.panoramio.com/user/89499"} + , + {"photo_id": 9530458, "photo_title": "Castillian cereal fields from Atienza walls", "photo_url": "http://www.panoramio.com/photo/9530458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9530458.jpg", "longitude": -2.874470, "latitude": 41.198451, "width": 500, "height": 470, "upload_date": "20 April 2008", "owner_id": 134279, "owner_name": "4ullas", "owner_url": "http://www.panoramio.com/user/134279"} + , + {"photo_id": 2935974, "photo_title": "Atardecer tras el Anboto desde el Aitzgorri", "photo_url": "http://www.panoramio.com/photo/2935974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2935974.jpg", "longitude": -2.324982, "latitude": 42.951240, "width": 500, "height": 331, "upload_date": "25 June 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 38587, "photo_title": "Blitz", "photo_url": "http://www.panoramio.com/photo/38587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/38587.jpg", "longitude": 7.949853, "latitude": 48.489947, "width": 500, "height": 375, "upload_date": "13 August 2006", "owner_id": 6002, "owner_name": "Paul Feiler", "owner_url": "http://www.panoramio.com/user/6002"} + , + {"photo_id": 9312247, "photo_title": "Idrija - High water after rain", "photo_url": "http://www.panoramio.com/photo/9312247", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9312247.jpg", "longitude": 13.965683, "latitude": 45.955625, "width": 500, "height": 375, "upload_date": "12 April 2008", "owner_id": 763995, "owner_name": "Samo T.", "owner_url": "http://www.panoramio.com/user/763995"} + , + {"photo_id": 110409, "photo_title": "Laguna de Yanganuco", "photo_url": "http://www.panoramio.com/photo/110409", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/110409.jpg", "longitude": -77.640553, "latitude": -9.071585, "width": 330, "height": 500, "upload_date": "11 December 2006", "owner_id": 16323, "owner_name": "Luis Torres", "owner_url": "http://www.panoramio.com/user/16323"} + , + {"photo_id": 7609439, "photo_title": "FényfürdÅ‘", "photo_url": "http://www.panoramio.com/photo/7609439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7609439.jpg", "longitude": 15.965366, "latitude": 47.877556, "width": 500, "height": 312, "upload_date": "05 February 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8599453, "photo_title": "Realidad comprimida", "photo_url": "http://www.panoramio.com/photo/8599453", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8599453.jpg", "longitude": -2.780957, "latitude": 43.033953, "width": 500, "height": 387, "upload_date": "17 March 2008", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 233921, "photo_title": "Mount Titlis, Engelberg, Switzerland www.titlis.ch / www.engelberg.ch/ www.berghuette.ch /www.brunnihuette.ch", "photo_url": "http://www.panoramio.com/photo/233921", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/233921.jpg", "longitude": 8.410742, "latitude": 46.841583, "width": 500, "height": 375, "upload_date": "25 December 2006", "owner_id": 47930, "owner_name": "werni", "owner_url": "http://www.panoramio.com/user/47930"} + , + {"photo_id": 561386, "photo_title": "the country", "photo_url": "http://www.panoramio.com/photo/561386", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/561386.jpg", "longitude": 138.871393, "latitude": 37.602196, "width": 500, "height": 383, "upload_date": "24 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1195112, "photo_title": "Tolar Grande", "photo_url": "http://www.panoramio.com/photo/1195112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1195112.jpg", "longitude": -67.361984, "latitude": -24.545249, "width": 500, "height": 342, "upload_date": "06 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 5466129, "photo_title": "\"Lasciate ogne speranza, voi ch’intrate\". (\"Abandon all hope, ye who enter here\" ; \"Toi qui entre ici, abandonne toute espérance\".) Dante e il primo girone dell'Inferno (o Virgilio nella selva oscura, accanto all'ingresso dell'Inferno) (ou encore, plus prosaïquement, pêche dans le Jaunay en Vendée, le 21 octobre 2007 à l'aube d'un très froid matin d'automne). #129", "photo_url": "http://www.panoramio.com/photo/5466129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5466129.jpg", "longitude": -1.901300, "latitude": 46.663398, "width": 500, "height": 281, "upload_date": "22 October 2007", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 57820, "photo_title": "Hallstatt 2", "photo_url": "http://www.panoramio.com/photo/57820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57820.jpg", "longitude": 13.649054, "latitude": 47.555040, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 798312, "photo_title": "Riflettendo...", "photo_url": "http://www.panoramio.com/photo/798312", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798312.jpg", "longitude": 7.677534, "latitude": 45.069925, "width": 500, "height": 332, "upload_date": "12 February 2007", "owner_id": 159455, "owner_name": "©Franco Truscello", "owner_url": "http://www.panoramio.com/user/159455"} + , + {"photo_id": 7401432, "photo_title": "07-12-18_\"Arterias del Bosque\" PIXELECTA", "photo_url": "http://www.panoramio.com/photo/7401432", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7401432.jpg", "longitude": -2.775679, "latitude": 43.005338, "width": 500, "height": 333, "upload_date": "27 January 2008", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 2584132, "photo_title": "Farm Tomita", "photo_url": "http://www.panoramio.com/photo/2584132", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2584132.jpg", "longitude": 142.426586, "latitude": 43.418889, "width": 500, "height": 375, "upload_date": "05 June 2007", "owner_id": 532882, "owner_name": "wisdomcomplex", "owner_url": "http://www.panoramio.com/user/532882"} + , + {"photo_id": 4670499, "photo_title": "El despertar de la naturaleza", "photo_url": "http://www.panoramio.com/photo/4670499", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4670499.jpg", "longitude": -73.227739, "latitude": -39.821285, "width": 500, "height": 371, "upload_date": "15 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 5133875, "photo_title": "Lumi Vardar", "photo_url": "http://www.panoramio.com/photo/5133875", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5133875.jpg", "longitude": 21.075597, "latitude": 42.006671, "width": 500, "height": 375, "upload_date": "06 October 2007", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 8309167, "photo_title": "Cueva de los Verdes", "photo_url": "http://www.panoramio.com/photo/8309167", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8309167.jpg", "longitude": -13.439734, "latitude": 29.161137, "width": 333, "height": 500, "upload_date": "05 March 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 1756166, "photo_title": "The Pantheon, Rome, Italy", "photo_url": "http://www.panoramio.com/photo/1756166", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1756166.jpg", "longitude": 12.476842, "latitude": 41.898540, "width": 376, "height": 500, "upload_date": "13 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 1831309, "photo_title": "Oak in blue - last one", "photo_url": "http://www.panoramio.com/photo/1831309", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1831309.jpg", "longitude": 10.771322, "latitude": 59.664143, "width": 326, "height": 500, "upload_date": "18 April 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 626487, "photo_title": "A harag napja", "photo_url": "http://www.panoramio.com/photo/626487", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/626487.jpg", "longitude": 15.919275, "latitude": 43.589468, "width": 500, "height": 333, "upload_date": "30 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 202162, "photo_title": "Monument Valley", "photo_url": "http://www.panoramio.com/photo/202162", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/202162.jpg", "longitude": -110.094552, "latitude": 36.976810, "width": 500, "height": 333, "upload_date": "21 December 2006", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 791016, "photo_title": "Sossusvlei", "photo_url": "http://www.panoramio.com/photo/791016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/791016.jpg", "longitude": 15.289364, "latitude": -24.730656, "width": 500, "height": 333, "upload_date": "12 February 2007", "owner_id": 12736, "owner_name": "www.sliwi.de", "owner_url": "http://www.panoramio.com/user/12736"} + , + {"photo_id": 9760518, "photo_title": "Eglise Notre-Dame de la Couture", "photo_url": "http://www.panoramio.com/photo/9760518", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9760518.jpg", "longitude": 0.596437, "latitude": 49.082510, "width": 375, "height": 500, "upload_date": "29 April 2008", "owner_id": 1275480, "owner_name": "Nicolas Aubé", "owner_url": "http://www.panoramio.com/user/1275480"} + , + {"photo_id": 2097684, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2097684", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2097684.jpg", "longitude": -79.793916, "latitude": 43.299447, "width": 500, "height": 333, "upload_date": "06 May 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 6851021, "photo_title": "Lumi Vardar-Sunset", "photo_url": "http://www.panoramio.com/photo/6851021", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6851021.jpg", "longitude": 21.077871, "latitude": 42.007532, "width": 458, "height": 500, "upload_date": "02 January 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 8137868, "photo_title": "Sunset Trace at Kotchi, Korea", "photo_url": "http://www.panoramio.com/photo/8137868", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8137868.jpg", "longitude": 126.333847, "latitude": 36.498597, "width": 500, "height": 500, "upload_date": "27 February 2008", "owner_id": 1221287, "owner_name": "TS Jeung", "owner_url": "http://www.panoramio.com/user/1221287"} + , + {"photo_id": 382104, "photo_title": "Meteora", "photo_url": "http://www.panoramio.com/photo/382104", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/382104.jpg", "longitude": 21.616974, "latitude": 39.743626, "width": 500, "height": 500, "upload_date": "11 January 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 3399014, "photo_title": "Vue du Schneibstein vers l'Est", "photo_url": "http://www.panoramio.com/photo/3399014", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3399014.jpg", "longitude": 13.055191, "latitude": 47.562396, "width": 500, "height": 328, "upload_date": "19 July 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 29596, "photo_title": "Ciudad de Los Cielos", "photo_url": "http://www.panoramio.com/photo/29596", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/29596.jpg", "longitude": -72.545900, "latitude": -13.165304, "width": 500, "height": 375, "upload_date": "01 July 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 1269713, "photo_title": "Rainbow over OlskÃ¥rdvatnet near Kiberg, Finnmark, Norway", "photo_url": "http://www.panoramio.com/photo/1269713", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1269713.jpg", "longitude": 30.906601, "latitude": 70.295137, "width": 361, "height": 500, "upload_date": "11 March 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 507631, "photo_title": "Egy ábrándos reggelen", "photo_url": "http://www.panoramio.com/photo/507631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507631.jpg", "longitude": 17.466667, "latitude": 47.866667, "width": 500, "height": 334, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 722974, "photo_title": "Airdrie Vortex", "photo_url": "http://www.panoramio.com/photo/722974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/722974.jpg", "longitude": -114.087481, "latitude": 51.048544, "width": 500, "height": 323, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1118007, "photo_title": "Moraine Lake, Banff NP (Canada)", "photo_url": "http://www.panoramio.com/photo/1118007", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1118007.jpg", "longitude": -116.177673, "latitude": 51.328091, "width": 500, "height": 326, "upload_date": "02 March 2007", "owner_id": 229005, "owner_name": "mypictures4u.com", "owner_url": "http://www.panoramio.com/user/229005"} + , + {"photo_id": 1343943, "photo_title": "Andes Mountains.Patagonia.Argentina", "photo_url": "http://www.panoramio.com/photo/1343943", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343943.jpg", "longitude": -72.422905, "latitude": -49.381814, "width": 500, "height": 375, "upload_date": "16 March 2007", "owner_id": 281428, "owner_name": "avni_", "owner_url": "http://www.panoramio.com/user/281428"} + , + {"photo_id": 5637365, "photo_title": "Northen lights", "photo_url": "http://www.panoramio.com/photo/5637365", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5637365.jpg", "longitude": 28.599129, "latitude": 66.247365, "width": 500, "height": 333, "upload_date": "30 October 2007", "owner_id": 897591, "owner_name": "markku pirttimaa www.karhukuusamo.com", "owner_url": "http://www.panoramio.com/user/897591"} + , + {"photo_id": 241562, "photo_title": "Süd-Ostisland", "photo_url": "http://www.panoramio.com/photo/241562", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/241562.jpg", "longitude": -17.512207, "latitude": 63.954261, "width": 500, "height": 326, "upload_date": "26 December 2006", "owner_id": 14774, "owner_name": "Frank Block", "owner_url": "http://www.panoramio.com/user/14774"} + , + {"photo_id": 48899, "photo_title": "Bellagio Fountain", "photo_url": "http://www.panoramio.com/photo/48899", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/48899.jpg", "longitude": -115.174227, "latitude": 36.112778, "width": 500, "height": 375, "upload_date": "16 September 2006", "owner_id": 7190, "owner_name": "Perry Tang", "owner_url": "http://www.panoramio.com/user/7190"} + , + {"photo_id": 49822, "photo_title": "Baños termales en Alhama de Granada", "photo_url": "http://www.panoramio.com/photo/49822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/49822.jpg", "longitude": -3.983274, "latitude": 37.018248, "width": 374, "height": 500, "upload_date": "19 September 2006", "owner_id": 5477, "owner_name": "errece", "owner_url": "http://www.panoramio.com/user/5477"} + , + {"photo_id": 8248490, "photo_title": "Emmerald river", "photo_url": "http://www.panoramio.com/photo/8248490", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8248490.jpg", "longitude": 13.650362, "latitude": 46.340336, "width": 375, "height": 500, "upload_date": "02 March 2008", "owner_id": 763995, "owner_name": "Samo T.", "owner_url": "http://www.panoramio.com/user/763995"} + , + {"photo_id": 459528, "photo_title": "gassan", "photo_url": "http://www.panoramio.com/photo/459528", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459528.jpg", "longitude": 139.895782, "latitude": 38.282391, "width": 500, "height": 379, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 50203, "photo_title": "Die Hütte in Nyidalur an einem Septembermorgen ....", "photo_url": "http://www.panoramio.com/photo/50203", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50203.jpg", "longitude": -18.132935, "latitude": 64.762124, "width": 500, "height": 299, "upload_date": "20 September 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 51502, "photo_title": "eclipse", "photo_url": "http://www.panoramio.com/photo/51502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/51502.jpg", "longitude": -0.121665, "latitude": 51.500969, "width": 500, "height": 375, "upload_date": "24 September 2006", "owner_id": 6645, "owner_name": "JesusVillalba", "owner_url": "http://www.panoramio.com/user/6645"} + , + {"photo_id": 3671663, "photo_title": "Urbia traspuesta de sol, desde Aizkorri", "photo_url": "http://www.panoramio.com/photo/3671663", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3671663.jpg", "longitude": -2.324831, "latitude": 42.951271, "width": 500, "height": 298, "upload_date": "02 August 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 1928780, "photo_title": "God is looking", "photo_url": "http://www.panoramio.com/photo/1928780", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1928780.jpg", "longitude": 19.952137, "latitude": 50.106075, "width": 500, "height": 379, "upload_date": "25 April 2007", "owner_id": 12954, "owner_name": "ZiÄ™bol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 10068109, "photo_title": "#2 Steinerne Brücke über Lendkanal, Stone Bridge over Lendkanal, Klagenfurt, Austria", "photo_url": "http://www.panoramio.com/photo/10068109", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10068109.jpg", "longitude": 14.284313, "latitude": 46.620436, "width": 376, "height": 500, "upload_date": "09 May 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 8730264, "photo_title": "Large wave hits the North Pier, Tynemouth - Easter 2008", "photo_url": "http://www.panoramio.com/photo/8730264", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8730264.jpg", "longitude": -1.420702, "latitude": 55.020727, "width": 434, "height": 500, "upload_date": "22 March 2008", "owner_id": 1107262, "owner_name": "bobpercy", "owner_url": "http://www.panoramio.com/user/1107262"} + , + {"photo_id": 330436, "photo_title": "bolivia salar-de-uyuni", "photo_url": "http://www.panoramio.com/photo/330436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/330436.jpg", "longitude": -67.876625, "latitude": -20.180046, "width": 500, "height": 334, "upload_date": "07 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 10287647, "photo_title": "A moment of silence * Honorable mention may contest*", "photo_url": "http://www.panoramio.com/photo/10287647", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10287647.jpg", "longitude": 6.177192, "latitude": 52.218099, "width": 500, "height": 413, "upload_date": "16 May 2008", "owner_id": 523564, "owner_name": "Luud Riphagen", "owner_url": "http://www.panoramio.com/user/523564"} + , + {"photo_id": 436323, "photo_title": "zeikan", "photo_url": "http://www.panoramio.com/photo/436323", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436323.jpg", "longitude": 139.057925, "latitude": 37.930016, "width": 500, "height": 381, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 298350, "photo_title": "What are you looking at ?", "photo_url": "http://www.panoramio.com/photo/298350", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/298350.jpg", "longitude": -109.276510, "latitude": -27.125567, "width": 500, "height": 332, "upload_date": "04 January 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 85618, "photo_title": "Minas de Mazarrón", "photo_url": "http://www.panoramio.com/photo/85618", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85618.jpg", "longitude": -1.331406, "latitude": 37.599544, "width": 500, "height": 334, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 3804107, "photo_title": "_Feloeka on the Nile_ (Aswan - Egypt)", "photo_url": "http://www.panoramio.com/photo/3804107", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3804107.jpg", "longitude": 32.887723, "latitude": 24.095443, "width": 500, "height": 350, "upload_date": "08 August 2007", "owner_id": 366746, "owner_name": "T NL", "owner_url": "http://www.panoramio.com/user/366746"} + , + {"photo_id": 369885, "photo_title": "Monarque on the beach", "photo_url": "http://www.panoramio.com/photo/369885", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/369885.jpg", "longitude": -70.563126, "latitude": 43.308816, "width": 500, "height": 371, "upload_date": "10 January 2007", "owner_id": 78738, "owner_name": "Nicola Vachon", "owner_url": "http://www.panoramio.com/user/78738"} + , + {"photo_id": 4819425, "photo_title": "Zeeland Magic, 1", "photo_url": "http://www.panoramio.com/photo/4819425", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4819425.jpg", "longitude": 3.479254, "latitude": 51.501169, "width": 492, "height": 500, "upload_date": "22 September 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 88122, "photo_title": "Arpy Lake - Aosta Valley - Italy", "photo_url": "http://www.panoramio.com/photo/88122", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88122.jpg", "longitude": 6.999636, "latitude": 45.723008, "width": 375, "height": 500, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 10219582, "photo_title": "MITTENS ALONG THE ROAD", "photo_url": "http://www.panoramio.com/photo/10219582", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10219582.jpg", "longitude": -110.091248, "latitude": 36.970810, "width": 500, "height": 462, "upload_date": "14 May 2008", "owner_id": 864987, "owner_name": "antorenz", "owner_url": "http://www.panoramio.com/user/864987"} + , + {"photo_id": 558167, "photo_title": "Táltostánc", "photo_url": "http://www.panoramio.com/photo/558167", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/558167.jpg", "longitude": 18.001614, "latitude": 47.409038, "width": 417, "height": 500, "upload_date": "24 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 7113068, "photo_title": "Bálavár", "photo_url": "http://www.panoramio.com/photo/7113068", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7113068.jpg", "longitude": 17.522507, "latitude": 47.775560, "width": 500, "height": 336, "upload_date": "14 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2920885, "photo_title": "Rainbow", "photo_url": "http://www.panoramio.com/photo/2920885", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2920885.jpg", "longitude": 10.620818, "latitude": 47.770960, "width": 375, "height": 500, "upload_date": "24 June 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 2499825, "photo_title": "Rosina lamberti,sunset, templestowe", "photo_url": "http://www.panoramio.com/photo/2499825", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2499825.jpg", "longitude": 145.143299, "latitude": -37.770104, "width": 500, "height": 359, "upload_date": "01 June 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 4536639, "photo_title": "Lago di Carezza", "photo_url": "http://www.panoramio.com/photo/4536639", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4536639.jpg", "longitude": 11.575298, "latitude": 46.410227, "width": 500, "height": 393, "upload_date": "09 September 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 314957, "photo_title": "\"He it is, who coming after me...\" - St. John Baptist on the Charles Bridge ", "photo_url": "http://www.panoramio.com/photo/314957", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/314957.jpg", "longitude": 14.410307, "latitude": 50.086597, "width": 335, "height": 500, "upload_date": "06 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 507214, "photo_title": "A változás ideje", "photo_url": "http://www.panoramio.com/photo/507214", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507214.jpg", "longitude": 17.980499, "latitude": 47.390912, "width": 500, "height": 335, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5551561, "photo_title": "New light old trees26-10-2007", "photo_url": "http://www.panoramio.com/photo/5551561", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5551561.jpg", "longitude": -5.663366, "latitude": 55.390130, "width": 338, "height": 500, "upload_date": "26 October 2007", "owner_id": 599676, "owner_name": "mossip", "owner_url": "http://www.panoramio.com/user/599676"} + , + {"photo_id": 67338, "photo_title": "Salar de Uyuni", "photo_url": "http://www.panoramio.com/photo/67338", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67338.jpg", "longitude": -67.539825, "latitude": -20.439882, "width": 375, "height": 500, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 436354, "photo_title": "oonogame", "photo_url": "http://www.panoramio.com/photo/436354", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436354.jpg", "longitude": 138.461380, "latitude": 38.311760, "width": 387, "height": 500, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 10068358, "photo_title": "#08 Reflections in Lendkanal, Klagenfurt, Scenery June 2008", "photo_url": "http://www.panoramio.com/photo/10068358", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10068358.jpg", "longitude": 14.294415, "latitude": 46.622326, "width": 375, "height": 500, "upload_date": "09 May 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 1440137, "photo_title": "Horseshoe Bend", "photo_url": "http://www.panoramio.com/photo/1440137", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1440137.jpg", "longitude": -111.510887, "latitude": 36.882641, "width": 500, "height": 391, "upload_date": "22 March 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 4809439, "photo_title": "Going Nowhere Fast", "photo_url": "http://www.panoramio.com/photo/4809439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4809439.jpg", "longitude": -119.013970, "latitude": 38.211420, "width": 375, "height": 500, "upload_date": "21 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 7806281, "photo_title": "Moon&Mosque", "photo_url": "http://www.panoramio.com/photo/7806281", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7806281.jpg", "longitude": 21.138296, "latitude": 41.960958, "width": 500, "height": 344, "upload_date": "13 February 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 821388, "photo_title": "Aurora Borealis with frosty fog from the sea in front", "photo_url": "http://www.panoramio.com/photo/821388", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/821388.jpg", "longitude": 23.229733, "latitude": 69.962616, "width": 500, "height": 256, "upload_date": "14 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 946841, "photo_title": "Maroon Bells", "photo_url": "http://www.panoramio.com/photo/946841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/946841.jpg", "longitude": -106.948385, "latitude": 39.095030, "width": 500, "height": 375, "upload_date": "21 February 2007", "owner_id": 163881, "owner_name": "faisasy", "owner_url": "http://www.panoramio.com/user/163881"} + , + {"photo_id": 3719882, "photo_title": "Puesta de Sol(Oest.Portugal)", "photo_url": "http://www.panoramio.com/photo/3719882", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3719882.jpg", "longitude": -9.286709, "latitude": 39.392428, "width": 375, "height": 500, "upload_date": "04 August 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 3418114, "photo_title": "Fény-Kép", "photo_url": "http://www.panoramio.com/photo/3418114", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3418114.jpg", "longitude": 17.511692, "latitude": 47.837127, "width": 500, "height": 333, "upload_date": "20 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 255257, "photo_title": "Croatia, Brela - Sunset on the Beach - near \"Kamen Brela\" rock, symbol of this adriatic town", "photo_url": "http://www.panoramio.com/photo/255257", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/255257.jpg", "longitude": 16.922604, "latitude": 43.372309, "width": 500, "height": 332, "upload_date": "28 December 2006", "owner_id": 52119, "owner_name": "RomanV", "owner_url": "http://www.panoramio.com/user/52119"} + , + {"photo_id": 2346040, "photo_title": "Huncut fények", "photo_url": "http://www.panoramio.com/photo/2346040", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2346040.jpg", "longitude": 15.539217, "latitude": 47.670589, "width": 500, "height": 334, "upload_date": "22 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1235900, "photo_title": "Fog, Hemlocks and Cedars ", "photo_url": "http://www.panoramio.com/photo/1235900", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235900.jpg", "longitude": -131.682816, "latitude": 52.885706, "width": 500, "height": 352, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 111554, "photo_title": "Lahna", "photo_url": "http://www.panoramio.com/photo/111554", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/111554.jpg", "longitude": 27.557831, "latitude": 42.550551, "width": 500, "height": 357, "upload_date": "11 December 2006", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 280112, "photo_title": "dune02", "photo_url": "http://www.panoramio.com/photo/280112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/280112.jpg", "longitude": -3.985291, "latitude": 31.156408, "width": 500, "height": 338, "upload_date": "01 January 2007", "owner_id": 58867, "owner_name": "Lachaud Franck", "owner_url": "http://www.panoramio.com/user/58867"} + , + {"photo_id": 5984, "photo_title": "Chott El Jerid", "photo_url": "http://www.panoramio.com/photo/5984", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5984.jpg", "longitude": 8.358536, "latitude": 33.715202, "width": 347, "height": 500, "upload_date": "17 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 25513, "photo_title": "Catarata Rio Celeste", "photo_url": "http://www.panoramio.com/photo/25513", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/25513.jpg", "longitude": -85.046539, "latitude": 10.643400, "width": 375, "height": 500, "upload_date": "17 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 35502, "photo_title": "roques", "photo_url": "http://www.panoramio.com/photo/35502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/35502.jpg", "longitude": -66.774902, "latitude": 11.802834, "width": 500, "height": 375, "upload_date": "29 July 2006", "owner_id": 3360, "owner_name": "ozzy", "owner_url": "http://www.panoramio.com/user/3360"} + , + {"photo_id": 1656020, "photo_title": "Palmeras", "photo_url": "http://www.panoramio.com/photo/1656020", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1656020.jpg", "longitude": -1.211929, "latitude": 37.935804, "width": 500, "height": 333, "upload_date": "06 April 2007", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 58341, "photo_title": "Lio Piccolo - Palazzetto Boldú", "photo_url": "http://www.panoramio.com/photo/58341", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58341.jpg", "longitude": 12.489095, "latitude": 45.490615, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 416310, "photo_title": "Lake of Glass Falls", "photo_url": "http://www.panoramio.com/photo/416310", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416310.jpg", "longitude": -105.664272, "latitude": 40.283192, "width": 500, "height": 374, "upload_date": "13 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 8148031, "photo_title": "Der Morgen in der Camargue .....", "photo_url": "http://www.panoramio.com/photo/8148031", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8148031.jpg", "longitude": 4.451180, "latitude": 43.507102, "width": 500, "height": 351, "upload_date": "27 February 2008", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 1088575, "photo_title": "Lampion", "photo_url": "http://www.panoramio.com/photo/1088575", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1088575.jpg", "longitude": 17.698631, "latitude": 47.521374, "width": 500, "height": 397, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 771169, "photo_title": "Bloodred evening sky, near Zutphen", "photo_url": "http://www.panoramio.com/photo/771169", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/771169.jpg", "longitude": 6.110770, "latitude": 52.113681, "width": 500, "height": 500, "upload_date": "11 February 2007", "owner_id": 161254, "owner_name": "fotoartistry", "owner_url": "http://www.panoramio.com/user/161254"} + , + {"photo_id": 2334149, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2334149", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2334149.jpg", "longitude": 0.493269, "latitude": 40.904204, "width": 500, "height": 304, "upload_date": "21 May 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 41688, "photo_title": "Unbelieveable sunrise colors at Lofoten", "photo_url": "http://www.panoramio.com/photo/41688", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/41688.jpg", "longitude": 14.256134, "latitude": 68.239368, "width": 500, "height": 375, "upload_date": "26 August 2006", "owner_id": 3404, "owner_name": "Csongor Böröczky", "owner_url": "http://www.panoramio.com/user/3404"} + , + {"photo_id": 6953, "photo_title": "Last moment of the day", "photo_url": "http://www.panoramio.com/photo/6953", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6953.jpg", "longitude": 2.191944, "latitude": 41.578599, "width": 500, "height": 320, "upload_date": "16 January 2006", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 10895432, "photo_title": "КарагайÑÐºÐ°Ñ ÑоÑна", "photo_url": "http://www.panoramio.com/photo/10895432", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10895432.jpg", "longitude": 57.886791, "latitude": 51.644708, "width": 333, "height": 500, "upload_date": "04 June 2008", "owner_id": 904057, "owner_name": "Б.Ярцев", "owner_url": "http://www.panoramio.com/user/904057"} + , + {"photo_id": 1446812, "photo_title": "Elfland", "photo_url": "http://www.panoramio.com/photo/1446812", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1446812.jpg", "longitude": 17.808323, "latitude": 47.349408, "width": 345, "height": 500, "upload_date": "22 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4898495, "photo_title": "Elfendel", "photo_url": "http://www.panoramio.com/photo/4898495", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4898495.jpg", "longitude": 17.724380, "latitude": 47.261058, "width": 500, "height": 325, "upload_date": "25 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 911298, "photo_title": "View from Nordenskiöldtoppen, Svalbard", "photo_url": "http://www.panoramio.com/photo/911298", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/911298.jpg", "longitude": 15.314941, "latitude": 78.179588, "width": 500, "height": 287, "upload_date": "20 February 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 2169236, "photo_title": "sunset", "photo_url": "http://www.panoramio.com/photo/2169236", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2169236.jpg", "longitude": 145.128708, "latitude": -37.759859, "width": 333, "height": 500, "upload_date": "11 May 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 237466, "photo_title": "wierzchon.com warsaw podzamcze", "photo_url": "http://www.panoramio.com/photo/237466", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/237466.jpg", "longitude": 21.011347, "latitude": 52.253852, "width": 335, "height": 500, "upload_date": "26 December 2006", "owner_id": 47836, "owner_name": "Andrzej Wierzchon", "owner_url": "http://www.panoramio.com/user/47836"} + , + {"photo_id": 355519, "photo_title": "chile laguna miscanti", "photo_url": "http://www.panoramio.com/photo/355519", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/355519.jpg", "longitude": -67.798347, "latitude": -23.758010, "width": 500, "height": 334, "upload_date": "09 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 58360, "photo_title": "Castello di Toblino", "photo_url": "http://www.panoramio.com/photo/58360", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58360.jpg", "longitude": 10.966415, "latitude": 46.054173, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 10511168, "photo_title": "Në Fush të Pallaticës", "photo_url": "http://www.panoramio.com/photo/10511168", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10511168.jpg", "longitude": 21.075296, "latitude": 42.007692, "width": 500, "height": 413, "upload_date": "23 May 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 572526, "photo_title": "Farm by Osafjorden in the first sun of the day", "photo_url": "http://www.panoramio.com/photo/572526", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/572526.jpg", "longitude": 6.998119, "latitude": 60.563101, "width": 500, "height": 353, "upload_date": "25 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 5303687, "photo_title": "Fátyoltánc", "photo_url": "http://www.panoramio.com/photo/5303687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5303687.jpg", "longitude": 15.934725, "latitude": 47.915997, "width": 500, "height": 334, "upload_date": "14 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 370324, "photo_title": "Rainbow_by_bkm", "photo_url": "http://www.panoramio.com/photo/370324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/370324.jpg", "longitude": 6.453094, "latitude": 62.636926, "width": 500, "height": 344, "upload_date": "10 January 2007", "owner_id": 78923, "owner_name": "bj00rn", "owner_url": "http://www.panoramio.com/user/78923"} + , + {"photo_id": 7996369, "photo_title": "Bled - Church on the island", "photo_url": "http://www.panoramio.com/photo/7996369", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7996369.jpg", "longitude": 14.084473, "latitude": 46.360671, "width": 375, "height": 500, "upload_date": "21 February 2008", "owner_id": 763995, "owner_name": "Samo T.", "owner_url": "http://www.panoramio.com/user/763995"} + , + {"photo_id": 498385, "photo_title": "Rainbow Falls in Sun", "photo_url": "http://www.panoramio.com/photo/498385", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/498385.jpg", "longitude": -119.084823, "latitude": 37.601771, "width": 407, "height": 500, "upload_date": "20 January 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 571110, "photo_title": "Nordlys - Aurora Borealis - over Vadsø", "photo_url": "http://www.panoramio.com/photo/571110", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/571110.jpg", "longitude": 29.815350, "latitude": 70.075649, "width": 500, "height": 332, "upload_date": "25 January 2007", "owner_id": 121482, "owner_name": "Jens Gressmyr", "owner_url": "http://www.panoramio.com/user/121482"} + , + {"photo_id": 3904502, "photo_title": "Una notte di fuoco - a night of fire ", "photo_url": "http://www.panoramio.com/photo/3904502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3904502.jpg", "longitude": 11.337290, "latitude": 46.461257, "width": 500, "height": 360, "upload_date": "13 August 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 1835001, "photo_title": "Вулкан ЖупановÑкий. РаÑÑвет", "photo_url": "http://www.panoramio.com/photo/1835001", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1835001.jpg", "longitude": 158.595543, "latitude": 53.496828, "width": 500, "height": 341, "upload_date": "19 April 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 91931, "photo_title": "Plitvice (Croacia)", "photo_url": "http://www.panoramio.com/photo/91931", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91931.jpg", "longitude": 15.599556, "latitude": 44.851975, "width": 500, "height": 375, "upload_date": "04 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 515905, "photo_title": "A figyelÅ‘", "photo_url": "http://www.panoramio.com/photo/515905", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/515905.jpg", "longitude": 17.625675, "latitude": 47.565060, "width": 500, "height": 345, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 7444056, "photo_title": "Ragyogás II.", "photo_url": "http://www.panoramio.com/photo/7444056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7444056.jpg", "longitude": 16.385422, "latitude": 46.850095, "width": 333, "height": 500, "upload_date": "29 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1674082, "photo_title": "STATUA LIBERTA'", "photo_url": "http://www.panoramio.com/photo/1674082", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1674082.jpg", "longitude": -74.042444, "latitude": 40.689229, "width": 500, "height": 375, "upload_date": "07 April 2007", "owner_id": 135078, "owner_name": "Fabio Belli FABIOSO", "owner_url": "http://www.panoramio.com/user/135078"} + , + {"photo_id": 798846, "photo_title": "Panther Rock, Antelope Canyon, AZ", "photo_url": "http://www.panoramio.com/photo/798846", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798846.jpg", "longitude": -111.391668, "latitude": 36.878728, "width": 376, "height": 500, "upload_date": "12 February 2007", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 21458, "photo_title": "The way of dreams (Aletschgletsher)", "photo_url": "http://www.panoramio.com/photo/21458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/21458.jpg", "longitude": 7.976074, "latitude": 46.544694, "width": 500, "height": 375, "upload_date": "29 May 2006", "owner_id": 3404, "owner_name": "Csongor Böröczky", "owner_url": "http://www.panoramio.com/user/3404"} + , + {"photo_id": 691681, "photo_title": "PANORAMIO - Ilha das Cabras - by Wolfgang Wodeck", "photo_url": "http://www.panoramio.com/photo/691681", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/691681.jpg", "longitude": -48.628750, "latitude": -26.989624, "width": 500, "height": 333, "upload_date": "04 February 2007", "owner_id": 103166, "owner_name": "Wolfgang Wodeck", "owner_url": "http://www.panoramio.com/user/103166"} + , + {"photo_id": 564451, "photo_title": "Gewitter über Schutterwald", "photo_url": "http://www.panoramio.com/photo/564451", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/564451.jpg", "longitude": 7.887470, "latitude": 48.453409, "width": 500, "height": 333, "upload_date": "25 January 2007", "owner_id": 121083, "owner_name": "Alexandra Buss", "owner_url": "http://www.panoramio.com/user/121083"} + , + {"photo_id": 1430151, "photo_title": "Burano", "photo_url": "http://www.panoramio.com/photo/1430151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1430151.jpg", "longitude": 12.416686, "latitude": 45.485966, "width": 500, "height": 365, "upload_date": "21 March 2007", "owner_id": 193913, "owner_name": "Klesitz Piroska", "owner_url": "http://www.panoramio.com/user/193913"} + , + {"photo_id": 3156915, "photo_title": "Brussels - Grand Place", "photo_url": "http://www.panoramio.com/photo/3156915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3156915.jpg", "longitude": 4.352152, "latitude": 50.846658, "width": 500, "height": 375, "upload_date": "07 July 2007", "owner_id": 138691, "owner_name": "Josep Maria Alegre", "owner_url": "http://www.panoramio.com/user/138691"} + , + {"photo_id": 6126516, "photo_title": "Richmond Deer", "photo_url": "http://www.panoramio.com/photo/6126516", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126516.jpg", "longitude": -0.279776, "latitude": 51.448565, "width": 500, "height": 294, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 679356, "photo_title": "sulphur crested cockatoos", "photo_url": "http://www.panoramio.com/photo/679356", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679356.jpg", "longitude": 150.363181, "latitude": -33.718234, "width": 500, "height": 500, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 462324, "photo_title": "Yucca", "photo_url": "http://www.panoramio.com/photo/462324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/462324.jpg", "longitude": -106.259680, "latitude": 32.797448, "width": 500, "height": 500, "upload_date": "17 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 9528831, "photo_title": "maldives", "photo_url": "http://www.panoramio.com/photo/9528831", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9528831.jpg", "longitude": 73.454686, "latitude": 3.845837, "width": 500, "height": 335, "upload_date": "20 April 2008", "owner_id": 647076, "owner_name": "garethohara", "owner_url": "http://www.panoramio.com/user/647076"} + , + {"photo_id": 11825351, "photo_title": " ARC Buque Escuela Gloria. ARC School Ship Gloria. by (((Jose Daniel))) ", "photo_url": "http://www.panoramio.com/photo/11825351", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11825351.jpg", "longitude": -75.539761, "latitude": 10.410917, "width": 500, "height": 392, "upload_date": "05 July 2008", "owner_id": 1611883, "owner_name": "(((Jose Daniel)))", "owner_url": "http://www.panoramio.com/user/1611883"} + , + {"photo_id": 459614, "photo_title": "seaside line", "photo_url": "http://www.panoramio.com/photo/459614", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459614.jpg", "longitude": 138.801785, "latitude": 37.756669, "width": 500, "height": 383, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 771974, "photo_title": "Retired Boat", "photo_url": "http://www.panoramio.com/photo/771974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/771974.jpg", "longitude": 25.427610, "latitude": 36.427576, "width": 500, "height": 332, "upload_date": "11 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1781649, "photo_title": "Fall in Yosemite Valley", "photo_url": "http://www.panoramio.com/photo/1781649", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781649.jpg", "longitude": -119.609270, "latitude": 37.735290, "width": 500, "height": 400, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 8491500, "photo_title": "Horsetail Falls at Sunset", "photo_url": "http://www.panoramio.com/photo/8491500", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8491500.jpg", "longitude": -119.623947, "latitude": 37.723512, "width": 333, "height": 500, "upload_date": "12 March 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 9505599, "photo_title": "#9 Penguins at Boulders Beach, Simon’s Town, Scenery May08", "photo_url": "http://www.panoramio.com/photo/9505599", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9505599.jpg", "longitude": 18.450642, "latitude": -34.196443, "width": 500, "height": 489, "upload_date": "19 April 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 1320563, "photo_title": "Pirates on anchor", "photo_url": "http://www.panoramio.com/photo/1320563", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1320563.jpg", "longitude": 39.311485, "latitude": -5.724799, "width": 316, "height": 500, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 2381962, "photo_title": "Uluru,Northern Territory,Australia-Rosina lamberti", "photo_url": "http://www.panoramio.com/photo/2381962", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2381962.jpg", "longitude": 131.054878, "latitude": -25.326959, "width": 500, "height": 274, "upload_date": "25 May 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 92102, "photo_title": "Briksdalsbreen (Norway)", "photo_url": "http://www.panoramio.com/photo/92102", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/92102.jpg", "longitude": 6.887054, "latitude": 61.664788, "width": 500, "height": 375, "upload_date": "05 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 7012377, "photo_title": "Kanyarfények", "photo_url": "http://www.panoramio.com/photo/7012377", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7012377.jpg", "longitude": 17.517700, "latitude": 47.760445, "width": 500, "height": 334, "upload_date": "09 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 422769, "photo_title": "hazaki2", "photo_url": "http://www.panoramio.com/photo/422769", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/422769.jpg", "longitude": 138.862553, "latitude": 37.711410, "width": 500, "height": 333, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 4558763, "photo_title": "Corsica - West Coast", "photo_url": "http://www.panoramio.com/photo/4558763", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4558763.jpg", "longitude": 8.640404, "latitude": 42.255205, "width": 500, "height": 342, "upload_date": "10 September 2007", "owner_id": 49870, "owner_name": "Jean-Michel Raggioli", "owner_url": "http://www.panoramio.com/user/49870"} + , + {"photo_id": 374479, "photo_title": "Corinthos", "photo_url": "http://www.panoramio.com/photo/374479", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/374479.jpg", "longitude": 22.997131, "latitude": 37.925514, "width": 375, "height": 500, "upload_date": "10 January 2007", "owner_id": 74407, "owner_name": "Yeoman", "owner_url": "http://www.panoramio.com/user/74407"} + , + {"photo_id": 2421991, "photo_title": "\"Different\" Arch", "photo_url": "http://www.panoramio.com/photo/2421991", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2421991.jpg", "longitude": -109.499032, "latitude": 38.744118, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 945978, "photo_title": "L'Ebre", "photo_url": "http://www.panoramio.com/photo/945978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945978.jpg", "longitude": 0.495501, "latitude": 40.905015, "width": 500, "height": 377, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 48449, "photo_title": "Montserrat", "photo_url": "http://www.panoramio.com/photo/48449", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/48449.jpg", "longitude": 1.840060, "latitude": 41.593702, "width": 500, "height": 337, "upload_date": "15 September 2006", "owner_id": 5477, "owner_name": "errece", "owner_url": "http://www.panoramio.com/user/5477"} + , + {"photo_id": 572483, "photo_title": "wheatfield in autumn", "photo_url": "http://www.panoramio.com/photo/572483", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/572483.jpg", "longitude": 11.278152, "latitude": 59.644760, "width": 500, "height": 351, "upload_date": "25 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 2060897, "photo_title": "Mid Coolum", "photo_url": "http://www.panoramio.com/photo/2060897", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2060897.jpg", "longitude": 153.097685, "latitude": -26.540052, "width": 500, "height": 336, "upload_date": "04 May 2007", "owner_id": 411736, "owner_name": "Nixpix", "owner_url": "http://www.panoramio.com/user/411736"} + , + {"photo_id": 6327146, "photo_title": "Winterwald beim \"Widi\" - a thin sheet of ice (messi 06)", "photo_url": "http://www.panoramio.com/photo/6327146", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6327146.jpg", "longitude": 7.381070, "latitude": 47.015670, "width": 500, "height": 363, "upload_date": "06 December 2007", "owner_id": 162722, "owner_name": "©polytropos", "owner_url": "http://www.panoramio.com/user/162722"} + , + {"photo_id": 36476, "photo_title": "Bergbach", "photo_url": "http://www.panoramio.com/photo/36476", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36476.jpg", "longitude": 13.911953, "latitude": 47.634164, "width": 375, "height": 500, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 436366, "photo_title": "sunset", "photo_url": "http://www.panoramio.com/photo/436366", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436366.jpg", "longitude": 138.857231, "latitude": 37.828497, "width": 500, "height": 351, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 701842, "photo_title": "Singapore Skyline @ Night", "photo_url": "http://www.panoramio.com/photo/701842", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/701842.jpg", "longitude": 103.855486, "latitude": 1.288897, "width": 500, "height": 324, "upload_date": "05 February 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 6086623, "photo_title": "Lángoló repce", "photo_url": "http://www.panoramio.com/photo/6086623", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6086623.jpg", "longitude": 17.784977, "latitude": 47.660994, "width": 500, "height": 334, "upload_date": "23 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1595617, "photo_title": "Rosina lamberti,Templestowe,Victoria,Australia", "photo_url": "http://www.panoramio.com/photo/1595617", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1595617.jpg", "longitude": 145.137978, "latitude": -37.774785, "width": 500, "height": 354, "upload_date": "02 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 74727, "photo_title": "ama dablam in background", "photo_url": "http://www.panoramio.com/photo/74727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74727.jpg", "longitude": 86.826496, "latitude": 27.904631, "width": 500, "height": 334, "upload_date": "02 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 36086, "photo_title": "Рим. двор Ватикана", "photo_url": "http://www.panoramio.com/photo/36086", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36086.jpg", "longitude": 12.454505, "latitude": 41.905695, "width": 500, "height": 444, "upload_date": "31 July 2006", "owner_id": 5641, "owner_name": "sergey duhanin", "owner_url": "http://www.panoramio.com/user/5641"} + , + {"photo_id": 2066940, "photo_title": "Unbelievable ice sculptures", "photo_url": "http://www.panoramio.com/photo/2066940", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2066940.jpg", "longitude": -73.264389, "latitude": -50.009063, "width": 500, "height": 333, "upload_date": "04 May 2007", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 1759754, "photo_title": "On the way for the heat wave", "photo_url": "http://www.panoramio.com/photo/1759754", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1759754.jpg", "longitude": -12.734528, "latitude": 20.208079, "width": 500, "height": 331, "upload_date": "13 April 2007", "owner_id": 121377, "owner_name": "Philippe Buffard", "owner_url": "http://www.panoramio.com/user/121377"} + , + {"photo_id": 5717808, "photo_title": "Moonlight @ Eglisau", "photo_url": "http://www.panoramio.com/photo/5717808", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5717808.jpg", "longitude": 8.521459, "latitude": 47.575035, "width": 500, "height": 331, "upload_date": "05 November 2007", "owner_id": 436351, "owner_name": "Sunpixx", "owner_url": "http://www.panoramio.com/user/436351"} + , + {"photo_id": 44853, "photo_title": "Airfocus20050501DSC_3416l", "photo_url": "http://www.panoramio.com/photo/44853", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/44853.jpg", "longitude": 7.663361, "latitude": 50.287009, "width": 500, "height": 332, "upload_date": "02 September 2006", "owner_id": 6703, "owner_name": "Peter Jansen", "owner_url": "http://www.panoramio.com/user/6703"} + , + {"photo_id": 57403, "photo_title": "Burano 2", "photo_url": "http://www.panoramio.com/photo/57403", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57403.jpg", "longitude": 12.420173, "latitude": 45.485365, "width": 500, "height": 331, "upload_date": "04 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 13130, "photo_title": "Agde - Painted wall", "photo_url": "http://www.panoramio.com/photo/13130", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/13130.jpg", "longitude": 3.471251, "latitude": 43.312314, "width": 500, "height": 375, "upload_date": "25 February 2006", "owner_id": 1981, "owner_name": "Eric Medvet", "owner_url": "http://www.panoramio.com/user/1981"} + , + {"photo_id": 7375236, "photo_title": "le Loir en crue à Briollay, janvier 2008. #276", "photo_url": "http://www.panoramio.com/photo/7375236", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7375236.jpg", "longitude": -0.500618, "latitude": 47.557827, "width": 500, "height": 338, "upload_date": "26 January 2008", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 3851701, "photo_title": "Mailbox", "photo_url": "http://www.panoramio.com/photo/3851701", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3851701.jpg", "longitude": -73.475790, "latitude": 44.528271, "width": 500, "height": 333, "upload_date": "10 August 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 1235904, "photo_title": "Ripples", "photo_url": "http://www.panoramio.com/photo/1235904", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235904.jpg", "longitude": -131.616211, "latitude": 52.834299, "width": 330, "height": 500, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 50646, "photo_title": "Ice Cave", "photo_url": "http://www.panoramio.com/photo/50646", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50646.jpg", "longitude": -118.052559, "latitude": 52.678620, "width": 500, "height": 375, "upload_date": "21 September 2006", "owner_id": 7190, "owner_name": "Perry Tang", "owner_url": "http://www.panoramio.com/user/7190"} + , + {"photo_id": 617458, "photo_title": "Pescador", "photo_url": "http://www.panoramio.com/photo/617458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/617458.jpg", "longitude": 0.492368, "latitude": 40.904091, "width": 500, "height": 334, "upload_date": "29 January 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 52724, "photo_title": "Sunrise Gythio", "photo_url": "http://www.panoramio.com/photo/52724", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52724.jpg", "longitude": 22.574501, "latitude": 36.755665, "width": 500, "height": 333, "upload_date": "26 September 2006", "owner_id": 7464, "owner_name": "Pieter", "owner_url": "http://www.panoramio.com/user/7464"} + , + {"photo_id": 289855, "photo_title": "Coronation Island Colours", "photo_url": "http://www.panoramio.com/photo/289855", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/289855.jpg", "longitude": -45.703125, "latitude": -60.705448, "width": 500, "height": 335, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 5649263, "photo_title": "Naab im Herbst", "photo_url": "http://www.panoramio.com/photo/5649263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5649263.jpg", "longitude": 12.070885, "latitude": 49.298711, "width": 500, "height": 329, "upload_date": "31 October 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 110750, "photo_title": "The Peter and Paul Fortress. Panoramic view (180°) from The Palace Quay. — Ð‘Ð¾Ð»ÑŒÑˆÐ°Ñ (180°) панорама ПетропавловÑкой крепоÑти Ñ Ð”Ð²Ð¾Ñ€Ñ†Ð¾Ð²Ð¾Ð¹ набережной.", "photo_url": "http://www.panoramio.com/photo/110750", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/110750.jpg", "longitude": 30.317802, "latitude": 59.946930, "width": 500, "height": 31, "upload_date": "11 December 2006", "owner_id": 12103, "owner_name": "Roman Sobolenko", "owner_url": "http://www.panoramio.com/user/12103"} + , + {"photo_id": 1870028, "photo_title": "Tour Moretti", "photo_url": "http://www.panoramio.com/photo/1870028", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1870028.jpg", "longitude": 2.247775, "latitude": 48.889175, "width": 500, "height": 395, "upload_date": "21 April 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 52752, "photo_title": "Sun and Clouds in Naphlion", "photo_url": "http://www.panoramio.com/photo/52752", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52752.jpg", "longitude": 22.792425, "latitude": 37.562405, "width": 333, "height": 500, "upload_date": "26 September 2006", "owner_id": 7464, "owner_name": "Pieter", "owner_url": "http://www.panoramio.com/user/7464"} + , + {"photo_id": 2256672, "photo_title": "En algún punto", "photo_url": "http://www.panoramio.com/photo/2256672", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2256672.jpg", "longitude": -2.579153, "latitude": 42.493436, "width": 500, "height": 331, "upload_date": "17 May 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 519209, "photo_title": "Armageddon", "photo_url": "http://www.panoramio.com/photo/519209", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/519209.jpg", "longitude": 17.627563, "latitude": 47.664809, "width": 500, "height": 334, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10175554, "photo_title": "Vessel to eternity", "photo_url": "http://www.panoramio.com/photo/10175554", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10175554.jpg", "longitude": 119.670467, "latitude": 11.089976, "width": 500, "height": 363, "upload_date": "13 May 2008", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 11138384, "photo_title": "Lac des Joncs, reflets", "photo_url": "http://www.panoramio.com/photo/11138384", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11138384.jpg", "longitude": 6.946986, "latitude": 46.513176, "width": 500, "height": 375, "upload_date": "12 June 2008", "owner_id": 1430484, "owner_name": "tiopepe8", "owner_url": "http://www.panoramio.com/user/1430484"} + , + {"photo_id": 204255, "photo_title": "Old farm by Osafjorden", "photo_url": "http://www.panoramio.com/photo/204255", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/204255.jpg", "longitude": 6.998978, "latitude": 60.564197, "width": 500, "height": 368, "upload_date": "21 December 2006", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3871571, "photo_title": "St. Bartholomä am Königssee", "photo_url": "http://www.panoramio.com/photo/3871571", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3871571.jpg", "longitude": 12.973351, "latitude": 47.545220, "width": 500, "height": 375, "upload_date": "11 August 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 5358166, "photo_title": "Mooney Falls", "photo_url": "http://www.panoramio.com/photo/5358166", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5358166.jpg", "longitude": -112.709148, "latitude": 36.262849, "width": 500, "height": 335, "upload_date": "16 October 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 600797, "photo_title": "Living (?) in Hong Kong", "photo_url": "http://www.panoramio.com/photo/600797", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/600797.jpg", "longitude": 113.935831, "latitude": 22.279794, "width": 500, "height": 334, "upload_date": "28 January 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 6459385, "photo_title": "Alternativ Future", "photo_url": "http://www.panoramio.com/photo/6459385", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6459385.jpg", "longitude": 17.598467, "latitude": 47.645846, "width": 500, "height": 325, "upload_date": "13 December 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 522010, "photo_title": "Hyperion", "photo_url": "http://www.panoramio.com/photo/522010", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522010.jpg", "longitude": 17.562933, "latitude": 47.632545, "width": 500, "height": 353, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4942642, "photo_title": "Förgeteg elött", "photo_url": "http://www.panoramio.com/photo/4942642", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4942642.jpg", "longitude": 17.807121, "latitude": 47.646887, "width": 500, "height": 334, "upload_date": "27 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 223798, "photo_title": "Kachemak Bay Moonrise", "photo_url": "http://www.panoramio.com/photo/223798", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/223798.jpg", "longitude": -151.426835, "latitude": 59.680146, "width": 500, "height": 333, "upload_date": "24 December 2006", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 1946961, "photo_title": "Három \"Grácia\"", "photo_url": "http://www.panoramio.com/photo/1946961", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1946961.jpg", "longitude": 18.273354, "latitude": 47.577684, "width": 500, "height": 290, "upload_date": "27 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 821342, "photo_title": "Northern Lights seen from Alta", "photo_url": "http://www.panoramio.com/photo/821342", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/821342.jpg", "longitude": 23.234882, "latitude": 69.962969, "width": 500, "height": 346, "upload_date": "14 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 9831100, "photo_title": "Repcepásztor", "photo_url": "http://www.panoramio.com/photo/9831100", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9831100.jpg", "longitude": 18.213100, "latitude": 47.567956, "width": 500, "height": 334, "upload_date": "01 May 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8294907, "photo_title": "Winds of Change", "photo_url": "http://www.panoramio.com/photo/8294907", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8294907.jpg", "longitude": -112.007847, "latitude": 36.993299, "width": 333, "height": 500, "upload_date": "04 March 2008", "owner_id": 107292, "owner_name": "Kevin Mikkelsen", "owner_url": "http://www.panoramio.com/user/107292"} + , + {"photo_id": 7388668, "photo_title": "jak dobrze wstać ...", "photo_url": "http://www.panoramio.com/photo/7388668", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7388668.jpg", "longitude": 15.746498, "latitude": 51.848929, "width": 500, "height": 353, "upload_date": "27 January 2008", "owner_id": 889535, "owner_name": "yossarian01", "owner_url": "http://www.panoramio.com/user/889535"} + , + {"photo_id": 617471, "photo_title": "Rio", "photo_url": "http://www.panoramio.com/photo/617471", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/617471.jpg", "longitude": 0.493505, "latitude": 40.904318, "width": 500, "height": 335, "upload_date": "29 January 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 259612, "photo_title": "Miss Liberty, NY/NJ Harbor", "photo_url": "http://www.panoramio.com/photo/259612", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/259612.jpg", "longitude": -74.039698, "latitude": 40.687472, "width": 357, "height": 500, "upload_date": "29 December 2006", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 2282545, "photo_title": "San Remo Scorcio di San Siro", "photo_url": "http://www.panoramio.com/photo/2282545", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2282545.jpg", "longitude": 7.773911, "latitude": 43.818234, "width": 500, "height": 459, "upload_date": "18 May 2007", "owner_id": 60898, "owner_name": "esseil", "owner_url": "http://www.panoramio.com/user/60898"} + , + {"photo_id": 84795, "photo_title": "0032", "photo_url": "http://www.panoramio.com/photo/84795", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/84795.jpg", "longitude": 25.830574, "latitude": -20.889688, "width": 500, "height": 334, "upload_date": "22 November 2006", "owner_id": 10637, "owner_name": "Carles Campsolinas Dresaire", "owner_url": "http://www.panoramio.com/user/10637"} + , + {"photo_id": 6205, "photo_title": "Valencia III", "photo_url": "http://www.panoramio.com/photo/6205", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6205.jpg", "longitude": -0.352764, "latitude": 39.456143, "width": 500, "height": 375, "upload_date": "28 December 2005", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 5255997, "photo_title": "Az alkonyvigyázó", "photo_url": "http://www.panoramio.com/photo/5255997", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5255997.jpg", "longitude": 17.417107, "latitude": 46.942762, "width": 500, "height": 334, "upload_date": "12 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4214336, "photo_title": "船家 ship On Li river", "photo_url": "http://www.panoramio.com/photo/4214336", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4214336.jpg", "longitude": 110.342388, "latitude": 25.215347, "width": 500, "height": 313, "upload_date": "26 August 2007", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + , + {"photo_id": 611660, "photo_title": "Tikehau Ile aux oiseaux JC", "photo_url": "http://www.panoramio.com/photo/611660", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611660.jpg", "longitude": -148.098224, "latitude": -14.974528, "width": 375, "height": 500, "upload_date": "29 January 2007", "owner_id": 131113, "owner_name": "Lair Jean Claude", "owner_url": "http://www.panoramio.com/user/131113"} + , + {"photo_id": 9822041, "photo_title": "Singapore", "photo_url": "http://www.panoramio.com/photo/9822041", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9822041.jpg", "longitude": 103.855219, "latitude": 1.288907, "width": 500, "height": 333, "upload_date": "01 May 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 126820, "photo_title": "Taj Mahal - colores", "photo_url": "http://www.panoramio.com/photo/126820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/126820.jpg", "longitude": 78.042165, "latitude": 27.172871, "width": 500, "height": 385, "upload_date": "12 December 2006", "owner_id": 10456, "owner_name": "eulogio", "owner_url": "http://www.panoramio.com/user/10456"} + , + {"photo_id": 112504, "photo_title": "V-01009", "photo_url": "http://www.panoramio.com/photo/112504", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112504.jpg", "longitude": 12.335946, "latitude": 45.438213, "width": 500, "height": 500, "upload_date": "11 December 2006", "owner_id": 17599, "owner_name": "Dmitry Andreev", "owner_url": "http://www.panoramio.com/user/17599"} + , + {"photo_id": 1898139, "photo_title": "Ein sehr menschenähnlicher Baum (http://www.redbubble.com/products/configure/1935618)", "photo_url": "http://www.panoramio.com/photo/1898139", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1898139.jpg", "longitude": 13.158177, "latitude": 52.456836, "width": 375, "height": 500, "upload_date": "23 April 2007", "owner_id": 311327, "owner_name": "www.einkauf.tk", "owner_url": "http://www.panoramio.com/user/311327"} + , + {"photo_id": 57813, "photo_title": "Hallstatt 1", "photo_url": "http://www.panoramio.com/photo/57813", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57813.jpg", "longitude": 13.652229, "latitude": 47.551274, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 533476, "photo_title": "Comet McNaught 220107 02", "photo_url": "http://www.panoramio.com/photo/533476", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/533476.jpg", "longitude": 18.371286, "latitude": -33.964363, "width": 328, "height": 500, "upload_date": "22 January 2007", "owner_id": 2748, "owner_name": "WirelessMonkey", "owner_url": "http://www.panoramio.com/user/2748"} + , + {"photo_id": 507370, "photo_title": "The Silence", "photo_url": "http://www.panoramio.com/photo/507370", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507370.jpg", "longitude": 17.497959, "latitude": 47.781328, "width": 465, "height": 500, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2422269, "photo_title": "Grand Trees", "photo_url": "http://www.panoramio.com/photo/2422269", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2422269.jpg", "longitude": -112.124019, "latitude": 36.062942, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2808348, "photo_title": "Blind River reflection", "photo_url": "http://www.panoramio.com/photo/2808348", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2808348.jpg", "longitude": -82.973557, "latitude": 46.193141, "width": 500, "height": 305, "upload_date": "18 June 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 2534183, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2534183", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2534183.jpg", "longitude": -69.934587, "latitude": -37.382844, "width": 500, "height": 335, "upload_date": "02 June 2007", "owner_id": 527160, "owner_name": "legui83", "owner_url": "http://www.panoramio.com/user/527160"} + , + {"photo_id": 1008446, "photo_title": "budamist", "photo_url": "http://www.panoramio.com/photo/1008446", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1008446.jpg", "longitude": 19.078649, "latitude": 47.516737, "width": 500, "height": 341, "upload_date": "24 February 2007", "owner_id": 2659, "owner_name": "ozalph", "owner_url": "http://www.panoramio.com/user/2659"} + , + {"photo_id": 2935385, "photo_title": "temporale sul mare di riccione", "photo_url": "http://www.panoramio.com/photo/2935385", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2935385.jpg", "longitude": 12.644491, "latitude": 43.964836, "width": 333, "height": 500, "upload_date": "25 June 2007", "owner_id": 267377, "owner_name": "Valter Galvani", "owner_url": "http://www.panoramio.com/user/267377"} + , + {"photo_id": 7586398, "photo_title": "Al vuelo", "photo_url": "http://www.panoramio.com/photo/7586398", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7586398.jpg", "longitude": -73.152337, "latitude": -37.114747, "width": 375, "height": 500, "upload_date": "04 February 2008", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 7624042, "photo_title": "Fairyland 11", "photo_url": "http://www.panoramio.com/photo/7624042", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7624042.jpg", "longitude": 6.067650, "latitude": 52.224684, "width": 352, "height": 500, "upload_date": "06 February 2008", "owner_id": 523564, "owner_name": "Luud Riphagen", "owner_url": "http://www.panoramio.com/user/523564"} + , + {"photo_id": 1186930, "photo_title": "Вид Ñ Ð³Ð¾Ñ€Ñ‹ Демерджи - Demergi mountain view", "photo_url": "http://www.panoramio.com/photo/1186930", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1186930.jpg", "longitude": 34.413729, "latitude": 44.749903, "width": 500, "height": 338, "upload_date": "05 March 2007", "owner_id": 244932, "owner_name": "Andrey Jitkov", "owner_url": "http://www.panoramio.com/user/244932"} + , + {"photo_id": 565512, "photo_title": "The staircase star", "photo_url": "http://www.panoramio.com/photo/565512", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/565512.jpg", "longitude": 5.646222, "latitude": 46.261262, "width": 500, "height": 331, "upload_date": "25 January 2007", "owner_id": 121377, "owner_name": "Philippe Buffard", "owner_url": "http://www.panoramio.com/user/121377"} + , + {"photo_id": 3566705, "photo_title": "Pattaya - Big Buddha and seven headed Naga", "photo_url": "http://www.panoramio.com/photo/3566705", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3566705.jpg", "longitude": 100.868155, "latitude": 12.915027, "width": 500, "height": 375, "upload_date": "28 July 2007", "owner_id": 716245, "owner_name": "—Dragon-64— ✈", "owner_url": "http://www.panoramio.com/user/716245"} + , + {"photo_id": 50113, "photo_title": "New York Skyline Panorama", "photo_url": "http://www.panoramio.com/photo/50113", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50113.jpg", "longitude": -73.997775, "latitude": 40.696581, "width": 500, "height": 55, "upload_date": "20 September 2006", "owner_id": 4957, "owner_name": "Ken Gibson", "owner_url": "http://www.panoramio.com/user/4957"} + , + {"photo_id": 74726, "photo_title": "nuptse 1 sunset", "photo_url": "http://www.panoramio.com/photo/74726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74726.jpg", "longitude": 86.865978, "latitude": 27.979243, "width": 500, "height": 334, "upload_date": "02 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 10552400, "photo_title": "Second Prize \"Travel\" May Contest, HDR, May 2008", "photo_url": "http://www.panoramio.com/photo/10552400", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10552400.jpg", "longitude": -3.705075, "latitude": 47.787960, "width": 500, "height": 333, "upload_date": "24 May 2008", "owner_id": 979901, "owner_name": "DiggaTwigga", "owner_url": "http://www.panoramio.com/user/979901"} + , + {"photo_id": 1605229, "photo_title": "Holdfényáhítat", "photo_url": "http://www.panoramio.com/photo/1605229", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1605229.jpg", "longitude": 17.748413, "latitude": 47.555214, "width": 400, "height": 500, "upload_date": "02 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 34669, "photo_title": "Paisaje otoñal - La Rioja - España", "photo_url": "http://www.panoramio.com/photo/34669", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/34669.jpg", "longitude": -2.864685, "latitude": 42.328664, "width": 500, "height": 326, "upload_date": "26 July 2006", "owner_id": 5487, "owner_name": "Joaquín Ramirez", "owner_url": "http://www.panoramio.com/user/5487"} + , + {"photo_id": 4596134, "photo_title": "Le vieux Nice, mars 2007", "photo_url": "http://www.panoramio.com/photo/4596134", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4596134.jpg", "longitude": 7.277198, "latitude": 43.696704, "width": 368, "height": 500, "upload_date": "12 September 2007", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 10576294, "photo_title": "Plaza de Bolívar, Bogotá. 1st. prize Panoramio Contest, May 08.(((Jose Daniel)))", "photo_url": "http://www.panoramio.com/photo/10576294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10576294.jpg", "longitude": -74.075629, "latitude": 4.597867, "width": 500, "height": 338, "upload_date": "25 May 2008", "owner_id": 1611883, "owner_name": "(((Jose Daniel)))", "owner_url": "http://www.panoramio.com/user/1611883"} + , + {"photo_id": 522151, "photo_title": "Jó volt ott", "photo_url": "http://www.panoramio.com/photo/522151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522151.jpg", "longitude": 17.611084, "latitude": 47.602401, "width": 500, "height": 354, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4247476, "photo_title": "Blick vom Zuckerhut", "photo_url": "http://www.panoramio.com/photo/4247476", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4247476.jpg", "longitude": -43.156872, "latitude": -22.948909, "width": 500, "height": 375, "upload_date": "28 August 2007", "owner_id": 496676, "owner_name": "Quasebart", "owner_url": "http://www.panoramio.com/user/496676"} + , + {"photo_id": 5472461, "photo_title": "Lapland", "photo_url": "http://www.panoramio.com/photo/5472461", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5472461.jpg", "longitude": 29.187653, "latitude": 66.189241, "width": 500, "height": 327, "upload_date": "22 October 2007", "owner_id": 912031, "owner_name": "Kimmo Lyytikäinen", "owner_url": "http://www.panoramio.com/user/912031"} + , + {"photo_id": 472802, "photo_title": "Golden Gate Bridge", "photo_url": "http://www.panoramio.com/photo/472802", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/472802.jpg", "longitude": -122.481366, "latitude": 37.827644, "width": 500, "height": 305, "upload_date": "18 January 2007", "owner_id": 100907, "owner_name": "Julia Wahl", "owner_url": "http://www.panoramio.com/user/100907"} + , + {"photo_id": 506118, "photo_title": "Overcast Pier, Hearst State Beach", "photo_url": "http://www.panoramio.com/photo/506118", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/506118.jpg", "longitude": -121.187868, "latitude": 35.643016, "width": 500, "height": 343, "upload_date": "20 January 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 1420841, "photo_title": "Poland ", "photo_url": "http://www.panoramio.com/photo/1420841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1420841.jpg", "longitude": 20.630060, "latitude": 52.073123, "width": 500, "height": 377, "upload_date": "20 March 2007", "owner_id": 234038, "owner_name": "Jacek M.", "owner_url": "http://www.panoramio.com/user/234038"} + , + {"photo_id": 4088401, "photo_title": "Bird at Hogsback - 198812", "photo_url": "http://www.panoramio.com/photo/4088401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4088401.jpg", "longitude": -124.339828, "latitude": 47.440860, "width": 500, "height": 355, "upload_date": "21 August 2007", "owner_id": 765658, "owner_name": "Larry Workman QIN", "owner_url": "http://www.panoramio.com/user/765658"} + , + {"photo_id": 8049018, "photo_title": "Eastern Sierra Sunset", "photo_url": "http://www.panoramio.com/photo/8049018", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8049018.jpg", "longitude": -119.220543, "latitude": 38.031698, "width": 500, "height": 333, "upload_date": "23 February 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 103324, "photo_title": "Lua em São Paulo", "photo_url": "http://www.panoramio.com/photo/103324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/103324.jpg", "longitude": -46.652606, "latitude": -23.545394, "width": 500, "height": 333, "upload_date": "10 December 2006", "owner_id": 14733, "owner_name": "Luiz Henrique Assunção", "owner_url": "http://www.panoramio.com/user/14733"} + , + {"photo_id": 5694626, "photo_title": "Lake of Varese - Moon and Venus before dawn", "photo_url": "http://www.panoramio.com/photo/5694626", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5694626.jpg", "longitude": 8.717716, "latitude": 45.839025, "width": 339, "height": 500, "upload_date": "02 November 2007", "owner_id": 933456, "owner_name": "© Marco De Candido", "owner_url": "http://www.panoramio.com/user/933456"} + , + {"photo_id": 1235876, "photo_title": "Logs on Lake Moraine", "photo_url": "http://www.panoramio.com/photo/1235876", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235876.jpg", "longitude": -116.180420, "latitude": 51.326321, "width": 330, "height": 500, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 6999770, "photo_title": "Mountain range of Pindos", "photo_url": "http://www.panoramio.com/photo/6999770", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6999770.jpg", "longitude": 21.553481, "latitude": 39.498345, "width": 500, "height": 333, "upload_date": "09 January 2008", "owner_id": 242446, "owner_name": "Ntinos Lagos", "owner_url": "http://www.panoramio.com/user/242446"} + , + {"photo_id": 405727, "photo_title": "awagatake", "photo_url": "http://www.panoramio.com/photo/405727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405727.jpg", "longitude": 139.042454, "latitude": 37.563222, "width": 500, "height": 380, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1488363, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488363", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488363.jpg", "longitude": 138.454514, "latitude": 38.308932, "width": 500, "height": 384, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 841001, "photo_title": "Central Balkan", "photo_url": "http://www.panoramio.com/photo/841001", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/841001.jpg", "longitude": 24.963917, "latitude": 42.679306, "width": 500, "height": 357, "upload_date": "16 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 57406, "photo_title": "Burano 4", "photo_url": "http://www.panoramio.com/photo/57406", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57406.jpg", "longitude": 12.419465, "latitude": 45.484567, "width": 500, "height": 333, "upload_date": "04 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1900891, "photo_title": "Peggys Cove, Nova Scotia La barca ...", "photo_url": "http://www.panoramio.com/photo/1900891", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1900891.jpg", "longitude": -63.918285, "latitude": 44.490873, "width": 375, "height": 500, "upload_date": "24 April 2007", "owner_id": 401966, "owner_name": "Syl de Canada", "owner_url": "http://www.panoramio.com/user/401966"} + , + {"photo_id": 2135721, "photo_title": " Coteau Landing (près de Valleyfield 3)", "photo_url": "http://www.panoramio.com/photo/2135721", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2135721.jpg", "longitude": -74.211960, "latitude": 45.253622, "width": 500, "height": 375, "upload_date": "08 May 2007", "owner_id": 401966, "owner_name": "Syl de Canada", "owner_url": "http://www.panoramio.com/user/401966"} + , + {"photo_id": 426155, "photo_title": "2007'01'14-Aucanada-0233", "photo_url": "http://www.panoramio.com/photo/426155", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/426155.jpg", "longitude": 3.169695, "latitude": 39.837627, "width": 500, "height": 335, "upload_date": "14 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 4868548, "photo_title": "Goodbye my dear", "photo_url": "http://www.panoramio.com/photo/4868548", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4868548.jpg", "longitude": 16.693211, "latitude": 43.183025, "width": 500, "height": 500, "upload_date": "24 September 2007", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 47069, "photo_title": "Laguna del Inca", "photo_url": "http://www.panoramio.com/photo/47069", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/47069.jpg", "longitude": -70.130786, "latitude": -32.834759, "width": 500, "height": 333, "upload_date": "11 September 2006", "owner_id": 6961, "owner_name": "Santiago Rios", "owner_url": "http://www.panoramio.com/user/6961"} + , + {"photo_id": 1781731, "photo_title": "The Subway", "photo_url": "http://www.panoramio.com/photo/1781731", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781731.jpg", "longitude": -113.052578, "latitude": 37.310448, "width": 500, "height": 333, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 2279, "photo_title": "Empire State Building", "photo_url": "http://www.panoramio.com/photo/2279", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2279.jpg", "longitude": -73.987073, "latitude": 40.744924, "width": 378, "height": 500, "upload_date": "08 October 2005", "owner_id": 220, "owner_name": "Jeff T. Alu", "owner_url": "http://www.panoramio.com/user/220"} + , + {"photo_id": 1277992, "photo_title": "Cologne-Köln - Dom im Hintergrund der Hohenzollernbrücke bei Nacht (by night)", "photo_url": "http://www.panoramio.com/photo/1277992", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1277992.jpg", "longitude": 6.967220, "latitude": 50.940826, "width": 500, "height": 375, "upload_date": "11 March 2007", "owner_id": 113678, "owner_name": "Canada-Fan", "owner_url": "http://www.panoramio.com/user/113678"} + , + {"photo_id": 207638, "photo_title": "Sunrise at Mont Saint Michel (1 of 2), august 2001", "photo_url": "http://www.panoramio.com/photo/207638", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/207638.jpg", "longitude": -1.509504, "latitude": 48.633547, "width": 331, "height": 500, "upload_date": "21 December 2006", "owner_id": 18925, "owner_name": "Marco Ferrari", "owner_url": "http://www.panoramio.com/user/18925"} + , + {"photo_id": 1452569, "photo_title": "Desierto de La Tatacoa (zona roja)", "photo_url": "http://www.panoramio.com/photo/1452569", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1452569.jpg", "longitude": -75.166667, "latitude": 3.333333, "width": 500, "height": 333, "upload_date": "22 March 2007", "owner_id": 5487, "owner_name": "Joaquín Ramirez", "owner_url": "http://www.panoramio.com/user/5487"} + , + {"photo_id": 3502890, "photo_title": "Monasteries in Meteora", "photo_url": "http://www.panoramio.com/photo/3502890", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3502890.jpg", "longitude": 21.627445, "latitude": 39.712601, "width": 480, "height": 500, "upload_date": "24 July 2007", "owner_id": 686703, "owner_name": "Thodoris Kliafas", "owner_url": "http://www.panoramio.com/user/686703"} + , + {"photo_id": 595505, "photo_title": "Burlington_Village_Square", "photo_url": "http://www.panoramio.com/photo/595505", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/595505.jpg", "longitude": -79.796180, "latitude": 43.326192, "width": 500, "height": 333, "upload_date": "27 January 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 60984, "photo_title": "Ventisquero P. Moreno", "photo_url": "http://www.panoramio.com/photo/60984", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/60984.jpg", "longitude": -73.051872, "latitude": -50.488641, "width": 500, "height": 328, "upload_date": "13 October 2006", "owner_id": 8409, "owner_name": "Hector Fabian Garrido", "owner_url": "http://www.panoramio.com/user/8409"} + , + {"photo_id": 6654030, "photo_title": "Va por un incomprendido Vincent Willem van Gogh", "photo_url": "http://www.panoramio.com/photo/6654030", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6654030.jpg", "longitude": 4.776306, "latitude": 51.477962, "width": 500, "height": 375, "upload_date": "24 December 2007", "owner_id": 804986, "owner_name": "VERJAGA", "owner_url": "http://www.panoramio.com/user/804986"} + , + {"photo_id": 3018575, "photo_title": "Abrasado", "photo_url": "http://www.panoramio.com/photo/3018575", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3018575.jpg", "longitude": -73.279324, "latitude": -39.838002, "width": 500, "height": 375, "upload_date": "29 June 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 521039, "photo_title": "Fátyolos narancslátomás", "photo_url": "http://www.panoramio.com/photo/521039", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/521039.jpg", "longitude": 17.463455, "latitude": 47.850146, "width": 500, "height": 291, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 208239, "photo_title": "Nuvola danzante, Svizzera 2002", "photo_url": "http://www.panoramio.com/photo/208239", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/208239.jpg", "longitude": 7.321701, "latitude": 46.219515, "width": 334, "height": 500, "upload_date": "22 December 2006", "owner_id": 18925, "owner_name": "Marco Ferrari", "owner_url": "http://www.panoramio.com/user/18925"} + , + {"photo_id": 6443936, "photo_title": "Pajkos vizek", "photo_url": "http://www.panoramio.com/photo/6443936", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6443936.jpg", "longitude": 15.934124, "latitude": 47.915019, "width": 500, "height": 334, "upload_date": "12 December 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 7467941, "photo_title": "A day off for the soul...", "photo_url": "http://www.panoramio.com/photo/7467941", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7467941.jpg", "longitude": -75.126133, "latitude": 40.970106, "width": 500, "height": 375, "upload_date": "30 January 2008", "owner_id": 89499, "owner_name": "Michael Braxenthaler", "owner_url": "http://www.panoramio.com/user/89499"} + , + {"photo_id": 800436, "photo_title": "Eiffel Tower", "photo_url": "http://www.panoramio.com/photo/800436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/800436.jpg", "longitude": 2.294576, "latitude": 48.858249, "width": 500, "height": 386, "upload_date": "13 February 2007", "owner_id": 165346, "owner_name": "Alan Knox", "owner_url": "http://www.panoramio.com/user/165346"} + , + {"photo_id": 479673, "photo_title": "Summit of Gogsøyra", "photo_url": "http://www.panoramio.com/photo/479673", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479673.jpg", "longitude": 8.147736, "latitude": 62.642606, "width": 500, "height": 333, "upload_date": "18 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 5378753, "photo_title": "Alps", "photo_url": "http://www.panoramio.com/photo/5378753", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5378753.jpg", "longitude": 6.847916, "latitude": 45.913840, "width": 500, "height": 500, "upload_date": "17 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 382413, "photo_title": "kilimanjaro sunset", "photo_url": "http://www.panoramio.com/photo/382413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/382413.jpg", "longitude": 37.382355, "latitude": -3.046583, "width": 500, "height": 375, "upload_date": "11 January 2007", "owner_id": 6105, "owner_name": "hackltom", "owner_url": "http://www.panoramio.com/user/6105"} + , + {"photo_id": 290784, "photo_title": "Tormenta Bahía de Pollensa", "photo_url": "http://www.panoramio.com/photo/290784", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290784.jpg", "longitude": 3.116437, "latitude": 39.928440, "width": 500, "height": 285, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 519904, "photo_title": "Dombok között felhÅ‘k alatt", "photo_url": "http://www.panoramio.com/photo/519904", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/519904.jpg", "longitude": 18.680878, "latitude": 47.631851, "width": 500, "height": 314, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 181264, "photo_title": "deer cave", "photo_url": "http://www.panoramio.com/photo/181264", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/181264.jpg", "longitude": 114.824553, "latitude": 4.024121, "width": 428, "height": 500, "upload_date": "18 December 2006", "owner_id": 9198, "owner_name": "Caveranger", "owner_url": "http://www.panoramio.com/user/9198"} + , + {"photo_id": 323533, "photo_title": "Elevador e Mercado Modelo Ssa Ba Br", "photo_url": "http://www.panoramio.com/photo/323533", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/323533.jpg", "longitude": -38.512552, "latitude": -12.974261, "width": 500, "height": 333, "upload_date": "06 January 2007", "owner_id": 63291, "owner_name": "Gastón Dapik", "owner_url": "http://www.panoramio.com/user/63291"} + , + {"photo_id": 512513, "photo_title": "Égi tűz", "photo_url": "http://www.panoramio.com/photo/512513", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/512513.jpg", "longitude": 17.481308, "latitude": 47.796148, "width": 500, "height": 334, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10237287, "photo_title": "Kentriki's Woods, by Kostas Andreopoulos", "photo_url": "http://www.panoramio.com/photo/10237287", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10237287.jpg", "longitude": 21.916909, "latitude": 38.569223, "width": 500, "height": 375, "upload_date": "14 May 2008", "owner_id": 1690483, "owner_name": "k.andre", "owner_url": "http://www.panoramio.com/user/1690483"} + , + {"photo_id": 52847, "photo_title": "153 The Forth Bridge (Railway) over the Firth of Forth", "photo_url": "http://www.panoramio.com/photo/52847", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52847.jpg", "longitude": -3.392672, "latitude": 56.007656, "width": 375, "height": 500, "upload_date": "26 September 2006", "owner_id": 7633, "owner_name": "Daniel Meyer", "owner_url": "http://www.panoramio.com/user/7633"} + , + {"photo_id": 11105192, "photo_title": "A bird is free", "photo_url": "http://www.panoramio.com/photo/11105192", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11105192.jpg", "longitude": -6.953058, "latitude": 52.773901, "width": 375, "height": 500, "upload_date": "11 June 2008", "owner_id": 1867220, "owner_name": "Aubrey :)", "owner_url": "http://www.panoramio.com/user/1867220"} + , + {"photo_id": 196039, "photo_title": "espigón", "photo_url": "http://www.panoramio.com/photo/196039", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196039.jpg", "longitude": -3.801688, "latitude": 43.461606, "width": 332, "height": 500, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 70865, "photo_title": "Cataratas de Iguazu", "photo_url": "http://www.panoramio.com/photo/70865", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70865.jpg", "longitude": -54.440818, "latitude": -25.688447, "width": 374, "height": 500, "upload_date": "26 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 6188760, "photo_title": "Vihar elött", "photo_url": "http://www.panoramio.com/photo/6188760", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6188760.jpg", "longitude": 17.462082, "latitude": 47.843579, "width": 500, "height": 330, "upload_date": "28 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 286439, "photo_title": "Rusted Car Along Route 66", "photo_url": "http://www.panoramio.com/photo/286439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/286439.jpg", "longitude": -109.804788, "latitude": 35.050024, "width": 500, "height": 333, "upload_date": "03 January 2007", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 1283563, "photo_title": "Kalalau beach", "photo_url": "http://www.panoramio.com/photo/1283563", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1283563.jpg", "longitude": -159.667397, "latitude": 22.164196, "width": 330, "height": 500, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1336919, "photo_title": "Neuschwanstein", "photo_url": "http://www.panoramio.com/photo/1336919", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1336919.jpg", "longitude": 10.750465, "latitude": 47.553128, "width": 500, "height": 371, "upload_date": "15 March 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 1343841, "photo_title": "Turning Torsoe in the fog", "photo_url": "http://www.panoramio.com/photo/1343841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343841.jpg", "longitude": 12.968073, "latitude": 55.613165, "width": 332, "height": 500, "upload_date": "16 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 4976484, "photo_title": "Le Bout du Monde avant l'orage", "photo_url": "http://www.panoramio.com/photo/4976484", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4976484.jpg", "longitude": 6.867528, "latitude": 46.108618, "width": 500, "height": 375, "upload_date": "29 September 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 1195113, "photo_title": "Берег Сетуни 2 - Setun riverbank 2", "photo_url": "http://www.panoramio.com/photo/1195113", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1195113.jpg", "longitude": 37.486424, "latitude": 55.719367, "width": 332, "height": 500, "upload_date": "06 March 2007", "owner_id": 244932, "owner_name": "Andrey Jitkov", "owner_url": "http://www.panoramio.com/user/244932"} + , + {"photo_id": 1549176, "photo_title": "ErdÅ‘tűz", "photo_url": "http://www.panoramio.com/photo/1549176", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1549176.jpg", "longitude": 17.767639, "latitude": 47.582084, "width": 500, "height": 268, "upload_date": "29 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2127008, "photo_title": "Thunderstorm over Thunderbolt", "photo_url": "http://www.panoramio.com/photo/2127008", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2127008.jpg", "longitude": -111.586761, "latitude": 41.605303, "width": 500, "height": 329, "upload_date": "08 May 2007", "owner_id": 395804, "owner_name": "Ralph Maughan", "owner_url": "http://www.panoramio.com/user/395804"} + , + {"photo_id": 2421940, "photo_title": "Twisted Ideas", "photo_url": "http://www.panoramio.com/photo/2421940", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2421940.jpg", "longitude": -112.105286, "latitude": 36.059681, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 8197305, "photo_title": "Mar Fantasma", "photo_url": "http://www.panoramio.com/photo/8197305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8197305.jpg", "longitude": -71.699395, "latitude": -33.407478, "width": 500, "height": 346, "upload_date": "29 February 2008", "owner_id": 730217, "owner_name": "C.e.C.v", "owner_url": "http://www.panoramio.com/user/730217"} + , + {"photo_id": 6126299, "photo_title": "Richmond Squirrel", "photo_url": "http://www.panoramio.com/photo/6126299", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126299.jpg", "longitude": -0.277609, "latitude": 51.448003, "width": 500, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 55016, "photo_title": "Jacaré-do-pantanal. Vazante do Capivari (Caiman crocodilus yacare)", "photo_url": "http://www.panoramio.com/photo/55016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55016.jpg", "longitude": -56.258326, "latitude": -18.771278, "width": 500, "height": 333, "upload_date": "30 September 2006", "owner_id": 7562, "owner_name": "Marcelo E. Salgado", "owner_url": "http://www.panoramio.com/user/7562"} + , + {"photo_id": 1640188, "photo_title": "Diagonal", "photo_url": "http://www.panoramio.com/photo/1640188", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1640188.jpg", "longitude": 20.428219, "latitude": 48.953621, "width": 408, "height": 500, "upload_date": "05 April 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 2935837, "photo_title": "Aitzgorri. Atardecer mirando al sureste", "photo_url": "http://www.panoramio.com/photo/2935837", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2935837.jpg", "longitude": -2.324939, "latitude": 42.951271, "width": 500, "height": 323, "upload_date": "25 June 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 355622, "photo_title": "newfoundland iceberg", "photo_url": "http://www.panoramio.com/photo/355622", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/355622.jpg", "longitude": -54.733200, "latitude": 49.710939, "width": 500, "height": 334, "upload_date": "09 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 202578, "photo_title": "Abant Lake (1), Bolu", "photo_url": "http://www.panoramio.com/photo/202578", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/202578.jpg", "longitude": 31.286316, "latitude": 40.612128, "width": 500, "height": 317, "upload_date": "21 December 2006", "owner_id": 2351, "owner_name": "Serdar Bilecen", "owner_url": "http://www.panoramio.com/user/2351"} + , + {"photo_id": 9653590, "photo_title": "Secret Gate, Kentriki - [ PANORAMIO APRIL 08 WINNERS]...by Fotinos", "photo_url": "http://www.panoramio.com/photo/9653590", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9653590.jpg", "longitude": 21.914872, "latitude": 38.571189, "width": 375, "height": 500, "upload_date": "24 April 2008", "owner_id": 1640258, "owner_name": "fotinos andreopoulos", "owner_url": "http://www.panoramio.com/user/1640258"} + , + {"photo_id": 2371950, "photo_title": "Dietro l'Isola dei Conigli", "photo_url": "http://www.panoramio.com/photo/2371950", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2371950.jpg", "longitude": 12.552137, "latitude": 35.514553, "width": 500, "height": 375, "upload_date": "24 May 2007", "owner_id": 476623, "owner_name": "Giulio Botticelli", "owner_url": "http://www.panoramio.com/user/476623"} + , + {"photo_id": 1340803, "photo_title": "Huge oak in monochrome", "photo_url": "http://www.panoramio.com/photo/1340803", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1340803.jpg", "longitude": 11.187515, "latitude": 59.548763, "width": 500, "height": 493, "upload_date": "15 March 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 520878, "photo_title": "Farewell", "photo_url": "http://www.panoramio.com/photo/520878", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/520878.jpg", "longitude": 17.466202, "latitude": 47.870186, "width": 415, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4738479, "photo_title": "\"Sovány szárcsavágta\"", "photo_url": "http://www.panoramio.com/photo/4738479", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4738479.jpg", "longitude": 17.571602, "latitude": 47.633354, "width": 500, "height": 347, "upload_date": "18 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2395577, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2395577", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2395577.jpg", "longitude": -79.844792, "latitude": 43.300310, "width": 500, "height": 333, "upload_date": "25 May 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 2470351, "photo_title": "Swans", "photo_url": "http://www.panoramio.com/photo/2470351", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2470351.jpg", "longitude": 23.713217, "latitude": 56.965614, "width": 500, "height": 332, "upload_date": "30 May 2007", "owner_id": 116556, "owner_name": "Pavels Dunaicevs", "owner_url": "http://www.panoramio.com/user/116556"} + , + {"photo_id": 6348257, "photo_title": "Sunset-pallatic", "photo_url": "http://www.panoramio.com/photo/6348257", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6348257.jpg", "longitude": 21.060791, "latitude": 42.004790, "width": 500, "height": 424, "upload_date": "07 December 2007", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 10248178, "photo_title": "LA LUZ DE LA MAÑANA", "photo_url": "http://www.panoramio.com/photo/10248178", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10248178.jpg", "longitude": -2.554321, "latitude": 43.209805, "width": 465, "height": 500, "upload_date": "15 May 2008", "owner_id": 1487989, "owner_name": "mesias", "owner_url": "http://www.panoramio.com/user/1487989"} + , + {"photo_id": 1177785, "photo_title": "Angkor Tom Dawn", "photo_url": "http://www.panoramio.com/photo/1177785", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1177785.jpg", "longitude": 103.858910, "latitude": 13.441383, "width": 401, "height": 500, "upload_date": "05 March 2007", "owner_id": 243825, "owner_name": "DarrinJ", "owner_url": "http://www.panoramio.com/user/243825"} + , + {"photo_id": 4785924, "photo_title": "Antelope Canyon", "photo_url": "http://www.panoramio.com/photo/4785924", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4785924.jpg", "longitude": -111.369422, "latitude": 36.853678, "width": 500, "height": 335, "upload_date": "20 September 2007", "owner_id": 464343, "owner_name": "yves floret", "owner_url": "http://www.panoramio.com/user/464343"} + , + {"photo_id": 459592, "photo_title": "nojiriko", "photo_url": "http://www.panoramio.com/photo/459592", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459592.jpg", "longitude": 138.140202, "latitude": 36.857510, "width": 500, "height": 383, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 377931, "photo_title": "Baobab Avenue after sunset", "photo_url": "http://www.panoramio.com/photo/377931", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/377931.jpg", "longitude": 44.418486, "latitude": -20.250874, "width": 500, "height": 333, "upload_date": "11 January 2007", "owner_id": 70471, "owner_name": "David Thyberg", "owner_url": "http://www.panoramio.com/user/70471"} + , + {"photo_id": 170330, "photo_title": "Petit Palais - Looking Up", "photo_url": "http://www.panoramio.com/photo/170330", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/170330.jpg", "longitude": 2.315115, "latitude": 48.866011, "width": 500, "height": 355, "upload_date": "17 December 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 5628541, "photo_title": "Pittsburgh", "photo_url": "http://www.panoramio.com/photo/5628541", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5628541.jpg", "longitude": -80.018985, "latitude": 40.438406, "width": 500, "height": 325, "upload_date": "30 October 2007", "owner_id": 31761, "owner_name": "Buck Cash", "owner_url": "http://www.panoramio.com/user/31761"} + , + {"photo_id": 51101, "photo_title": "Morgenstimmung zwischen Bru und Bordeyri ...", "photo_url": "http://www.panoramio.com/photo/51101", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/51101.jpg", "longitude": -21.099930, "latitude": 65.205068, "width": 500, "height": 272, "upload_date": "23 September 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 4352968, "photo_title": "Coucher du soleil sur le lac du Môle", "photo_url": "http://www.panoramio.com/photo/4352968", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4352968.jpg", "longitude": 6.426079, "latitude": 46.137084, "width": 500, "height": 374, "upload_date": "03 September 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 2345674, "photo_title": "Ãlomvölgy", "photo_url": "http://www.panoramio.com/photo/2345674", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2345674.jpg", "longitude": 17.791328, "latitude": 47.343243, "width": 500, "height": 334, "upload_date": "22 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3521484, "photo_title": "Ki korán kel...", "photo_url": "http://www.panoramio.com/photo/3521484", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3521484.jpg", "longitude": 17.514782, "latitude": 47.744980, "width": 500, "height": 334, "upload_date": "25 July 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8868820, "photo_title": "Burime ne malin Shar-Winner March contest -2008 \"Scenery\" Categorie", "photo_url": "http://www.panoramio.com/photo/8868820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8868820.jpg", "longitude": 20.884666, "latitude": 42.060318, "width": 375, "height": 500, "upload_date": "26 March 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 206560, "photo_title": "Sumela Monastery", "photo_url": "http://www.panoramio.com/photo/206560", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/206560.jpg", "longitude": 39.608116, "latitude": 40.770012, "width": 500, "height": 375, "upload_date": "21 December 2006", "owner_id": 2351, "owner_name": "Serdar Bilecen", "owner_url": "http://www.panoramio.com/user/2351"} + , + {"photo_id": 1488354, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488354", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488354.jpg", "longitude": 138.213072, "latitude": 37.829921, "width": 500, "height": 336, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 3334377, "photo_title": "ROSENGARTEN", "photo_url": "http://www.panoramio.com/photo/3334377", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3334377.jpg", "longitude": 11.591349, "latitude": 46.411603, "width": 500, "height": 375, "upload_date": "15 July 2007", "owner_id": 584241, "owner_name": "irene.italy", "owner_url": "http://www.panoramio.com/user/584241"} + , + {"photo_id": 12668091, "photo_title": "lago di Fedaia - 2008 August NPC subject Reflecting on reflection", "photo_url": "http://www.panoramio.com/photo/12668091", "photo_file_url": "http://static4.bareka.com/photos/medium/12668091.jpg", "longitude": 11.864547, "latitude": 46.460164, "width": 385, "height": 500, "upload_date": "31 July 2008", "owner_id": 6033, "owner_name": "â–º Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 11177556, "photo_title": "Early morning ... :)", "photo_url": "http://www.panoramio.com/photo/11177556", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11177556.jpg", "longitude": 168.307543, "latitude": -46.578215, "width": 500, "height": 340, "upload_date": "13 June 2008", "owner_id": 1256771, "owner_name": "Zsuzsanna W", "owner_url": "http://www.panoramio.com/user/1256771"} + , + {"photo_id": 67333, "photo_title": "Laguna Colorada", "photo_url": "http://www.panoramio.com/photo/67333", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67333.jpg", "longitude": -67.798176, "latitude": -22.217285, "width": 375, "height": 500, "upload_date": "20 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 2850309, "photo_title": "Single tree...", "photo_url": "http://www.panoramio.com/photo/2850309", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2850309.jpg", "longitude": 33.571987, "latitude": 27.130876, "width": 500, "height": 375, "upload_date": "20 June 2007", "owner_id": 399963, "owner_name": "Victor Galanin", "owner_url": "http://www.panoramio.com/user/399963"} + , + {"photo_id": 1286406, "photo_title": "Creation", "photo_url": "http://www.panoramio.com/photo/1286406", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1286406.jpg", "longitude": 35.109558, "latitude": -1.460337, "width": 500, "height": 456, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 4136208, "photo_title": "Mesél az erdÅ‘", "photo_url": "http://www.panoramio.com/photo/4136208", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4136208.jpg", "longitude": 18.062897, "latitude": 47.274105, "width": 500, "height": 334, "upload_date": "23 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8476696, "photo_title": "Coucher de soleil sur Silhouette, Seychelles. Panoramio and ATP first CONTEST, March 2008, category Travel : awarded \"Runner Up\" (second Prize). Many thanks to all voters. #434", "photo_url": "http://www.panoramio.com/photo/8476696", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8476696.jpg", "longitude": 55.493660, "latitude": -4.563249, "width": 500, "height": 339, "upload_date": "12 March 2008", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 6189344, "photo_title": "Retenue Courchevel", "photo_url": "http://www.panoramio.com/photo/6189344", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6189344.jpg", "longitude": 6.654494, "latitude": 45.385908, "width": 500, "height": 335, "upload_date": "28 November 2007", "owner_id": 464343, "owner_name": "yves floret", "owner_url": "http://www.panoramio.com/user/464343"} + , + {"photo_id": 6934835, "photo_title": "I feel shivers down my spine... (Coucher de soleil hivernal au cimetière du Père Lachaise)", "photo_url": "http://www.panoramio.com/photo/6934835", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6934835.jpg", "longitude": 2.389634, "latitude": 48.862132, "width": 500, "height": 384, "upload_date": "06 January 2008", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 4214329, "photo_title": "Sunrise of Huangshan", "photo_url": "http://www.panoramio.com/photo/4214329", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4214329.jpg", "longitude": 118.282928, "latitude": 30.139189, "width": 500, "height": 313, "upload_date": "26 August 2007", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + , + {"photo_id": 8846650, "photo_title": "Vette Tempestose - Winner of Panoramio Contest of March 2008 - Travel category", "photo_url": "http://www.panoramio.com/photo/8846650", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8846650.jpg", "longitude": 8.456469, "latitude": 45.886752, "width": 500, "height": 215, "upload_date": "25 March 2008", "owner_id": 634000, "owner_name": "© Massimo De Candido", "owner_url": "http://www.panoramio.com/user/634000"} + , + {"photo_id": 945986, "photo_title": "Xerta taronja", "photo_url": "http://www.panoramio.com/photo/945986", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945986.jpg", "longitude": 0.483055, "latitude": 40.909102, "width": 500, "height": 377, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 5108615, "photo_title": "El Vado Lake, 1", "photo_url": "http://www.panoramio.com/photo/5108615", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5108615.jpg", "longitude": -106.755394, "latitude": 36.594858, "width": 500, "height": 490, "upload_date": "05 October 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 6095512, "photo_title": "before the snow came - Thunersee - in bad weather", "photo_url": "http://www.panoramio.com/photo/6095512", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6095512.jpg", "longitude": 7.641592, "latitude": 46.744566, "width": 500, "height": 374, "upload_date": "24 November 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 1541286, "photo_title": "Wave3", "photo_url": "http://www.panoramio.com/photo/1541286", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1541286.jpg", "longitude": -112.007471, "latitude": 36.994755, "width": 333, "height": 500, "upload_date": "29 March 2007", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 11309226, "photo_title": "Sunset on Portsea", "photo_url": "http://www.panoramio.com/photo/11309226", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11309226.jpg", "longitude": 144.695692, "latitude": -38.330766, "width": 500, "height": 357, "upload_date": "18 June 2008", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 76734, "photo_title": "Buitre leonado", "photo_url": "http://www.panoramio.com/photo/76734", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/76734.jpg", "longitude": -5.662347, "latitude": 36.522413, "width": 500, "height": 375, "upload_date": "05 November 2006", "owner_id": 473, "owner_name": "Juanlu", "owner_url": "http://www.panoramio.com/user/473"} + , + {"photo_id": 196037, "photo_title": "camello", "photo_url": "http://www.panoramio.com/photo/196037", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196037.jpg", "longitude": -3.776196, "latitude": 43.470686, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 1338852, "photo_title": "Stairs down to Praia dé Paraiso", "photo_url": "http://www.panoramio.com/photo/1338852", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1338852.jpg", "longitude": -8.475040, "latitude": 37.096924, "width": 332, "height": 500, "upload_date": "15 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 1269734, "photo_title": "Frosty fishermans boat, Nesseby, Finnmark, Norway", "photo_url": "http://www.panoramio.com/photo/1269734", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1269734.jpg", "longitude": 28.851471, "latitude": 70.144796, "width": 500, "height": 323, "upload_date": "11 March 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 1075687, "photo_title": "Lake Como sunset", "photo_url": "http://www.panoramio.com/photo/1075687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1075687.jpg", "longitude": 9.285164, "latitude": 46.009839, "width": 500, "height": 332, "upload_date": "28 February 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 58363, "photo_title": "Sonnenuntergang bei Bardolino", "photo_url": "http://www.panoramio.com/photo/58363", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58363.jpg", "longitude": 10.714073, "latitude": 45.556372, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 890788, "photo_title": "KapliÄka", "photo_url": "http://www.panoramio.com/photo/890788", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/890788.jpg", "longitude": 18.222713, "latitude": 49.491950, "width": 500, "height": 333, "upload_date": "19 February 2007", "owner_id": 187280, "owner_name": "Radek ÄŒampa", "owner_url": "http://www.panoramio.com/user/187280"} + , + {"photo_id": 8730610, "photo_title": "Antelope Canyon", "photo_url": "http://www.panoramio.com/photo/8730610", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8730610.jpg", "longitude": -111.415787, "latitude": 36.918058, "width": 375, "height": 500, "upload_date": "22 March 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 3008013, "photo_title": "Infrared Mood of Peyto Lake", "photo_url": "http://www.panoramio.com/photo/3008013", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3008013.jpg", "longitude": -116.509409, "latitude": 51.717989, "width": 500, "height": 334, "upload_date": "29 June 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 565018, "photo_title": "Another one sunset in dubulti", "photo_url": "http://www.panoramio.com/photo/565018", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/565018.jpg", "longitude": 23.765488, "latitude": 56.971626, "width": 500, "height": 333, "upload_date": "25 January 2007", "owner_id": 116556, "owner_name": "Pavels Dunaicevs", "owner_url": "http://www.panoramio.com/user/116556"} + , + {"photo_id": 2217257, "photo_title": "Csermely", "photo_url": "http://www.panoramio.com/photo/2217257", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2217257.jpg", "longitude": 17.986851, "latitude": 47.273755, "width": 500, "height": 334, "upload_date": "14 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3008041, "photo_title": "Lake Louise", "photo_url": "http://www.panoramio.com/photo/3008041", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3008041.jpg", "longitude": -116.219387, "latitude": 51.417409, "width": 500, "height": 335, "upload_date": "29 June 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 636724, "photo_title": "Bora Bora JC", "photo_url": "http://www.panoramio.com/photo/636724", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/636724.jpg", "longitude": -151.714239, "latitude": -16.475926, "width": 500, "height": 375, "upload_date": "31 January 2007", "owner_id": 131113, "owner_name": "Lair Jean Claude", "owner_url": "http://www.panoramio.com/user/131113"} + , + {"photo_id": 511806, "photo_title": "EzüsterdÅ‘", "photo_url": "http://www.panoramio.com/photo/511806", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/511806.jpg", "longitude": 17.748070, "latitude": 47.273056, "width": 366, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 727360, "photo_title": "Hot croissant for breakfast - Crescent sunrise", "photo_url": "http://www.panoramio.com/photo/727360", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/727360.jpg", "longitude": 19.053833, "latitude": 47.605512, "width": 500, "height": 311, "upload_date": "07 February 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 5148235, "photo_title": "shinagawa", "photo_url": "http://www.panoramio.com/photo/5148235", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5148235.jpg", "longitude": 139.741459, "latitude": 35.627460, "width": 500, "height": 500, "upload_date": "07 October 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 2082127, "photo_title": "Rejtelmes Szigetköz", "photo_url": "http://www.panoramio.com/photo/2082127", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2082127.jpg", "longitude": 17.508516, "latitude": 47.850088, "width": 500, "height": 316, "upload_date": "05 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1589607, "photo_title": "Baalbek - Temple of Bacchus - Giant Columns", "photo_url": "http://www.panoramio.com/photo/1589607", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1589607.jpg", "longitude": 36.204404, "latitude": 34.006228, "width": 500, "height": 283, "upload_date": "01 April 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 410991, "photo_title": "Burj al Arab", "photo_url": "http://www.panoramio.com/photo/410991", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/410991.jpg", "longitude": 55.187352, "latitude": 25.139282, "width": 500, "height": 342, "upload_date": "13 January 2007", "owner_id": 82662, "owner_name": "Sven Goelles", "owner_url": "http://www.panoramio.com/user/82662"} + , + {"photo_id": 6012, "photo_title": "Rastoke", "photo_url": "http://www.panoramio.com/photo/6012", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012.jpg", "longitude": 15.584493, "latitude": 45.119144, "width": 343, "height": 500, "upload_date": "18 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 4989314, "photo_title": "Range of Light", "photo_url": "http://www.panoramio.com/photo/4989314", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4989314.jpg", "longitude": -118.597283, "latitude": 37.234360, "width": 500, "height": 357, "upload_date": "29 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 2115987, "photo_title": "La Croix de Brume", "photo_url": "http://www.panoramio.com/photo/2115987", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2115987.jpg", "longitude": 0.341520, "latitude": 44.859519, "width": 409, "height": 500, "upload_date": "07 May 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 229544, "photo_title": "VRT RTBf Toren", "photo_url": "http://www.panoramio.com/photo/229544", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/229544.jpg", "longitude": 4.401634, "latitude": 50.852972, "width": 333, "height": 500, "upload_date": "24 December 2006", "owner_id": 7464, "owner_name": "Pieter", "owner_url": "http://www.panoramio.com/user/7464"} + , + {"photo_id": 58283, "photo_title": "Weg", "photo_url": "http://www.panoramio.com/photo/58283", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58283.jpg", "longitude": 12.898464, "latitude": 48.059496, "width": 500, "height": 333, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 112110, "photo_title": "Toronto_CN-Tower", "photo_url": "http://www.panoramio.com/photo/112110", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112110.jpg", "longitude": -79.386907, "latitude": 43.641805, "width": 500, "height": 375, "upload_date": "11 December 2006", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 4446966, "photo_title": "Ãlmodó folyó", "photo_url": "http://www.panoramio.com/photo/4446966", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4446966.jpg", "longitude": 17.454357, "latitude": 47.881470, "width": 500, "height": 375, "upload_date": "06 September 2007", "owner_id": 182660, "owner_name": "Bálint Tünde", "owner_url": "http://www.panoramio.com/user/182660"} + , + {"photo_id": 91966, "photo_title": "Bled (Slovenia)", "photo_url": "http://www.panoramio.com/photo/91966", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91966.jpg", "longitude": 14.087219, "latitude": 46.358184, "width": 500, "height": 375, "upload_date": "04 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 6013503, "photo_title": "Kapelle bei Böhmenkirch", "photo_url": "http://www.panoramio.com/photo/6013503", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6013503.jpg", "longitude": 9.943142, "latitude": 48.694756, "width": 500, "height": 375, "upload_date": "19 November 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 1781593, "photo_title": "Medusa's Sandbox", "photo_url": "http://www.panoramio.com/photo/1781593", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781593.jpg", "longitude": -112.006624, "latitude": 36.995852, "width": 375, "height": 500, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 704119, "photo_title": "Izzó Adria", "photo_url": "http://www.panoramio.com/photo/704119", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/704119.jpg", "longitude": 17.056789, "latitude": 43.272206, "width": 500, "height": 285, "upload_date": "05 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 85624, "photo_title": "Isla del Fraile Ãguilas", "photo_url": "http://www.panoramio.com/photo/85624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85624.jpg", "longitude": -0.722609, "latitude": 37.924329, "width": 500, "height": 298, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 52350, "photo_title": "Cataratas del Iguazú. Brasil", "photo_url": "http://www.panoramio.com/photo/52350", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/52350.jpg", "longitude": -54.439831, "latitude": -25.687422, "width": 500, "height": 333, "upload_date": "25 September 2006", "owner_id": 6961, "owner_name": "Santiago Rios", "owner_url": "http://www.panoramio.com/user/6961"} + , + {"photo_id": 36482, "photo_title": "Rovinj Harbour", "photo_url": "http://www.panoramio.com/photo/36482", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36482.jpg", "longitude": 13.632714, "latitude": 45.083938, "width": 500, "height": 332, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 7251846, "photo_title": "Azért a víz az úr", "photo_url": "http://www.panoramio.com/photo/7251846", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7251846.jpg", "longitude": 17.629623, "latitude": 47.687334, "width": 500, "height": 329, "upload_date": "20 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1551756, "photo_title": "Templestowe", "photo_url": "http://www.panoramio.com/photo/1551756", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1551756.jpg", "longitude": 145.116667, "latitude": -37.750000, "width": 500, "height": 298, "upload_date": "30 March 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 2397841, "photo_title": "Storm Season II", "photo_url": "http://www.panoramio.com/photo/2397841", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2397841.jpg", "longitude": -122.439870, "latitude": 37.427928, "width": 407, "height": 500, "upload_date": "26 May 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 1237915, "photo_title": "Chlum u Trebone", "photo_url": "http://www.panoramio.com/photo/1237915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1237915.jpg", "longitude": 14.923811, "latitude": 48.960159, "width": 500, "height": 429, "upload_date": "09 March 2007", "owner_id": 235166, "owner_name": "jirivrobel", "owner_url": "http://www.panoramio.com/user/235166"} + , + {"photo_id": 359324, "photo_title": "Abstraktion in der Kirche von Mogno, Tessin .......", "photo_url": "http://www.panoramio.com/photo/359324", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/359324.jpg", "longitude": 8.663492, "latitude": 46.430966, "width": 500, "height": 380, "upload_date": "09 January 2007", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 483742, "photo_title": "Venus at Haleakala", "photo_url": "http://www.panoramio.com/photo/483742", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/483742.jpg", "longitude": -156.239491, "latitude": 20.707468, "width": 500, "height": 375, "upload_date": "18 January 2007", "owner_id": 100907, "owner_name": "Julia Wahl", "owner_url": "http://www.panoramio.com/user/100907"} + , + {"photo_id": 1087397, "photo_title": "Fjellbjerk (Betula) Snøhetta mountain in the background", "photo_url": "http://www.panoramio.com/photo/1087397", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1087397.jpg", "longitude": 9.555531, "latitude": 62.240111, "width": 500, "height": 333, "upload_date": "28 February 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 2846123, "photo_title": "新潟 å°åƒè°·ã€€é¢¨èˆ¹ä¸€æ†ã€€2003 niigata ojiya balloon riot Fireworks", "photo_url": "http://www.panoramio.com/photo/2846123", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2846123.jpg", "longitude": 138.791313, "latitude": 37.289350, "width": 500, "height": 497, "upload_date": "20 June 2007", "owner_id": 446937, "owner_name": "y_komatsu", "owner_url": "http://www.panoramio.com/user/446937"} + , + {"photo_id": 2533559, "photo_title": "Great Idea ! Don´t do it !!!", "photo_url": "http://www.panoramio.com/photo/2533559", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2533559.jpg", "longitude": -35.036988, "latitude": -6.241628, "width": 500, "height": 308, "upload_date": "02 June 2007", "owner_id": 1908, "owner_name": "Cleber Lima", "owner_url": "http://www.panoramio.com/user/1908"} + , + {"photo_id": 86246, "photo_title": "Salinas de Santa Pola", "photo_url": "http://www.panoramio.com/photo/86246", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/86246.jpg", "longitude": -0.528374, "latitude": 38.230090, "width": 500, "height": 333, "upload_date": "25 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 405740, "photo_title": "fudoutaki", "photo_url": "http://www.panoramio.com/photo/405740", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405740.jpg", "longitude": 139.502249, "latitude": 37.580909, "width": 500, "height": 394, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 12848417, "photo_title": "Niedrigwasser an der Elbe-Dresden", "photo_url": "http://www.panoramio.com/photo/12848417", "photo_file_url": "http://static2.bareka.com/photos/medium/12848417.jpg", "longitude": 13.745323, "latitude": 51.055093, "width": 500, "height": 268, "upload_date": "05 August 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 291091, "photo_title": "Imperia Porto Maurizio Puesta del Sol al Prino", "photo_url": "http://www.panoramio.com/photo/291091", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/291091.jpg", "longitude": 8.006684, "latitude": 43.869312, "width": 500, "height": 465, "upload_date": "03 January 2007", "owner_id": 60898, "owner_name": "esseil", "owner_url": "http://www.panoramio.com/user/60898"} + , + {"photo_id": 1183261, "photo_title": "Az óperencián innen", "photo_url": "http://www.panoramio.com/photo/1183261", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1183261.jpg", "longitude": 15.823574, "latitude": 43.708462, "width": 500, "height": 312, "upload_date": "05 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1637150, "photo_title": "Vista del Misti por encima de las nubes", "photo_url": "http://www.panoramio.com/photo/1637150", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1637150.jpg", "longitude": -71.414566, "latitude": -16.300040, "width": 500, "height": 333, "upload_date": "05 April 2007", "owner_id": 328178, "owner_name": "Mariví Jiménez", "owner_url": "http://www.panoramio.com/user/328178"} + , + {"photo_id": 507703, "photo_title": "Csendes vizek", "photo_url": "http://www.panoramio.com/photo/507703", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507703.jpg", "longitude": 17.568769, "latitude": 47.633586, "width": 500, "height": 349, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 55100, "photo_title": "Ballesvikskardet", "photo_url": "http://www.panoramio.com/photo/55100", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55100.jpg", "longitude": 17.122707, "latitude": 69.352910, "width": 500, "height": 375, "upload_date": "30 September 2006", "owner_id": 3574, "owner_name": "blackone", "owner_url": "http://www.panoramio.com/user/3574"} + , + {"photo_id": 291648, "photo_title": "Galway Cathedral", "photo_url": "http://www.panoramio.com/photo/291648", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/291648.jpg", "longitude": -9.057664, "latitude": 53.275627, "width": 500, "height": 336, "upload_date": "03 January 2007", "owner_id": 61285, "owner_name": "kamil krawczak", "owner_url": "http://www.panoramio.com/user/61285"} + , + {"photo_id": 5285701, "photo_title": "Another South Sister reflecting in Sparks Lake", "photo_url": "http://www.panoramio.com/photo/5285701", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5285701.jpg", "longitude": -121.737549, "latitude": 44.014176, "width": 500, "height": 334, "upload_date": "13 October 2007", "owner_id": 128746, "owner_name": "© Michael Hatten", "owner_url": "http://www.panoramio.com/user/128746"} + , + {"photo_id": 761958, "photo_title": "Lake Oulujärvi", "photo_url": "http://www.panoramio.com/photo/761958", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/761958.jpg", "longitude": 27.339649, "latitude": 64.231986, "width": 375, "height": 500, "upload_date": "10 February 2007", "owner_id": 151444, "owner_name": "Timo Rossi", "owner_url": "http://www.panoramio.com/user/151444"} + , + {"photo_id": 3853459, "photo_title": "Its great to be a swan on Hawn Pawn!", "photo_url": "http://www.panoramio.com/photo/3853459", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3853459.jpg", "longitude": -71.154628, "latitude": 42.470625, "width": 389, "height": 500, "upload_date": "10 August 2007", "owner_id": 286174, "owner_name": "kamaly", "owner_url": "http://www.panoramio.com/user/286174"} + , + {"photo_id": 4610197, "photo_title": "Yosemite Valley with Fallen Redwood from V11", "photo_url": "http://www.panoramio.com/photo/4610197", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4610197.jpg", "longitude": -119.661703, "latitude": 37.717214, "width": 500, "height": 281, "upload_date": "12 September 2007", "owner_id": 339677, "owner_name": "Chip Stephan", "owner_url": "http://www.panoramio.com/user/339677"} + , + {"photo_id": 5700759, "photo_title": "Crete senesi", "photo_url": "http://www.panoramio.com/photo/5700759", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5700759.jpg", "longitude": 11.448483, "latitude": 43.280205, "width": 500, "height": 304, "upload_date": "02 November 2007", "owner_id": 158718, "owner_name": "giulio colla", "owner_url": "http://www.panoramio.com/user/158718"} + , + {"photo_id": 1391775, "photo_title": "Arboles al atardecer en Chapala - Trees at sunset in Chapala Lake", "photo_url": "http://www.panoramio.com/photo/1391775", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1391775.jpg", "longitude": -102.775211, "latitude": 20.308730, "width": 500, "height": 341, "upload_date": "19 March 2007", "owner_id": 291650, "owner_name": "J.Ernesto Ortiz Razo", "owner_url": "http://www.panoramio.com/user/291650"} + , + {"photo_id": 57514, "photo_title": "Limone 1", "photo_url": "http://www.panoramio.com/photo/57514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57514.jpg", "longitude": 10.792179, "latitude": 45.816298, "width": 500, "height": 333, "upload_date": "04 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 2602937, "photo_title": "Alone", "photo_url": "http://www.panoramio.com/photo/2602937", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2602937.jpg", "longitude": -4.001770, "latitude": 31.174035, "width": 500, "height": 320, "upload_date": "06 June 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 117465, "photo_title": "New York in the Afternoon...from Soho.. by Jeremiah Christopher", "photo_url": "http://www.panoramio.com/photo/117465", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/117465.jpg", "longitude": -74.003212, "latitude": 40.724059, "width": 500, "height": 375, "upload_date": "11 December 2006", "owner_id": 16869, "owner_name": "Jeremiah Christopher", "owner_url": "http://www.panoramio.com/user/16869"} + , + {"photo_id": 1331707, "photo_title": "Kastellet (Copenhagen fortress), Aerial", "photo_url": "http://www.panoramio.com/photo/1331707", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1331707.jpg", "longitude": 12.594967, "latitude": 55.691230, "width": 500, "height": 332, "upload_date": "15 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 11853382, "photo_title": "Railroads by Sunset/ Schienen bei Sonnenuntergang", "photo_url": "http://www.panoramio.com/photo/11853382", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11853382.jpg", "longitude": 8.283455, "latitude": 51.692644, "width": 500, "height": 332, "upload_date": "06 July 2008", "owner_id": 564436, "owner_name": "Thomas Splietker", "owner_url": "http://www.panoramio.com/user/564436"} + , + {"photo_id": 1558288, "photo_title": "Notre-Dame et Tour Saint Jacques", "photo_url": "http://www.panoramio.com/photo/1558288", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1558288.jpg", "longitude": 2.354808, "latitude": 48.850399, "width": 500, "height": 333, "upload_date": "30 March 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 7601425, "photo_title": "Venezianische Impressionen", "photo_url": "http://www.panoramio.com/photo/7601425", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7601425.jpg", "longitude": 12.337024, "latitude": 45.432280, "width": 500, "height": 385, "upload_date": "05 February 2008", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 36386, "photo_title": "Half Dome Cables", "photo_url": "http://www.panoramio.com/photo/36386", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36386.jpg", "longitude": -119.530735, "latitude": 37.746710, "width": 333, "height": 500, "upload_date": "02 August 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 1089570, "photo_title": "Titokzatos reggel", "photo_url": "http://www.panoramio.com/photo/1089570", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1089570.jpg", "longitude": 17.467575, "latitude": 47.870532, "width": 500, "height": 331, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 575276, "photo_title": "Sunrise", "photo_url": "http://www.panoramio.com/photo/575276", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/575276.jpg", "longitude": 2.288809, "latitude": 48.861892, "width": 500, "height": 349, "upload_date": "26 January 2007", "owner_id": 123518, "owner_name": "ERic Pouhier ericpouhier.com", "owner_url": "http://www.panoramio.com/user/123518"} + , + {"photo_id": 486480, "photo_title": "Monte Generoso", "photo_url": "http://www.panoramio.com/photo/486480", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/486480.jpg", "longitude": 9.015055, "latitude": 45.924826, "width": 428, "height": 500, "upload_date": "19 January 2007", "owner_id": 24068, "owner_name": "Daniele Nasi", "owner_url": "http://www.panoramio.com/user/24068"} + , + {"photo_id": 1100378, "photo_title": "Rensbekksetra (summer pasture)", "photo_url": "http://www.panoramio.com/photo/1100378", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1100378.jpg", "longitude": 9.293404, "latitude": 62.712731, "width": 500, "height": 255, "upload_date": "01 March 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 5844316, "photo_title": "Hikarigaoka IMA", "photo_url": "http://www.panoramio.com/photo/5844316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5844316.jpg", "longitude": 139.630048, "latitude": 35.758154, "width": 500, "height": 326, "upload_date": "11 November 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 1345372, "photo_title": "Sunset, Foeniculum vulgare (fennel, is one likely candidate)", "photo_url": "http://www.panoramio.com/photo/1345372", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1345372.jpg", "longitude": 10.727119, "latitude": 55.205080, "width": 332, "height": 500, "upload_date": "16 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 1317735, "photo_title": "Motu of Bora Bora", "photo_url": "http://www.panoramio.com/photo/1317735", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1317735.jpg", "longitude": -151.698360, "latitude": -16.495843, "width": 500, "height": 355, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1012093, "photo_title": "Sunrise from the east side of Longs Peak", "photo_url": "http://www.panoramio.com/photo/1012093", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1012093.jpg", "longitude": -105.542564, "latitude": 40.274549, "width": 374, "height": 500, "upload_date": "25 February 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 5035419, "photo_title": "Basilica de San Basilio (Moscow)", "photo_url": "http://www.panoramio.com/photo/5035419", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5035419.jpg", "longitude": 37.622852, "latitude": 55.752622, "width": 398, "height": 500, "upload_date": "01 October 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 799910, "photo_title": "A Dramatic Turn of the Yangtze River", "photo_url": "http://www.panoramio.com/photo/799910", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/799910.jpg", "longitude": 99.272633, "latitude": 28.255552, "width": 500, "height": 226, "upload_date": "13 February 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 765388, "photo_title": "Leh", "photo_url": "http://www.panoramio.com/photo/765388", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/765388.jpg", "longitude": 77.587509, "latitude": 34.164943, "width": 500, "height": 333, "upload_date": "10 February 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 2875857, "photo_title": "Elgol, Isle of Skye", "photo_url": "http://www.panoramio.com/photo/2875857", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2875857.jpg", "longitude": -6.107025, "latitude": 57.150023, "width": 500, "height": 500, "upload_date": "22 June 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 840915, "photo_title": "Island of The Day Before", "photo_url": "http://www.panoramio.com/photo/840915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/840915.jpg", "longitude": 27.436638, "latitude": 42.441448, "width": 500, "height": 333, "upload_date": "16 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 1459925, "photo_title": "The last ray", "photo_url": "http://www.panoramio.com/photo/1459925", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1459925.jpg", "longitude": -110.134850, "latitude": 36.955379, "width": 500, "height": 290, "upload_date": "23 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 872177, "photo_title": "Sahara Desert sunrise, Chott el Jerid, near Kebili, Tunisia, 1/2007", "photo_url": "http://www.panoramio.com/photo/872177", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/872177.jpg", "longitude": 8.475866, "latitude": 33.930898, "width": 500, "height": 375, "upload_date": "18 February 2007", "owner_id": 183521, "owner_name": "SteveT", "owner_url": "http://www.panoramio.com/user/183521"} + , + {"photo_id": 405753, "photo_title": "sinanogawa", "photo_url": "http://www.panoramio.com/photo/405753", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405753.jpg", "longitude": 138.822384, "latitude": 37.268589, "width": 500, "height": 386, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 548240, "photo_title": "Old Bagan 2002", "photo_url": "http://www.panoramio.com/photo/548240", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/548240.jpg", "longitude": 94.825230, "latitude": 21.137026, "width": 500, "height": 375, "upload_date": "23 January 2007", "owner_id": 64758, "owner_name": "Joly David", "owner_url": "http://www.panoramio.com/user/64758"} + , + {"photo_id": 4868105, "photo_title": "Bled lake", "photo_url": "http://www.panoramio.com/photo/4868105", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4868105.jpg", "longitude": 14.104900, "latitude": 46.369793, "width": 500, "height": 333, "upload_date": "24 September 2007", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 549396, "photo_title": "RÃ¥kneset on Storfjellet island, Røst", "photo_url": "http://www.panoramio.com/photo/549396", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/549396.jpg", "longitude": 11.932955, "latitude": 67.457456, "width": 500, "height": 375, "upload_date": "23 January 2007", "owner_id": 95799, "owner_name": "Owen Morgan", "owner_url": "http://www.panoramio.com/user/95799"} + , + {"photo_id": 196121, "photo_title": "canallave", "photo_url": "http://www.panoramio.com/photo/196121", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196121.jpg", "longitude": -3.960571, "latitude": 43.452358, "width": 500, "height": 332, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 2422299, "photo_title": "Pacific Weather", "photo_url": "http://www.panoramio.com/photo/2422299", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2422299.jpg", "longitude": -124.097099, "latitude": 44.345704, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 821291, "photo_title": "Храм ВаÑÐ¸Ð»Ð¸Ñ Ð‘Ð»Ð°Ð¶ÐµÐ½Ð½Ð¾Ð³Ð¾ (МоÑква, ноÑбрь 2006 года)", "photo_url": "http://www.panoramio.com/photo/821291", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/821291.jpg", "longitude": 37.622954, "latitude": 55.752613, "width": 500, "height": 375, "upload_date": "14 February 2007", "owner_id": 55593, "owner_name": "pokatut.photosight.ru", "owner_url": "http://www.panoramio.com/user/55593"} + , + {"photo_id": 3545143, "photo_title": "Rainbow (Regnbue)", "photo_url": "http://www.panoramio.com/photo/3545143", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3545143.jpg", "longitude": 8.598175, "latitude": 62.904445, "width": 500, "height": 223, "upload_date": "26 July 2007", "owner_id": 343934, "owner_name": "Asbjørn999", "owner_url": "http://www.panoramio.com/user/343934"} + , + {"photo_id": 1794618, "photo_title": "TúlélÅ‘k", "photo_url": "http://www.panoramio.com/photo/1794618", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1794618.jpg", "longitude": 20.803127, "latitude": 48.014157, "width": 399, "height": 500, "upload_date": "15 April 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 3904091, "photo_title": "Hajnali utakon", "photo_url": "http://www.panoramio.com/photo/3904091", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3904091.jpg", "longitude": 17.512014, "latitude": 47.850319, "width": 500, "height": 334, "upload_date": "13 August 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 5649508, "photo_title": "Quiet morning", "photo_url": "http://www.panoramio.com/photo/5649508", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5649508.jpg", "longitude": 12.190876, "latitude": 49.357446, "width": 500, "height": 333, "upload_date": "31 October 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 7938965, "photo_title": "Pattaya - Big Buddha - Big Buddha Hill", "photo_url": "http://www.panoramio.com/photo/7938965", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7938965.jpg", "longitude": 100.868343, "latitude": 12.914107, "width": 500, "height": 375, "upload_date": "19 February 2008", "owner_id": 716245, "owner_name": "—Dragon-64— ✈", "owner_url": "http://www.panoramio.com/user/716245"} + , + {"photo_id": 497056, "photo_title": "Japanese Garden maple", "photo_url": "http://www.panoramio.com/photo/497056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/497056.jpg", "longitude": -122.707999, "latitude": 45.518810, "width": 500, "height": 300, "upload_date": "20 January 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 438699, "photo_title": "White Sand Dunes", "photo_url": "http://www.panoramio.com/photo/438699", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/438699.jpg", "longitude": -106.262083, "latitude": 32.799324, "width": 371, "height": 500, "upload_date": "15 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 2082221, "photo_title": "\"Bekötött szemmel\"", "photo_url": "http://www.panoramio.com/photo/2082221", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2082221.jpg", "longitude": 17.660522, "latitude": 47.604543, "width": 500, "height": 334, "upload_date": "05 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5836484, "photo_title": "An Autumn's golden dawn on the Lake of Varese", "photo_url": "http://www.panoramio.com/photo/5836484", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5836484.jpg", "longitude": 8.718081, "latitude": 45.838966, "width": 500, "height": 312, "upload_date": "11 November 2007", "owner_id": 933456, "owner_name": "© Marco De Candido", "owner_url": "http://www.panoramio.com/user/933456"} + , + {"photo_id": 5204696, "photo_title": "Scotland", "photo_url": "http://www.panoramio.com/photo/5204696", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5204696.jpg", "longitude": -5.078773, "latitude": 56.558726, "width": 500, "height": 254, "upload_date": "09 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 1343454, "photo_title": "Вулкан КарымÑкий", "photo_url": "http://www.panoramio.com/photo/1343454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1343454.jpg", "longitude": 159.480286, "latitude": 54.025470, "width": 364, "height": 500, "upload_date": "16 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 507424, "photo_title": "Lankák, ívek, felhőárnyak", "photo_url": "http://www.panoramio.com/photo/507424", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507424.jpg", "longitude": 17.967281, "latitude": 47.318112, "width": 500, "height": 291, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5893176, "photo_title": "07-06-11_Camino de Santiago, Castrojeriz_PIXELECTA", "photo_url": "http://www.panoramio.com/photo/5893176", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5893176.jpg", "longitude": -4.182916, "latitude": 42.285723, "width": 500, "height": 333, "upload_date": "13 November 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 186685, "photo_title": "People of Petra, the boy and his job", "photo_url": "http://www.panoramio.com/photo/186685", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/186685.jpg", "longitude": 35.437002, "latitude": 30.322285, "width": 500, "height": 375, "upload_date": "19 December 2006", "owner_id": 24068, "owner_name": "Daniele Nasi", "owner_url": "http://www.panoramio.com/user/24068"} + , + {"photo_id": 355648, "photo_title": "puerto-rico el-yunque", "photo_url": "http://www.panoramio.com/photo/355648", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/355648.jpg", "longitude": -65.788536, "latitude": 18.298795, "width": 500, "height": 334, "upload_date": "09 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 46913, "photo_title": "beachy head", "photo_url": "http://www.panoramio.com/photo/46913", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/46913.jpg", "longitude": 0.216272, "latitude": 50.737969, "width": 500, "height": 291, "upload_date": "11 September 2006", "owner_id": 2575, "owner_name": "mikel ortega", "owner_url": "http://www.panoramio.com/user/2575"} + , + {"photo_id": 6012999, "photo_title": "Wetterumschwung in Murano", "photo_url": "http://www.panoramio.com/photo/6012999", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012999.jpg", "longitude": 12.357838, "latitude": 45.457557, "width": 500, "height": 336, "upload_date": "19 November 2007", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 590422, "photo_title": "Gyilkos-tó (Killer Lake) - Remains of the forest, which grew here until 1837, conserved by the water", "photo_url": "http://www.panoramio.com/photo/590422", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/590422.jpg", "longitude": 25.785170, "latitude": 46.792597, "width": 500, "height": 352, "upload_date": "27 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 5119067, "photo_title": "Fog In The Forest", "photo_url": "http://www.panoramio.com/photo/5119067", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5119067.jpg", "longitude": 7.667191, "latitude": 49.174283, "width": 500, "height": 375, "upload_date": "05 October 2007", "owner_id": 528834, "owner_name": "©junebug", "owner_url": "http://www.panoramio.com/user/528834"} + , + {"photo_id": 4702558, "photo_title": "Sunset ( Isla de Antigua-Caribe)", "photo_url": "http://www.panoramio.com/photo/4702558", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4702558.jpg", "longitude": -61.833801, "latitude": 17.171627, "width": 500, "height": 375, "upload_date": "16 September 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 717413, "photo_title": "Singapore Skyline with Esplanade at night", "photo_url": "http://www.panoramio.com/photo/717413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/717413.jpg", "longitude": 103.856664, "latitude": 1.291589, "width": 391, "height": 500, "upload_date": "06 February 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 6281064, "photo_title": "Latemar Carezza", "photo_url": "http://www.panoramio.com/photo/6281064", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6281064.jpg", "longitude": 11.595447, "latitude": 46.412476, "width": 500, "height": 332, "upload_date": "03 December 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 327016, "photo_title": "bryce canyon", "photo_url": "http://www.panoramio.com/photo/327016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/327016.jpg", "longitude": -112.210836, "latitude": 37.586146, "width": 500, "height": 375, "upload_date": "07 January 2007", "owner_id": 63705, "owner_name": "Karl Wiktorin", "owner_url": "http://www.panoramio.com/user/63705"} + , + {"photo_id": 301678, "photo_title": "Akashi Kaikyo Bridge (Pearl Bridge)", "photo_url": "http://www.panoramio.com/photo/301678", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/301678.jpg", "longitude": 135.028882, "latitude": 34.623002, "width": 443, "height": 500, "upload_date": "04 January 2007", "owner_id": 30202, "owner_name": "S_Mori", "owner_url": "http://www.panoramio.com/user/30202"} + , + {"photo_id": 6055804, "photo_title": "2007 Balsa de SALBURUA_VITORIA (Alava) PIXELECTA", "photo_url": "http://www.panoramio.com/photo/6055804", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6055804.jpg", "longitude": -2.650537, "latitude": 42.859907, "width": 500, "height": 333, "upload_date": "21 November 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 5946759, "photo_title": "Snow Pond", "photo_url": "http://www.panoramio.com/photo/5946759", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5946759.jpg", "longitude": 10.899510, "latitude": 49.694507, "width": 500, "height": 375, "upload_date": "16 November 2007", "owner_id": 884621, "owner_name": "Florian Eichhorn", "owner_url": "http://www.panoramio.com/user/884621"} + , + {"photo_id": 231305, "photo_title": "Cathedral Rock in Sedona, AZ at Sunset", "photo_url": "http://www.panoramio.com/photo/231305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/231305.jpg", "longitude": -111.792294, "latitude": 34.818657, "width": 500, "height": 327, "upload_date": "25 December 2006", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 582047, "photo_title": "Old Vineyard with the sun trying to break through the fog: Oakley, CA", "photo_url": "http://www.panoramio.com/photo/582047", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/582047.jpg", "longitude": -121.753750, "latitude": 38.001658, "width": 500, "height": 316, "upload_date": "26 January 2007", "owner_id": 99249, "owner_name": "shaunika", "owner_url": "http://www.panoramio.com/user/99249"} + , + {"photo_id": 679332, "photo_title": "forbidden city", "photo_url": "http://www.panoramio.com/photo/679332", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679332.jpg", "longitude": 116.396177, "latitude": 39.921734, "width": 500, "height": 248, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 3904189, "photo_title": "Hajnal", "photo_url": "http://www.panoramio.com/photo/3904189", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3904189.jpg", "longitude": 17.361488, "latitude": 47.875138, "width": 500, "height": 333, "upload_date": "13 August 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 11059137, "photo_title": "Sunset at Kythira Greece by Nikos Demiris", "photo_url": "http://www.panoramio.com/photo/11059137", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11059137.jpg", "longitude": 23.003998, "latitude": 36.142034, "width": 500, "height": 346, "upload_date": "09 June 2008", "owner_id": 1629713, "owner_name": "demirisn", "owner_url": "http://www.panoramio.com/user/1629713"} + , + {"photo_id": 2334150, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/2334150", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2334150.jpg", "longitude": 0.491531, "latitude": 40.903993, "width": 500, "height": 373, "upload_date": "21 May 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 5709301, "photo_title": "Ködvarázs II", "photo_url": "http://www.panoramio.com/photo/5709301", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5709301.jpg", "longitude": 17.998352, "latitude": 47.252903, "width": 333, "height": 500, "upload_date": "05 November 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 55029, "photo_title": "Solar Eclipce, Mt.Elbrus, Refuge of 11", "photo_url": "http://www.panoramio.com/photo/55029", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55029.jpg", "longitude": 42.451859, "latitude": 43.316186, "width": 448, "height": 500, "upload_date": "30 September 2006", "owner_id": 7707, "owner_name": "Yorix", "owner_url": "http://www.panoramio.com/user/7707"} + , + {"photo_id": 702974, "photo_title": "Hundertwasserhaus", "photo_url": "http://www.panoramio.com/photo/702974", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/702974.jpg", "longitude": 16.393780, "latitude": 48.207594, "width": 375, "height": 500, "upload_date": "05 February 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 8811826, "photo_title": "Der Baum im Wasser", "photo_url": "http://www.panoramio.com/photo/8811826", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8811826.jpg", "longitude": 9.293532, "latitude": 52.869078, "width": 375, "height": 500, "upload_date": "24 March 2008", "owner_id": 1431077, "owner_name": "Heiner F.", "owner_url": "http://www.panoramio.com/user/1431077"} + , + {"photo_id": 67843, "photo_title": "Torre Eiffel", "photo_url": "http://www.panoramio.com/photo/67843", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/67843.jpg", "longitude": 2.294587, "latitude": 48.858468, "width": 500, "height": 375, "upload_date": "21 October 2006", "owner_id": 9163, "owner_name": "marathoniano", "owner_url": "http://www.panoramio.com/user/9163"} + , + {"photo_id": 1183509, "photo_title": "Viharpart", "photo_url": "http://www.panoramio.com/photo/1183509", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1183509.jpg", "longitude": 15.917473, "latitude": 43.590587, "width": 500, "height": 334, "upload_date": "05 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 449049, "photo_title": "Encantos de Santos", "photo_url": "http://www.panoramio.com/photo/449049", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/449049.jpg", "longitude": -46.307716, "latitude": -23.988605, "width": 500, "height": 342, "upload_date": "16 January 2007", "owner_id": 81574, "owner_name": "Criss RB", "owner_url": "http://www.panoramio.com/user/81574"} + , + {"photo_id": 4669228, "photo_title": "Reif an der naab", "photo_url": "http://www.panoramio.com/photo/4669228", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4669228.jpg", "longitude": 12.113457, "latitude": 49.339105, "width": 500, "height": 333, "upload_date": "15 September 2007", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 516653, "photo_title": "Alkonyvarázs", "photo_url": "http://www.panoramio.com/photo/516653", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516653.jpg", "longitude": 17.451611, "latitude": 47.782424, "width": 404, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4214320, "photo_title": "暮色", "photo_url": "http://www.panoramio.com/photo/4214320", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4214320.jpg", "longitude": 110.364532, "latitude": 25.201524, "width": 500, "height": 313, "upload_date": "26 August 2007", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + , + {"photo_id": 9419312, "photo_title": "Skeleton", "photo_url": "http://www.panoramio.com/photo/9419312", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9419312.jpg", "longitude": -147.929063, "latitude": -15.091723, "width": 500, "height": 326, "upload_date": "16 April 2008", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 642609, "photo_title": "Oia, Santorini, Cyclades, Hellas, Greece", "photo_url": "http://www.panoramio.com/photo/642609", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/642609.jpg", "longitude": 25.377388, "latitude": 36.460778, "width": 500, "height": 333, "upload_date": "01 February 2007", "owner_id": 131038, "owner_name": "wolffystyle", "owner_url": "http://www.panoramio.com/user/131038"} + , + {"photo_id": 354614, "photo_title": "Dresden_Centrum_01", "photo_url": "http://www.panoramio.com/photo/354614", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/354614.jpg", "longitude": 13.740206, "latitude": 51.056934, "width": 500, "height": 332, "upload_date": "09 January 2007", "owner_id": 71628, "owner_name": "Ulrich Hässler, Dresden", "owner_url": "http://www.panoramio.com/user/71628"} + , + {"photo_id": 678200, "photo_title": "Geometria de terrazas", "photo_url": "http://www.panoramio.com/photo/678200", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/678200.jpg", "longitude": -16.841269, "latitude": 28.235525, "width": 500, "height": 333, "upload_date": "03 February 2007", "owner_id": 92750, "owner_name": "Pablo López Ramos", "owner_url": "http://www.panoramio.com/user/92750"} + , + {"photo_id": 436284, "photo_title": "bandaibasi2", "photo_url": "http://www.panoramio.com/photo/436284", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436284.jpg", "longitude": 139.051423, "latitude": 37.920063, "width": 500, "height": 393, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 2235454, "photo_title": "La bonde et la brume", "photo_url": "http://www.panoramio.com/photo/2235454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2235454.jpg", "longitude": 1.595249, "latitude": 47.313181, "width": 500, "height": 500, "upload_date": "15 May 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 5983, "photo_title": "Waiting", "photo_url": "http://www.panoramio.com/photo/5983", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5983.jpg", "longitude": 7.796173, "latitude": 33.954752, "width": 344, "height": 500, "upload_date": "17 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 97402, "photo_title": "Mostar", "photo_url": "http://www.panoramio.com/photo/97402", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97402.jpg", "longitude": 17.814803, "latitude": 43.337102, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 12954, "owner_name": "ZiÄ™bol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 5159548, "photo_title": "Autumn - Herbstfarben - Fall", "photo_url": "http://www.panoramio.com/photo/5159548", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5159548.jpg", "longitude": 7.541599, "latitude": 46.834772, "width": 500, "height": 374, "upload_date": "08 October 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 1779072, "photo_title": "Égi érintés", "photo_url": "http://www.panoramio.com/photo/1779072", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1779072.jpg", "longitude": 17.747383, "latitude": 47.556835, "width": 462, "height": 500, "upload_date": "14 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5795973, "photo_title": "Emmental mit 7 Hengsten Hohgant und Berneralpen - Emmental, 7 Stallions and Bernese Alpine Snow Mountains", "photo_url": "http://www.panoramio.com/photo/5795973", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5795973.jpg", "longitude": 7.730427, "latitude": 47.033280, "width": 500, "height": 374, "upload_date": "08 November 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 6850694, "photo_title": "2007-VITORIA Alava PIXELECTA", "photo_url": "http://www.panoramio.com/photo/6850694", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6850694.jpg", "longitude": -2.649336, "latitude": 42.861260, "width": 500, "height": 116, "upload_date": "02 January 2008", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 11738506, "photo_title": "Galeria de Itálica", "photo_url": "http://www.panoramio.com/photo/11738506", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11738506.jpg", "longitude": -6.046858, "latitude": 37.444199, "width": 378, "height": 500, "upload_date": "03 July 2008", "owner_id": 1038666, "owner_name": "Doenjo", "owner_url": "http://www.panoramio.com/user/1038666"} + , + {"photo_id": 4013965, "photo_title": "Pedaleando en la costanera", "photo_url": "http://www.panoramio.com/photo/4013965", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4013965.jpg", "longitude": -73.231012, "latitude": -39.817655, "width": 500, "height": 366, "upload_date": "18 August 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 611985, "photo_title": "Toda Temple", "photo_url": "http://www.panoramio.com/photo/611985", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611985.jpg", "longitude": 76.715459, "latitude": 11.420014, "width": 500, "height": 375, "upload_date": "29 January 2007", "owner_id": 130990, "owner_name": "Eye for India. blogspot .com", "owner_url": "http://www.panoramio.com/user/130990"} + , + {"photo_id": 2689441, "photo_title": "Terepszemle", "photo_url": "http://www.panoramio.com/photo/2689441", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2689441.jpg", "longitude": 17.674255, "latitude": 47.601533, "width": 500, "height": 347, "upload_date": "11 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6599853, "photo_title": "FlowerSun", "photo_url": "http://www.panoramio.com/photo/6599853", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6599853.jpg", "longitude": 21.042938, "latitude": 41.988333, "width": 480, "height": 500, "upload_date": "21 December 2007", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 71855, "photo_title": "British Museum", "photo_url": "http://www.panoramio.com/photo/71855", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/71855.jpg", "longitude": -0.127373, "latitude": 51.519265, "width": 500, "height": 333, "upload_date": "28 October 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 58291, "photo_title": "Gollinger Wasserfall", "photo_url": "http://www.panoramio.com/photo/58291", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58291.jpg", "longitude": 13.138103, "latitude": 47.601244, "width": 330, "height": 500, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 3903941, "photo_title": "Viharos Pipacsos", "photo_url": "http://www.panoramio.com/photo/3903941", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3903941.jpg", "longitude": 16.638451, "latitude": 47.732396, "width": 500, "height": 331, "upload_date": "13 August 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 5363928, "photo_title": "Antelope Slot Canyon", "photo_url": "http://www.panoramio.com/photo/5363928", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5363928.jpg", "longitude": -111.370811, "latitude": 36.856755, "width": 500, "height": 326, "upload_date": "17 October 2007", "owner_id": 358485, "owner_name": "Francesco Villa", "owner_url": "http://www.panoramio.com/user/358485"} + , + {"photo_id": 2688750, "photo_title": "Playa de Strenc,Mallorca", "photo_url": "http://www.panoramio.com/photo/2688750", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2688750.jpg", "longitude": 2.980042, "latitude": 39.348702, "width": 500, "height": 427, "upload_date": "11 June 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 3148025, "photo_title": "Zuidlede", "photo_url": "http://www.panoramio.com/photo/3148025", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3148025.jpg", "longitude": 3.906112, "latitude": 51.147667, "width": 496, "height": 500, "upload_date": "06 July 2007", "owner_id": 635244, "owner_name": "A.Lebacq", "owner_url": "http://www.panoramio.com/user/635244"} + , + {"photo_id": 809727, "photo_title": "Túl az óperencián", "photo_url": "http://www.panoramio.com/photo/809727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/809727.jpg", "longitude": 17.062283, "latitude": 43.277580, "width": 500, "height": 334, "upload_date": "13 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 11560716, "photo_title": "China's Great Wall, 09 may 2008", "photo_url": "http://www.panoramio.com/photo/11560716", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11560716.jpg", "longitude": 116.064860, "latitude": 40.287162, "width": 500, "height": 331, "upload_date": "27 June 2008", "owner_id": 1931067, "owner_name": "EugeneTrambo", "owner_url": "http://www.panoramio.com/user/1931067"} + , + {"photo_id": 10484028, "photo_title": "Tuscanny in lower bavaria? Toskana in Niederbayern? near Pfeffenhausen", "photo_url": "http://www.panoramio.com/photo/10484028", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10484028.jpg", "longitude": 11.982479, "latitude": 48.628768, "width": 500, "height": 411, "upload_date": "22 May 2008", "owner_id": 1077251, "owner_name": "picsonthemove", "owner_url": "http://www.panoramio.com/user/1077251"} + , + {"photo_id": 10321724, "photo_title": "Kingston Lacy beech avenue from the middle of the road (don't try this at home...)", "photo_url": "http://www.panoramio.com/photo/10321724", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10321724.jpg", "longitude": -2.051697, "latitude": 50.820469, "width": 500, "height": 473, "upload_date": "17 May 2008", "owner_id": 450216, "owner_name": "Graham Hobbs", "owner_url": "http://www.panoramio.com/user/450216"} + , + {"photo_id": 11847917, "photo_title": "Neda.... The end of an unusual trip! First Prize \"Travel\" Panoramio JULY 2008, a shot by kostas andreopoulos", "photo_url": "http://www.panoramio.com/photo/11847917", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11847917.jpg", "longitude": 21.776275, "latitude": 37.394711, "width": 500, "height": 484, "upload_date": "06 July 2008", "owner_id": 1690483, "owner_name": "k.andre", "owner_url": "http://www.panoramio.com/user/1690483"} + , + {"photo_id": 723285, "photo_title": "Stonehenge Fisheye View June 2000", "photo_url": "http://www.panoramio.com/photo/723285", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723285.jpg", "longitude": -1.826195, "latitude": 51.178849, "width": 500, "height": 500, "upload_date": "07 February 2007", "owner_id": 154364, "owner_name": "Edgy01", "owner_url": "http://www.panoramio.com/user/154364"} + , + {"photo_id": 9831198, "photo_title": "VerÅ‘fényes hangulat", "photo_url": "http://www.panoramio.com/photo/9831198", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9831198.jpg", "longitude": 18.331053, "latitude": 47.650689, "width": 333, "height": 500, "upload_date": "01 May 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4670496, "photo_title": "Vuelo rasante entre la niebla", "photo_url": "http://www.panoramio.com/photo/4670496", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4670496.jpg", "longitude": -73.243092, "latitude": -39.809134, "width": 500, "height": 371, "upload_date": "15 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 2414624, "photo_title": "Triumvirátus", "photo_url": "http://www.panoramio.com/photo/2414624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2414624.jpg", "longitude": 17.768154, "latitude": 47.510940, "width": 500, "height": 309, "upload_date": "27 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 196129, "photo_title": "usgo", "photo_url": "http://www.panoramio.com/photo/196129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196129.jpg", "longitude": -3.999882, "latitude": 43.439397, "width": 500, "height": 316, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 304677, "photo_title": "Allee bei Wilhelmsthal", "photo_url": "http://www.panoramio.com/photo/304677", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/304677.jpg", "longitude": 9.409919, "latitude": 51.392686, "width": 500, "height": 409, "upload_date": "05 January 2007", "owner_id": 63703, "owner_name": "Rainer Kaufhold", "owner_url": "http://www.panoramio.com/user/63703"} + , + {"photo_id": 4924213, "photo_title": "Egy varázslatos estén", "photo_url": "http://www.panoramio.com/photo/4924213", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4924213.jpg", "longitude": 2.151239, "latitude": 41.371278, "width": 500, "height": 335, "upload_date": "26 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 189243, "photo_title": "coming in for a landing", "photo_url": "http://www.panoramio.com/photo/189243", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/189243.jpg", "longitude": -123.147984, "latitude": 49.198812, "width": 500, "height": 333, "upload_date": "19 December 2006", "owner_id": 29932, "owner_name": "Rom@nce", "owner_url": "http://www.panoramio.com/user/29932"} + , + {"photo_id": 3121730, "photo_title": "Mers-les-Bains dark clouds looming", "photo_url": "http://www.panoramio.com/photo/3121730", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3121730.jpg", "longitude": 1.383655, "latitude": 50.066878, "width": 500, "height": 375, "upload_date": "04 July 2007", "owner_id": 633531, "owner_name": "ianwstokes", "owner_url": "http://www.panoramio.com/user/633531"} + , + {"photo_id": 5358146, "photo_title": "Lone Rock Rainbows", "photo_url": "http://www.panoramio.com/photo/5358146", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5358146.jpg", "longitude": -111.537795, "latitude": 37.020475, "width": 500, "height": 335, "upload_date": "16 October 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 9633346, "photo_title": "Altstadt von Spello--Winner Contest of April 2008 First Prize of Travel Category", "photo_url": "http://www.panoramio.com/photo/9633346", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9633346.jpg", "longitude": 12.672386, "latitude": 42.989236, "width": 347, "height": 500, "upload_date": "23 April 2008", "owner_id": 1400529, "owner_name": "marita1004", "owner_url": "http://www.panoramio.com/user/1400529"} + , + {"photo_id": 611425, "photo_title": "The Dome of Cologne", "photo_url": "http://www.panoramio.com/photo/611425", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611425.jpg", "longitude": 6.968604, "latitude": 50.941157, "width": 500, "height": 357, "upload_date": "29 January 2007", "owner_id": 8058, "owner_name": "Ermanec", "owner_url": "http://www.panoramio.com/user/8058"} + , + {"photo_id": 6850661, "photo_title": "Në Fush të Pallaticës", "photo_url": "http://www.panoramio.com/photo/6850661", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6850661.jpg", "longitude": 21.075768, "latitude": 42.007915, "width": 488, "height": 500, "upload_date": "02 January 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 5617509, "photo_title": "Cölöp kiadó", "photo_url": "http://www.panoramio.com/photo/5617509", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5617509.jpg", "longitude": 12.333934, "latitude": 45.425368, "width": 500, "height": 334, "upload_date": "29 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2083687, "photo_title": "Sunrise at Abu Simbel", "photo_url": "http://www.panoramio.com/photo/2083687", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2083687.jpg", "longitude": 31.630840, "latitude": 22.363729, "width": 500, "height": 335, "upload_date": "05 May 2007", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 7284083, "photo_title": "Japanese garden", "photo_url": "http://www.panoramio.com/photo/7284083", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7284083.jpg", "longitude": -13.673172, "latitude": 21.259301, "width": 335, "height": 500, "upload_date": "22 January 2008", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 5750152, "photo_title": "Earth, Moon and Sky", "photo_url": "http://www.panoramio.com/photo/5750152", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5750152.jpg", "longitude": -117.560234, "latitude": 36.678057, "width": 333, "height": 500, "upload_date": "06 November 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 5633673, "photo_title": "Ridgely Farm Lane", "photo_url": "http://www.panoramio.com/photo/5633673", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5633673.jpg", "longitude": -78.775320, "latitude": 38.031867, "width": 500, "height": 378, "upload_date": "30 October 2007", "owner_id": 523038, "owner_name": "Yank in Dixie", "owner_url": "http://www.panoramio.com/user/523038"} + , + {"photo_id": 723090, "photo_title": "Grand Canyon (Havasupai)", "photo_url": "http://www.panoramio.com/photo/723090", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723090.jpg", "longitude": -112.716293, "latitude": 36.270989, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1226915, "photo_title": "Flamants roses sur l'Etang de Vaccarès", "photo_url": "http://www.panoramio.com/photo/1226915", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1226915.jpg", "longitude": 4.627304, "latitude": 43.551285, "width": 500, "height": 333, "upload_date": "08 March 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 2738883, "photo_title": "Tormenta", "photo_url": "http://www.panoramio.com/photo/2738883", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2738883.jpg", "longitude": -71.616096, "latitude": -33.042558, "width": 333, "height": 500, "upload_date": "14 June 2007", "owner_id": 477365, "owner_name": "✔chilefoto", "owner_url": "http://www.panoramio.com/user/477365"} + , + {"photo_id": 2875846, "photo_title": "Rannoch Moor, Scotland", "photo_url": "http://www.panoramio.com/photo/2875846", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2875846.jpg", "longitude": -4.745750, "latitude": 56.594467, "width": 500, "height": 462, "upload_date": "22 June 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 533456, "photo_title": "Zöld symphonia", "photo_url": "http://www.panoramio.com/photo/533456", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/533456.jpg", "longitude": 17.500362, "latitude": 47.843579, "width": 500, "height": 333, "upload_date": "22 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3078609, "photo_title": "Pagan - Sunset Vista", "photo_url": "http://www.panoramio.com/photo/3078609", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3078609.jpg", "longitude": 94.884624, "latitude": 21.166644, "width": 500, "height": 329, "upload_date": "02 July 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 1599459, "photo_title": "Rosina Lamberti - Templestowe Sunset", "photo_url": "http://www.panoramio.com/photo/1599459", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1599459.jpg", "longitude": 145.145187, "latitude": -37.773700, "width": 500, "height": 332, "upload_date": "02 April 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 37097, "photo_title": "Burj Al Arab at Night", "photo_url": "http://www.panoramio.com/photo/37097", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/37097.jpg", "longitude": 55.190012, "latitude": 25.144411, "width": 333, "height": 500, "upload_date": "05 August 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 42988, "photo_title": "Mekhong at Nakhon Phanom, Thailand", "photo_url": "http://www.panoramio.com/photo/42988", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/42988.jpg", "longitude": 104.780045, "latitude": 17.415348, "width": 500, "height": 375, "upload_date": "29 August 2006", "owner_id": 6386, "owner_name": "Uwe Werner", "owner_url": "http://www.panoramio.com/user/6386"} + , + {"photo_id": 4738551, "photo_title": "Aquakatedral", "photo_url": "http://www.panoramio.com/photo/4738551", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4738551.jpg", "longitude": 18.026505, "latitude": 47.279462, "width": 500, "height": 334, "upload_date": "18 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6126327, "photo_title": "Autumnal Morning", "photo_url": "http://www.panoramio.com/photo/6126327", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126327.jpg", "longitude": 0.209620, "latitude": 51.658827, "width": 500, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 1390072, "photo_title": "Winter Wonder Woods", "photo_url": "http://www.panoramio.com/photo/1390072", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1390072.jpg", "longitude": -123.184891, "latitude": 49.400027, "width": 500, "height": 343, "upload_date": "19 March 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 8600061, "photo_title": "Templio", "photo_url": "http://www.panoramio.com/photo/8600061", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8600061.jpg", "longitude": 13.600258, "latitude": 37.288703, "width": 500, "height": 375, "upload_date": "17 March 2008", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 1232144, "photo_title": "the Wave", "photo_url": "http://www.panoramio.com/photo/1232144", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1232144.jpg", "longitude": -112.006313, "latitude": 36.995921, "width": 497, "height": 500, "upload_date": "08 March 2007", "owner_id": 256348, "owner_name": "DIEZ Jean-Paul", "owner_url": "http://www.panoramio.com/user/256348"} + , + {"photo_id": 12825028, "photo_title": "American Star shipwreck", "photo_url": "http://www.panoramio.com/photo/12825028", "photo_file_url": "http://static1.bareka.com/photos/medium/12825028.jpg", "longitude": -14.178050, "latitude": 28.345596, "width": 500, "height": 375, "upload_date": "05 August 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 9705164, "photo_title": "Die blaue Stunde-Dresden", "photo_url": "http://www.panoramio.com/photo/9705164", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9705164.jpg", "longitude": 13.732374, "latitude": 51.061020, "width": 500, "height": 333, "upload_date": "26 April 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 9701147, "photo_title": "After the thunderstorm II (Calella de Palafrugell)", "photo_url": "http://www.panoramio.com/photo/9701147", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9701147.jpg", "longitude": 3.185166, "latitude": 41.888413, "width": 500, "height": 347, "upload_date": "26 April 2008", "owner_id": 629243, "owner_name": "Olivier Faugeras", "owner_url": "http://www.panoramio.com/user/629243"} + , + {"photo_id": 3414277, "photo_title": "Morning at Vlixos_Lefkada", "photo_url": "http://www.panoramio.com/photo/3414277", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3414277.jpg", "longitude": 20.698693, "latitude": 38.689111, "width": 500, "height": 333, "upload_date": "20 July 2007", "owner_id": 242446, "owner_name": "Ntinos Lagos", "owner_url": "http://www.panoramio.com/user/242446"} + , + {"photo_id": 1205806, "photo_title": "A tavasz aranya", "photo_url": "http://www.panoramio.com/photo/1205806", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1205806.jpg", "longitude": 17.634773, "latitude": 47.557299, "width": 500, "height": 302, "upload_date": "07 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6430261, "photo_title": "The wet side of winter", "photo_url": "http://www.panoramio.com/photo/6430261", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6430261.jpg", "longitude": 9.531434, "latitude": 48.559611, "width": 500, "height": 375, "upload_date": "11 December 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 8116025, "photo_title": "Sale el Sol, Cae la Luna", "photo_url": "http://www.panoramio.com/photo/8116025", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8116025.jpg", "longitude": -71.875992, "latitude": -41.170126, "width": 500, "height": 333, "upload_date": "26 February 2008", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 1235514, "photo_title": "Pulau Menjangan", "photo_url": "http://www.panoramio.com/photo/1235514", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235514.jpg", "longitude": 114.502687, "latitude": -8.095941, "width": 500, "height": 341, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 32827, "photo_title": "Xi'an Bell Tower", "photo_url": "http://www.panoramio.com/photo/32827", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/32827.jpg", "longitude": 108.943026, "latitude": 34.260759, "width": 500, "height": 375, "upload_date": "17 July 2006", "owner_id": 5168, "owner_name": "Markus Källander", "owner_url": "http://www.panoramio.com/user/5168"} + , + {"photo_id": 798014, "photo_title": "Porto Canale", "photo_url": "http://www.panoramio.com/photo/798014", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798014.jpg", "longitude": 12.399648, "latitude": 44.203343, "width": 500, "height": 332, "upload_date": "12 February 2007", "owner_id": 159455, "owner_name": "©Franco Truscello", "owner_url": "http://www.panoramio.com/user/159455"} + , + {"photo_id": 10517317, "photo_title": "Route 66", "photo_url": "http://www.panoramio.com/photo/10517317", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10517317.jpg", "longitude": 18.027492, "latitude": 46.268071, "width": 500, "height": 375, "upload_date": "23 May 2008", "owner_id": 328249, "owner_name": "v.zsoloo", "owner_url": "http://www.panoramio.com/user/328249"} + , + {"photo_id": 416838, "photo_title": "Old Faithful on New Year's Morning", "photo_url": "http://www.panoramio.com/photo/416838", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416838.jpg", "longitude": -110.827900, "latitude": 44.459354, "width": 500, "height": 375, "upload_date": "13 January 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 5964, "photo_title": "Skradin bridge", "photo_url": "http://www.panoramio.com/photo/5964", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5964.jpg", "longitude": 15.908031, "latitude": 43.806040, "width": 500, "height": 333, "upload_date": "17 December 2005", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 419923, "photo_title": "bandaibashi2", "photo_url": "http://www.panoramio.com/photo/419923", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/419923.jpg", "longitude": 139.055500, "latitude": 37.920029, "width": 334, "height": 500, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 26985, "photo_title": "Cementerio General", "photo_url": "http://www.panoramio.com/photo/26985", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/26985.jpg", "longitude": -84.091458, "latitude": 9.930174, "width": 393, "height": 500, "upload_date": "23 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 405866, "photo_title": "awasima", "photo_url": "http://www.panoramio.com/photo/405866", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405866.jpg", "longitude": 139.229908, "latitude": 38.463267, "width": 396, "height": 500, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1319538, "photo_title": "What a place !", "photo_url": "http://www.panoramio.com/photo/1319538", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1319538.jpg", "longitude": -62.542677, "latitude": 6.022092, "width": 329, "height": 500, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 444280, "photo_title": "Cigars are for ladies", "photo_url": "http://www.panoramio.com/photo/444280", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/444280.jpg", "longitude": -82.351027, "latitude": 23.139117, "width": 500, "height": 375, "upload_date": "15 January 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 6016, "photo_title": "Å ibenik - tiramol", "photo_url": "http://www.panoramio.com/photo/6016", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6016.jpg", "longitude": 15.890865, "latitude": 43.735693, "width": 473, "height": 500, "upload_date": "18 December 2005", "owner_id": 991, "owner_name": "Mario Marotti", "owner_url": "http://www.panoramio.com/user/991"} + , + {"photo_id": 3531661, "photo_title": "Zúzmara", "photo_url": "http://www.panoramio.com/photo/3531661", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3531661.jpg", "longitude": 17.498131, "latitude": 47.847727, "width": 500, "height": 346, "upload_date": "25 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 723088, "photo_title": "Friendly Evening Haze", "photo_url": "http://www.panoramio.com/photo/723088", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723088.jpg", "longitude": 25.428715, "latitude": 36.421282, "width": 333, "height": 500, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 422813, "photo_title": "tanokami", "photo_url": "http://www.panoramio.com/photo/422813", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/422813.jpg", "longitude": 138.777237, "latitude": 37.581453, "width": 500, "height": 379, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 516256, "photo_title": "A hitehagyott", "photo_url": "http://www.panoramio.com/photo/516256", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516256.jpg", "longitude": 17.533493, "latitude": 47.842139, "width": 500, "height": 291, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 706978, "photo_title": "Snow at full moon", "photo_url": "http://www.panoramio.com/photo/706978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/706978.jpg", "longitude": 23.878784, "latitude": 69.829207, "width": 500, "height": 334, "upload_date": "05 February 2007", "owner_id": 56091, "owner_name": "Kjetil Vaage Øie", "owner_url": "http://www.panoramio.com/user/56091"} + , + {"photo_id": 4994983, "photo_title": "Camogli - Castello della \"Dragonara\" (north-west looking photograph)", "photo_url": "http://www.panoramio.com/photo/4994983", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4994983.jpg", "longitude": 9.151220, "latitude": 44.350207, "width": 325, "height": 500, "upload_date": "30 September 2007", "owner_id": 180947, "owner_name": "gilberto silvestri", "owner_url": "http://www.panoramio.com/user/180947"} + , + {"photo_id": 1315255, "photo_title": "Tulpen in Holland", "photo_url": "http://www.panoramio.com/photo/1315255", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1315255.jpg", "longitude": 4.556494, "latitude": 52.278451, "width": 500, "height": 321, "upload_date": "14 March 2007", "owner_id": 193467, "owner_name": "Jörg Behmann", "owner_url": "http://www.panoramio.com/user/193467"} + , + {"photo_id": 5204412, "photo_title": "Alaska Range", "photo_url": "http://www.panoramio.com/photo/5204412", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5204412.jpg", "longitude": -150.150146, "latitude": 62.734601, "width": 500, "height": 375, "upload_date": "09 October 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 5204668, "photo_title": "Scotland", "photo_url": "http://www.panoramio.com/photo/5204668", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5204668.jpg", "longitude": -4.821882, "latitude": 56.634188, "width": 500, "height": 500, "upload_date": "09 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 1706188, "photo_title": "Night", "photo_url": "http://www.panoramio.com/photo/1706188", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1706188.jpg", "longitude": 21.440957, "latitude": 48.427236, "width": 390, "height": 500, "upload_date": "09 April 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 6366165, "photo_title": "Il Latemar", "photo_url": "http://www.panoramio.com/photo/6366165", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6366165.jpg", "longitude": 11.575856, "latitude": 46.410138, "width": 500, "height": 375, "upload_date": "08 December 2007", "owner_id": 933456, "owner_name": "© Marco De Candido", "owner_url": "http://www.panoramio.com/user/933456"} + , + {"photo_id": 5433048, "photo_title": "moon photoshop", "photo_url": "http://www.panoramio.com/photo/5433048", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5433048.jpg", "longitude": 11.337848, "latitude": 46.460602, "width": 500, "height": 335, "upload_date": "20 October 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 611035, "photo_title": "Ice berg", "photo_url": "http://www.panoramio.com/photo/611035", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/611035.jpg", "longitude": -58.886719, "latitude": -63.470145, "width": 333, "height": 500, "upload_date": "29 January 2007", "owner_id": 14940, "owner_name": "elmtree", "owner_url": "http://www.panoramio.com/user/14940"} + , + {"photo_id": 4258269, "photo_title": "Új nap kelte", "photo_url": "http://www.panoramio.com/photo/4258269", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4258269.jpg", "longitude": 17.474785, "latitude": 47.832057, "width": 500, "height": 327, "upload_date": "28 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 37088, "photo_title": "Komandoo From The Air", "photo_url": "http://www.panoramio.com/photo/37088", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/37088.jpg", "longitude": 73.422661, "latitude": 5.496900, "width": 500, "height": 278, "upload_date": "05 August 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 71667, "photo_title": "2006ë…„06ì›”11ì¼(ì¼) 장전계곡 ë° ë‹¨ìž„ê³¨ 046_resize", "photo_url": "http://www.panoramio.com/photo/71667", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/71667.jpg", "longitude": 128.533516, "latitude": 37.435340, "width": 500, "height": 333, "upload_date": "28 October 2006", "owner_id": 9424, "owner_name": "박범호", "owner_url": "http://www.panoramio.com/user/9424"} + , + {"photo_id": 5300468, "photo_title": "Lac du Vieux Emosson", "photo_url": "http://www.panoramio.com/photo/5300468", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5300468.jpg", "longitude": 6.883256, "latitude": 46.055744, "width": 500, "height": 500, "upload_date": "14 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 591351, "photo_title": "smokestack_8739", "photo_url": "http://www.panoramio.com/photo/591351", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/591351.jpg", "longitude": -79.386027, "latitude": 43.648168, "width": 500, "height": 392, "upload_date": "27 January 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 11224316, "photo_title": "Remindful winter season-Vardar river", "photo_url": "http://www.panoramio.com/photo/11224316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11224316.jpg", "longitude": 21.084051, "latitude": 42.013782, "width": 214, "height": 500, "upload_date": "15 June 2008", "owner_id": 695042, "owner_name": "Neim Sejfuli ♦", "owner_url": "http://www.panoramio.com/user/695042"} + , + {"photo_id": 5968187, "photo_title": "2007 VITORIA Alava PIXELECTA", "photo_url": "http://www.panoramio.com/photo/5968187", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5968187.jpg", "longitude": -2.650087, "latitude": 42.860206, "width": 500, "height": 333, "upload_date": "17 November 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 1781517, "photo_title": "Yosemite Falls in Winter", "photo_url": "http://www.panoramio.com/photo/1781517", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781517.jpg", "longitude": -119.590130, "latitude": 37.744318, "width": 500, "height": 400, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 5796376, "photo_title": "Shuto Expressway Loop Line in Nihombashi", "photo_url": "http://www.panoramio.com/photo/5796376", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5796376.jpg", "longitude": 139.776344, "latitude": 35.684536, "width": 327, "height": 500, "upload_date": "08 November 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 5523741, "photo_title": "Saskatchewan Sunset October 24/07 (and there is the flat land of the prairies at the bottom of this pic ;)", "photo_url": "http://www.panoramio.com/photo/5523741", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5523741.jpg", "longitude": -105.535011, "latitude": 50.502073, "width": 375, "height": 500, "upload_date": "24 October 2007", "owner_id": 133037, "owner_name": "Lilypon", "owner_url": "http://www.panoramio.com/user/133037"} + , + {"photo_id": 196125, "photo_title": "arnía y covachos", "photo_url": "http://www.panoramio.com/photo/196125", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/196125.jpg", "longitude": -3.914223, "latitude": 43.474349, "width": 500, "height": 337, "upload_date": "20 December 2006", "owner_id": 38804, "owner_name": "www.oscarsanchez.net", "owner_url": "http://www.panoramio.com/user/38804"} + , + {"photo_id": 349726, "photo_title": "thailand ko-samui sunset", "photo_url": "http://www.panoramio.com/photo/349726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/349726.jpg", "longitude": 99.930954, "latitude": 9.472344, "width": 500, "height": 334, "upload_date": "08 January 2007", "owner_id": 69671, "owner_name": "illusandpics.com", "owner_url": "http://www.panoramio.com/user/69671"} + , + {"photo_id": 280106, "photo_title": "dune01", "photo_url": "http://www.panoramio.com/photo/280106", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/280106.jpg", "longitude": -5.089073, "latitude": 30.229408, "width": 500, "height": 345, "upload_date": "01 January 2007", "owner_id": 58867, "owner_name": "Lachaud Franck", "owner_url": "http://www.panoramio.com/user/58867"} + , + {"photo_id": 4446015, "photo_title": "Mennyei fényjáték", "photo_url": "http://www.panoramio.com/photo/4446015", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4446015.jpg", "longitude": 17.818108, "latitude": 47.525084, "width": 500, "height": 333, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4644180, "photo_title": "Bridalveil Falls from Valley View", "photo_url": "http://www.panoramio.com/photo/4644180", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4644180.jpg", "longitude": -119.661723, "latitude": 37.717419, "width": 500, "height": 357, "upload_date": "14 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 457302, "photo_title": "Matterhorn Zermatt", "photo_url": "http://www.panoramio.com/photo/457302", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/457302.jpg", "longitude": 7.746391, "latitude": 46.016992, "width": 500, "height": 375, "upload_date": "16 January 2007", "owner_id": 47930, "owner_name": "werni", "owner_url": "http://www.panoramio.com/user/47930"} + , + {"photo_id": 4258138, "photo_title": "Szentkút", "photo_url": "http://www.panoramio.com/photo/4258138", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4258138.jpg", "longitude": 17.731848, "latitude": 47.243755, "width": 500, "height": 334, "upload_date": "28 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 26986, "photo_title": "Cementerio General", "photo_url": "http://www.panoramio.com/photo/26986", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/26986.jpg", "longitude": -84.091158, "latitude": 9.930047, "width": 500, "height": 373, "upload_date": "23 June 2006", "owner_id": 4112, "owner_name": "Roberto Garcia", "owner_url": "http://www.panoramio.com/user/4112"} + , + {"photo_id": 1269869, "photo_title": "Barents Sea at night, Finnmark, Norway", "photo_url": "http://www.panoramio.com/photo/1269869", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1269869.jpg", "longitude": 30.868149, "latitude": 70.438638, "width": 500, "height": 324, "upload_date": "11 March 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 515971, "photo_title": "A hosszútávfutó magányossága", "photo_url": "http://www.panoramio.com/photo/515971", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/515971.jpg", "longitude": 17.870121, "latitude": 47.373012, "width": 500, "height": 276, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 36486, "photo_title": "Sunrise on Trondheimsfjord", "photo_url": "http://www.panoramio.com/photo/36486", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36486.jpg", "longitude": 10.333843, "latitude": 63.456186, "width": 500, "height": 332, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 4950702, "photo_title": "Abandoned Gas Stand, Hachimantai, Iwate, Japan", "photo_url": "http://www.panoramio.com/photo/4950702", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4950702.jpg", "longitude": 141.062308, "latitude": 39.955547, "width": 500, "height": 335, "upload_date": "28 September 2007", "owner_id": 699984, "owner_name": "Fried Toast", "owner_url": "http://www.panoramio.com/user/699984"} + , + {"photo_id": 2345653, "photo_title": "planet mars", "photo_url": "http://www.panoramio.com/photo/2345653", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2345653.jpg", "longitude": 33.631908, "latitude": 27.380118, "width": 500, "height": 322, "upload_date": "22 May 2007", "owner_id": 223374, "owner_name": "voutsen", "owner_url": "http://www.panoramio.com/user/223374"} + , + {"photo_id": 4612307, "photo_title": "Sitges - Spinaker", "photo_url": "http://www.panoramio.com/photo/4612307", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4612307.jpg", "longitude": 1.859436, "latitude": 41.211722, "width": 500, "height": 371, "upload_date": "13 September 2007", "owner_id": 138691, "owner_name": "Josep Maria Alegre", "owner_url": "http://www.panoramio.com/user/138691"} + , + {"photo_id": 4644311, "photo_title": "Through the Looking Glass", "photo_url": "http://www.panoramio.com/photo/4644311", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4644311.jpg", "longitude": -119.649745, "latitude": 37.722019, "width": 333, "height": 500, "upload_date": "14 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 1480664, "photo_title": "Királyi szurkolótábor", "photo_url": "http://www.panoramio.com/photo/1480664", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1480664.jpg", "longitude": 17.300034, "latitude": 47.190646, "width": 500, "height": 269, "upload_date": "24 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8492774, "photo_title": "Lago Fedaia in estate Panoramio and ATP first CONTEST, March 2008, category Scenery : awarded \" Honorable Mention\". Many thanks to all voters", "photo_url": "http://www.panoramio.com/photo/8492774", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8492774.jpg", "longitude": 11.867519, "latitude": 46.463128, "width": 500, "height": 375, "upload_date": "12 March 2008", "owner_id": 6033, "owner_name": "â–º Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 57835, "photo_title": "Seewaldsee 2 - St.Koloman", "photo_url": "http://www.panoramio.com/photo/57835", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57835.jpg", "longitude": 13.274918, "latitude": 47.630115, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 57837, "photo_title": "Der Hraunfossar an einem kalten Wintertag .....(MS)", "photo_url": "http://www.panoramio.com/photo/57837", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57837.jpg", "longitude": -20.939941, "latitude": 64.698078, "width": 500, "height": 264, "upload_date": "05 October 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 70641, "photo_title": "Lake Nakuru (Kenya)", "photo_url": "http://www.panoramio.com/photo/70641", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70641.jpg", "longitude": 36.114979, "latitude": -0.324782, "width": 500, "height": 333, "upload_date": "25 October 2006", "owner_id": 8975, "owner_name": "Laura Sayalero", "owner_url": "http://www.panoramio.com/user/8975"} + , + {"photo_id": 766205, "photo_title": "posta sol porto colom", "photo_url": "http://www.panoramio.com/photo/766205", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/766205.jpg", "longitude": 3.264495, "latitude": 39.425093, "width": 500, "height": 335, "upload_date": "10 February 2007", "owner_id": 134682, "owner_name": "------ Cafate ------", "owner_url": "http://www.panoramio.com/user/134682"} + , + {"photo_id": 10662910, "photo_title": "Megvilágosodván", "photo_url": "http://www.panoramio.com/photo/10662910", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10662910.jpg", "longitude": 17.718544, "latitude": 47.460130, "width": 500, "height": 334, "upload_date": "27 May 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8703547, "photo_title": "Lonely bike-rider", "photo_url": "http://www.panoramio.com/photo/8703547", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8703547.jpg", "longitude": 6.039004, "latitude": 52.208974, "width": 500, "height": 467, "upload_date": "21 March 2008", "owner_id": 523564, "owner_name": "Luud Riphagen", "owner_url": "http://www.panoramio.com/user/523564"} + , + {"photo_id": 11669907, "photo_title": "Alba sulle pale di San Martino", "photo_url": "http://www.panoramio.com/photo/11669907", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11669907.jpg", "longitude": 11.568518, "latitude": 46.345269, "width": 500, "height": 361, "upload_date": "30 June 2008", "owner_id": 6033, "owner_name": "â–º Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 11403916, "photo_title": "Lonely", "photo_url": "http://www.panoramio.com/photo/11403916", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11403916.jpg", "longitude": 18.164520, "latitude": 46.345269, "width": 500, "height": 375, "upload_date": "21 June 2008", "owner_id": 328249, "owner_name": "v.zsoloo", "owner_url": "http://www.panoramio.com/user/328249"} + , + {"photo_id": 289803, "photo_title": "Rain Clouds", "photo_url": "http://www.panoramio.com/photo/289803", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/289803.jpg", "longitude": -57.733154, "latitude": -51.661908, "width": 500, "height": 335, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 123413, "photo_title": "Paisaje cromático de Landmanalaugar", "photo_url": "http://www.panoramio.com/photo/123413", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/123413.jpg", "longitude": -19.085140, "latitude": 63.918285, "width": 500, "height": 332, "upload_date": "12 December 2006", "owner_id": 20549, "owner_name": "oscarvg", "owner_url": "http://www.panoramio.com/user/20549"} + , + {"photo_id": 595734, "photo_title": "Sphinx profile", "photo_url": "http://www.panoramio.com/photo/595734", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/595734.jpg", "longitude": 31.137791, "latitude": 29.975034, "width": 500, "height": 330, "upload_date": "27 January 2007", "owner_id": 124418, "owner_name": "Pierre-Jean Durieu", "owner_url": "http://www.panoramio.com/user/124418"} + , + {"photo_id": 3282726, "photo_title": "Shanghai - Inside the Jinmao Tower", "photo_url": "http://www.panoramio.com/photo/3282726", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3282726.jpg", "longitude": 121.501153, "latitude": 31.237519, "width": 500, "height": 335, "upload_date": "13 July 2007", "owner_id": 578163, "owner_name": "Margherita-Italy", "owner_url": "http://www.panoramio.com/user/578163"} + , + {"photo_id": 1346342, "photo_title": "nemrut", "photo_url": "http://www.panoramio.com/photo/1346342", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1346342.jpg", "longitude": 38.761826, "latitude": 38.042413, "width": 340, "height": 500, "upload_date": "16 March 2007", "owner_id": 2659, "owner_name": "ozalph", "owner_url": "http://www.panoramio.com/user/2659"} + , + {"photo_id": 151849, "photo_title": "panoramas photo @ the cross at Xin-Yi and Kee-Lung road ( my 2nd try )", "photo_url": "http://www.panoramio.com/photo/151849", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/151849.jpg", "longitude": 121.559209, "latitude": 25.033073, "width": 500, "height": 348, "upload_date": "15 December 2006", "owner_id": 27791, "owner_name": "Jerome Chen", "owner_url": "http://www.panoramio.com/user/27791"} + , + {"photo_id": 1212973, "photo_title": "Perhaps Neruda's View", "photo_url": "http://www.panoramio.com/photo/1212973", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1212973.jpg", "longitude": 14.398935, "latitude": 50.084752, "width": 500, "height": 333, "upload_date": "07 March 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 809789, "photo_title": "Pihike", "photo_url": "http://www.panoramio.com/photo/809789", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/809789.jpg", "longitude": 17.457018, "latitude": 47.881010, "width": 500, "height": 387, "upload_date": "13 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 88150, "photo_title": "Marmore Falls - Umbria - Italy", "photo_url": "http://www.panoramio.com/photo/88150", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88150.jpg", "longitude": 12.716667, "latitude": 42.550000, "width": 375, "height": 500, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 624990, "photo_title": "Mélyrepülés", "photo_url": "http://www.panoramio.com/photo/624990", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/624990.jpg", "longitude": 17.455988, "latitude": 47.881931, "width": 500, "height": 288, "upload_date": "30 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 612449, "photo_title": "Rio de Janeiro - Vista do Corcovado ©G.Schüür", "photo_url": "http://www.panoramio.com/photo/612449", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/612449.jpg", "longitude": -43.210323, "latitude": -22.951463, "width": 500, "height": 400, "upload_date": "29 January 2007", "owner_id": 120756, "owner_name": "Germano Schüür", "owner_url": "http://www.panoramio.com/user/120756"} + , + {"photo_id": 1545313, "photo_title": "Tempestade", "photo_url": "http://www.panoramio.com/photo/1545313", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1545313.jpg", "longitude": -48.678703, "latitude": -26.643470, "width": 500, "height": 341, "upload_date": "29 March 2007", "owner_id": 160342, "owner_name": "Jakson Santos", "owner_url": "http://www.panoramio.com/user/160342"} + , + {"photo_id": 1595492, "photo_title": "Explosión Rosa", "photo_url": "http://www.panoramio.com/photo/1595492", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1595492.jpg", "longitude": -73.250393, "latitude": -39.813481, "width": 500, "height": 375, "upload_date": "02 April 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 5501284, "photo_title": "Da qui passano i sogni...", "photo_url": "http://www.panoramio.com/photo/5501284", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5501284.jpg", "longitude": 12.335930, "latitude": 45.435563, "width": 375, "height": 500, "upload_date": "23 October 2007", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 444265, "photo_title": "Cafe, Calle and Capitol of Cuba", "photo_url": "http://www.panoramio.com/photo/444265", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/444265.jpg", "longitude": -82.350453, "latitude": 23.136354, "width": 500, "height": 375, "upload_date": "15 January 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 9590, "photo_title": "South Street Seaport and Financial Center Skyline [007783]", "photo_url": "http://www.panoramio.com/photo/9590", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9590.jpg", "longitude": -74.001760, "latitude": 40.704937, "width": 500, "height": 375, "upload_date": "04 February 2006", "owner_id": 1489, "owner_name": "Thorsten", "owner_url": "http://www.panoramio.com/user/1489"} + , + {"photo_id": 204153, "photo_title": "Stormheimfjell and Hamperokken mountains near Brevikeidet ", "photo_url": "http://www.panoramio.com/photo/204153", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/204153.jpg", "longitude": 19.650421, "latitude": 69.668899, "width": 500, "height": 375, "upload_date": "21 December 2006", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 916095, "photo_title": "Before daybreak on Mount Etna (as seen from Piano Provenzana)", "photo_url": "http://www.panoramio.com/photo/916095", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/916095.jpg", "longitude": 15.038610, "latitude": 37.793881, "width": 500, "height": 375, "upload_date": "20 February 2007", "owner_id": 67714, "owner_name": "Robert Gulyas", "owner_url": "http://www.panoramio.com/user/67714"} + , + {"photo_id": 680320, "photo_title": "A severe storm approaches Nyngan, NSW www.ozthunder.com", "photo_url": "http://www.panoramio.com/photo/680320", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/680320.jpg", "longitude": 147.154312, "latitude": -31.563910, "width": 500, "height": 378, "upload_date": "04 February 2007", "owner_id": 67208, "owner_name": "Michael Thompson", "owner_url": "http://www.panoramio.com/user/67208"} + , + {"photo_id": 6018, "photo_title": "Jadrija - barke", "photo_url": "http://www.panoramio.com/photo/6018", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6018.jpg", "longitude": 15.841599, "latitude": 43.725026, "width": 500, "height": 176, "upload_date": "18 December 2005", "owner_id": 991, "owner_name": "Mario Marotti", "owner_url": "http://www.panoramio.com/user/991"} + , + {"photo_id": 36485, "photo_title": "Great Belt Bridge", "photo_url": "http://www.panoramio.com/photo/36485", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36485.jpg", "longitude": 11.029501, "latitude": 55.342130, "width": 500, "height": 332, "upload_date": "02 August 2006", "owner_id": 5703, "owner_name": "dancer", "owner_url": "http://www.panoramio.com/user/5703"} + , + {"photo_id": 19098, "photo_title": "Jökulsárlón", "photo_url": "http://www.panoramio.com/photo/19098", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/19098.jpg", "longitude": -16.355896, "latitude": 64.037351, "width": 500, "height": 333, "upload_date": "02 May 2006", "owner_id": 2885, "owner_name": "Luis Rodríguez Baena", "owner_url": "http://www.panoramio.com/user/2885"} + , + {"photo_id": 55458, "photo_title": "034 Troianisches Pferd", "photo_url": "http://www.panoramio.com/photo/55458", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/55458.jpg", "longitude": 26.240464, "latitude": 39.957188, "width": 375, "height": 500, "upload_date": "01 October 2006", "owner_id": 7633, "owner_name": "Daniel Meyer", "owner_url": "http://www.panoramio.com/user/7633"} + , + {"photo_id": 1800357, "photo_title": "Beach & Evening Light - Garrapata State Park Big Sur, CA", "photo_url": "http://www.panoramio.com/photo/1800357", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1800357.jpg", "longitude": -121.925915, "latitude": 36.455437, "width": 500, "height": 345, "upload_date": "16 April 2007", "owner_id": 107613, "owner_name": "Tom Grubbe", "owner_url": "http://www.panoramio.com/user/107613"} + , + {"photo_id": 1447086, "photo_title": "Odyssey", "photo_url": "http://www.panoramio.com/photo/1447086", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1447086.jpg", "longitude": 15.923395, "latitude": 43.589530, "width": 500, "height": 323, "upload_date": "22 March 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10378421, "photo_title": "Red Bus", "photo_url": "http://www.panoramio.com/photo/10378421", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10378421.jpg", "longitude": -0.124497, "latitude": 51.500809, "width": 414, "height": 500, "upload_date": "19 May 2008", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 1087672, "photo_title": "És azután menydörgést hallottunk...", "photo_url": "http://www.panoramio.com/photo/1087672", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1087672.jpg", "longitude": 15.917473, "latitude": 43.590836, "width": 500, "height": 299, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 74950, "photo_title": "高åƒç©‚", "photo_url": "http://www.panoramio.com/photo/74950", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74950.jpg", "longitude": 131.019516, "latitude": 32.320504, "width": 500, "height": 375, "upload_date": "03 November 2006", "owner_id": 9556, "owner_name": "shigesato", "owner_url": "http://www.panoramio.com/user/9556"} + , + {"photo_id": 1749978, "photo_title": "Campos de Criptana", "photo_url": "http://www.panoramio.com/photo/1749978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1749978.jpg", "longitude": -3.123207, "latitude": 39.409805, "width": 500, "height": 334, "upload_date": "12 April 2007", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 94171, "photo_title": "Matsumoto Castle", "photo_url": "http://www.panoramio.com/photo/94171", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/94171.jpg", "longitude": 137.967778, "latitude": 36.239194, "width": 408, "height": 500, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 2053084, "photo_title": "Blue lagoon, Melchior islands", "photo_url": "http://www.panoramio.com/photo/2053084", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2053084.jpg", "longitude": -62.830811, "latitude": -64.415921, "width": 500, "height": 336, "upload_date": "03 May 2007", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 86244, "photo_title": "Palmeras", "photo_url": "http://www.panoramio.com/photo/86244", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/86244.jpg", "longitude": -1.116829, "latitude": 37.930930, "width": 333, "height": 500, "upload_date": "25 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 629489, "photo_title": "Hare in winter fur...beast of the Cave of Caerbannog.", "photo_url": "http://www.panoramio.com/photo/629489", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/629489.jpg", "longitude": -105.645390, "latitude": 40.296593, "width": 500, "height": 376, "upload_date": "31 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 8459506, "photo_title": "Baltic sunrise in Kiel", "photo_url": "http://www.panoramio.com/photo/8459506", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8459506.jpg", "longitude": 10.169671, "latitude": 54.430970, "width": 500, "height": 375, "upload_date": "11 March 2008", "owner_id": 73946, "owner_name": "pembo", "owner_url": "http://www.panoramio.com/user/73946"} + , + {"photo_id": 36599, "photo_title": "ц Ð—Ð°Ñ‡Ð°Ñ‚Ð¸Ñ Ðнны на Углу", "photo_url": "http://www.panoramio.com/photo/36599", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36599.jpg", "longitude": 37.630963, "latitude": 55.750159, "width": 500, "height": 375, "upload_date": "03 August 2006", "owner_id": 5641, "owner_name": "sergey duhanin", "owner_url": "http://www.panoramio.com/user/5641"} + , + {"photo_id": 62716, "photo_title": "Amanecer en la Sauceda", "photo_url": "http://www.panoramio.com/photo/62716", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/62716.jpg", "longitude": -5.591730, "latitude": 36.521630, "width": 500, "height": 330, "upload_date": "15 October 2006", "owner_id": 473, "owner_name": "Juanlu", "owner_url": "http://www.panoramio.com/user/473"} + , + {"photo_id": 4709631, "photo_title": "The sun sets in the East....", "photo_url": "http://www.panoramio.com/photo/4709631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4709631.jpg", "longitude": -112.624583, "latitude": 45.211038, "width": 500, "height": 375, "upload_date": "17 September 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 11408203, "photo_title": "05-08-31_Paramo de MASA_PIXELECTA", "photo_url": "http://www.panoramio.com/photo/11408203", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11408203.jpg", "longitude": -3.536568, "latitude": 42.669357, "width": 500, "height": 375, "upload_date": "21 June 2008", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 416263, "photo_title": "Mt. Meeker at Dawn", "photo_url": "http://www.panoramio.com/photo/416263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416263.jpg", "longitude": -105.579643, "latitude": 40.270472, "width": 500, "height": 374, "upload_date": "13 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 1289233, "photo_title": " High Dades", "photo_url": "http://www.panoramio.com/photo/1289233", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1289233.jpg", "longitude": -5.838375, "latitude": 31.652066, "width": 500, "height": 329, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1567767, "photo_title": "Rosina Lamberti - Sunset Templestowe, 31 March 2007", "photo_url": "http://www.panoramio.com/photo/1567767", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1567767.jpg", "longitude": 145.133858, "latitude": -37.765015, "width": 500, "height": 237, "upload_date": "31 March 2007", "owner_id": 140796, "owner_name": "rosina lamberti", "owner_url": "http://www.panoramio.com/user/140796"} + , + {"photo_id": 4130842, "photo_title": "Ãrvore Solar", "photo_url": "http://www.panoramio.com/photo/4130842", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4130842.jpg", "longitude": -51.830320, "latitude": -22.939424, "width": 427, "height": 500, "upload_date": "23 August 2007", "owner_id": 465654, "owner_name": "Carlos Sica", "owner_url": "http://www.panoramio.com/user/465654"} + , + {"photo_id": 340508, "photo_title": "Sunset from Camelback Mountain Echo Trail", "photo_url": "http://www.panoramio.com/photo/340508", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/340508.jpg", "longitude": -111.969969, "latitude": 33.520820, "width": 333, "height": 500, "upload_date": "08 January 2007", "owner_id": 45308, "owner_name": "Mike Cavaroc", "owner_url": "http://www.panoramio.com/user/45308"} + , + {"photo_id": 74792, "photo_title": "annapurna south", "photo_url": "http://www.panoramio.com/photo/74792", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74792.jpg", "longitude": 83.804398, "latitude": 28.524813, "width": 500, "height": 334, "upload_date": "03 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 4445995, "photo_title": "Ködvarázs", "photo_url": "http://www.panoramio.com/photo/4445995", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4445995.jpg", "longitude": 18.053970, "latitude": 47.276783, "width": 500, "height": 334, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3032620, "photo_title": "Mira sin bueyes", "photo_url": "http://www.panoramio.com/photo/3032620", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3032620.jpg", "longitude": -8.802710, "latitude": 40.459324, "width": 500, "height": 327, "upload_date": "30 June 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 415533, "photo_title": "Manila Sunset", "photo_url": "http://www.panoramio.com/photo/415533", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/415533.jpg", "longitude": 120.984208, "latitude": 14.572339, "width": 333, "height": 500, "upload_date": "13 January 2007", "owner_id": 20398, "owner_name": "boerx", "owner_url": "http://www.panoramio.com/user/20398"} + , + {"photo_id": 723004, "photo_title": "Bouncing Light", "photo_url": "http://www.panoramio.com/photo/723004", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723004.jpg", "longitude": 25.379276, "latitude": 36.461468, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2514494, "photo_title": "klatschmohn bis zum Horizont", "photo_url": "http://www.panoramio.com/photo/2514494", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2514494.jpg", "longitude": 12.025051, "latitude": 54.145244, "width": 500, "height": 334, "upload_date": "01 June 2007", "owner_id": 82603, "owner_name": "HelgeNug", "owner_url": "http://www.panoramio.com/user/82603"} + , + {"photo_id": 436289, "photo_title": "koaganogawa", "photo_url": "http://www.panoramio.com/photo/436289", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436289.jpg", "longitude": 139.065456, "latitude": 37.831548, "width": 500, "height": 341, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 73027, "photo_title": "Concourse, British Museum", "photo_url": "http://www.panoramio.com/photo/73027", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73027.jpg", "longitude": -0.127201, "latitude": 51.519532, "width": 500, "height": 326, "upload_date": "29 October 2006", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 9766996, "photo_title": "Racetrack Playa", "photo_url": "http://www.panoramio.com/photo/9766996", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9766996.jpg", "longitude": -117.558091, "latitude": 36.664815, "width": 388, "height": 500, "upload_date": "29 April 2008", "owner_id": 308300, "owner_name": "Tony R Immoos", "owner_url": "http://www.panoramio.com/user/308300"} + , + {"photo_id": 1455193, "photo_title": "Вулкан КарымÑкий, Ñо Ñклона вулкана Малый СемÑчик", "photo_url": "http://www.panoramio.com/photo/1455193", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1455193.jpg", "longitude": 159.626970, "latitude": 54.133227, "width": 500, "height": 345, "upload_date": "23 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 1234797, "photo_title": "Sahalie Falls, Mckenzie River", "photo_url": "http://www.panoramio.com/photo/1234797", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1234797.jpg", "longitude": -121.997187, "latitude": 44.348769, "width": 500, "height": 420, "upload_date": "09 March 2007", "owner_id": 128746, "owner_name": "© Michael Hatten", "owner_url": "http://www.panoramio.com/user/128746"} + , + {"photo_id": 3989102, "photo_title": "El Gran Miércoles", "photo_url": "http://www.panoramio.com/photo/3989102", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3989102.jpg", "longitude": -17.991056, "latitude": 27.797638, "width": 500, "height": 375, "upload_date": "17 August 2007", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 85625, "photo_title": "Cañón de Valdeinfiernos", "photo_url": "http://www.panoramio.com/photo/85625", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/85625.jpg", "longitude": -1.961060, "latitude": 37.801511, "width": 333, "height": 500, "upload_date": "24 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 4558716, "photo_title": "Corsica - West Coast", "photo_url": "http://www.panoramio.com/photo/4558716", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4558716.jpg", "longitude": 8.655338, "latitude": 42.253108, "width": 500, "height": 341, "upload_date": "10 September 2007", "owner_id": 49870, "owner_name": "Jean-Michel Raggioli", "owner_url": "http://www.panoramio.com/user/49870"} + , + {"photo_id": 3201916, "photo_title": "Mönch", "photo_url": "http://www.panoramio.com/photo/3201916", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3201916.jpg", "longitude": 7.640026, "latitude": 46.745537, "width": 500, "height": 374, "upload_date": "09 July 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 4365440, "photo_title": "a piece of wood", "photo_url": "http://www.panoramio.com/photo/4365440", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4365440.jpg", "longitude": -1.254158, "latitude": 44.480463, "width": 221, "height": 500, "upload_date": "03 September 2007", "owner_id": 521836, "owner_name": "KLEFER", "owner_url": "http://www.panoramio.com/user/521836"} + , + {"photo_id": 124545, "photo_title": "66_St-Cyp_vagues_01", "photo_url": "http://www.panoramio.com/photo/124545", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/124545.jpg", "longitude": 3.037736, "latitude": 42.623436, "width": 500, "height": 333, "upload_date": "12 December 2006", "owner_id": 18696, "owner_name": "Besnard", "owner_url": "http://www.panoramio.com/user/18696"} + , + {"photo_id": 65666, "photo_title": "Barco fantasma", "photo_url": "http://www.panoramio.com/photo/65666", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/65666.jpg", "longitude": -14.179380, "latitude": 28.344878, "width": 500, "height": 375, "upload_date": "18 October 2006", "owner_id": 8658, "owner_name": "Canarina", "owner_url": "http://www.panoramio.com/user/8658"} + , + {"photo_id": 573064, "photo_title": "Looking west across Isfjorden", "photo_url": "http://www.panoramio.com/photo/573064", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/573064.jpg", "longitude": 7.681332, "latitude": 62.558395, "width": 500, "height": 332, "upload_date": "26 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 859786, "photo_title": "Aurora Borealis, Andøya, VesterÃ¥len, Norway", "photo_url": "http://www.panoramio.com/photo/859786", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/859786.jpg", "longitude": 15.605392, "latitude": 69.118548, "width": 500, "height": 377, "upload_date": "17 February 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 507024, "photo_title": "Agrárcolorgeometria", "photo_url": "http://www.panoramio.com/photo/507024", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507024.jpg", "longitude": 18.014488, "latitude": 47.316017, "width": 500, "height": 300, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6665111, "photo_title": "Coucher du soleil depuis les Crêts", "photo_url": "http://www.panoramio.com/photo/6665111", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6665111.jpg", "longitude": 6.172214, "latitude": 46.129129, "width": 500, "height": 375, "upload_date": "24 December 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 679331, "photo_title": "wentworth falls", "photo_url": "http://www.panoramio.com/photo/679331", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/679331.jpg", "longitude": 150.371124, "latitude": -33.727111, "width": 498, "height": 500, "upload_date": "04 February 2007", "owner_id": 146092, "owner_name": "sid1662", "owner_url": "http://www.panoramio.com/user/146092"} + , + {"photo_id": 459436, "photo_title": "aikawa", "photo_url": "http://www.panoramio.com/photo/459436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459436.jpg", "longitude": 138.234701, "latitude": 37.998936, "width": 500, "height": 341, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 31662, "photo_title": "NY_7_GE", "photo_url": "http://www.panoramio.com/photo/31662", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/31662.jpg", "longitude": -73.977041, "latitude": 40.761528, "width": 452, "height": 500, "upload_date": "11 July 2006", "owner_id": 4657, "owner_name": "Giuseppe Grande", "owner_url": "http://www.panoramio.com/user/4657"} + , + {"photo_id": 1488304, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488304", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488304.jpg", "longitude": 138.135223, "latitude": 36.848719, "width": 383, "height": 500, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 181939, "photo_title": "The Eiffel Tower, Paris", "photo_url": "http://www.panoramio.com/photo/181939", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/181939.jpg", "longitude": 2.288718, "latitude": 48.861920, "width": 384, "height": 500, "upload_date": "18 December 2006", "owner_id": 12954, "owner_name": "ZiÄ™bol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 2422198, "photo_title": "In the Pine's Shade", "photo_url": "http://www.panoramio.com/photo/2422198", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2422198.jpg", "longitude": -112.393484, "latitude": 44.580075, "width": 500, "height": 333, "upload_date": "27 May 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2363576, "photo_title": "Cienfuegos Yacht Club", "photo_url": "http://www.panoramio.com/photo/2363576", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2363576.jpg", "longitude": -80.450901, "latitude": 22.126499, "width": 500, "height": 306, "upload_date": "23 May 2007", "owner_id": 2575, "owner_name": "mikel ortega", "owner_url": "http://www.panoramio.com/user/2575"} + , + {"photo_id": 58296, "photo_title": "Liechtensteinklamm 2", "photo_url": "http://www.panoramio.com/photo/58296", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58296.jpg", "longitude": 13.190546, "latitude": 47.310140, "width": 333, "height": 500, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 507328, "photo_title": "Pillantás a hídról", "photo_url": "http://www.panoramio.com/photo/507328", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/507328.jpg", "longitude": 17.629859, "latitude": 47.687102, "width": 500, "height": 334, "upload_date": "20 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 468161, "photo_title": "Honfleur", "photo_url": "http://www.panoramio.com/photo/468161", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/468161.jpg", "longitude": 0.234833, "latitude": 49.421806, "width": 500, "height": 350, "upload_date": "17 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 2521031, "photo_title": "Derűs délután", "photo_url": "http://www.panoramio.com/photo/2521031", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2521031.jpg", "longitude": 17.523537, "latitude": 47.751790, "width": 380, "height": 500, "upload_date": "02 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 934105, "photo_title": "Times Square", "photo_url": "http://www.panoramio.com/photo/934105", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/934105.jpg", "longitude": -73.986762, "latitude": 40.756652, "width": 375, "height": 500, "upload_date": "21 February 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 57824, "photo_title": "Hallstatt 3", "photo_url": "http://www.panoramio.com/photo/57824", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57824.jpg", "longitude": 13.642616, "latitude": 47.556372, "width": 500, "height": 333, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1370861, "photo_title": "Wanganui Sunrise", "photo_url": "http://www.panoramio.com/photo/1370861", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1370861.jpg", "longitude": 175.053218, "latitude": -39.927193, "width": 500, "height": 400, "upload_date": "17 March 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 4823023, "photo_title": "Cielo en llamas ( Sky on fire )", "photo_url": "http://www.panoramio.com/photo/4823023", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4823023.jpg", "longitude": -0.471725, "latitude": 39.601588, "width": 500, "height": 375, "upload_date": "22 September 2007", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 520945, "photo_title": "Estvarázs", "photo_url": "http://www.panoramio.com/photo/520945", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/520945.jpg", "longitude": 17.627692, "latitude": 47.665156, "width": 500, "height": 334, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 818423, "photo_title": "Karst Countryside in Guangxi, China", "photo_url": "http://www.panoramio.com/photo/818423", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/818423.jpg", "longitude": 106.953964, "latitude": 22.716023, "width": 500, "height": 206, "upload_date": "14 February 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 532730, "photo_title": "Nightfall and fog at lake Helgeren", "photo_url": "http://www.panoramio.com/photo/532730", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532730.jpg", "longitude": 10.708923, "latitude": 60.074348, "width": 419, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 650237, "photo_title": "Aruba, Eagle Beach, Divi Divi Tree", "photo_url": "http://www.panoramio.com/photo/650237", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/650237.jpg", "longitude": -70.055099, "latitude": 12.555003, "width": 500, "height": 375, "upload_date": "01 February 2007", "owner_id": 136446, "owner_name": "© Wim", "owner_url": "http://www.panoramio.com/user/136446"} + , + {"photo_id": 2414590, "photo_title": "Egy csendes estén", "photo_url": "http://www.panoramio.com/photo/2414590", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2414590.jpg", "longitude": 17.626448, "latitude": 47.662613, "width": 500, "height": 334, "upload_date": "27 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 10544520, "photo_title": "Plansee", "photo_url": "http://www.panoramio.com/photo/10544520", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10544520.jpg", "longitude": 10.799389, "latitude": 47.473011, "width": 500, "height": 242, "upload_date": "24 May 2008", "owner_id": 634000, "owner_name": "© Massimo De Candido", "owner_url": "http://www.panoramio.com/user/634000"} + , + {"photo_id": 11341211, "photo_title": "AMAPOLAS AL SOL", "photo_url": "http://www.panoramio.com/photo/11341211", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11341211.jpg", "longitude": -1.995735, "latitude": 42.471844, "width": 500, "height": 374, "upload_date": "19 June 2008", "owner_id": 1487989, "owner_name": "mesias", "owner_url": "http://www.panoramio.com/user/1487989"} + , + {"photo_id": 134748, "photo_title": "20060813_9795_raw", "photo_url": "http://www.panoramio.com/photo/134748", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/134748.jpg", "longitude": 30.452921, "latitude": 50.358700, "width": 500, "height": 333, "upload_date": "13 December 2006", "owner_id": 17090, "owner_name": "Pavel Danko", "owner_url": "http://www.panoramio.com/user/17090"} + , + {"photo_id": 66816, "photo_title": "desierto cerca de Tolar Grande", "photo_url": "http://www.panoramio.com/photo/66816", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/66816.jpg", "longitude": -67.394257, "latitude": -24.584593, "width": 374, "height": 500, "upload_date": "19 October 2006", "owner_id": 9080, "owner_name": "Marco Teodonio", "owner_url": "http://www.panoramio.com/user/9080"} + , + {"photo_id": 70148, "photo_title": "Grotto Azure, Capris: The cave is lit by light refracting through the water.", "photo_url": "http://www.panoramio.com/photo/70148", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/70148.jpg", "longitude": 14.203262, "latitude": 40.560895, "width": 500, "height": 375, "upload_date": "25 October 2006", "owner_id": 1634, "owner_name": "Rick Guthrie", "owner_url": "http://www.panoramio.com/user/1634"} + , + {"photo_id": 1409801, "photo_title": "Hedges, Aerial", "photo_url": "http://www.panoramio.com/photo/1409801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1409801.jpg", "longitude": 9.027843, "latitude": 56.130772, "width": 332, "height": 500, "upload_date": "20 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 840971, "photo_title": "Upper Thracian Lowlands", "photo_url": "http://www.panoramio.com/photo/840971", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/840971.jpg", "longitude": 26.364269, "latitude": 42.717759, "width": 500, "height": 400, "upload_date": "16 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 9557772, "photo_title": "Le Shan Giant Buddha Statue - Geotagged April 08 Photo Contest Heritage Category Honorable Mentions", "photo_url": "http://www.panoramio.com/photo/9557772", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9557772.jpg", "longitude": 103.769115, "latitude": 29.547084, "width": 375, "height": 500, "upload_date": "20 April 2008", "owner_id": 964751, "owner_name": "jymsn123", "owner_url": "http://www.panoramio.com/user/964751"} + , + {"photo_id": 4716049, "photo_title": "Sol-edad", "photo_url": "http://www.panoramio.com/photo/4716049", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4716049.jpg", "longitude": -73.228008, "latitude": -39.820720, "width": 366, "height": 500, "upload_date": "17 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 1419283, "photo_title": "Sunset in Boka", "photo_url": "http://www.panoramio.com/photo/1419283", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1419283.jpg", "longitude": 18.703022, "latitude": 42.479883, "width": 500, "height": 375, "upload_date": "20 March 2007", "owner_id": 239453, "owner_name": "Å ovran NikÅ¡a", "owner_url": "http://www.panoramio.com/user/239453"} + , + {"photo_id": 3507222, "photo_title": "The sheperd of the Glen", "photo_url": "http://www.panoramio.com/photo/3507222", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3507222.jpg", "longitude": -4.840164, "latitude": 56.641504, "width": 500, "height": 334, "upload_date": "24 July 2007", "owner_id": 599676, "owner_name": "mossip", "owner_url": "http://www.panoramio.com/user/599676"} + , + {"photo_id": 3521820, "photo_title": "Utolsó pillantás", "photo_url": "http://www.panoramio.com/photo/3521820", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3521820.jpg", "longitude": 17.809353, "latitude": 47.528097, "width": 500, "height": 334, "upload_date": "25 July 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 521264, "photo_title": "Felhőátvonulás", "photo_url": "http://www.panoramio.com/photo/521264", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/521264.jpg", "longitude": 17.760429, "latitude": 47.555329, "width": 500, "height": 280, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 636723, "photo_title": "ASZFALTOZÓK", "photo_url": "http://www.panoramio.com/photo/636723", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/636723.jpg", "longitude": 19.038105, "latitude": 47.520041, "width": 500, "height": 318, "upload_date": "31 January 2007", "owner_id": 137538, "owner_name": "BALÃS ISTVÃN", "owner_url": "http://www.panoramio.com/user/137538"} + , + {"photo_id": 153144, "photo_title": "cierny_vah01", "photo_url": "http://www.panoramio.com/photo/153144", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/153144.jpg", "longitude": 19.907227, "latitude": 49.020084, "width": 500, "height": 332, "upload_date": "15 December 2006", "owner_id": 28092, "owner_name": "Design d15", "owner_url": "http://www.panoramio.com/user/28092"} + , + {"photo_id": 7485246, "photo_title": "Túl mindenen", "photo_url": "http://www.panoramio.com/photo/7485246", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7485246.jpg", "longitude": 17.624259, "latitude": 47.662092, "width": 500, "height": 334, "upload_date": "31 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4884030, "photo_title": "A Cloud is Born", "photo_url": "http://www.panoramio.com/photo/4884030", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4884030.jpg", "longitude": -119.631693, "latitude": 37.724208, "width": 333, "height": 500, "upload_date": "24 September 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 6126146, "photo_title": "North Weald Park", "photo_url": "http://www.panoramio.com/photo/6126146", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126146.jpg", "longitude": 0.264530, "latitude": 51.624631, "width": 500, "height": 333, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 438342, "photo_title": "Sunrise in Sierra Nevada", "photo_url": "http://www.panoramio.com/photo/438342", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/438342.jpg", "longitude": -119.225607, "latitude": 37.945213, "width": 500, "height": 318, "upload_date": "15 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 91978, "photo_title": "Dubrovnik (Croatia)", "photo_url": "http://www.panoramio.com/photo/91978", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/91978.jpg", "longitude": 18.108457, "latitude": 42.642909, "width": 500, "height": 375, "upload_date": "04 December 2006", "owner_id": 11403, "owner_name": "Arnáiz", "owner_url": "http://www.panoramio.com/user/11403"} + , + {"photo_id": 10816587, "photo_title": "Cementiri de Carcassonne", "photo_url": "http://www.panoramio.com/photo/10816587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10816587.jpg", "longitude": 2.365751, "latitude": 43.205551, "width": 500, "height": 333, "upload_date": "01 June 2008", "owner_id": 599233, "owner_name": "SílviaPrats", "owner_url": "http://www.panoramio.com/user/599233"} + , + {"photo_id": 292943, "photo_title": "Aekingerzand", "photo_url": "http://www.panoramio.com/photo/292943", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/292943.jpg", "longitude": 6.296024, "latitude": 52.935293, "width": 500, "height": 333, "upload_date": "03 January 2007", "owner_id": 62613, "owner_name": "erik van den Ham", "owner_url": "http://www.panoramio.com/user/62613"} + , + {"photo_id": 4696655, "photo_title": "Old boat", "photo_url": "http://www.panoramio.com/photo/4696655", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4696655.jpg", "longitude": 27.399902, "latitude": 42.414079, "width": 500, "height": 357, "upload_date": "16 September 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 348752, "photo_title": "_Cariniana legalis_ (Lecythidaceae), Santa Rita do Passa Quatro, SP,Brasil", "photo_url": "http://www.panoramio.com/photo/348752", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/348752.jpg", "longitude": -47.618523, "latitude": -21.691885, "width": 500, "height": 375, "upload_date": "08 January 2007", "owner_id": 56214, "owner_name": "Vinícius Antonio de Oliveira Dittrich", "owner_url": "http://www.panoramio.com/user/56214"} + , + {"photo_id": 3724631, "photo_title": "Abbazia di Chiaravalle in un'alba nebbiosa", "photo_url": "http://www.panoramio.com/photo/3724631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3724631.jpg", "longitude": 9.201404, "latitude": 45.424284, "width": 500, "height": 375, "upload_date": "04 August 2007", "owner_id": 732643, "owner_name": "La Mugna", "owner_url": "http://www.panoramio.com/user/732643"} + , + {"photo_id": 405853, "photo_title": "oyasirazu", "photo_url": "http://www.panoramio.com/photo/405853", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405853.jpg", "longitude": 137.747955, "latitude": 37.009133, "width": 500, "height": 384, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1192286, "photo_title": "Ojos del mar - 1", "photo_url": "http://www.panoramio.com/photo/1192286", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1192286.jpg", "longitude": -67.369022, "latitude": -24.630634, "width": 500, "height": 337, "upload_date": "06 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 589411, "photo_title": "Sunset, London, UK.", "photo_url": "http://www.panoramio.com/photo/589411", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/589411.jpg", "longitude": -0.123596, "latitude": 51.500942, "width": 500, "height": 346, "upload_date": "27 January 2007", "owner_id": 44319, "owner_name": "André Bonacin", "owner_url": "http://www.panoramio.com/user/44319"} + , + {"photo_id": 7586406, "photo_title": "Sol naciente en Villarrica", "photo_url": "http://www.panoramio.com/photo/7586406", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7586406.jpg", "longitude": -72.219400, "latitude": -39.289273, "width": 500, "height": 375, "upload_date": "04 February 2008", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 621, "photo_title": "Cape Drastis / Corfu", "photo_url": "http://www.panoramio.com/photo/621", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/621.jpg", "longitude": 19.701061, "latitude": 39.795744, "width": 500, "height": 375, "upload_date": "27 September 2005", "owner_id": 30, "owner_name": "eSHa", "owner_url": "http://www.panoramio.com/user/30"} + , + {"photo_id": 2379636, "photo_title": "Detail from the valley below Holmbukttind", "photo_url": "http://www.panoramio.com/photo/2379636", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2379636.jpg", "longitude": 19.781570, "latitude": 69.476339, "width": 500, "height": 375, "upload_date": "24 May 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 5725557, "photo_title": "Kardzhali lake - Panorama", "photo_url": "http://www.panoramio.com/photo/5725557", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5725557.jpg", "longitude": 25.242250, "latitude": 41.668667, "width": 500, "height": 187, "upload_date": "05 November 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 22393, "photo_title": "View from Bosphorus Bridge", "photo_url": "http://www.panoramio.com/photo/22393", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/22393.jpg", "longitude": 28.999443, "latitude": 41.027053, "width": 500, "height": 355, "upload_date": "04 June 2006", "owner_id": 3504, "owner_name": "zeytinbass", "owner_url": "http://www.panoramio.com/user/3504"} + , + {"photo_id": 5611129, "photo_title": "Torrent de Pareis - Sa Calobra (Mallorca)", "photo_url": "http://www.panoramio.com/photo/5611129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5611129.jpg", "longitude": 2.807093, "latitude": 39.851709, "width": 500, "height": 373, "upload_date": "29 October 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 3457918, "photo_title": "Walk of Venus", "photo_url": "http://www.panoramio.com/photo/3457918", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3457918.jpg", "longitude": 14.721851, "latitude": 44.838891, "width": 500, "height": 367, "upload_date": "22 July 2007", "owner_id": 346103, "owner_name": "lacitot", "owner_url": "http://www.panoramio.com/user/346103"} + , + {"photo_id": 21135, "photo_title": "icebergs in the Channel", "photo_url": "http://www.panoramio.com/photo/21135", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/21135.jpg", "longitude": -63.017578, "latitude": -64.774125, "width": 500, "height": 338, "upload_date": "24 May 2006", "owner_id": 3316, "owner_name": "kristine hannon (www.traveltheglobe.be)", "owner_url": "http://www.panoramio.com/user/3316"} + , + {"photo_id": 1288597, "photo_title": "Gift", "photo_url": "http://www.panoramio.com/photo/1288597", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1288597.jpg", "longitude": 72.920036, "latitude": 4.038077, "width": 337, "height": 500, "upload_date": "12 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 708502, "photo_title": "A single skier from Gogsøyra tw Litjskjorta mountain", "photo_url": "http://www.panoramio.com/photo/708502", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/708502.jpg", "longitude": 8.160782, "latitude": 62.645604, "width": 424, "height": 500, "upload_date": "05 February 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 4386456, "photo_title": "good bye", "photo_url": "http://www.panoramio.com/photo/4386456", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4386456.jpg", "longitude": -1.254845, "latitude": 44.463191, "width": 500, "height": 405, "upload_date": "04 September 2007", "owner_id": 521836, "owner_name": "KLEFER", "owner_url": "http://www.panoramio.com/user/521836"} + , + {"photo_id": 902303, "photo_title": "Kék", "photo_url": "http://www.panoramio.com/photo/902303", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/902303.jpg", "longitude": 17.941017, "latitude": 47.650703, "width": 334, "height": 500, "upload_date": "19 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3660960, "photo_title": "Angkor - Ta Prohm IV", "photo_url": "http://www.panoramio.com/photo/3660960", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3660960.jpg", "longitude": 103.890334, "latitude": 13.435028, "width": 338, "height": 500, "upload_date": "01 August 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 902570, "photo_title": "Tavitündér", "photo_url": "http://www.panoramio.com/photo/902570", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/902570.jpg", "longitude": 17.468948, "latitude": 47.871914, "width": 500, "height": 345, "upload_date": "19 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 2521005, "photo_title": "Megvilágosodás elött", "photo_url": "http://www.panoramio.com/photo/2521005", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2521005.jpg", "longitude": 17.515984, "latitude": 47.743825, "width": 500, "height": 286, "upload_date": "02 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 586159, "photo_title": "Central Park", "photo_url": "http://www.panoramio.com/photo/586159", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/586159.jpg", "longitude": -73.971816, "latitude": 40.775789, "width": 500, "height": 375, "upload_date": "27 January 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 23475, "photo_title": "Good Morning", "photo_url": "http://www.panoramio.com/photo/23475", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/23475.jpg", "longitude": -28.210895, "latitude": 38.680351, "width": 500, "height": 375, "upload_date": "11 June 2006", "owner_id": 3760, "owner_name": "Frank Pustlauck", "owner_url": "http://www.panoramio.com/user/3760"} + , + {"photo_id": 1006005, "photo_title": "04-09-07_\"La Nube Sangrante\"_017_PIXELECTA", "photo_url": "http://www.panoramio.com/photo/1006005", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1006005.jpg", "longitude": -0.896330, "latitude": 41.738016, "width": 500, "height": 375, "upload_date": "24 February 2007", "owner_id": 163655, "owner_name": "[[[ PIXELECTA ]]]", "owner_url": "http://www.panoramio.com/user/163655"} + , + {"photo_id": 3473597, "photo_title": "Sails in the sunset", "photo_url": "http://www.panoramio.com/photo/3473597", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3473597.jpg", "longitude": -87.173424, "latitude": 45.158317, "width": 500, "height": 375, "upload_date": "22 July 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 3809992, "photo_title": "DÅ‚ugie Pobrzeże latem/ Las casas narcisistas que se pasan el día mirándose en el espejo del agua - gracias Arturo García!", "photo_url": "http://www.panoramio.com/photo/3809992", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3809992.jpg", "longitude": 18.658776, "latitude": 54.350679, "width": 500, "height": 375, "upload_date": "08 August 2007", "owner_id": 277750, "owner_name": "Karolina P.", "owner_url": "http://www.panoramio.com/user/277750"} + , + {"photo_id": 2280401, "photo_title": "Hetyke-egyke", "photo_url": "http://www.panoramio.com/photo/2280401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2280401.jpg", "longitude": 17.829094, "latitude": 47.206508, "width": 500, "height": 308, "upload_date": "18 May 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 290772, "photo_title": "Tormenta Bahía de Pollensa", "photo_url": "http://www.panoramio.com/photo/290772", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290772.jpg", "longitude": 3.116437, "latitude": 39.928440, "width": 500, "height": 335, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 57822, "photo_title": "Maria Alm - Pfarrkirche", "photo_url": "http://www.panoramio.com/photo/57822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/57822.jpg", "longitude": 12.903442, "latitude": 47.407877, "width": 346, "height": 500, "upload_date": "05 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 516322, "photo_title": "A völgy", "photo_url": "http://www.panoramio.com/photo/516322", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516322.jpg", "longitude": 17.774162, "latitude": 47.292504, "width": 338, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 12271085, "photo_title": "Ein Bild für meine Freunde", "photo_url": "http://www.panoramio.com/photo/12271085", "photo_file_url": "http://static2.bareka.com/photos/medium/12271085.jpg", "longitude": 9.284134, "latitude": 51.510933, "width": 500, "height": 333, "upload_date": "19 July 2008", "owner_id": 497213, "owner_name": "UlrichSchnuerer", "owner_url": "http://www.panoramio.com/user/497213"} + , + {"photo_id": 5050864, "photo_title": "Ãlmok útján", "photo_url": "http://www.panoramio.com/photo/5050864", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5050864.jpg", "longitude": 12.333773, "latitude": 45.436466, "width": 500, "height": 354, "upload_date": "02 October 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 617461, "photo_title": "Miravet", "photo_url": "http://www.panoramio.com/photo/617461", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/617461.jpg", "longitude": 0.593348, "latitude": 41.035568, "width": 500, "height": 334, "upload_date": "29 January 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 2689526, "photo_title": "Égszakadás", "photo_url": "http://www.panoramio.com/photo/2689526", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2689526.jpg", "longitude": 17.503624, "latitude": 47.749481, "width": 500, "height": 325, "upload_date": "11 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 38135, "photo_title": "Amanecer en el sur", "photo_url": "http://www.panoramio.com/photo/38135", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/38135.jpg", "longitude": -64.983333, "latitude": -31.900000, "width": 500, "height": 375, "upload_date": "11 August 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 1087737, "photo_title": "Szeles nyárelÅ‘", "photo_url": "http://www.panoramio.com/photo/1087737", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1087737.jpg", "longitude": 17.605934, "latitude": 47.603154, "width": 500, "height": 333, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 8411394, "photo_title": "Dead Vlei", "photo_url": "http://www.panoramio.com/photo/8411394", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8411394.jpg", "longitude": 15.295715, "latitude": -24.764914, "width": 500, "height": 341, "upload_date": "09 March 2008", "owner_id": 1204358, "owner_name": "aldenc", "owner_url": "http://www.panoramio.com/user/1204358"} + , + {"photo_id": 8491464, "photo_title": "Horsetail Falls on El Capitan", "photo_url": "http://www.panoramio.com/photo/8491464", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8491464.jpg", "longitude": -119.623947, "latitude": 37.723512, "width": 357, "height": 500, "upload_date": "12 March 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 58134, "photo_title": "Chateaux Lake Louise from the head of the lake", "photo_url": "http://www.panoramio.com/photo/58134", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58134.jpg", "longitude": -116.239901, "latitude": 51.407291, "width": 500, "height": 375, "upload_date": "06 October 2006", "owner_id": 8118, "owner_name": "Michael Gerstmann", "owner_url": "http://www.panoramio.com/user/8118"} + , + {"photo_id": 11237087, "photo_title": " Ein Strand zum träumen", "photo_url": "http://www.panoramio.com/photo/11237087", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11237087.jpg", "longitude": 15.914984, "latitude": 38.683366, "width": 500, "height": 294, "upload_date": "15 June 2008", "owner_id": 1400529, "owner_name": "marita1004", "owner_url": "http://www.panoramio.com/user/1400529"} + , + {"photo_id": 8384850, "photo_title": "Winter has gone", "photo_url": "http://www.panoramio.com/photo/8384850", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8384850.jpg", "longitude": 12.428112, "latitude": 49.084351, "width": 500, "height": 333, "upload_date": "08 March 2008", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 3947779, "photo_title": "Mont-Saint-Michel floating in water", "photo_url": "http://www.panoramio.com/photo/3947779", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3947779.jpg", "longitude": -1.508625, "latitude": 48.634561, "width": 500, "height": 335, "upload_date": "15 August 2007", "owner_id": 57893, "owner_name": "ThoiryK", "owner_url": "http://www.panoramio.com/user/57893"} + , + {"photo_id": 1069321, "photo_title": "The old Temple N2", "photo_url": "http://www.panoramio.com/photo/1069321", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1069321.jpg", "longitude": 37.426300, "latitude": 56.370622, "width": 500, "height": 333, "upload_date": "27 February 2007", "owner_id": 212477, "owner_name": "Cherepanov Timofey", "owner_url": "http://www.panoramio.com/user/212477"} + , + {"photo_id": 5756689, "photo_title": "Tokyo Metropolitan Government", "photo_url": "http://www.panoramio.com/photo/5756689", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5756689.jpg", "longitude": 139.690722, "latitude": 35.689906, "width": 500, "height": 339, "upload_date": "06 November 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 1599763, "photo_title": "Atomium", "photo_url": "http://www.panoramio.com/photo/1599763", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1599763.jpg", "longitude": 4.341531, "latitude": 50.894805, "width": 500, "height": 375, "upload_date": "02 April 2007", "owner_id": 18137, "owner_name": "digitaler lumpensammler", "owner_url": "http://www.panoramio.com/user/18137"} + , + {"photo_id": 516375, "photo_title": "A zöld folyó", "photo_url": "http://www.panoramio.com/photo/516375", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/516375.jpg", "longitude": 17.724895, "latitude": 46.297137, "width": 369, "height": 500, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1538329, "photo_title": "View east from Empire State Building by night", "photo_url": "http://www.panoramio.com/photo/1538329", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1538329.jpg", "longitude": -73.986332, "latitude": 40.748346, "width": 500, "height": 332, "upload_date": "28 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 1838875, "photo_title": "Modern art in Mainz", "photo_url": "http://www.panoramio.com/photo/1838875", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1838875.jpg", "longitude": 8.276659, "latitude": 50.001071, "width": 500, "height": 393, "upload_date": "19 April 2007", "owner_id": 12954, "owner_name": "ZiÄ™bol", "owner_url": "http://www.panoramio.com/user/12954"} + , + {"photo_id": 4740891, "photo_title": "The golden path - Az aranyozott ösvény", "photo_url": "http://www.panoramio.com/photo/4740891", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4740891.jpg", "longitude": 17.599239, "latitude": 47.639948, "width": 500, "height": 334, "upload_date": "18 September 2007", "owner_id": 217370, "owner_name": "Borbély Márk", "owner_url": "http://www.panoramio.com/user/217370"} + , + {"photo_id": 441376, "photo_title": "Bolungarvik", "photo_url": "http://www.panoramio.com/photo/441376", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/441376.jpg", "longitude": -23.197975, "latitude": 66.151698, "width": 500, "height": 333, "upload_date": "15 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 3354401, "photo_title": "Alkonyi színjáték", "photo_url": "http://www.panoramio.com/photo/3354401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3354401.jpg", "longitude": 17.504225, "latitude": 47.745730, "width": 500, "height": 334, "upload_date": "16 July 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 809506, "photo_title": "Szivárványhorizont", "photo_url": "http://www.panoramio.com/photo/809506", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/809506.jpg", "longitude": 15.969830, "latitude": 43.626632, "width": 500, "height": 334, "upload_date": "13 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 36387, "photo_title": "Adobe Headquarters - Looking Up", "photo_url": "http://www.panoramio.com/photo/36387", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/36387.jpg", "longitude": -121.893804, "latitude": 37.330959, "width": 351, "height": 500, "upload_date": "02 August 2006", "owner_id": 5684, "owner_name": "Brent Townshend", "owner_url": "http://www.panoramio.com/user/5684"} + , + {"photo_id": 722982, "photo_title": "Antelope-Light", "photo_url": "http://www.panoramio.com/photo/722982", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/722982.jpg", "longitude": -111.371326, "latitude": 36.857236, "width": 333, "height": 500, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 138030, "photo_title": "Kinderdijk", "photo_url": "http://www.panoramio.com/photo/138030", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/138030.jpg", "longitude": 4.645500, "latitude": 51.879458, "width": 500, "height": 335, "upload_date": "13 December 2006", "owner_id": 18131, "owner_name": "ron zoeteweij", "owner_url": "http://www.panoramio.com/user/18131"} + , + {"photo_id": 9725235, "photo_title": "railway / MaÅ‚opolska / województwo maÅ‚opolskie", "photo_url": "http://www.panoramio.com/photo/9725235", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9725235.jpg", "longitude": 20.363159, "latitude": 49.748443, "width": 321, "height": 500, "upload_date": "28 April 2008", "owner_id": 454219, "owner_name": "Rafal Ociepka", "owner_url": "http://www.panoramio.com/user/454219"} + , + {"photo_id": 945984, "photo_title": "El canal", "photo_url": "http://www.panoramio.com/photo/945984", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/945984.jpg", "longitude": 0.484858, "latitude": 40.901901, "width": 378, "height": 500, "upload_date": "21 February 2007", "owner_id": 3022, "owner_name": "Arcadi", "owner_url": "http://www.panoramio.com/user/3022"} + , + {"photo_id": 677953, "photo_title": "Shuto Expressway over the Sumida River", "photo_url": "http://www.panoramio.com/photo/677953", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/677953.jpg", "longitude": 139.788644, "latitude": 35.690411, "width": 500, "height": 364, "upload_date": "03 February 2007", "owner_id": 78856, "owner_name": "chrisjongkind • archive", "owner_url": "http://www.panoramio.com/user/78856"} + , + {"photo_id": 2723655, "photo_title": "Orciano Pisano", "photo_url": "http://www.panoramio.com/photo/2723655", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2723655.jpg", "longitude": 10.505505, "latitude": 43.491911, "width": 366, "height": 500, "upload_date": "13 June 2007", "owner_id": 65478, "owner_name": "Gabriele Marabotti", "owner_url": "http://www.panoramio.com/user/65478"} + , + {"photo_id": 444745, "photo_title": "Pres de Nefta", "photo_url": "http://www.panoramio.com/photo/444745", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/444745.jpg", "longitude": 7.904320, "latitude": 33.766590, "width": 500, "height": 333, "upload_date": "15 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 1388623, "photo_title": "El Aviario (Parque Ecológico, Puebla, México)", "photo_url": "http://www.panoramio.com/photo/1388623", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1388623.jpg", "longitude": -98.187540, "latitude": 19.025552, "width": 500, "height": 488, "upload_date": "18 March 2007", "owner_id": 274633, "owner_name": "D4v17 ]7. G.", "owner_url": "http://www.panoramio.com/user/274633"} + , + {"photo_id": 792658, "photo_title": "Reichtag in the dome, Berlin HDR", "photo_url": "http://www.panoramio.com/photo/792658", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/792658.jpg", "longitude": 13.376133, "latitude": 52.518610, "width": 376, "height": 500, "upload_date": "12 February 2007", "owner_id": 161254, "owner_name": "fotoartistry", "owner_url": "http://www.panoramio.com/user/161254"} + , + {"photo_id": 324694, "photo_title": "Thachted houses", "photo_url": "http://www.panoramio.com/photo/324694", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/324694.jpg", "longitude": 137.235117, "latitude": 36.132095, "width": 500, "height": 265, "upload_date": "06 January 2007", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 2353496, "photo_title": "раÑÑвет над вулканом ЖупановÑкий", "photo_url": "http://www.panoramio.com/photo/2353496", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2353496.jpg", "longitude": 158.591080, "latitude": 53.497850, "width": 500, "height": 337, "upload_date": "23 May 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 7251801, "photo_title": "Fellegek közt", "photo_url": "http://www.panoramio.com/photo/7251801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7251801.jpg", "longitude": 18.314981, "latitude": 47.638820, "width": 500, "height": 329, "upload_date": "20 January 2008", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 35422, "photo_title": "caracas", "photo_url": "http://www.panoramio.com/photo/35422", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/35422.jpg", "longitude": -66.904507, "latitude": 10.498193, "width": 500, "height": 375, "upload_date": "29 July 2006", "owner_id": 3360, "owner_name": "ozzy", "owner_url": "http://www.panoramio.com/user/3360"} + , + {"photo_id": 405861, "photo_title": "myoukou", "photo_url": "http://www.panoramio.com/photo/405861", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/405861.jpg", "longitude": 138.295898, "latitude": 37.099003, "width": 500, "height": 383, "upload_date": "13 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 2719848, "photo_title": "Idaho relic", "photo_url": "http://www.panoramio.com/photo/2719848", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2719848.jpg", "longitude": -111.398749, "latitude": 42.286707, "width": 500, "height": 375, "upload_date": "13 June 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 599401, "photo_title": "Hozenji", "photo_url": "http://www.panoramio.com/photo/599401", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/599401.jpg", "longitude": 135.502450, "latitude": 34.668002, "width": 500, "height": 500, "upload_date": "28 January 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 53101, "photo_title": "Night Auadkhara", "photo_url": "http://www.panoramio.com/photo/53101", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/53101.jpg", "longitude": 40.631331, "latitude": 43.525806, "width": 500, "height": 323, "upload_date": "27 September 2006", "owner_id": 7707, "owner_name": "Yorix", "owner_url": "http://www.panoramio.com/user/7707"} + , + {"photo_id": 112752, "photo_title": "V-35-003b", "photo_url": "http://www.panoramio.com/photo/112752", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112752.jpg", "longitude": 12.339267, "latitude": 45.433696, "width": 500, "height": 338, "upload_date": "11 December 2006", "owner_id": 17599, "owner_name": "Dmitry Andreev", "owner_url": "http://www.panoramio.com/user/17599"} + , + {"photo_id": 1946749, "photo_title": "Mt Hood and a John Deer Tractor over the Wooden Shoe Tulip Fields Monitor Oregon", "photo_url": "http://www.panoramio.com/photo/1946749", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1946749.jpg", "longitude": -122.740974, "latitude": 45.119326, "width": 500, "height": 351, "upload_date": "27 April 2007", "owner_id": 128746, "owner_name": "© Michael Hatten", "owner_url": "http://www.panoramio.com/user/128746"} + , + {"photo_id": 723074, "photo_title": "September Twilight in Thira", "photo_url": "http://www.panoramio.com/photo/723074", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723074.jpg", "longitude": 25.430603, "latitude": 36.416862, "width": 500, "height": 223, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1658251, "photo_title": "Behold the moon", "photo_url": "http://www.panoramio.com/photo/1658251", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1658251.jpg", "longitude": 15.589085, "latitude": 78.170125, "width": 333, "height": 500, "upload_date": "06 April 2007", "owner_id": 3574, "owner_name": "blackone", "owner_url": "http://www.panoramio.com/user/3574"} + , + {"photo_id": 2225571, "photo_title": "Landscape (Via Di Porta Castello Street) ~ Tarquinia, Italy", "photo_url": "http://www.panoramio.com/photo/2225571", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2225571.jpg", "longitude": 11.751836, "latitude": 42.255808, "width": 500, "height": 335, "upload_date": "15 May 2007", "owner_id": 395380, "owner_name": "Rafael (Retrocool)", "owner_url": "http://www.panoramio.com/user/395380"} + , + {"photo_id": 348071, "photo_title": "Perfect ice for skating, Svartlögafjärden", "photo_url": "http://www.panoramio.com/photo/348071", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/348071.jpg", "longitude": 19.021196, "latitude": 59.558766, "width": 500, "height": 375, "upload_date": "08 January 2007", "owner_id": 70471, "owner_name": "David Thyberg", "owner_url": "http://www.panoramio.com/user/70471"} + , + {"photo_id": 1408683, "photo_title": "Dragon", "photo_url": "http://www.panoramio.com/photo/1408683", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1408683.jpg", "longitude": 11.099625, "latitude": 24.203758, "width": 334, "height": 500, "upload_date": "20 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 58293, "photo_title": "Hundeschlittenrennen in Werfenweng", "photo_url": "http://www.panoramio.com/photo/58293", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58293.jpg", "longitude": 13.263245, "latitude": 47.465062, "width": 500, "height": 377, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 1488328, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1488328", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1488328.jpg", "longitude": 139.290161, "latitude": 37.860218, "width": 500, "height": 383, "upload_date": "25 March 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 5439200, "photo_title": "shinjuku", "photo_url": "http://www.panoramio.com/photo/5439200", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5439200.jpg", "longitude": 139.693281, "latitude": 35.690921, "width": 500, "height": 500, "upload_date": "20 October 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 86241, "photo_title": "camino", "photo_url": "http://www.panoramio.com/photo/86241", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/86241.jpg", "longitude": -1.145668, "latitude": 38.170464, "width": 333, "height": 500, "upload_date": "25 November 2006", "owner_id": 10969, "owner_name": "Juanra", "owner_url": "http://www.panoramio.com/user/10969"} + , + {"photo_id": 4757733, "photo_title": "MASSIVE WAVE", "photo_url": "http://www.panoramio.com/photo/4757733", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4757733.jpg", "longitude": -1.262569, "latitude": 44.426793, "width": 259, "height": 500, "upload_date": "19 September 2007", "owner_id": 521836, "owner_name": "KLEFER", "owner_url": "http://www.panoramio.com/user/521836"} + , + {"photo_id": 941286, "photo_title": "Mesa Arch (3x1 pano)", "photo_url": "http://www.panoramio.com/photo/941286", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/941286.jpg", "longitude": -109.863667, "latitude": 38.388159, "width": 500, "height": 181, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1284843, "photo_title": "Озеро Хангар в кратере вулкана", "photo_url": "http://www.panoramio.com/photo/1284843", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1284843.jpg", "longitude": 157.393055, "latitude": 54.764255, "width": 500, "height": 197, "upload_date": "12 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 2602988, "photo_title": "The best beach of Manihi", "photo_url": "http://www.panoramio.com/photo/2602988", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2602988.jpg", "longitude": -145.847282, "latitude": -14.348134, "width": 500, "height": 333, "upload_date": "06 June 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 2273013, "photo_title": "Another View of Vedra Island", "photo_url": "http://www.panoramio.com/photo/2273013", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2273013.jpg", "longitude": 1.247164, "latitude": 38.859406, "width": 500, "height": 465, "upload_date": "18 May 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 8857011, "photo_title": "The Subway,Zion NP", "photo_url": "http://www.panoramio.com/photo/8857011", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8857011.jpg", "longitude": -113.055840, "latitude": 37.308741, "width": 500, "height": 375, "upload_date": "26 March 2008", "owner_id": 1465912, "owner_name": "funtor", "owner_url": "http://www.panoramio.com/user/1465912"} + , + {"photo_id": 167606, "photo_title": "Rainy Causeway Bay", "photo_url": "http://www.panoramio.com/photo/167606", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/167606.jpg", "longitude": 114.169595, "latitude": 22.293028, "width": 500, "height": 238, "upload_date": "16 December 2006", "owner_id": 31693, "owner_name": "Huw Thomas", "owner_url": "http://www.panoramio.com/user/31693"} + , + {"photo_id": 11077834, "photo_title": "In sunset", "photo_url": "http://www.panoramio.com/photo/11077834", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11077834.jpg", "longitude": 174.865694, "latitude": -41.330162, "width": 500, "height": 357, "upload_date": "10 June 2008", "owner_id": 1248894, "owner_name": "Eva Kaprinay", "owner_url": "http://www.panoramio.com/user/1248894"} + , + {"photo_id": 10919439, "photo_title": "Majestic Møøse", "photo_url": "http://www.panoramio.com/photo/10919439", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10919439.jpg", "longitude": -110.549712, "latitude": 43.866322, "width": 500, "height": 400, "upload_date": "04 June 2008", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 4892928, "photo_title": "tsukudajima", "photo_url": "http://www.panoramio.com/photo/4892928", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4892928.jpg", "longitude": 139.788172, "latitude": 35.672141, "width": 430, "height": 500, "upload_date": "25 September 2007", "owner_id": 128403, "owner_name": "mechanics", "owner_url": "http://www.panoramio.com/user/128403"} + , + {"photo_id": 5798660, "photo_title": "Guiding Light", "photo_url": "http://www.panoramio.com/photo/5798660", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5798660.jpg", "longitude": -111.374674, "latitude": 36.861974, "width": 333, "height": 500, "upload_date": "08 November 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 94219, "photo_title": "Bridge of Manganji", "photo_url": "http://www.panoramio.com/photo/94219", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/94219.jpg", "longitude": 137.821137, "latitude": 36.329284, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 3772695, "photo_title": "Fotomontaggio di Arquata & Andromeda", "photo_url": "http://www.panoramio.com/photo/3772695", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3772695.jpg", "longitude": 13.304100, "latitude": 42.773731, "width": 500, "height": 375, "upload_date": "07 August 2007", "owner_id": 646873, "owner_name": "Fabio Roman", "owner_url": "http://www.panoramio.com/user/646873"} + , + {"photo_id": 1314842, "photo_title": "Река Сим Ñ Ð¼Ð¾Ñта (1729 км)", "photo_url": "http://www.panoramio.com/photo/1314842", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1314842.jpg", "longitude": 57.309623, "latitude": 55.013544, "width": 500, "height": 335, "upload_date": "14 March 2007", "owner_id": 268724, "owner_name": "Korotnev AV", "owner_url": "http://www.panoramio.com/user/268724"} + , + {"photo_id": 5333278, "photo_title": "hong kong, early evening", "photo_url": "http://www.panoramio.com/photo/5333278", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5333278.jpg", "longitude": 114.151651, "latitude": 22.280112, "width": 375, "height": 500, "upload_date": "15 October 2007", "owner_id": 90373, "owner_name": "michael habla", "owner_url": "http://www.panoramio.com/user/90373"} + , + {"photo_id": 2574624, "photo_title": "Mount Everest", "photo_url": "http://www.panoramio.com/photo/2574624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2574624.jpg", "longitude": 86.933270, "latitude": 27.979546, "width": 500, "height": 375, "upload_date": "04 June 2007", "owner_id": 534045, "owner_name": "Lucjon", "owner_url": "http://www.panoramio.com/user/534045"} + , + {"photo_id": 160808, "photo_title": "Luquillo Beach", "photo_url": "http://www.panoramio.com/photo/160808", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/160808.jpg", "longitude": -65.677128, "latitude": 18.364871, "width": 500, "height": 375, "upload_date": "16 December 2006", "owner_id": 28766, "owner_name": "Tim Jansa", "owner_url": "http://www.panoramio.com/user/28766"} + , + {"photo_id": 2883625, "photo_title": "Sokorói impresszió", "photo_url": "http://www.panoramio.com/photo/2883625", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2883625.jpg", "longitude": 17.678204, "latitude": 47.533661, "width": 500, "height": 332, "upload_date": "22 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 287785, "photo_title": "Cascada Fuente del Algar © (Foto_Seb)", "photo_url": "http://www.panoramio.com/photo/287785", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/287785.jpg", "longitude": -0.095959, "latitude": 38.659359, "width": 500, "height": 332, "upload_date": "03 January 2007", "owner_id": 55833, "owner_name": "Sebastien Pigneur Jans (Outdoor Photographer) seolta@terra.es", "owner_url": "http://www.panoramio.com/user/55833"} + , + {"photo_id": 354350, "photo_title": "Bondhus icefall up close", "photo_url": "http://www.panoramio.com/photo/354350", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/354350.jpg", "longitude": 6.296539, "latitude": 60.071436, "width": 500, "height": 332, "upload_date": "09 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3625784, "photo_title": "P.N.P.J.(Croacia)", "photo_url": "http://www.panoramio.com/photo/3625784", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3625784.jpg", "longitude": 15.612602, "latitude": 44.883911, "width": 500, "height": 375, "upload_date": "30 July 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 4866107, "photo_title": "Milkdrop sunset", "photo_url": "http://www.panoramio.com/photo/4866107", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4866107.jpg", "longitude": 16.693897, "latitude": 43.183338, "width": 334, "height": 500, "upload_date": "24 September 2007", "owner_id": 989, "owner_name": "Mrgud", "owner_url": "http://www.panoramio.com/user/989"} + , + {"photo_id": 5217595, "photo_title": "kolory...", "photo_url": "http://www.panoramio.com/photo/5217595", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5217595.jpg", "longitude": 17.990541, "latitude": 54.253292, "width": 375, "height": 500, "upload_date": "10 October 2007", "owner_id": 277750, "owner_name": "Karolina P.", "owner_url": "http://www.panoramio.com/user/277750"} + , + {"photo_id": 1235515, "photo_title": "Gangga sunset", "photo_url": "http://www.panoramio.com/photo/1235515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1235515.jpg", "longitude": 115.063634, "latitude": -8.586962, "width": 332, "height": 500, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 88143, "photo_title": "Anse Cocos - La Digue - Seychelles", "photo_url": "http://www.panoramio.com/photo/88143", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88143.jpg", "longitude": 55.850029, "latitude": -4.365924, "width": 500, "height": 375, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 993105, "photo_title": "Dinos", "photo_url": "http://www.panoramio.com/photo/993105", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/993105.jpg", "longitude": 47.267990, "latitude": 34.392321, "width": 432, "height": 500, "upload_date": "24 February 2007", "owner_id": 83972, "owner_name": "Maxim Popov (http://www.popovm.ru)", "owner_url": "http://www.panoramio.com/user/83972"} + , + {"photo_id": 3382098, "photo_title": "Golden sunset", "photo_url": "http://www.panoramio.com/photo/3382098", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3382098.jpg", "longitude": -9.231960, "latitude": 38.652899, "width": 500, "height": 375, "upload_date": "18 July 2007", "owner_id": 465080, "owner_name": "Vasco Pires", "owner_url": "http://www.panoramio.com/user/465080"} + , + {"photo_id": 4689747, "photo_title": "La disipación de un ensueño", "photo_url": "http://www.panoramio.com/photo/4689747", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4689747.jpg", "longitude": -73.231199, "latitude": -39.817288, "width": 500, "height": 375, "upload_date": "16 September 2007", "owner_id": 327310, "owner_name": "Erwin Woenckhaus", "owner_url": "http://www.panoramio.com/user/327310"} + , + {"photo_id": 2520917, "photo_title": "Két vihar közt alkonyatkor", "photo_url": "http://www.panoramio.com/photo/2520917", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2520917.jpg", "longitude": 17.514782, "latitude": 47.747057, "width": 500, "height": 334, "upload_date": "02 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 419927, "photo_title": "echigoheiya", "photo_url": "http://www.panoramio.com/photo/419927", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/419927.jpg", "longitude": 138.885427, "latitude": 37.568562, "width": 500, "height": 334, "upload_date": "14 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1977433, "photo_title": "Victoria Falls, devils cauldron natural hot tub at lip of falls", "photo_url": "http://www.panoramio.com/photo/1977433", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1977433.jpg", "longitude": 25.853426, "latitude": -17.923924, "width": 500, "height": 375, "upload_date": "29 April 2007", "owner_id": 165455, "owner_name": "snorth", "owner_url": "http://www.panoramio.com/user/165455"} + , + {"photo_id": 3417691, "photo_title": "Völgy-Zugoly", "photo_url": "http://www.panoramio.com/photo/3417691", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3417691.jpg", "longitude": 17.826734, "latitude": 47.359293, "width": 500, "height": 346, "upload_date": "20 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 4166241, "photo_title": "Egy másik világ", "photo_url": "http://www.panoramio.com/photo/4166241", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4166241.jpg", "longitude": 18.056545, "latitude": 47.276667, "width": 333, "height": 500, "upload_date": "25 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3976033, "photo_title": "Sunrise Blüemlisalp Switzerland", "photo_url": "http://www.panoramio.com/photo/3976033", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3976033.jpg", "longitude": 7.779844, "latitude": 46.528974, "width": 500, "height": 333, "upload_date": "16 August 2007", "owner_id": 47930, "owner_name": "werni", "owner_url": "http://www.panoramio.com/user/47930"} + , + {"photo_id": 1449570, "photo_title": "Akabat", "photo_url": "http://www.panoramio.com/photo/1449570", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1449570.jpg", "longitude": 28.286717, "latitude": 27.484675, "width": 500, "height": 304, "upload_date": "22 March 2007", "owner_id": 304324, "owner_name": "OxyPhoto.ru - O x y", "owner_url": "http://www.panoramio.com/user/304324"} + , + {"photo_id": 8802, "photo_title": "Statue of Liberty [003393]", "photo_url": "http://www.panoramio.com/photo/8802", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8802.jpg", "longitude": -74.044375, "latitude": 40.688871, "width": 500, "height": 375, "upload_date": "27 January 2006", "owner_id": 1489, "owner_name": "Thorsten", "owner_url": "http://www.panoramio.com/user/1489"} + , + {"photo_id": 6015859, "photo_title": "Amazing place to drink ouzo", "photo_url": "http://www.panoramio.com/photo/6015859", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6015859.jpg", "longitude": 23.057030, "latitude": 36.687990, "width": 500, "height": 333, "upload_date": "19 November 2007", "owner_id": 242446, "owner_name": "Ntinos Lagos", "owner_url": "http://www.panoramio.com/user/242446"} + , + {"photo_id": 653941, "photo_title": "Mt. Moran across Jackson Lake", "photo_url": "http://www.panoramio.com/photo/653941", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/653941.jpg", "longitude": -110.656099, "latitude": 43.897336, "width": 500, "height": 374, "upload_date": "02 February 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 354695, "photo_title": "Dresden_Zwinger_01", "photo_url": "http://www.panoramio.com/photo/354695", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/354695.jpg", "longitude": 13.734369, "latitude": 51.053481, "width": 399, "height": 500, "upload_date": "09 January 2007", "owner_id": 71628, "owner_name": "Ulrich Hässler, Dresden", "owner_url": "http://www.panoramio.com/user/71628"} + , + {"photo_id": 8327051, "photo_title": "Anelito di .... luce", "photo_url": "http://www.panoramio.com/photo/8327051", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8327051.jpg", "longitude": 13.717203, "latitude": 45.699706, "width": 500, "height": 375, "upload_date": "06 March 2008", "owner_id": 1121720, "owner_name": "â–¬ Mauro Antonini â–¬", "owner_url": "http://www.panoramio.com/user/1121720"} + , + {"photo_id": 522126, "photo_title": "Ãme a ludas hogy Márton lemaradt", "photo_url": "http://www.panoramio.com/photo/522126", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/522126.jpg", "longitude": 16.855431, "latitude": 47.653594, "width": 500, "height": 319, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 3948179, "photo_title": " petit matin en Vendée, sur la rive droite du Jaunay, 11 août 2007. #921, 933", "photo_url": "http://www.panoramio.com/photo/3948179", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3948179.jpg", "longitude": -1.901278, "latitude": 46.663487, "width": 500, "height": 343, "upload_date": "15 August 2007", "owner_id": 666755, "owner_name": "Armagnac", "owner_url": "http://www.panoramio.com/user/666755"} + , + {"photo_id": 1781399, "photo_title": "Dawn in Yosemite Valley", "photo_url": "http://www.panoramio.com/photo/1781399", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1781399.jpg", "longitude": -119.590645, "latitude": 37.743775, "width": 333, "height": 500, "upload_date": "15 April 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 905112, "photo_title": "Searea buildings in Odaiba", "photo_url": "http://www.panoramio.com/photo/905112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/905112.jpg", "longitude": 139.773039, "latitude": 35.635670, "width": 500, "height": 372, "upload_date": "19 February 2007", "owner_id": 78856, "owner_name": "chrisjongkind • archive", "owner_url": "http://www.panoramio.com/user/78856"} + , + {"photo_id": 6935706, "photo_title": "poranek w ogniu - morning on fire", "photo_url": "http://www.panoramio.com/photo/6935706", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6935706.jpg", "longitude": 20.319901, "latitude": 49.730028, "width": 500, "height": 332, "upload_date": "06 January 2008", "owner_id": 454219, "owner_name": "Rafal Ociepka", "owner_url": "http://www.panoramio.com/user/454219"} + , + {"photo_id": 29606, "photo_title": "Romance entre el Agua y la Roca", "photo_url": "http://www.panoramio.com/photo/29606", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/29606.jpg", "longitude": -64.859161, "latitude": -31.991480, "width": 500, "height": 375, "upload_date": "01 July 2006", "owner_id": 4483, "owner_name": "Miguel Coranti", "owner_url": "http://www.panoramio.com/user/4483"} + , + {"photo_id": 58290, "photo_title": "Taurachbahn", "photo_url": "http://www.panoramio.com/photo/58290", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58290.jpg", "longitude": 13.688021, "latitude": 47.130418, "width": 500, "height": 369, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 44982, "photo_title": "Paris200412PJDSC_9304l", "photo_url": "http://www.panoramio.com/photo/44982", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/44982.jpg", "longitude": 2.301636, "latitude": 48.853760, "width": 500, "height": 332, "upload_date": "02 September 2006", "owner_id": 6703, "owner_name": "Peter Jansen", "owner_url": "http://www.panoramio.com/user/6703"} + , + {"photo_id": 532669, "photo_title": "Closeup of wheatfield in november", "photo_url": "http://www.panoramio.com/photo/532669", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532669.jpg", "longitude": 11.276093, "latitude": 59.644239, "width": 375, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 723648, "photo_title": "Elk near Jasper", "photo_url": "http://www.panoramio.com/photo/723648", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/723648.jpg", "longitude": -118.046207, "latitude": 52.923290, "width": 500, "height": 332, "upload_date": "07 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 535234, "photo_title": "Cathedral Cove near Hahei, New Zealand", "photo_url": "http://www.panoramio.com/photo/535234", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/535234.jpg", "longitude": 175.790222, "latitude": -36.828611, "width": 500, "height": 375, "upload_date": "22 January 2007", "owner_id": 101257, "owner_name": "Denis Campbell", "owner_url": "http://www.panoramio.com/user/101257"} + , + {"photo_id": 15299, "photo_title": "Bodrum Sunset", "photo_url": "http://www.panoramio.com/photo/15299", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/15299.jpg", "longitude": 27.425308, "latitude": 37.028595, "width": 500, "height": 375, "upload_date": "19 March 2006", "owner_id": 2351, "owner_name": "Serdar Bilecen", "owner_url": "http://www.panoramio.com/user/2351"} + , + {"photo_id": 1932227, "photo_title": "Mono Lake 3", "photo_url": "http://www.panoramio.com/photo/1932227", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1932227.jpg", "longitude": -119.023819, "latitude": 37.940068, "width": 333, "height": 500, "upload_date": "26 April 2007", "owner_id": 40260, "owner_name": "Don Albonico", "owner_url": "http://www.panoramio.com/user/40260"} + , + {"photo_id": 744906, "photo_title": "Tsukahara Highland", "photo_url": "http://www.panoramio.com/photo/744906", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/744906.jpg", "longitude": 131.403952, "latitude": 33.320201, "width": 500, "height": 375, "upload_date": "08 February 2007", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 490198, "photo_title": "Jal Mahal, Jaipur", "photo_url": "http://www.panoramio.com/photo/490198", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/490198.jpg", "longitude": 75.842797, "latitude": 26.954571, "width": 500, "height": 403, "upload_date": "19 January 2007", "owner_id": 10456, "owner_name": "eulogio", "owner_url": "http://www.panoramio.com/user/10456"} + , + {"photo_id": 451032, "photo_title": "Mono Lake", "photo_url": "http://www.panoramio.com/photo/451032", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/451032.jpg", "longitude": -119.017537, "latitude": 37.941803, "width": 363, "height": 500, "upload_date": "16 January 2007", "owner_id": 93560, "owner_name": "Alex Petrov", "owner_url": "http://www.panoramio.com/user/93560"} + , + {"photo_id": 5808345, "photo_title": "Majesty in the snow", "photo_url": "http://www.panoramio.com/photo/5808345", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5808345.jpg", "longitude": 9.944987, "latitude": 48.684866, "width": 367, "height": 500, "upload_date": "09 November 2007", "owner_id": 424589, "owner_name": "PeSchn", "owner_url": "http://www.panoramio.com/user/424589"} + , + {"photo_id": 2718436, "photo_title": "BKCC view northwest", "photo_url": "http://www.panoramio.com/photo/2718436", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2718436.jpg", "longitude": 139.752048, "latitude": 35.708102, "width": 500, "height": 365, "upload_date": "12 June 2007", "owner_id": 558055, "owner_name": "www.tokyoform.com", "owner_url": "http://www.panoramio.com/user/558055"} + , + {"photo_id": 5446639, "photo_title": "ОÑень", "photo_url": "http://www.panoramio.com/photo/5446639", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5446639.jpg", "longitude": 23.824694, "latitude": 53.680547, "width": 500, "height": 375, "upload_date": "21 October 2007", "owner_id": 937915, "owner_name": "HiV", "owner_url": "http://www.panoramio.com/user/937915"} + , + {"photo_id": 3393267, "photo_title": "Barco hundido (pecio) /Shipwreck /épave ", "photo_url": "http://www.panoramio.com/photo/3393267", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3393267.jpg", "longitude": -81.680587, "latitude": 45.255181, "width": 329, "height": 500, "upload_date": "18 July 2007", "owner_id": 401966, "owner_name": "Syl de Canada", "owner_url": "http://www.panoramio.com/user/401966"} + , + {"photo_id": 4369140, "photo_title": "Beach on HÃ¥ja", "photo_url": "http://www.panoramio.com/photo/4369140", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4369140.jpg", "longitude": 18.096886, "latitude": 69.740825, "width": 500, "height": 375, "upload_date": "03 September 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3711738, "photo_title": "Safe", "photo_url": "http://www.panoramio.com/photo/3711738", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3711738.jpg", "longitude": 1.787220, "latitude": 41.224610, "width": 500, "height": 375, "upload_date": "04 August 2007", "owner_id": 138691, "owner_name": "Josep Maria Alegre", "owner_url": "http://www.panoramio.com/user/138691"} + , + {"photo_id": 7415554, "photo_title": "Sunrise at Hae-keum-gang, Korea", "photo_url": "http://www.panoramio.com/photo/7415554", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7415554.jpg", "longitude": 128.605957, "latitude": 34.698719, "width": 500, "height": 500, "upload_date": "28 January 2008", "owner_id": 1221287, "owner_name": "TS Jeung", "owner_url": "http://www.panoramio.com/user/1221287"} + , + {"photo_id": 10129080, "photo_title": "Polish Silesia sunset.", "photo_url": "http://www.panoramio.com/photo/10129080", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10129080.jpg", "longitude": 18.819752, "latitude": 49.789798, "width": 500, "height": 335, "upload_date": "11 May 2008", "owner_id": 548131, "owner_name": "murart", "owner_url": "http://www.panoramio.com/user/548131"} + , + {"photo_id": 11827263, "photo_title": ": Casa Rustica", "photo_url": "http://www.panoramio.com/photo/11827263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11827263.jpg", "longitude": -8.644395, "latitude": 42.795039, "width": 500, "height": 375, "upload_date": "05 July 2008", "owner_id": 546858, "owner_name": "Lazariparcero", "owner_url": "http://www.panoramio.com/user/546858"} + , + {"photo_id": 9185096, "photo_title": "E per cambiare... oggi è nevicato ! 07.04.2008", "photo_url": "http://www.panoramio.com/photo/9185096", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9185096.jpg", "longitude": 11.469633, "latitude": 46.304547, "width": 500, "height": 375, "upload_date": "07 April 2008", "owner_id": 6033, "owner_name": "â–º Marco Vanzo", "owner_url": "http://www.panoramio.com/user/6033"} + , + {"photo_id": 691, "photo_title": "Monasterio de Santa Catalina. Arequipa, Perú", "photo_url": "http://www.panoramio.com/photo/691", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/691.jpg", "longitude": -71.536671, "latitude": -16.395835, "width": 500, "height": 375, "upload_date": "05 October 2005", "owner_id": 7, "owner_name": "Eduardo Manchón", "owner_url": "http://www.panoramio.com/user/7"} + , + {"photo_id": 672525, "photo_title": "Pyramid", "photo_url": "http://www.panoramio.com/photo/672525", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/672525.jpg", "longitude": 31.132421, "latitude": 29.978283, "width": 500, "height": 474, "upload_date": "03 February 2007", "owner_id": 123698, "owner_name": "© Kojak", "owner_url": "http://www.panoramio.com/user/123698"} + , + {"photo_id": 275730, "photo_title": "Oberalp - 2033 m", "photo_url": "http://www.panoramio.com/photo/275730", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/275730.jpg", "longitude": 8.668191, "latitude": 46.661528, "width": 500, "height": 333, "upload_date": "01 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 3661332, "photo_title": "Angkor - Temple vs Trees", "photo_url": "http://www.panoramio.com/photo/3661332", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3661332.jpg", "longitude": 103.855079, "latitude": 13.449099, "width": 500, "height": 461, "upload_date": "01 August 2007", "owner_id": 73104, "owner_name": "zerega", "owner_url": "http://www.panoramio.com/user/73104"} + , + {"photo_id": 336151, "photo_title": "Lake north of Tupaassat", "photo_url": "http://www.panoramio.com/photo/336151", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/336151.jpg", "longitude": -44.307861, "latitude": 60.376030, "width": 500, "height": 333, "upload_date": "07 January 2007", "owner_id": 62557, "owner_name": "Dirk Jenrich", "owner_url": "http://www.panoramio.com/user/62557"} + , + {"photo_id": 423705, "photo_title": "Bouche du Pu`u `ÅŒ`Å", "photo_url": "http://www.panoramio.com/photo/423705", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/423705.jpg", "longitude": -155.106182, "latitude": 19.390101, "width": 500, "height": 349, "upload_date": "14 January 2007", "owner_id": 75602, "owner_name": "Lloulhy", "owner_url": "http://www.panoramio.com/user/75602"} + , + {"photo_id": 1344795, "photo_title": "Tree in a field, Aerial", "photo_url": "http://www.panoramio.com/photo/1344795", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1344795.jpg", "longitude": 12.058611, "latitude": 55.471581, "width": 500, "height": 332, "upload_date": "16 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 5591839, "photo_title": "Can I touch the clouds?", "photo_url": "http://www.panoramio.com/photo/5591839", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5591839.jpg", "longitude": 130.689411, "latitude": 33.305569, "width": 333, "height": 500, "upload_date": "28 October 2007", "owner_id": 775356, "owner_name": "ascesis.image", "owner_url": "http://www.panoramio.com/user/775356"} + , + {"photo_id": 5476386, "photo_title": "Nuages crépusculaires sur le Lauterbrunnental", "photo_url": "http://www.panoramio.com/photo/5476386", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5476386.jpg", "longitude": 7.908010, "latitude": 46.592490, "width": 500, "height": 375, "upload_date": "22 October 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 459556, "photo_title": "minatopia", "photo_url": "http://www.panoramio.com/photo/459556", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459556.jpg", "longitude": 139.058182, "latitude": 37.930041, "width": 381, "height": 500, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1407525, "photo_title": "Mackinac Bridge, Michigan", "photo_url": "http://www.panoramio.com/photo/1407525", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1407525.jpg", "longitude": -84.729652, "latitude": 45.788250, "width": 500, "height": 313, "upload_date": "20 March 2007", "owner_id": 60173, "owner_name": "Lars Jensen", "owner_url": "http://www.panoramio.com/user/60173"} + , + {"photo_id": 74790, "photo_title": "kang taiga with moon in sunset", "photo_url": "http://www.panoramio.com/photo/74790", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/74790.jpg", "longitude": 86.830101, "latitude": 27.811750, "width": 500, "height": 334, "upload_date": "03 November 2006", "owner_id": 9812, "owner_name": "wsm earp", "owner_url": "http://www.panoramio.com/user/9812"} + , + {"photo_id": 4025902, "photo_title": "Coloured PoznaÅ„ ", "photo_url": "http://www.panoramio.com/photo/4025902", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4025902.jpg", "longitude": 16.934255, "latitude": 52.407878, "width": 500, "height": 316, "upload_date": "19 August 2007", "owner_id": 369127, "owner_name": "♥ Caterpillar", "owner_url": "http://www.panoramio.com/user/369127"} + , + {"photo_id": 88121, "photo_title": "View from Punta Martin - Liguria - Italy", "photo_url": "http://www.panoramio.com/photo/88121", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/88121.jpg", "longitude": 8.795028, "latitude": 44.468489, "width": 500, "height": 375, "upload_date": "28 November 2006", "owner_id": 11098, "owner_name": "Michele Masnata", "owner_url": "http://www.panoramio.com/user/11098"} + , + {"photo_id": 8214845, "photo_title": "Molino Albolafia,cauce del Guadalquivir(Córdoba)", "photo_url": "http://www.panoramio.com/photo/8214845", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8214845.jpg", "longitude": -4.780898, "latitude": 37.876242, "width": 500, "height": 375, "upload_date": "01 March 2008", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 23364, "photo_title": "Alanya, Taurus-Mountains of Kemer", "photo_url": "http://www.panoramio.com/photo/23364", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/23364.jpg", "longitude": 31.979656, "latitude": 36.548466, "width": 500, "height": 375, "upload_date": "10 June 2006", "owner_id": 3760, "owner_name": "Frank Pustlauck", "owner_url": "http://www.panoramio.com/user/3760"} + , + {"photo_id": 6128452, "photo_title": "Ð’ оÑеннем парке - In autumn park", "photo_url": "http://www.panoramio.com/photo/6128452", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6128452.jpg", "longitude": 37.458926, "latitude": 55.737422, "width": 500, "height": 500, "upload_date": "25 November 2007", "owner_id": 244932, "owner_name": "Andrey Jitkov", "owner_url": "http://www.panoramio.com/user/244932"} + , + {"photo_id": 4356679, "photo_title": "Old Santa Fe Caboose", "photo_url": "http://www.panoramio.com/photo/4356679", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4356679.jpg", "longitude": -119.699687, "latitude": 36.707083, "width": 500, "height": 335, "upload_date": "03 September 2007", "owner_id": 339677, "owner_name": "Chip Stephan", "owner_url": "http://www.panoramio.com/user/339677"} + , + {"photo_id": 436312, "photo_title": "tokimesse", "photo_url": "http://www.panoramio.com/photo/436312", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/436312.jpg", "longitude": 139.059105, "latitude": 37.932013, "width": 396, "height": 500, "upload_date": "15 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 1089381, "photo_title": "Szabadon szélben", "photo_url": "http://www.panoramio.com/photo/1089381", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1089381.jpg", "longitude": 17.604561, "latitude": 47.588799, "width": 332, "height": 500, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 5667175, "photo_title": "Northen Lights", "photo_url": "http://www.panoramio.com/photo/5667175", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5667175.jpg", "longitude": 28.482399, "latitude": 66.227860, "width": 500, "height": 333, "upload_date": "01 November 2007", "owner_id": 897591, "owner_name": "markku pirttimaa www.karhukuusamo.com", "owner_url": "http://www.panoramio.com/user/897591"} + , + {"photo_id": 1317737, "photo_title": "Bora Bora", "photo_url": "http://www.panoramio.com/photo/1317737", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1317737.jpg", "longitude": -151.739988, "latitude": -16.538715, "width": 500, "height": 351, "upload_date": "14 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 993129, "photo_title": "Würzburg", "photo_url": "http://www.panoramio.com/photo/993129", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/993129.jpg", "longitude": 9.931523, "latitude": 49.793310, "width": 500, "height": 395, "upload_date": "24 February 2007", "owner_id": 83972, "owner_name": "Maxim Popov (http://www.popovm.ru)", "owner_url": "http://www.panoramio.com/user/83972"} + , + {"photo_id": 1836922, "photo_title": "Fountain Place / Dallas / Texas", "photo_url": "http://www.panoramio.com/photo/1836922", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1836922.jpg", "longitude": -96.802940, "latitude": 32.785236, "width": 500, "height": 405, "upload_date": "19 April 2007", "owner_id": 57778, "owner_name": "William Lile", "owner_url": "http://www.panoramio.com/user/57778"} + , + {"photo_id": 3409786, "photo_title": "Molinos de Elguea con Gorbea al fondo", "photo_url": "http://www.panoramio.com/photo/3409786", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3409786.jpg", "longitude": -2.325025, "latitude": 42.951271, "width": 500, "height": 303, "upload_date": "19 July 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 476284, "photo_title": "Place \"Poda\"", "photo_url": "http://www.panoramio.com/photo/476284", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/476284.jpg", "longitude": 27.471657, "latitude": 42.447655, "width": 500, "height": 357, "upload_date": "18 January 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 3499645, "photo_title": "Tükör-kép", "photo_url": "http://www.panoramio.com/photo/3499645", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3499645.jpg", "longitude": 17.503667, "latitude": 47.843522, "width": 500, "height": 333, "upload_date": "24 July 2007", "owner_id": 689769, "owner_name": "Ponty István", "owner_url": "http://www.panoramio.com/user/689769"} + , + {"photo_id": 1419901, "photo_title": "Øresundsbroen seen from Sweden (The Dragon Tail), Aerial", "photo_url": "http://www.panoramio.com/photo/1419901", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1419901.jpg", "longitude": 12.885418, "latitude": 55.566213, "width": 332, "height": 500, "upload_date": "20 March 2007", "owner_id": 278074, "owner_name": "H. C. Steensen", "owner_url": "http://www.panoramio.com/user/278074"} + , + {"photo_id": 441727, "photo_title": "Ð¤Ð¾Ñ€Ñ‚ÐµÑ†Ñ Ñƒ Кам'Ñнці-ПодільÑькому", "photo_url": "http://www.panoramio.com/photo/441727", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/441727.jpg", "longitude": 26.563311, "latitude": 48.672486, "width": 375, "height": 500, "upload_date": "15 January 2007", "owner_id": 13058, "owner_name": "Kyryl", "owner_url": "http://www.panoramio.com/user/13058"} + , + {"photo_id": 309122, "photo_title": "Standing Stone, Spittal of Glenshee", "photo_url": "http://www.panoramio.com/photo/309122", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/309122.jpg", "longitude": -3.461593, "latitude": 56.814745, "width": 500, "height": 332, "upload_date": "05 January 2007", "owner_id": 64815, "owner_name": "PigleT", "owner_url": "http://www.panoramio.com/user/64815"} + , + {"photo_id": 2599560, "photo_title": "Isigaki Island Hirakubosaki lighthouse 石垣島 平久ä¿å´Žç¯å°", "photo_url": "http://www.panoramio.com/photo/2599560", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2599560.jpg", "longitude": 124.315994, "latitude": 24.610064, "width": 500, "height": 328, "upload_date": "06 June 2007", "owner_id": 446937, "owner_name": "y_komatsu", "owner_url": "http://www.panoramio.com/user/446937"} + , + {"photo_id": 6545801, "photo_title": "Front Range of the Canadian Rocky Mountains", "photo_url": "http://www.panoramio.com/photo/6545801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6545801.jpg", "longitude": -115.248213, "latitude": 51.026389, "width": 500, "height": 338, "upload_date": "18 December 2007", "owner_id": 85489, "owner_name": "Bruce MacIver", "owner_url": "http://www.panoramio.com/user/85489"} + , + {"photo_id": 1254026, "photo_title": "Hagia Sophia (inside)", "photo_url": "http://www.panoramio.com/photo/1254026", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1254026.jpg", "longitude": 28.979831, "latitude": 41.008548, "width": 500, "height": 408, "upload_date": "10 March 2007", "owner_id": 258322, "owner_name": "www.tatjana.ingold.ch", "owner_url": "http://www.panoramio.com/user/258322"} + , + {"photo_id": 911501, "photo_title": "View from Nordenskiöldtoppen, Svalbard", "photo_url": "http://www.panoramio.com/photo/911501", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/911501.jpg", "longitude": 15.402832, "latitude": 78.184088, "width": 500, "height": 308, "upload_date": "20 February 2007", "owner_id": 66734, "owner_name": "Svein Solhaug", "owner_url": "http://www.panoramio.com/user/66734"} + , + {"photo_id": 3797140, "photo_title": "Mas Francesc", "photo_url": "http://www.panoramio.com/photo/3797140", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3797140.jpg", "longitude": 2.408388, "latitude": 41.962346, "width": 500, "height": 332, "upload_date": "08 August 2007", "owner_id": 756267, "owner_name": "Albert Codina", "owner_url": "http://www.panoramio.com/user/756267"} + , + {"photo_id": 150165, "photo_title": "Aso crater from the air", "photo_url": "http://www.panoramio.com/photo/150165", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/150165.jpg", "longitude": 131.083159, "latitude": 32.885390, "width": 500, "height": 375, "upload_date": "14 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 532631, "photo_title": "Last bath in Oslofjorden - self portrait", "photo_url": "http://www.panoramio.com/photo/532631", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532631.jpg", "longitude": 10.782223, "latitude": 59.854773, "width": 500, "height": 205, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 3978149, "photo_title": "Les Mines 3", "photo_url": "http://www.panoramio.com/photo/3978149", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3978149.jpg", "longitude": 1.315312, "latitude": 45.921961, "width": 500, "height": 500, "upload_date": "16 August 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 848807, "photo_title": "mystic morning", "photo_url": "http://www.panoramio.com/photo/848807", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/848807.jpg", "longitude": 10.144372, "latitude": 54.323031, "width": 375, "height": 500, "upload_date": "17 February 2007", "owner_id": 73946, "owner_name": "pembo", "owner_url": "http://www.panoramio.com/user/73946"} + , + {"photo_id": 4097972, "photo_title": "Dry Land", "photo_url": "http://www.panoramio.com/photo/4097972", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4097972.jpg", "longitude": 25.936694, "latitude": 41.660906, "width": 500, "height": 333, "upload_date": "22 August 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 479927, "photo_title": "Monterosso at night", "photo_url": "http://www.panoramio.com/photo/479927", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479927.jpg", "longitude": 9.655094, "latitude": 44.144461, "width": 500, "height": 357, "upload_date": "18 January 2007", "owner_id": 100907, "owner_name": "Julia Wahl", "owner_url": "http://www.panoramio.com/user/100907"} + , + {"photo_id": 50872, "photo_title": "Düne 40 auf dem Weg nach Sossusvlei ...", "photo_url": "http://www.panoramio.com/photo/50872", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/50872.jpg", "longitude": 15.593033, "latitude": -24.720950, "width": 500, "height": 192, "upload_date": "22 September 2006", "owner_id": 7434, "owner_name": "baldinger reisen ag, waedenswil/switzerland", "owner_url": "http://www.panoramio.com/user/7434"} + , + {"photo_id": 2903483, "photo_title": "Reggeli", "photo_url": "http://www.panoramio.com/photo/2903483", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2903483.jpg", "longitude": 17.469549, "latitude": 47.868977, "width": 410, "height": 500, "upload_date": "23 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4226249, "photo_title": "Rainbow", "photo_url": "http://www.panoramio.com/photo/4226249", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4226249.jpg", "longitude": 9.615569, "latitude": 62.529150, "width": 500, "height": 230, "upload_date": "27 August 2007", "owner_id": 223406, "owner_name": "Sigmund Rise", "owner_url": "http://www.panoramio.com/user/223406"} + , + {"photo_id": 2267849, "photo_title": "Rayos vistos desde mi ventana", "photo_url": "http://www.panoramio.com/photo/2267849", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2267849.jpg", "longitude": -89.203963, "latitude": 13.728734, "width": 500, "height": 375, "upload_date": "17 May 2007", "owner_id": 170919, "owner_name": "Wilber Calderón - El Salvador", "owner_url": "http://www.panoramio.com/user/170919"} + , + {"photo_id": 459470, "photo_title": "bandaibashi4", "photo_url": "http://www.panoramio.com/photo/459470", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459470.jpg", "longitude": 139.051123, "latitude": 37.919081, "width": 500, "height": 399, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 5279707, "photo_title": "Jægervasstindane", "photo_url": "http://www.panoramio.com/photo/5279707", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5279707.jpg", "longitude": 19.651279, "latitude": 69.771296, "width": 500, "height": 375, "upload_date": "13 October 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 1057758, "photo_title": "Giant dragonfly in rice field", "photo_url": "http://www.panoramio.com/photo/1057758", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1057758.jpg", "longitude": 137.115641, "latitude": 34.862834, "width": 500, "height": 375, "upload_date": "27 February 2007", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 479454, "photo_title": "Morning sun over lake Øymarksjøen", "photo_url": "http://www.panoramio.com/photo/479454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479454.jpg", "longitude": 11.637611, "latitude": 59.338617, "width": 333, "height": 500, "upload_date": "18 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 87263, "photo_title": "Payun - Mendoza - Argentina", "photo_url": "http://www.panoramio.com/photo/87263", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/87263.jpg", "longitude": -69.280128, "latitude": -36.643080, "width": 500, "height": 333, "upload_date": "27 November 2006", "owner_id": 8409, "owner_name": "Hector Fabian Garrido", "owner_url": "http://www.panoramio.com/user/8409"} + , + {"photo_id": 11430112, "photo_title": "Tramonto dalla Pietra Parcellara", "photo_url": "http://www.panoramio.com/photo/11430112", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11430112.jpg", "longitude": 9.476480, "latitude": 44.843334, "width": 500, "height": 375, "upload_date": "22 June 2008", "owner_id": 22921, "owner_name": "Francesco Favalesi - VAL LURETTA", "owner_url": "http://www.panoramio.com/user/22921"} + , + {"photo_id": 33760, "photo_title": "Yu Yuan Gardens", "photo_url": "http://www.panoramio.com/photo/33760", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/33760.jpg", "longitude": 121.487803, "latitude": 31.228821, "width": 500, "height": 375, "upload_date": "21 July 2006", "owner_id": 5168, "owner_name": "Markus Källander", "owner_url": "http://www.panoramio.com/user/5168"} + , + {"photo_id": 1935332, "photo_title": "Lafayette", "photo_url": "http://www.panoramio.com/photo/1935332", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1935332.jpg", "longitude": 2.311839, "latitude": 48.864475, "width": 384, "height": 500, "upload_date": "26 April 2007", "owner_id": 372189, "owner_name": "Phil©", "owner_url": "http://www.panoramio.com/user/372189"} + , + {"photo_id": 2558954, "photo_title": "Two Thumbs Morning", "photo_url": "http://www.panoramio.com/photo/2558954", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2558954.jpg", "longitude": 170.463352, "latitude": -43.999792, "width": 500, "height": 400, "upload_date": "04 June 2007", "owner_id": 286729, "owner_name": "jimwitkowski", "owner_url": "http://www.panoramio.com/user/286729"} + , + {"photo_id": 94190, "photo_title": "morning light", "photo_url": "http://www.panoramio.com/photo/94190", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/94190.jpg", "longitude": 138.362846, "latitude": 35.981896, "width": 500, "height": 375, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 1283054, "photo_title": "Panorama - Bahia desde la playa", "photo_url": "http://www.panoramio.com/photo/1283054", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1283054.jpg", "longitude": -1.990094, "latitude": 43.316053, "width": 500, "height": 167, "upload_date": "12 March 2007", "owner_id": 218075, "owner_name": "fotoramas", "owner_url": "http://www.panoramio.com/user/218075"} + , + {"photo_id": 2541040, "photo_title": "Színförgeteg", "photo_url": "http://www.panoramio.com/photo/2541040", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2541040.jpg", "longitude": 17.506886, "latitude": 47.744403, "width": 500, "height": 334, "upload_date": "03 June 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 837872, "photo_title": "Midnight Sunset", "photo_url": "http://www.panoramio.com/photo/837872", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/837872.jpg", "longitude": -14.670181, "latitude": 65.142363, "width": 500, "height": 333, "upload_date": "16 February 2007", "owner_id": 175423, "owner_name": "Fabien Barrau", "owner_url": "http://www.panoramio.com/user/175423"} + , + {"photo_id": 1706995, "photo_title": "Cantera de Manresa", "photo_url": "http://www.panoramio.com/photo/1706995", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1706995.jpg", "longitude": 3.131152, "latitude": 39.868942, "width": 335, "height": 500, "upload_date": "09 April 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 575731, "photo_title": "Le Mont Saint-Michel (Francia)", "photo_url": "http://www.panoramio.com/photo/575731", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/575731.jpg", "longitude": -1.498604, "latitude": 48.636085, "width": 500, "height": 334, "upload_date": "26 January 2007", "owner_id": 38814, "owner_name": "Romeo Ferrari", "owner_url": "http://www.panoramio.com/user/38814"} + , + {"photo_id": 1960951, "photo_title": "Utah Autumn Aspen", "photo_url": "http://www.panoramio.com/photo/1960951", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1960951.jpg", "longitude": -111.620750, "latitude": 40.441721, "width": 500, "height": 332, "upload_date": "28 April 2007", "owner_id": 107359, "owner_name": "Ron Cooper", "owner_url": "http://www.panoramio.com/user/107359"} + , + {"photo_id": 162298, "photo_title": "Nuvole (Effetto Dio) sopra Marano Ticino (2 of 2), settembre 2005", "photo_url": "http://www.panoramio.com/photo/162298", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/162298.jpg", "longitude": 8.623238, "latitude": 45.629825, "width": 500, "height": 375, "upload_date": "16 December 2006", "owner_id": 18925, "owner_name": "Marco Ferrari", "owner_url": "http://www.panoramio.com/user/18925"} + , + {"photo_id": 9358587, "photo_title": "Sicilia, a me bedda!", "photo_url": "http://www.panoramio.com/photo/9358587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9358587.jpg", "longitude": 14.652908, "latitude": 38.068172, "width": 500, "height": 375, "upload_date": "14 April 2008", "owner_id": 325031, "owner_name": "Gibrail", "owner_url": "http://www.panoramio.com/user/325031"} + , + {"photo_id": 11271799, "photo_title": "Candelaria, version completa ( Candelaria, full version )", "photo_url": "http://www.panoramio.com/photo/11271799", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/11271799.jpg", "longitude": -18.005776, "latitude": 27.750886, "width": 334, "height": 500, "upload_date": "16 June 2008", "owner_id": 787217, "owner_name": "♣ Víctor S de Lara ♣", "owner_url": "http://www.panoramio.com/user/787217"} + , + {"photo_id": 81, "photo_title": "North Cape from plane", "photo_url": "http://www.panoramio.com/photo/81", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/81.jpg", "longitude": 25.786285, "latitude": 71.171196, "width": 500, "height": 340, "upload_date": "30 July 2005", "owner_id": 7, "owner_name": "Eduardo Manchón", "owner_url": "http://www.panoramio.com/user/7"} + , + {"photo_id": 6548480, "photo_title": "ç å³°æ™“月", "photo_url": "http://www.panoramio.com/photo/6548480", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6548480.jpg", "longitude": 86.857567, "latitude": 28.119833, "width": 500, "height": 332, "upload_date": "18 December 2007", "owner_id": 1201050, "owner_name": "黄河影人", "owner_url": "http://www.panoramio.com/user/1201050"} + , + {"photo_id": 1989382, "photo_title": "", "photo_url": "http://www.panoramio.com/photo/1989382", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1989382.jpg", "longitude": 20.628827, "latitude": 52.062874, "width": 500, "height": 375, "upload_date": "29 April 2007", "owner_id": 234038, "owner_name": "Jacek M.", "owner_url": "http://www.panoramio.com/user/234038"} + , + {"photo_id": 3186699, "photo_title": "Ruta del Cares: Paredón de los Collainos -más 400 m. de vertical-", "photo_url": "http://www.panoramio.com/photo/3186699", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3186699.jpg", "longitude": -4.863296, "latitude": 43.253174, "width": 335, "height": 500, "upload_date": "08 July 2007", "owner_id": 129297, "owner_name": "Enrique Ortiz de Zárate", "owner_url": "http://www.panoramio.com/user/129297"} + , + {"photo_id": 9899533, "photo_title": "Grado: Are you Ready? . . . . . . . . . Honorable mention \"Scenery\" May Contest 2008", "photo_url": "http://www.panoramio.com/photo/9899533", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9899533.jpg", "longitude": 13.395016, "latitude": 45.676262, "width": 500, "height": 375, "upload_date": "04 May 2008", "owner_id": 381221, "owner_name": "Flavio Snidero", "owner_url": "http://www.panoramio.com/user/381221"} + , + {"photo_id": 324623, "photo_title": "richmond bridge", "photo_url": "http://www.panoramio.com/photo/324623", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/324623.jpg", "longitude": 147.439506, "latitude": -42.734358, "width": 500, "height": 375, "upload_date": "06 January 2007", "owner_id": 66974, "owner_name": "lieskovec", "owner_url": "http://www.panoramio.com/user/66974"} + , + {"photo_id": 4450585, "photo_title": "Giorno di riposo", "photo_url": "http://www.panoramio.com/photo/4450585", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4450585.jpg", "longitude": 35.440521, "latitude": 33.732906, "width": 500, "height": 375, "upload_date": "06 September 2007", "owner_id": 407625, "owner_name": "Lyana Luna", "owner_url": "http://www.panoramio.com/user/407625"} + , + {"photo_id": 1088801, "photo_title": "Kalászos impresszió", "photo_url": "http://www.panoramio.com/photo/1088801", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1088801.jpg", "longitude": 17.727127, "latitude": 47.444575, "width": 500, "height": 360, "upload_date": "28 February 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 290083, "photo_title": "Beach full of life", "photo_url": "http://www.panoramio.com/photo/290083", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/290083.jpg", "longitude": -59.072113, "latitude": -52.430478, "width": 335, "height": 500, "upload_date": "03 January 2007", "owner_id": 61890, "owner_name": "enriquevidalphoto.com", "owner_url": "http://www.panoramio.com/user/61890"} + , + {"photo_id": 5734694, "photo_title": "Virginia Horse Country", "photo_url": "http://www.panoramio.com/photo/5734694", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5734694.jpg", "longitude": -78.754292, "latitude": 38.014964, "width": 500, "height": 375, "upload_date": "05 November 2007", "owner_id": 523038, "owner_name": "Yank in Dixie", "owner_url": "http://www.panoramio.com/user/523038"} + , + {"photo_id": 6012970, "photo_title": "Herbstliches Venedig", "photo_url": "http://www.panoramio.com/photo/6012970", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6012970.jpg", "longitude": 12.343435, "latitude": 45.433752, "width": 500, "height": 336, "upload_date": "19 November 2007", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 6321454, "photo_title": "Sea Storm III - \" Dragonara \" Castle", "photo_url": "http://www.panoramio.com/photo/6321454", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6321454.jpg", "longitude": 9.151177, "latitude": 44.350211, "width": 444, "height": 500, "upload_date": "05 December 2007", "owner_id": 180947, "owner_name": "gilberto silvestri", "owner_url": "http://www.panoramio.com/user/180947"} + , + {"photo_id": 459569, "photo_title": "mt hakkai", "photo_url": "http://www.panoramio.com/photo/459569", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459569.jpg", "longitude": 138.921432, "latitude": 37.092157, "width": 500, "height": 389, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 940337, "photo_title": "Sunrising Monuments", "photo_url": "http://www.panoramio.com/photo/940337", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/940337.jpg", "longitude": -110.110474, "latitude": 36.980255, "width": 500, "height": 287, "upload_date": "21 February 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 2400305, "photo_title": "Cape of Favaritx, Gateway to Another Planet", "photo_url": "http://www.panoramio.com/photo/2400305", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2400305.jpg", "longitude": 4.264122, "latitude": 39.996608, "width": 500, "height": 352, "upload_date": "26 May 2007", "owner_id": 213866, "owner_name": "Nicolas Mertens", "owner_url": "http://www.panoramio.com/user/213866"} + , + {"photo_id": 398130, "photo_title": "Aiguille du Chardonnet", "photo_url": "http://www.panoramio.com/photo/398130", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/398130.jpg", "longitude": 7.013569, "latitude": 45.979190, "width": 500, "height": 333, "upload_date": "12 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 283954, "photo_title": "Dong-ao:The most beautiful coast of Taiwan", "photo_url": "http://www.panoramio.com/photo/283954", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/283954.jpg", "longitude": 121.850481, "latitude": 24.524822, "width": 500, "height": 375, "upload_date": "02 January 2007", "owner_id": 60214, "owner_name": "swinelin", "owner_url": "http://www.panoramio.com/user/60214"} + , + {"photo_id": 5115188, "photo_title": "Iceland", "photo_url": "http://www.panoramio.com/photo/5115188", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5115188.jpg", "longitude": -23.008804, "latitude": 64.947976, "width": 500, "height": 333, "upload_date": "05 October 2007", "owner_id": 588149, "owner_name": "Adam Salwanowicz", "owner_url": "http://www.panoramio.com/user/588149"} + , + {"photo_id": 1865268, "photo_title": "Rainbow Ridge Sunset", "photo_url": "http://www.panoramio.com/photo/1865268", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1865268.jpg", "longitude": -112.404728, "latitude": 36.426808, "width": 500, "height": 333, "upload_date": "21 April 2007", "owner_id": 66847, "owner_name": "Lukas Novak", "owner_url": "http://www.panoramio.com/user/66847"} + , + {"photo_id": 1633076, "photo_title": "Parliament", "photo_url": "http://www.panoramio.com/photo/1633076", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1633076.jpg", "longitude": 19.046752, "latitude": 47.512998, "width": 500, "height": 500, "upload_date": "04 April 2007", "owner_id": 52226, "owner_name": "jenoapu", "owner_url": "http://www.panoramio.com/user/52226"} + , + {"photo_id": 800056, "photo_title": "Karst Landscape in Guangxi, China", "photo_url": "http://www.panoramio.com/photo/800056", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/800056.jpg", "longitude": 107.121944, "latitude": 23.605000, "width": 500, "height": 191, "upload_date": "13 February 2007", "owner_id": 164125, "owner_name": "DannyXu", "owner_url": "http://www.panoramio.com/user/164125"} + , + {"photo_id": 21304, "photo_title": "Matterhorn", "photo_url": "http://www.panoramio.com/photo/21304", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/21304.jpg", "longitude": 7.718582, "latitude": 45.994577, "width": 375, "height": 500, "upload_date": "28 May 2006", "owner_id": 3404, "owner_name": "Csongor Böröczky", "owner_url": "http://www.panoramio.com/user/3404"} + , + {"photo_id": 402493, "photo_title": "Burg-Eltz", "photo_url": "http://www.panoramio.com/photo/402493", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/402493.jpg", "longitude": 7.336400, "latitude": 50.206104, "width": 369, "height": 500, "upload_date": "12 January 2007", "owner_id": 6105, "owner_name": "hackltom", "owner_url": "http://www.panoramio.com/user/6105"} + , + {"photo_id": 411453, "photo_title": "Dune 45 in Sosussvlei", "photo_url": "http://www.panoramio.com/photo/411453", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/411453.jpg", "longitude": 15.397339, "latitude": -24.739972, "width": 500, "height": 333, "upload_date": "13 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 1813822, "photo_title": "Csendes délután", "photo_url": "http://www.panoramio.com/photo/1813822", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1813822.jpg", "longitude": 17.779655, "latitude": 47.507229, "width": 500, "height": 334, "upload_date": "17 April 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 798783, "photo_title": "Georgia, Antelope Canyon, AZ", "photo_url": "http://www.panoramio.com/photo/798783", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/798783.jpg", "longitude": -111.385489, "latitude": 36.873441, "width": 376, "height": 500, "upload_date": "12 February 2007", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 5193281, "photo_title": "The park at Gamlehaugen a bautiful day in September 2007, Bergen - Norway", "photo_url": "http://www.panoramio.com/photo/5193281", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5193281.jpg", "longitude": 5.336909, "latitude": 60.341253, "width": 500, "height": 279, "upload_date": "09 October 2007", "owner_id": 121518, "owner_name": "S.M Tunli - www.tunliweb.no", "owner_url": "http://www.panoramio.com/user/121518"} + , + {"photo_id": 642882, "photo_title": "La Presolana e la Cometa Hale-Bopp", "photo_url": "http://www.panoramio.com/photo/642882", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/642882.jpg", "longitude": 10.094032, "latitude": 45.927991, "width": 500, "height": 375, "upload_date": "01 February 2007", "owner_id": 38814, "owner_name": "Romeo Ferrari", "owner_url": "http://www.panoramio.com/user/38814"} + , + {"photo_id": 304963, "photo_title": "Calanque d'En Vau 2", "photo_url": "http://www.panoramio.com/photo/304963", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/304963.jpg", "longitude": 5.500288, "latitude": 43.201422, "width": 500, "height": 375, "upload_date": "05 January 2007", "owner_id": 64344, "owner_name": "Seb - Lyon", "owner_url": "http://www.panoramio.com/user/64344"} + , + {"photo_id": 6126154, "photo_title": "Swan - EPping Forest", "photo_url": "http://www.panoramio.com/photo/6126154", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6126154.jpg", "longitude": 0.025658, "latitude": 51.638836, "width": 499, "height": 500, "upload_date": "25 November 2007", "owner_id": 1130880, "owner_name": "marksimms", "owner_url": "http://www.panoramio.com/user/1130880"} + , + {"photo_id": 441426, "photo_title": "Dettifoss", "photo_url": "http://www.panoramio.com/photo/441426", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/441426.jpg", "longitude": -16.390743, "latitude": 65.819939, "width": 500, "height": 350, "upload_date": "15 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 4105301, "photo_title": "Eikesdalsvatnet. Norway.", "photo_url": "http://www.panoramio.com/photo/4105301", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4105301.jpg", "longitude": 8.171768, "latitude": 62.561718, "width": 500, "height": 326, "upload_date": "22 August 2007", "owner_id": 806637, "owner_name": "Bjørn Fransgjerde", "owner_url": "http://www.panoramio.com/user/806637"} + , + {"photo_id": 519765, "photo_title": "Derűs szeglet", "photo_url": "http://www.panoramio.com/photo/519765", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/519765.jpg", "longitude": 17.173862, "latitude": 46.633997, "width": 500, "height": 282, "upload_date": "21 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 4401751, "photo_title": "Fire Escape", "photo_url": "http://www.panoramio.com/photo/4401751", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4401751.jpg", "longitude": -2.315347, "latitude": 52.644873, "width": 366, "height": 500, "upload_date": "04 September 2007", "owner_id": 1295, "owner_name": "Matthew Walters", "owner_url": "http://www.panoramio.com/user/1295"} + , + {"photo_id": 1747294, "photo_title": "Red Fort II / Fuerte rojo II", "photo_url": "http://www.panoramio.com/photo/1747294", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1747294.jpg", "longitude": 73.017197, "latitude": 26.296801, "width": 500, "height": 375, "upload_date": "12 April 2007", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 2856289, "photo_title": "Copacabana Praia", "photo_url": "http://www.panoramio.com/photo/2856289", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2856289.jpg", "longitude": -43.179188, "latitude": -22.969457, "width": 500, "height": 375, "upload_date": "20 June 2007", "owner_id": 496676, "owner_name": "Quasebart", "owner_url": "http://www.panoramio.com/user/496676"} + , + {"photo_id": 3116906, "photo_title": "Mototaki Falls", "photo_url": "http://www.panoramio.com/photo/3116906", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/3116906.jpg", "longitude": 139.954662, "latitude": 39.158750, "width": 500, "height": 375, "upload_date": "04 July 2007", "owner_id": 164173, "owner_name": "tsushima", "owner_url": "http://www.panoramio.com/user/164173"} + , + {"photo_id": 8919659, "photo_title": "Bavarian Forest", "photo_url": "http://www.panoramio.com/photo/8919659", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/8919659.jpg", "longitude": 12.429099, "latitude": 49.084548, "width": 500, "height": 332, "upload_date": "28 March 2008", "owner_id": 696605, "owner_name": "© alfredschaffer", "owner_url": "http://www.panoramio.com/user/696605"} + , + {"photo_id": 2040174, "photo_title": "Looking east from Sognefjellet - april 29", "photo_url": "http://www.panoramio.com/photo/2040174", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2040174.jpg", "longitude": 7.974873, "latitude": 61.561141, "width": 375, "height": 500, "upload_date": "03 May 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 1195122, "photo_title": "Cerro Macon", "photo_url": "http://www.panoramio.com/photo/1195122", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1195122.jpg", "longitude": -67.356405, "latitude": -24.528540, "width": 335, "height": 500, "upload_date": "06 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 1182587, "photo_title": "Gaggenau-Moosbronn, Wallfahrtskirche", "photo_url": "http://www.panoramio.com/photo/1182587", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1182587.jpg", "longitude": 8.384285, "latitude": 48.840486, "width": 382, "height": 500, "upload_date": "05 March 2007", "owner_id": 66229, "owner_name": "Mast", "owner_url": "http://www.panoramio.com/user/66229"} + , + {"photo_id": 4787323, "photo_title": "Hell's Gate(Antigua-Caribe)", "photo_url": "http://www.panoramio.com/photo/4787323", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4787323.jpg", "longitude": -61.722651, "latitude": 17.140052, "width": 500, "height": 375, "upload_date": "20 September 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 5474175, "photo_title": "Chemin bucolique au Lauterbrunnental 2", "photo_url": "http://www.panoramio.com/photo/5474175", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/5474175.jpg", "longitude": 7.909877, "latitude": 46.580479, "width": 500, "height": 384, "upload_date": "22 October 2007", "owner_id": 359127, "owner_name": "wx", "owner_url": "http://www.panoramio.com/user/359127"} + , + {"photo_id": 479364, "photo_title": "The Earth Above Us II", "photo_url": "http://www.panoramio.com/photo/479364", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/479364.jpg", "longitude": 19.053029, "latitude": 47.601392, "width": 500, "height": 317, "upload_date": "18 January 2007", "owner_id": 57869, "owner_name": "NAGY Albert", "owner_url": "http://www.panoramio.com/user/57869"} + , + {"photo_id": 575110, "photo_title": "A huge wave crashes against the front of Kiama Blowhole www.ozthunder.com", "photo_url": "http://www.panoramio.com/photo/575110", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/575110.jpg", "longitude": 150.863657, "latitude": -34.671264, "width": 500, "height": 338, "upload_date": "26 January 2007", "owner_id": 67208, "owner_name": "Michael Thompson", "owner_url": "http://www.panoramio.com/user/67208"} + , + {"photo_id": 543624, "photo_title": "Dalmát álom", "photo_url": "http://www.panoramio.com/photo/543624", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/543624.jpg", "longitude": 15.969143, "latitude": 43.624768, "width": 500, "height": 333, "upload_date": "23 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 121224, "photo_title": "ParadisePW", "photo_url": "http://www.panoramio.com/photo/121224", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/121224.jpg", "longitude": -62.907715, "latitude": -64.830254, "width": 500, "height": 329, "upload_date": "12 December 2006", "owner_id": 19856, "owner_name": "Juan Kratzmaier", "owner_url": "http://www.panoramio.com/user/19856"} + , + {"photo_id": 10074505, "photo_title": "Volcàn Chaitèn, Chaitèn, Palena, Chile Por Daniel Basualto", "photo_url": "http://www.panoramio.com/photo/10074505", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10074505.jpg", "longitude": -72.759705, "latitude": -42.908160, "width": 375, "height": 500, "upload_date": "10 May 2008", "owner_id": 88547, "owner_name": "Patricia Santini", "owner_url": "http://www.panoramio.com/user/88547"} + , + {"photo_id": 10378, "photo_title": "Chiang Mai, temple", "photo_url": "http://www.panoramio.com/photo/10378", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10378.jpg", "longitude": 98.921596, "latitude": 18.805157, "width": 319, "height": 500, "upload_date": "06 February 2006", "owner_id": 414, "owner_name": "Sonia Villegas", "owner_url": "http://www.panoramio.com/user/414"} + , + {"photo_id": 532620, "photo_title": "Morning mist near Skjønhaug", "photo_url": "http://www.panoramio.com/photo/532620", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532620.jpg", "longitude": 11.297293, "latitude": 59.639511, "width": 333, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 625805, "photo_title": "Primosten blue(s)", "photo_url": "http://www.panoramio.com/photo/625805", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/625805.jpg", "longitude": 15.932236, "latitude": 43.575168, "width": 500, "height": 334, "upload_date": "30 January 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 247704, "photo_title": "Paris in the night", "photo_url": "http://www.panoramio.com/photo/247704", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/247704.jpg", "longitude": 2.294512, "latitude": 48.858052, "width": 327, "height": 500, "upload_date": "27 December 2006", "owner_id": 51517, "owner_name": "threshold2000", "owner_url": "http://www.panoramio.com/user/51517"} + , + {"photo_id": 73888, "photo_title": "Fitz-Roy", "photo_url": "http://www.panoramio.com/photo/73888", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/73888.jpg", "longitude": -72.987328, "latitude": -49.277885, "width": 500, "height": 204, "upload_date": "01 November 2006", "owner_id": 7372, "owner_name": "vuillet", "owner_url": "http://www.panoramio.com/user/7372"} + , + {"photo_id": 6065568, "photo_title": "Amigos para siempre Paris-Francia", "photo_url": "http://www.panoramio.com/photo/6065568", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6065568.jpg", "longitude": 2.288697, "latitude": 48.861906, "width": 375, "height": 500, "upload_date": "22 November 2007", "owner_id": 83865, "owner_name": "Epi F.Villanueva", "owner_url": "http://www.panoramio.com/user/83865"} + , + {"photo_id": 9643938, "photo_title": "Occhio indiscreto ... sulla città ... illuminata ", "photo_url": "http://www.panoramio.com/photo/9643938", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/9643938.jpg", "longitude": 13.818569, "latitude": 45.641329, "width": 500, "height": 449, "upload_date": "23 April 2008", "owner_id": 1121720, "owner_name": "â–¬ Mauro Antonini â–¬", "owner_url": "http://www.panoramio.com/user/1121720"} + , + {"photo_id": 532643, "photo_title": "Icecarved granite at Herføl", "photo_url": "http://www.panoramio.com/photo/532643", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/532643.jpg", "longitude": 11.054649, "latitude": 58.986512, "width": 375, "height": 500, "upload_date": "22 January 2007", "owner_id": 39160, "owner_name": "Snemann", "owner_url": "http://www.panoramio.com/user/39160"} + , + {"photo_id": 112298, "photo_title": "paris06_004IR", "photo_url": "http://www.panoramio.com/photo/112298", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/112298.jpg", "longitude": 2.343779, "latitude": 48.887746, "width": 500, "height": 500, "upload_date": "11 December 2006", "owner_id": 17599, "owner_name": "Dmitry Andreev", "owner_url": "http://www.panoramio.com/user/17599"} + , + {"photo_id": 525997, "photo_title": "Grand Canyon Desert View", "photo_url": "http://www.panoramio.com/photo/525997", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/525997.jpg", "longitude": -111.824341, "latitude": 36.043547, "width": 500, "height": 333, "upload_date": "22 January 2007", "owner_id": 85489, "owner_name": "Bruce MacIver", "owner_url": "http://www.panoramio.com/user/85489"} + , + {"photo_id": 2972849, "photo_title": "Donadea Forest", "photo_url": "http://www.panoramio.com/photo/2972849", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2972849.jpg", "longitude": -6.743374, "latitude": 53.346555, "width": 500, "height": 377, "upload_date": "27 June 2007", "owner_id": 137785, "owner_name": "W@Z", "owner_url": "http://www.panoramio.com/user/137785"} + , + {"photo_id": 1175992, "photo_title": "Mt. Roberts Tram, Juneau, Alaska", "photo_url": "http://www.panoramio.com/photo/1175992", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1175992.jpg", "longitude": -134.391643, "latitude": 58.294679, "width": 500, "height": 347, "upload_date": "05 March 2007", "owner_id": 52440, "owner_name": "Hank Waxman", "owner_url": "http://www.panoramio.com/user/52440"} + , + {"photo_id": 462521, "photo_title": "Fontaine de Trevi", "photo_url": "http://www.panoramio.com/photo/462521", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/462521.jpg", "longitude": 12.483280, "latitude": 41.901047, "width": 500, "height": 333, "upload_date": "17 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 848316, "photo_title": "Malyovitsa, Rila", "photo_url": "http://www.panoramio.com/photo/848316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/848316.jpg", "longitude": 23.383627, "latitude": 42.201517, "width": 500, "height": 357, "upload_date": "17 February 2007", "owner_id": 16880, "owner_name": "evgenidinev.com", "owner_url": "http://www.panoramio.com/user/16880"} + , + {"photo_id": 459453, "photo_title": "bandaibashi3", "photo_url": "http://www.panoramio.com/photo/459453", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/459453.jpg", "longitude": 139.055586, "latitude": 37.920436, "width": 500, "height": 382, "upload_date": "16 January 2007", "owner_id": 86411, "owner_name": "中æ‘è„©-Osamu nakamura", "owner_url": "http://www.panoramio.com/user/86411"} + , + {"photo_id": 968639, "photo_title": "张永富 黄山风光06 Huangshan", "photo_url": "http://www.panoramio.com/photo/968639", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/968639.jpg", "longitude": 118.166199, "latitude": 30.105633, "width": 348, "height": 500, "upload_date": "23 February 2007", "owner_id": 203011, "owner_name": "SammyZhang", "owner_url": "http://www.panoramio.com/user/203011"} + , + {"photo_id": 97731, "photo_title": "Kaimondake", "photo_url": "http://www.panoramio.com/photo/97731", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/97731.jpg", "longitude": 130.652161, "latitude": 31.247443, "width": 500, "height": 212, "upload_date": "09 December 2006", "owner_id": 11781, "owner_name": "ANDRE GARDELLA", "owner_url": "http://www.panoramio.com/user/11781"} + , + {"photo_id": 2859205, "photo_title": "Lundy Lake Sunset", "photo_url": "http://www.panoramio.com/photo/2859205", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2859205.jpg", "longitude": -119.221230, "latitude": 38.031597, "width": 400, "height": 500, "upload_date": "21 June 2007", "owner_id": 376395, "owner_name": "JeffSullivan (www.MyPhotoGuides.com)", "owner_url": "http://www.panoramio.com/user/376395"} + , + {"photo_id": 309190, "photo_title": "Populonia, sunset", "photo_url": "http://www.panoramio.com/photo/309190", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/309190.jpg", "longitude": 10.490313, "latitude": 42.989581, "width": 308, "height": 500, "upload_date": "05 January 2007", "owner_id": 65478, "owner_name": "Gabriele Marabotti", "owner_url": "http://www.panoramio.com/user/65478"} + , + {"photo_id": 54982, "photo_title": "Baia dos Porcos", "photo_url": "http://www.panoramio.com/photo/54982", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/54982.jpg", "longitude": -32.443485, "latitude": -3.855177, "width": 500, "height": 333, "upload_date": "30 September 2006", "owner_id": 7562, "owner_name": "Marcelo E. Salgado", "owner_url": "http://www.panoramio.com/user/7562"} + , + {"photo_id": 58316, "photo_title": "800_Schafberg03", "photo_url": "http://www.panoramio.com/photo/58316", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/58316.jpg", "longitude": 13.429413, "latitude": 47.775445, "width": 500, "height": 316, "upload_date": "07 October 2006", "owner_id": 8060, "owner_name": "Norbert MAIER", "owner_url": "http://www.panoramio.com/user/8060"} + , + {"photo_id": 423887, "photo_title": "Dunes near Zagora", "photo_url": "http://www.panoramio.com/photo/423887", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/423887.jpg", "longitude": -5.872707, "latitude": 30.280713, "width": 500, "height": 333, "upload_date": "14 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 4136144, "photo_title": "Égi jel", "photo_url": "http://www.panoramio.com/photo/4136144", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4136144.jpg", "longitude": 17.564564, "latitude": 47.633181, "width": 500, "height": 376, "upload_date": "23 August 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 6620113, "photo_title": "Winterlandschaft - Winter Scenery - Emmental", "photo_url": "http://www.panoramio.com/photo/6620113", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6620113.jpg", "longitude": 7.787676, "latitude": 47.055856, "width": 500, "height": 374, "upload_date": "22 December 2007", "owner_id": 635422, "owner_name": "♫ Swissmay", "owner_url": "http://www.panoramio.com/user/635422"} + , + {"photo_id": 2702545, "photo_title": "Church at Oia, Santorini", "photo_url": "http://www.panoramio.com/photo/2702545", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2702545.jpg", "longitude": 25.376015, "latitude": 36.461330, "width": 375, "height": 500, "upload_date": "11 June 2007", "owner_id": 555551, "owner_name": "Marilyn Whiteley", "owner_url": "http://www.panoramio.com/user/555551"} + , + {"photo_id": 416472, "photo_title": "Ice Crystal Clouds", "photo_url": "http://www.panoramio.com/photo/416472", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/416472.jpg", "longitude": -105.650969, "latitude": 40.294126, "width": 500, "height": 374, "upload_date": "13 January 2007", "owner_id": 87752, "owner_name": "Richard Ryer", "owner_url": "http://www.panoramio.com/user/87752"} + , + {"photo_id": 6080988, "photo_title": "Zion Tree (HDR)", "photo_url": "http://www.panoramio.com/photo/6080988", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/6080988.jpg", "longitude": -112.946116, "latitude": 37.213331, "width": 500, "height": 333, "upload_date": "23 November 2007", "owner_id": 17488, "owner_name": "John Gillett", "owner_url": "http://www.panoramio.com/user/17488"} + , + {"photo_id": 2321382, "photo_title": "Old Wreck at Bannack", "photo_url": "http://www.panoramio.com/photo/2321382", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/2321382.jpg", "longitude": -112.997518, "latitude": 45.162614, "width": 500, "height": 375, "upload_date": "21 May 2007", "owner_id": 71099, "owner_name": "Eve in Montana", "owner_url": "http://www.panoramio.com/user/71099"} + , + {"photo_id": 122858, "photo_title": "Antelope Canyon - Page, Arizona", "photo_url": "http://www.panoramio.com/photo/122858", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/122858.jpg", "longitude": -111.399908, "latitude": 36.887447, "width": 332, "height": 500, "upload_date": "12 December 2006", "owner_id": 20332, "owner_name": "RJ", "owner_url": "http://www.panoramio.com/user/20332"} + , + {"photo_id": 4445933, "photo_title": "Tavi alkony", "photo_url": "http://www.panoramio.com/photo/4445933", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/4445933.jpg", "longitude": 17.465172, "latitude": 47.864486, "width": 500, "height": 350, "upload_date": "06 September 2007", "owner_id": 109117, "owner_name": "Busa Péter", "owner_url": "http://www.panoramio.com/user/109117"} + , + {"photo_id": 1238515, "photo_title": "EDEN", "photo_url": "http://www.panoramio.com/photo/1238515", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/1238515.jpg", "longitude": -83.677711, "latitude": 22.661542, "width": 500, "height": 345, "upload_date": "09 March 2007", "owner_id": 232099, "owner_name": "mabut", "owner_url": "http://www.panoramio.com/user/232099"} + , + {"photo_id": 398585, "photo_title": "Near Glittertind", "photo_url": "http://www.panoramio.com/photo/398585", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/398585.jpg", "longitude": 8.489170, "latitude": 61.621820, "width": 500, "height": 333, "upload_date": "12 January 2007", "owner_id": 78506, "owner_name": "Philippe Stoop", "owner_url": "http://www.panoramio.com/user/78506"} + , + {"photo_id": 10240311, "photo_title": "two planes", "photo_url": "http://www.panoramio.com/photo/10240311", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/10240311.jpg", "longitude": 20.306683, "latitude": 49.750107, "width": 332, "height": 500, "upload_date": "15 May 2008", "owner_id": 454219, "owner_name": "Rafal Ociepka", "owner_url": "http://www.panoramio.com/user/454219"} + , + {"photo_id": 7593894, "photo_title": "æ¡‚æž—å胜百景——é‡é¾™æ²³", "photo_url": "http://www.panoramio.com/photo/7593894", "photo_file_url": "http://mw2.google.com/mw-panoramio/photos/medium/7593894.jpg", "longitude": 110.424957, "latitude": 24.781747, "width": 500, "height": 375, "upload_date": "04 February 2008", "owner_id": 161470, "owner_name": "John Su", "owner_url": "http://www.panoramio.com/user/161470"} + ]}; +} + diff --git a/markerclustererplus/markerclustererplus.d.ts b/markerclustererplus/markerclustererplus.d.ts new file mode 100644 index 000000000..24a2b2636 --- /dev/null +++ b/markerclustererplus/markerclustererplus.d.ts @@ -0,0 +1,834 @@ +// Type definitions for MarkerClustererPlus for Google Maps V3 2.1.1 +// Project: http://github.com/mahnunchik/markerclustererplus +// Definitions by: Mathias Rodriguez +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +/** + * @name ClusterIconStyle + * @class This class represents the object for values in the styles array passed + * to the {@link MarkerClusterer} constructor. The element in this array that is used to + * style the cluster icon is determined by calling the calculator function. + * + * @property {string} url The URL of the cluster icon image file. Required. + * @property {number} height The display height (in pixels) of the cluster icon. Required. + * @property {number} width The display width (in pixels) of the cluster icon. Required. + * @property {Array} [anchorText] The position (in pixels) from the center of the cluster icon to + * where the text label is to be centered and drawn. The format is [yoffset, xoffset] + * where yoffset increases as you go down from center and xoffset + * increases to the right of center. The default is [0, 0]. + * @property {Array} [anchorIcon] The anchor position (in pixels) of the cluster icon. This is the + * spot on the cluster icon that is to be aligned with the cluster position. The format is + * [yoffset, xoffset] where yoffset increases as you go down and + * xoffset increases to the right of the top-left corner of the icon. The default + * anchor position is the center of the cluster icon. + * @property {string} [textColor="black"] The color of the label text shown on the + * cluster icon. + * @property {number} [textSize=11] The size (in pixels) of the label text shown on the + * cluster icon. + * @property {string} [textDecoration="none"] The value of the CSS text-decoration + * property for the label text shown on the cluster icon. + * @property {string} [fontWeight="bold"] The value of the CSS font-weight + * property for the label text shown on the cluster icon. + * @property {string} [fontStyle="normal"] The value of the CSS font-style + * property for the label text shown on the cluster icon. + * @property {string} [fontFamily="Arial,sans-serif"] The value of the CSS font-family + * property for the label text shown on the cluster icon. + * @property {string} [backgroundPosition="0 0"] The position of the cluster icon image + * within the image defined by url. The format is "xpos ypos" + * (the same format as for the CSS background-position property). You must set + * this property appropriately when the image defined by url represents a sprite + * containing multiple images. Note that the position must be specified in px units. + */ + +declare class ClusterIconStyle { + url: string; + height: number; + width: number; + anchorText: number[]; + anchorIcon: number[]; + textColor: string; + textSize: number; + textDecoration: string; + fontWeight: string; + fontStyle: string; + fontFamily: string; + backgroundPosition: string; +} + +/** + * @name ClusterIconInfo + * @class This class is an object containing general information about a cluster icon. This is + * the object that a calculator function returns. + * + * @property {string} text The text of the label to be shown on the cluster icon. + * @property {number} index The index plus 1 of the element in the styles + * array to be used to style the cluster icon. + * @property {string} title The tooltip to display when the mouse moves over the cluster icon. + * If this value is undefined or "", title is set to the + * value of the title property passed to the MarkerClusterer. + */ + +declare class ClusterIconInfo extends google.maps.OverlayView { + text: string; + index: number; + title: string; + /** + * A cluster icon. + * + * @constructor + * @extends google.maps.OverlayView + * @param {Cluster} cluster The cluster with which the icon is to be associated. + * @param {Array} [styles] An array of {@link ClusterIconStyle} defining the cluster icons + * to use for various cluster sizes. + * @private + */ + constructor(cluster: Cluster, styles: ClusterIconStyle[]); + + /** + * Adds the icon to the DOM. + */ + onAdd(): void; + + /** + * Removes the icon from the DOM. + */ + onRemove(): void; + + /** + * Draws the icon. + */ + draw(): void; + + /** + * Hides the icon. + */ + hide(): void; + + /** + * Positions and shows the icon. + */ + show(): void; + + /** + * Sets the icon styles to the appropriate element in the styles array. + * + * @param {ClusterIconInfo} sums The icon label text and styles index. + */ + useStyle(sums: ClusterIconInfo[]): void; + + /** + * Sets the position at which to center the icon. + * + * @param {google.maps.LatLng} center The latlng to set as the center. + */ + setCenter(center: google.maps.LatLng): void; + + /** + * Creates the cssText style parameter based on the position of the icon. + * + * @param {google.maps.Point} pos The position of the icon. + * @return {string} The CSS style text. + */ + createCss(pos: google.maps.Point): string; + + /** + * Returns the position at which to place the DIV depending on the latlng. + * + * @param {google.maps.LatLng} latlng The position in latlng. + * @return {google.maps.Point} The position in pixels. + */ + getPosFromLatLng_(latLng: google.maps.LatLng): google.maps.Point; +} + +interface Cluster { + /** + * Creates a single cluster that manages a group of proximate markers. + * Used internally, do not call this constructor directly. + * @constructor + * @param {MarkerClusterer} mc The MarkerClusterer object with which this + * cluster is associated. + */ + new (mc: MarkerClusterer): Cluster; + + /** + * Returns the number of markers managed by the cluster. You can call this from + * a click, mouseover, or mouseout event handler + * for the MarkerClusterer object. + * + * @return {number} The number of markers in the cluster. + */ + getSize(): number; + + /** + * Returns the array of markers managed by the cluster. You can call this from + * a click, mouseover, or mouseout event handler + * for the MarkerClusterer object. + * + * @return {Array} The array of markers in the cluster. + */ + getMarkers(): google.maps.Marker[]; + + /** + * Returns the center of the cluster. You can call this from + * a click, mouseover, or mouseout event handler + * for the MarkerClusterer object. + * + * @return {google.maps.LatLng} The center of the cluster. + */ + getCenter(): google.maps.LatLng; + + /** + * Returns the map with which the cluster is associated. + * + * @return {google.maps.Map} The map. + * @ignore + */ + getMap(): google.maps.Map; + + /** + * Returns the MarkerClusterer object with which the cluster is associated. + * + * @return {MarkerClusterer} The associated marker clusterer. + * @ignore + */ + getMarkerClusterer(): MarkerClusterer; + + /** + * Returns the bounds of the cluster. + * + * @return {google.maps.LatLngBounds} the cluster bounds. + * @ignore + */ + getBounds(): google.maps.LatLngBounds; + + /** + * Removes the cluster from the map. + * + * @ignore + */ + remove(): void; + + /** + * Adds a marker to the cluster. + * + * @param {google.maps.Marker} marker The marker to be added. + * @return {boolean} True if the marker was added. + * @ignore + */ + addMarker(marker: google.maps.Marker): boolean; + + /** + * Determines if a marker lies within the cluster's bounds. + * + * @param {google.maps.Marker} marker The marker to check. + * @return {boolean} True if the marker lies in the bounds. + * @ignore + */ + isMarkerInClusterBounds(marker: google.maps.Marker): boolean; + + /** + * Calculates the extended bounds of the cluster with the grid. + */ + calculateBounds_(): void; + + /** + * Updates the cluster icon. + */ + updateIcon_(): void; + + /** + * Determines if a marker has already been added to the cluster. + * + * @param {google.maps.Marker} marker The marker to check. + * @return {boolean} True if the marker has already been added. + */ + isMarkerAlreadyAdded_(marker: google.maps.Marker): boolean; +} + +/** + * @name MarkerClustererOptions + * @class This class represents the optional parameter passed to + * the {@link MarkerClusterer} constructor. + * @property {number} [gridSize=60] The grid size of a cluster in pixels. The grid is a square. + * @property {number} [maxZoom=null] The maximum zoom level at which clustering is enabled or + * null if clustering is to be enabled at all zoom levels. + * @property {boolean} [zoomOnClick=true] Whether to zoom the map when a cluster marker is + * clicked. You may want to set this to false if you have installed a handler + * for the click event and it deals with zooming on its own. + * @property {boolean} [averageCenter=false] Whether the position of a cluster marker should be + * the average position of all markers in the cluster. If set to false, the + * cluster marker is positioned at the location of the first marker added to the cluster. + * @property {number} [minimumClusterSize=2] The minimum number of markers needed in a cluster + * before the markers are hidden and a cluster marker appears. + * @property {boolean} [ignoreHidden=false] Whether to ignore hidden markers in clusters. You + * may want to set this to true to ensure that hidden markers are not included + * in the marker count that appears on a cluster marker (this count is the value of the + * text property of the result returned by the default calculator). + * If set to true and you change the visibility of a marker being clustered, be + * sure to also call MarkerClusterer.repaint(). + * @property {string} [title=""] The tooltip to display when the mouse moves over a cluster + * marker. (Alternatively, you can use a custom calculator function to specify a + * different tooltip for each cluster marker.) + * @property {function} [calculator=MarkerClusterer.CALCULATOR] The function used to determine + * the text to be displayed on a cluster marker and the index indicating which style to use + * for the cluster marker. The input parameters for the function are (1) the array of markers + * represented by a cluster marker and (2) the number of cluster icon styles. It returns a + * {@link ClusterIconInfo} object. The default calculator returns a + * text property which is the number of markers in the cluster and an + * index property which is one higher than the lowest integer such that + * 10^i exceeds the number of markers in the cluster, or the size of the styles + * array, whichever is less. The styles array element used has an index of + * index minus 1. For example, the default calculator returns a + * text value of "125" and an index of 3 + * for a cluster icon representing 125 markers so the element used in the styles + * array is 2. A calculator may also return a title + * property that contains the text of the tooltip to be used for the cluster marker. If + * title is not defined, the tooltip is set to the value of the title + * property for the MarkerClusterer. + * @property {string} [clusterClass="cluster"] The name of the CSS class defining general styles + * for the cluster markers. Use this class to define CSS styles that are not set up by the code + * that processes the styles array. + * @property {Array} [styles] An array of {@link ClusterIconStyle} elements defining the styles + * of the cluster markers to be used. The element to be used to style a given cluster marker + * is determined by the function defined by the calculator property. + * The default is an array of {@link ClusterIconStyle} elements whose properties are derived + * from the values for imagePath, imageExtension, and + * imageSizes. + * @property {boolean} [enableRetinaIcons=false] Whether to allow the use of cluster icons that + * have sizes that are some multiple (typically double) of their actual display size. Icons such + * as these look better when viewed on high-resolution monitors such as Apple's Retina displays. + * Note: if this property is true, sprites cannot be used as cluster icons. + * @property {number} [batchSize=MarkerClusterer.BATCH_SIZE] Set this property to the + * number of markers to be processed in a single batch when using a browser other than + * Internet Explorer (for Internet Explorer, use the batchSizeIE property instead). + * @property {number} [batchSizeIE=MarkerClusterer.BATCH_SIZE_IE] When Internet Explorer is + * being used, markers are processed in several batches with a small delay inserted between + * each batch in an attempt to avoid Javascript timeout errors. Set this property to the + * number of markers to be processed in a single batch; select as high a number as you can + * without causing a timeout error in the browser. This number might need to be as low as 100 + * if 15,000 markers are being managed, for example. + * @property {string} [imagePath=MarkerClusterer.IMAGE_PATH] + * The full URL of the root name of the group of image files to use for cluster icons. + * The complete file name is of the form imagePathn.imageExtension + * where n is the image file number (1, 2, etc.). + * @property {string} [imageExtension=MarkerClusterer.IMAGE_EXTENSION] + * The extension name for the cluster icon image files (e.g., "png" or + * "jpg"). + * @property {Array} [imageSizes=MarkerClusterer.IMAGE_SIZES] + * An array of numbers containing the widths of the group of + * imagePathn.imageExtension image files. + * (The images are assumed to be square.) + **/ +interface MarkerClustererOptions { + gridSize: number; + maxZoom: number; + zoomOnClick: boolean; + averageCenter: boolean; + minimumClusterSize: number; + ignoreHidden: boolean; + title: string; + calculator(): Function; + clusterClass: string; + styles: ClusterIconStyle[]; + enableRetinaIcons: boolean; + batchSize: number; + batchSizeIE: number; + imagePath: string; + imageExtension: string; + imageSizes: number[]; +} + +interface MarkerClusterer extends google.maps.OverlayView { + /** + * Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}. + * @constructor + * @extends google.maps.OverlayView + * @param {google.maps.Map} map The Google map to attach to. + * @param {Array.} [opt_markers] The markers to be added to the cluster. + * @param {MarkerClustererOptions} [opt_options] The optional parameters. + */ + new (map: google.maps.Map, opt_markers: google.maps.Marker[], opt_options?: MarkerClustererOptions): MarkerClusterer; + + /** + * Implementation of the onAdd interface method. + * @ignore + */ + onAdd(): void; + + /** + * Implementation of the onRemove interface method. + * Removes map event listeners and all cluster icons from the DOM. + * All managed markers are also put back on the map. + * @ignore + */ + onRemove(): void; + + /** + * Implementation of the draw interface method. + * @ignore + */ + draw(): void; + + /** + * Sets up the styles object. + */ + setupStyles_(): void; + + /** + * Fits the map to the bounds of the markers managed by the clusterer. + */ + fitMapToMarkers(): void; + + /** + * Returns the value of the gridSize property. + * + * @return {number} The grid size. + */ + getGridSize(): number; + + /** + * Sets the value of the gridSize property. + * + * @param {number} gridSize The grid size. + */ + setGridSize(gridSize: number): void; + + /** + * Returns the value of the minimumClusterSize property. + * + * @return {number} The minimum cluster size. + */ + getMinimumClusterSize(): number; + + /** + * Sets the value of the minimumClusterSize property. + * + * @param {number} minimumClusterSize The minimum cluster size. + */ + setMinimumClusterSize(minimumClusterSize: number): void; + + /** + * Returns the value of the maxZoom property. + * + * @return {number} The maximum zoom level. + */ + getMaxZoom(): number; + + /** + * Sets the value of the maxZoom property. + * + * @param {number} maxZoom The maximum zoom level. + */ + setMaxZoom(maxZoom: number): void; + + /** + * Returns the value of the styles property. + * + * @return {Array} The array of styles defining the cluster markers to be used. + */ + getStyles(): ClusterIconStyle[]; + + /** + * Sets the value of the styles property. + * + * @param {Array.} styles The array of styles to use. + */ + setStyles(styles: ClusterIconStyle[]): void; + + /** + * Returns the value of the title property. + * + * @return {string} The content of the title text. + */ + getTitle(): string; + + /** + * Sets the value of the title property. + * + * @param {string} title The value of the title property. + */ + setTitle(title: string): void; + + /** + * Returns the value of the zoomOnClick property. + * + * @return {boolean} True if zoomOnClick property is set. + */ + getZoomOnClick(): boolean; + + /** + * Sets the value of the zoomOnClick property. + * + * @param {boolean} zoomOnClick The value of the zoomOnClick property. + */ + setZoomOnClick(zoomOnClick: boolean): void; + + /** + * Returns the value of the averageCenter property. + * + * @return {boolean} True if averageCenter property is set. + */ + getAverageCenter(): boolean; + + /** + * Sets the value of the averageCenter property. + * + * @param {boolean} averageCenter The value of the averageCenter property. + */ + setAverageCenter(averageCenter: boolean): void; + + /** + * Returns the value of the ignoreHidden property. + * + * @return {boolean} True if ignoreHidden property is set. + */ + getIgnoreHidden(): boolean; + + /** + * Sets the value of the ignoreHidden property. + * + * @param {boolean} ignoreHidden The value of the ignoreHidden property. + */ + setIgnoreHidden(ignoreHidden: boolean): void; + + /** + * Returns the value of the enableRetinaIcons property. + * + * @return {boolean} True if enableRetinaIcons property is set. + */ + getEnableRetinaIcons(): boolean; + + /** + * Sets the value of the enableRetinaIcons property. + * + * @param {boolean} enableRetinaIcons The value of the enableRetinaIcons property. + */ + setEnableRetinaIcons(enableRetinaIcons: boolean): void; + + /** + * Returns the value of the imageExtension property. + * + * @return {string} The value of the imageExtension property. + */ + getImageExtension(): string; + + /** + * Sets the value of the imageExtension property. + * + * @param {string} imageExtension The value of the imageExtension property. + */ + setImageExtension(imageExtension: string): void; + + /** + * Returns the value of the imagePath property. + * + * @return {string} The value of the imagePath property. + */ + getImagePath(): string; + + /** + * Sets the value of the imagePath property. + * + * @param {string} imagePath The value of the imagePath property. + */ + setImagePath(imagePath: string): void; + + /** + * Returns the value of the imageSizes property. + * + * @return {Array} The value of the imageSizes property. + */ + getImageSizes(): number[]; + + /** + * Sets the value of the imageSizes property. + * + * @param {Array} imageSizes The value of the imageSizes property. + */ + setImageSizes(imageSizes: number[]): void; + + /** + * Returns the value of the calculator property. + * + * @return {function} the value of the calculator property. + */ + getCalculator(): Function; + + /** + * Sets the value of the calculator property. + * + * @param {function(Array., number)} calculator The value + * of the calculator property. + */ + setCalculator(calculator: (marker: google.maps.Marker, value: number) => Function): void; + + /** + * Sets the value of the hideLabel property. + * + * @param {boolean} printable The value of the hideLabel property. + */ + setHideLabel(printable: boolean): void; + + /** + * Returns the value of the hideLabel property. + * + * @return {boolean} the value of the hideLabel property. + */ + getHideLabel(): boolean; + + /** + * Returns the value of the batchSizeIE property. + * + * @return {number} the value of the batchSizeIE property. + */ + getBatchSizeIE(): number; + + /** + * Sets the value of the batchSizeIE property. + * + * @param {number} batchSizeIE The value of the batchSizeIE property. + */ + setBatchSizeIE(batchSizeIE: number): void; + + /** + * Returns the value of the clusterClass property. + * + * @return {string} the value of the clusterClass property. + */ + getClusterClass(): string; + + /** + * Sets the value of the clusterClass property. + * + * @param {string} clusterClass The value of the clusterClass property. + */ + setClusterClass(clusterClass: string): void; + + /** + * Returns the array of markers managed by the clusterer. + * + * @return {Array} The array of markers managed by the clusterer. + */ + getMarkers(): google.maps.Marker[]; + + /** + * Returns the number of markers managed by the clusterer. + * + * @return {number} The number of markers. + */ + getTotalMarkers(): number; + + /** + * Returns the current array of clusters formed by the clusterer. + * + * @return {Array} The array of clusters formed by the clusterer. + */ + getClusters(): Cluster[]; + + /** + * Returns the number of clusters formed by the clusterer. + * + * @return {number} The number of clusters formed by the clusterer. + */ + getTotalClusters(): number; + + /** + * Adds a marker to the clusterer. The clusters are redrawn unless + * opt_nodraw is set to true. + * + * @param {google.maps.Marker} marker The marker to add. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + */ + addMarker(marker: google.maps.Marker, opt_nodraw: boolean): void; + + /** + * Adds an array of markers to the clusterer. The clusters are redrawn unless + * opt_nodraw is set to true. + * + * @param {Array.} markers The markers to add. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + */ + addMarkers(markers: google.maps.Marker[], opt_nodraw: boolean): void; + + /** + * Pushes a marker to the clusterer. + * + * @param {google.maps.Marker} marker The marker to add. + */ + pushMarkerTo_(marker: google.maps.Marker): void; + + /** + * Removes a marker from the cluster and map. The clusters are redrawn unless + * opt_nodraw is set to true. Returns true if the + * marker was removed from the clusterer. + * + * @param {google.maps.Marker} marker The marker to remove. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + * @param {boolean} [opt_noMapRemove] Set to true to prevent removal from map but still removing from cluster management + * @return {boolean} True if the marker was removed from the clusterer. + */ + removeMarker(marker: google.maps.Marker, opt_nodraw: boolean, noMapRemove: boolean): boolean; + + /** + * Removes an array of markers from the cluster and map. The clusters are redrawn unless + * opt_nodraw is set to true. Returns true if markers + * were removed from the clusterer. + * + * @param {Array.} markers The markers to remove. + * @param {boolean} [opt_nodraw] Set to true to prevent redrawing. + * @param {boolean} [opt_noMapRemove] Set to true to prevent removal from map but still removing from cluster management + * @return {boolean} True if markers were removed from the clusterer. + */ + removeMarkers(markers: google.maps.Marker[], opt_nodraw: boolean, opt_noMapRemove: boolean): boolean; + + /** + * Removes a marker and returns true if removed, false if not. + * + * @param {google.maps.Marker} marker The marker to remove + * @param {boolean} removeFromMap set to true to explicitly remove from map as well as cluster manangement + * @return {boolean} Whether the marker was removed or not + */ + removeMarker_(marker: google.maps.Marker, removeFromMap: boolean): boolean; + + /** + * Removes all clusters and markers from the map and also removes all markers + * managed by the clusterer. + */ + clearMarkers(): void; + + /** + * Recalculates and redraws all the marker clusters from scratch. + * Call this after changing any properties. + */ + repaint(): void; + + /** + * Returns the current bounds extended by the grid size. + * + * @param {google.maps.LatLngBounds} bounds The bounds to extend. + * @return {google.maps.LatLngBounds} The extended bounds. + * @ignore + */ + getExtendedBounds(bounds: google.maps.LatLngBounds): google.maps.LatLngBounds; + + /** + * Redraws all the clusters. + */ + redraw_(): void; + + /** + * Removes all clusters from the map. The markers are also removed from the map + * if opt_hide is set to true. + * + * @param {boolean} [opt_hide] Set to true to also remove the markers + * from the map. + */ + resetViewport_(opt_hide: boolean): void; + + /** + * Calculates the distance between two latlng locations in km. + * + * @param {google.maps.LatLng} p1 The first lat lng point. + * @param {google.maps.LatLng} p2 The second lat lng point. + * @return {number} The distance between the two points in km. + * @see http://www.movable-type.co.uk/scripts/latlong.html + */ + distanceBetweenPoints_(p1: google.maps.LatLng, p2: google.maps.LatLng): number; + + /** + * Determines if a marker is contained in a bounds. + * + * @param {google.maps.Marker} marker The marker to check. + * @param {google.maps.LatLngBounds} bounds The bounds to check against. + * @return {boolean} True if the marker is in the bounds. + */ + isMarkerInBounds_(marker: google.maps.Marker, bounds: google.maps.LatLngBounds): boolean; + + /** + * Adds a marker to a cluster, or creates a new cluster. + * + * @param {google.maps.Marker} marker The marker to add. + */ + addToClosestCluster_(marker: google.maps.Marker): void; + + /** + * Creates the clusters. This is done in batches to avoid timeout errors + * in some browsers when there is a huge number of markers. + * + * @param {number} iFirst The index of the first marker in the batch of + * markers to be added to clusters. + */ + createClusters_(iFirst: number): void; + + /** + * Extends an object's prototype by another's. + * + * @param {Object} obj1 The object to be extended. + * @param {Object} obj2 The object to extend with. + * @return {Object} The new extended object. + * @ignore + */ + extend(obj1: Object, obj2: Object): Object; + + /** + * The default function for determining the label text and style + * for a cluster icon. + * + * @param {Array.} markers The array of markers represented by the cluster. + * @param {number} numStyles The number of marker styles available. + * @return {ClusterIconInfo} The information resource for the cluster. + * @constant + * @ignore + */ + CALCULATOR(markers: google.maps.Marker[], numStyles: number): ClusterIconInfo; + + /** + * The number of markers to process in one batch. + * + * @type {number} + * @constant + */ + BATCH_SIZE: number; + + /** + * The number of markers to process in one batch (IE only). + * + * @type {number} + * @constant + */ + BATCH_SIZE_IE: number; + + /** + * The default root name for the marker cluster images. + * + * @type {string} + * @constant + */ + IMAGE_PATH: string; + + /** + * The default extension name for the marker cluster images. + * + * @type {string} + * @constant + */ + IMAGE_EXTENSION: string; + + /** + * The default array of sizes for the marker cluster images. + * + * @type {Array.} + * @constant + */ + IMAGE_SIZES: number[]; + +} + +declare var MarkerClusterer: MarkerClusterer; + +interface String { + trim(): string; +} From 0242bb8147de010b2d847175cec9edd9191fa570 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Date: Sun, 24 May 2015 19:39:37 -0300 Subject: [PATCH 285/534] defs + tests from examples --- hashids/hashids-test.ts | 19 +++++++++++++++++++ hashids/hashids.d.ts | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 hashids/hashids-test.ts create mode 100644 hashids/hashids.d.ts diff --git a/hashids/hashids-test.ts b/hashids/hashids-test.ts new file mode 100644 index 000000000..9e51c8b8a --- /dev/null +++ b/hashids/hashids-test.ts @@ -0,0 +1,19 @@ +/// + +/* require hashids */ +import Hashids = require("hashids"); + +/* creating class object */ +var hashids = new Hashids("this is my salt"); + +/* encoding several numbers into one id */ +var id = hashids.encode(1337, 5, 77, 12345678); +id = hashids.encode(1337); +id = hashids.encode(45, 434, 1313, 99); + +/* decoding that id */ +var numbers = hashids.decode(id); +numbers.length > 0 ? true : false; + +hashids = new Hashids("this is my salt", 0, "abcdefgh123456789"); +hashids = new Hashids("this is my salt", 8); diff --git a/hashids/hashids.d.ts b/hashids/hashids.d.ts new file mode 100644 index 000000000..9a98259b0 --- /dev/null +++ b/hashids/hashids.d.ts @@ -0,0 +1,36 @@ +// Type definitions for Hashids.js 1.x +// Project: https://github.com/ivanakimov/hashids.node.js +// Definitions by: Paulo Cesar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Hashids { + + export interface IHashids { + new(salt: string, minHashLength?: number, alphabet?: string): IHashids; + version: string; + minAlphabetLength: number; + sepDiv: number; + guardDiv: number; + errorAlphabetLength: string; + errorAlphabetSpace: string; + alphabet: string[]; + seps: string; + minHashLength: number; + salt: string; + decode(hash: string): number[]; + encode(arg: number): string; + encode(arg: number[]): string; + encode(...args: number[]): string; + encodeHex(str: string): string; + decodeHex(hash: string): string; + hash(input: number, alphabet: string): string; + unhash(input: string[], alphabet: string): number; + } +} + +declare module 'hashids' { + var hashids: Hashids.IHashids; + export = hashids; +} \ No newline at end of file From 550e5bfee2c882c2641967325c14ac935d0e6e68 Mon Sep 17 00:00:00 2001 From: Seulgi Kim Date: Fri, 22 May 2015 23:23:59 +0900 Subject: [PATCH 286/534] Add declaration for mpromise --- mpromise/mpromise-tests.ts | 134 +++++++++++++++++++++++++++++++++++++ mpromise/mpromise.d.ts | 42 ++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 mpromise/mpromise-tests.ts create mode 100644 mpromise/mpromise.d.ts diff --git a/mpromise/mpromise-tests.ts b/mpromise/mpromise-tests.ts new file mode 100644 index 000000000..cb09df475 --- /dev/null +++ b/mpromise/mpromise-tests.ts @@ -0,0 +1,134 @@ +/// +/// + +var assert = require('assert'); +import Promise = require('mpromise'); + +function ex1() { + var promise = new Promise; +} + +function ex2() { + var promise = new Promise (function(reason: string, ...args: number[]) { + return; + }); +} + +function ex3() { + var promise = new Promise(); + promise.onResolve(function(reason: string, ...args: number[]) { + return; + }); +} + +function fulfill() { + var promise = new Promise(); + promise.fulfill(1, 2, 3); +} + +function reject() { + var promise = new Promise(); + promise.reject('reason'); +} + +function onFulfill1() { + var promise = new Promise(); + promise.onFulfill(function (...args: number[]) { + assert.equal(3, args[0] + args[1]); + }); + promise.fulfill(1, 2); +} + +function onFulfill2() { + var promise = new Promise(); + promise.fulfill(" :D "); + promise.onFulfill(function (arg: string) { + console.log(arg); // logs " :D " + }); +} + +function onReject1() { + var promise = new Promise(); + promise.onReject(function (reason: string) { + assert.equal('sad', reason); + }); + promise.reject('sad'); +} + +function onReject2() { + var promise = new Promise(); + promise.reject(" :( "); + promise.onReject(function (reason: string) { + console.log(reason); // logs " :( " + }); +} + +function onResolve1() { + var promise = new Promise(); + promise.onResolve(function (err: R, ...args: number[]) { + console.log(args[0] + args[1]); // logs 3 + }); + promise.fulfill(1, 2); +} + +function onResolve2() { + // rejection + var promise = new Promise(); + promise.onResolve(function (err: Error) { + if (err) { + console.log(err.message); // logs "failed" + } + }); + promise.reject(new Error('failed')); +} + +function then() { + var promise = new Promise(); + + promise.then(function (arg: number) { + return arg + 1; + }).then(function (arg: number) { + throw new Error(arg + ' is an error!'); + }).then(null, function (err: Error) { + assert.ok(err instanceof Error); + assert.equal('2 is an error', err.message); + }); + promise.fulfill(1); +} + +function end1() { + var promise = new Promise(); + promise.then(function(){ throw new Error('shucks') }); + setTimeout(function () { + promise.fulfill(); + // error was caught and swallowed by the promise returned from + // p.then(). we either have to always register handlers on + // the returned promises or we can do the following... + }, 10); +} + +function end2() { + // this time we use .end() which prevents catching thrown errors + var promise = new Promise(); + setTimeout(function () { + promise.fulfill(); // throws "shucks" + }, 10); + return promise.then(function(){ throw new Error('shucks') }).end(); // <-- +} + +function chain() { + function makeMeAPromise(i: number) { + var p = new Promise(); + p.fulfill(i); + return p; + } + + var initialPromise = new Promise(); + var returnPromise = initialPromise; + for (var i=0; i<10; ++i) { + returnPromise = returnPromise.chain(makeMeAPromise(i)); + } + + initialPromise.fulfill(); + return returnPromise; +} diff --git a/mpromise/mpromise.d.ts b/mpromise/mpromise.d.ts new file mode 100644 index 000000000..ba6961362 --- /dev/null +++ b/mpromise/mpromise.d.ts @@ -0,0 +1,42 @@ +// Type definitions for mpromise 0.5.4 +// Project: https://github.com/aheckmann/mpromise +// Definitions by: Seulgi Kim +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "mpromise" { + interface IFulfillFunction { + (...args: F[]): void; + (arg: F): void; + } + interface IRejectFunction { + (err: R): void; + } + interface IResolveFunction { + (err: R, ...args: F[]): void; + (err: R, arg: F): void; + } + + class Promise { + constructor(fn?: IResolveFunction); + + static FAILURE: string; + static SUCCESS: string; + + fulfill(...args: F[]): Promise; + fulfill(arg: F): Promise; + reject(reason: R): Promise; + resolve(reason: R, ...args: F[]): Promise; + resolve(reason: R, arg: F): Promise; + + onFulfill(callback: IFulfillFunction): Promise; + onReject(callback: IRejectFunction): Promise; + onResolve(callback: IResolveFunction): Promise; + + then(onFulfilled: IFulfillFunction, onRejected?: IRejectFunction): Promise; + end(): void; + + chain(promise: Promise): Promise; + } + + export = Promise; +} From 1f0b864b9d63574481c8ab39c84ca8378a6dce9c Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 00:17:41 -0300 Subject: [PATCH 287/534] Add definitions for the Piwik NodeJS tracker Piwik.org is a tracker similar to Google Analitics, but can run on your own server. These definitions are for the node api. --- piwik-tracker/piwik-tracker.d.ts | 91 ++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 piwik-tracker/piwik-tracker.d.ts diff --git a/piwik-tracker/piwik-tracker.d.ts b/piwik-tracker/piwik-tracker.d.ts new file mode 100644 index 000000000..a1c18b627 --- /dev/null +++ b/piwik-tracker/piwik-tracker.d.ts @@ -0,0 +1,91 @@ +// Type definitions for PiwikTracker v0.1.1 +// Project: http://piwik.org - https://www.npmjs.com/package/piwik-tracker +// Definitions by: Guilherme Bernal +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "piwik-tracker" { + + export = PiwikTracker; + + // refer to http://developer.piwik.org/api-reference/tracking-api + interface PiwikTrackOptions { + // Required parameters + url : string; + + // Recommended parameters + action_name? : string; + _id? : string; + rand? : string; + apiv? : number; + + // Optional User info + urlref? : string; + _cvar? : string; + _idvc? : string; + _viewts? : string; + _idts? : string; + _rcn? : string; + _rck? : string; + res? : string; + h? : number; + m? : number; + s? : number; + ua? : string; + lang? : string; + uid? : string; + cid? : string; + new_visit? : number; + + // Optional Action info + cvar? : string; + link? : string; + download? : string; + search? : string; + search_cat? : string; + search_count? : number; + idgoal? : number; + revenue? : number; + gt_ms? : number; + cs? : string; + + // Optional Event Tracking info + e_c? : string; + e_a? : string; + e_n? : string; + e_v? : string; + + // Optional Content Tracking info + c_n? : string; + c_p? : string; + c_t? : string; + c_i? : string; + + // Optional Ecommerce info + ec_id? : string; + ec_items? : string; + ec_st? : number; + ec_tx? : number; + ec_sh? : number; + ec_dt? : number; + _ects? : number; + + // Other parameters (require authentication via token_auth) + token_auth? : string; + cip? : string; + cdt? : string; + country? : string; + region? : string; + city? : string; + lat? : string; + long? : string; + + // Other parameters + send_image? : number; + } + + class PiwikTracker { + constructor(siteId : number, trackerUrl : string); + track(options : PiwikTrackOptions) : void; + } + +} From ca873b08a38c57559d4eebe949737710343dd177 Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 00:23:31 -0300 Subject: [PATCH 288/534] piwik-tracker: Update project url --- piwik-tracker/piwik-tracker.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piwik-tracker/piwik-tracker.d.ts b/piwik-tracker/piwik-tracker.d.ts index a1c18b627..ddb1ae133 100644 --- a/piwik-tracker/piwik-tracker.d.ts +++ b/piwik-tracker/piwik-tracker.d.ts @@ -1,5 +1,5 @@ // Type definitions for PiwikTracker v0.1.1 -// Project: http://piwik.org - https://www.npmjs.com/package/piwik-tracker +// Project: https://www.npmjs.com/package/piwik-tracker // Definitions by: Guilherme Bernal // Definitions: https://github.com/borisyankov/DefinitelyTyped From 16c6bbf0c9771581b4a01ea7b0c13ee8ec283772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Mon, 25 May 2015 08:11:12 +0200 Subject: [PATCH 289/534] express: Request.host deprecated, use .hostname --- express/express.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/express/express.d.ts b/express/express.d.ts index 0a7aa0057..0bd42b82f 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -349,6 +349,11 @@ declare module "express" { /** * Parse the "Host" header field hostname. */ + hostname: string; + + /** + * @deprecated Use hostname instead. + */ host: string; /** From f68c7d8664642406b9f79bb182dca39e22da6acc Mon Sep 17 00:00:00 2001 From: Tysonzero Date: Mon, 25 May 2015 00:17:20 -0600 Subject: [PATCH 290/534] Rename inputmask function to mask --- maskedinput/maskedinput-tests.ts | 6 +++--- maskedinput/maskedinput.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/maskedinput/maskedinput-tests.ts b/maskedinput/maskedinput-tests.ts index ba9ff33e6..c50387104 100644 --- a/maskedinput/maskedinput-tests.ts +++ b/maskedinput/maskedinput-tests.ts @@ -6,7 +6,7 @@ /// /// -$("#test").inputmask("9:000"); -$("#test").inputmask("9:000", { numeric: true }); +$("#test").mask("9:000"); +$("#test").mask("9:000", { numeric: true }); -var alies = $.inputmask.defaults.aliases; \ No newline at end of file +var alies = $.mask.defaults.aliases; \ No newline at end of file diff --git a/maskedinput/maskedinput.d.ts b/maskedinput/maskedinput.d.ts index 2e918ed66..b099ba326 100644 --- a/maskedinput/maskedinput.d.ts +++ b/maskedinput/maskedinput.d.ts @@ -47,9 +47,9 @@ interface MaskedInputDefaults { } interface JQueryStatic { - inputmask: MaskedInputStatic; + mask: MaskedInputStatic; } interface JQuery { - inputmask(mask: string, options?: JQueryMaskedInputOptions): JQuery; + mask(mask: string, options?: JQueryMaskedInputOptions): JQuery; } \ No newline at end of file From 6a38eeb4bff7b88145b92b188b24a4fa41caeca3 Mon Sep 17 00:00:00 2001 From: Tysonzero Date: Mon, 25 May 2015 00:17:49 -0600 Subject: [PATCH 291/534] Add newlines at end of maskedinput files --- maskedinput/maskedinput-tests.ts | 2 +- maskedinput/maskedinput.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/maskedinput/maskedinput-tests.ts b/maskedinput/maskedinput-tests.ts index c50387104..52d01db21 100644 --- a/maskedinput/maskedinput-tests.ts +++ b/maskedinput/maskedinput-tests.ts @@ -9,4 +9,4 @@ $("#test").mask("9:000"); $("#test").mask("9:000", { numeric: true }); -var alies = $.mask.defaults.aliases; \ No newline at end of file +var alies = $.mask.defaults.aliases; diff --git a/maskedinput/maskedinput.d.ts b/maskedinput/maskedinput.d.ts index b099ba326..cf30fe023 100644 --- a/maskedinput/maskedinput.d.ts +++ b/maskedinput/maskedinput.d.ts @@ -52,4 +52,4 @@ interface JQueryStatic { interface JQuery { mask(mask: string, options?: JQueryMaskedInputOptions): JQuery; -} \ No newline at end of file +} From 179b684deb12f0660ec06ac7d71211dd216c493d Mon Sep 17 00:00:00 2001 From: Ruslan Grabovoy Date: Mon, 25 May 2015 12:57:56 +0300 Subject: [PATCH 292/534] Make errback an optional argument (Squire.js) --- squirejs/squirejs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squirejs/squirejs.d.ts b/squirejs/squirejs.d.ts index 693ca7d90..a6ee7ec20 100644 --- a/squirejs/squirejs.d.ts +++ b/squirejs/squirejs.d.ts @@ -9,7 +9,7 @@ declare module 'Squire' { constructor(context: string); mock(name: string, mock: any): Squire; mock(mocks: {[name: string]: any}): Squire; - require(dependencies: string[], callback: Function, errback: Function): Squire; + require(dependencies: string[], callback: Function, errback?: Function): Squire; store(name: string | string[]): Squire; clean(): Squire; clean(name: string | string[]): Squire; From 4c960b46b3a841bccf7c26b3d575ea45cb97172f Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Fri, 24 Apr 2015 22:20:21 -0400 Subject: [PATCH 293/534] Move to uri namespace --- urijs/URI-tests.ts | 16 ++ urijs/URI.d.ts | 377 +++++++++++++++++++++++++-------------------- 2 files changed, 222 insertions(+), 171 deletions(-) create mode 100644 urijs/URI-tests.ts diff --git a/urijs/URI-tests.ts b/urijs/URI-tests.ts new file mode 100644 index 000000000..4ab69219e --- /dev/null +++ b/urijs/URI-tests.ts @@ -0,0 +1,16 @@ +/// + +new URI(); +new URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); +new URI({ + protocol: 'http', + username: 'user', + password: 'pass', + hostname: 'example.org', + port: '80', + path: '/foo/bar.html', + query: 'foo=bar&bar=baz', + fragment: 'frag' +}); + +var uri: uri.URI = $('a').uri(); diff --git a/urijs/URI.d.ts b/urijs/URI.d.ts index 448365762..2f40b1a46 100644 --- a/urijs/URI.d.ts +++ b/urijs/URI.d.ts @@ -1,186 +1,221 @@ // Type definitions for URI.js // Project: https://github.com/medialize/URI.js -// Definitions by: RodneyJT +// Definitions by: RodneyJT , Brian Surowiec // Definitions: https://github.com/borisyankov/DefinitelyTyped /// -interface URIOptions { - protocol?: string; - username?: string; - password?: string; - hostname?: string; - port?: string; - path?: string; - query?: string; - fragment?: string; -} +declare module uri { -declare class URI { - constructor(); - constructor(uri: string); - constructor(options: URIOptions); - clone(): URI; - href(): string; - href(url: string): void; - valueOf(): string; - scheme(): string; - protocol(): string; - scheme(protocol: string): URI; - protocol(protocol: string): URI; - username(): string; - username(uname: string): URI; - password(): string; - password(pw: string): URI; - port(): string; - port(port: string): URI; - hostname(): string; - hostname(hostname: string): URI; - host(): string; - host(host: string): URI; - userinfo(): string; - userinfo(userinfo: string): URI; - authority(): string; - authority(authority: string): URI; - domain(): string; - domain(domain: boolean): string; - domain(domain: string): URI; - subdomain(): string; - subdomain(subdomain: string): URI; - tld(): string; - tld(tld: boolean): string; - tld(tld: string): URI; - path(): string; - path(path: boolean): string; - path(path: string): URI; - pathname(): string; - pathname(path: boolean): string; - pathname(path: string): URI; - directory(): string; - directory(dir: boolean): string; - directory(dir: string): URI; - filename(): string; - filename(file: boolean): string; - filename(file: string): URI; - suffix(): string; - suffix(suffix: boolean): string; - suffix(suffix: string): URI; - segment(): string[]; - segment(segments: string[]): string; - segment(position: number): string; - segment(position: number, level: string): string; - segment(level: string): string; - search(): string; - search(qry: string): URI; - search(qry: boolean): any; - search(qry: Object): URI; - query(): string; - query(qry: string): URI; - query(qry: boolean): Object; - query(qry: Object): URI; - hash(): string; - hash(hash: string): URI; - fragment(): string; - fragment(fragment: string): URI; - resource(): string; - resource(resource: string): URI; - is(qry: string): boolean; - addSearch(qry: string): URI; - addSearch(qry: Object): URI; - addQuery(qry: string): URI; - addQuery(qry: Object): URI; - removeSearch(qry: string): URI; - removeSearch(qry: Object): URI; - removeQuery(qry: string): URI; - removeQuery(qry: Object): URI; - addFragment(fragment: string): URI; - //fragmentPrefix: string; - fragmentPrefix(prefix: string): URI; - normalize(): URI; - normalizeProtocol(): URI; - normalizeHostname(): URI; - normalizePort(): URI; - normalizePathname(): URI; - normalizePath(): URI; - normalizeSearch(): URI; - normalizeQuery(): URI; - normalizeHash(): URI; - normalizeFragment(): URI; - iso8859(): URI; - unicode(): URI; - readable(): string; - relativeTo(path: string): URI; - absoluteTo(path: string): URI; - equals(): boolean; - equals(url: string): boolean; - static parse(url: string): { - protocol: string; - username: string; - password: string; - hostname: string; - port: string; - path: string; - query: string; - fragment: string; - }; - static parseAuthority(url: string, parts: { + interface URI { + absoluteTo(path: string): URI; + addFragment(fragment: string): URI; + addQuery(qry: string): URI; + addQuery(qry: Object): URI; + addSearch(qry: string): URI; + addSearch(qry: Object): URI; + authority(): string; + authority(authority: string): URI; + + clone(): URI; + + directory(): string; + directory(dir: boolean): string; + directory(dir: string): URI; + domain(): string; + domain(domain: boolean): string; + domain(domain: string): URI; + + equals(): boolean; + equals(url: string): boolean; + + filename(): string; + filename(file: boolean): string; + filename(file: string): URI; + fragment(): string; + fragment(fragment: string): URI; + fragmentPrefix(prefix: string): URI; + + hash(): string; + hash(hash: string): URI; + host(): string; + host(host: string): URI; + hostname(): string; + hostname(hostname: string): URI; + href(): string; + href(url: string): void; + + is(qry: string): boolean; + iso8859(): URI; + + normalize(): URI; + normalizeFragment(): URI; + normalizeHash(): URI; + normalizeHostname(): URI; + normalizePath(): URI; + normalizePathname(): URI; + normalizePort(): URI; + normalizeProtocol(): URI; + normalizeQuery(): URI; + normalizeSearch(): URI; + + password(): string; + password(pw: string): URI; + path(): string; + path(path: boolean): string; + path(path: string): URI; + pathname(): string; + pathname(path: boolean): string; + pathname(path: string): URI; + port(): string; + port(port: string): URI; + protocol(): string; + protocol(protocol: string): URI; + + query(): string; + query(qry: string): URI; + query(qry: boolean): Object; + query(qry: Object): URI; + + readable(): string; + relativeTo(path: string): URI; + removeQuery(qry: string): URI; + removeQuery(qry: Object): URI; + removeSearch(qry: string): URI; + removeSearch(qry: Object): URI; + resource(): string; + resource(resource: string): URI; + + scheme(): string; + scheme(protocol: string): URI; + search(): string; + search(qry: string): URI; + search(qry: boolean): any; + search(qry: Object): URI; + segment(): string[]; + segment(segments: string[]): string; + segment(position: number): string; + segment(position: number, level: string): string; + segment(level: string): string; + subdomain(): string; + subdomain(subdomain: string): URI; + suffix(): string; + suffix(suffix: boolean): string; + suffix(suffix: string): URI; + + tld(): string; + tld(tld: boolean): string; + tld(tld: string): URI; + + unicode(): URI; + userinfo(): string; + userinfo(userinfo: string): URI; + username(): string; + username(uname: string): URI; + + valueOf(): string; + } + + interface URIOptions { + protocol?: string; username?: string; password?: string; hostname?: string; port?: string; - }): string; - static parseUserinfo(url: string, parts: { - username?: string; - password?: string; - }): string; - static parseHost(url: string, parts: { - hostname?: string; - port?: string; - }): string; - static parseQuery(url: string): Object; - static build(parts: { - protocol: string; - username: string; - password: string; - hostname: string; - port: string; - path: string; - query: string; - fragment: string; - }): string; - static buildAuthority(parts: { - username?: string; - password?: string; - hostname?: string; - port?: string; - }): string; - static buildUserinfo(parts: { - username?: string; - password?: string; - }): string; - static buildHost(parts: { - hostname?: string; - port?: string; - }): string; - static buildQuery(qry: Object): string; - static buildQuery(qry: Object, duplicates: boolean): string; - static encode(str: string): string; - static decode(str: string): string; - static encodeReserved(str: string): string; - static encodeQuery(qry: string): string; - static decodeQuery(qry: string): string; - static addQuery(data: Object, prop: string, value: string): Object; - static addQuery(data: Object, qryObj: Object): Object; - static removeQuery(data: Object, prop: string, value: string): Object; - static removeQuery(data: Object, props: string[]): Object; - static removeQuery(data: Object, props: Object): Object; - static commonPath(path1: string, path2: string): string; - static withinString(source: string, func: (url: string) => string): string; - static iso8859(): void; - static unicode(): void; - static expand(template: string, vals: Object): URI; + path?: string; + query?: string; + fragment?: string; + } + + interface URIStatic { + new (): URI; + new (value: string | URIOptions): URI; + + addQuery(data: Object, prop: string, value: string): Object; + addQuery(data: Object, qryObj: Object): Object; + + build(parts: { + protocol: string; + username: string; + password: string; + hostname: string; + port: string; + path: string; + query: string; + fragment: string; + }): string; + buildAuthority(parts: { + username?: string; + password?: string; + hostname?: string; + port?: string; + }): string; + buildHost(parts: { + hostname?: string; + port?: string; + }): string; + buildQuery(qry: Object): string; + buildQuery(qry: Object, duplicates: boolean): string; + buildUserinfo(parts: { + username?: string; + password?: string; + }): string; + + commonPath(path1: string, path2: string): string; + + decode(str: string): string; + decodeQuery(qry: string): string; + + encode(str: string): string; + encodeQuery(qry: string): string; + encodeReserved(str: string): string; + expand(template: string, vals: Object): URI; + + iso8859(): void; + + parse(url: string): { + protocol: string; + username: string; + password: string; + hostname: string; + port: string; + path: string; + query: string; + fragment: string; + }; + parseAuthority(url: string, parts: { + username?: string; + password?: string; + hostname?: string; + port?: string; + }): string; + parseHost(url: string, parts: { + hostname?: string; + port?: string; + }): string; + parseQuery(url: string): Object; + parseUserinfo(url: string, parts: { + username?: string; + password?: string; + }): string; + + removeQuery(data: Object, prop: string, value: string): Object; + removeQuery(data: Object, props: string[]): Object; + removeQuery(data: Object, props: Object): Object; + + unicode(): void; + + withinString(source: string, func: (url: string) => string): string; + } + } interface JQuery { - uri(): URI; + uri(): uri.URI; +} + +declare var URI: uri.URIStatic; + +declare module 'URI' { + export = URI; } From 74eeac855c6e93bc6a780700cc06ba0b5059ae0a Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Fri, 24 Apr 2015 22:21:50 -0400 Subject: [PATCH 294/534] Add support for URI() --- urijs/URI-tests.ts | 13 +++++++++++++ urijs/URI.d.ts | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/urijs/URI-tests.ts b/urijs/URI-tests.ts index 4ab69219e..75e999140 100644 --- a/urijs/URI-tests.ts +++ b/urijs/URI-tests.ts @@ -1,5 +1,18 @@ /// +URI(); +URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); +URI({ + protocol: 'http', + username: 'user', + password: 'pass', + hostname: 'example.org', + port: '80', + path: '/foo/bar.html', + query: 'foo=bar&bar=baz', + fragment: 'frag' +}); + new URI(); new URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); new URI({ diff --git a/urijs/URI.d.ts b/urijs/URI.d.ts index 2f40b1a46..b140df400 100644 --- a/urijs/URI.d.ts +++ b/urijs/URI.d.ts @@ -1,4 +1,4 @@ -// Type definitions for URI.js +// Type definitions for URI.js 1.15.1 // Project: https://github.com/medialize/URI.js // Definitions by: RodneyJT , Brian Surowiec // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -128,6 +128,9 @@ declare module uri { } interface URIStatic { + (): URI; + (value: string | URIOptions): URI; + new (): URI; new (value: string | URIOptions): URI; From e15a4e3df3674496cc08f17cb97b0b8ac9af65aa Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Fri, 24 Apr 2015 23:29:27 -0400 Subject: [PATCH 295/534] Add setQuery and setSearch methods --- urijs/URI-tests.ts | 5 +++++ urijs/URI.d.ts | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/urijs/URI-tests.ts b/urijs/URI-tests.ts index 75e999140..0c5efc8c7 100644 --- a/urijs/URI-tests.ts +++ b/urijs/URI-tests.ts @@ -26,4 +26,9 @@ new URI({ fragment: 'frag' }); +URI('').setQuery('foo', 'bar'); +URI('').setQuery({ foo: 'bar' }); +URI('').setSearch('foo', 'bar'); +URI('').setSearch({ foo: 'bar' }); + var uri: uri.URI = $('a').uri(); diff --git a/urijs/URI.d.ts b/urijs/URI.d.ts index b140df400..f745c6164 100644 --- a/urijs/URI.d.ts +++ b/urijs/URI.d.ts @@ -97,6 +97,10 @@ declare module uri { segment(position: number): string; segment(position: number, level: string): string; segment(level: string): string; + setQuery(key: string, value: string): URI; + setQuery(qry: Object): URI; + setSearch(key: string, value: string): URI; + setSearch(qry: Object): URI; subdomain(): string; subdomain(subdomain: string): URI; suffix(): string; From ab3cc6e0e0c362472527c174c2e7c1f6e21968c1 Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Fri, 24 Apr 2015 23:30:16 -0400 Subject: [PATCH 296/534] Add html element constructors --- urijs/URI-tests.ts | 2 ++ urijs/URI.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/urijs/URI-tests.ts b/urijs/URI-tests.ts index 0c5efc8c7..2ccd29d9c 100644 --- a/urijs/URI-tests.ts +++ b/urijs/URI-tests.ts @@ -12,6 +12,7 @@ URI({ query: 'foo=bar&bar=baz', fragment: 'frag' }); +URI(document.createElement('a')); new URI(); new URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); @@ -25,6 +26,7 @@ new URI({ query: 'foo=bar&bar=baz', fragment: 'frag' }); +new URI(document.createElement('a')); URI('').setQuery('foo', 'bar'); URI('').setQuery({ foo: 'bar' }); diff --git a/urijs/URI.d.ts b/urijs/URI.d.ts index f745c6164..b59dad6aa 100644 --- a/urijs/URI.d.ts +++ b/urijs/URI.d.ts @@ -133,10 +133,10 @@ declare module uri { interface URIStatic { (): URI; - (value: string | URIOptions): URI; + (value: string | URIOptions | HTMLElement): URI; new (): URI; - new (value: string | URIOptions): URI; + new (value: string | URIOptions | HTMLElement): URI; addQuery(data: Object, prop: string, value: string): Object; addQuery(data: Object, qryObj: Object): Object; From 6c7eba43d4560122032c8504450725645f38832a Mon Sep 17 00:00:00 2001 From: Brian Surowiec Date: Mon, 25 May 2015 15:28:02 -0400 Subject: [PATCH 297/534] Rename files to match project name --- urijs/{URI-tests.ts => URIjs-tests.ts} | 2 +- urijs/{URI.d.ts => URIjs.d.ts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename urijs/{URI-tests.ts => URIjs-tests.ts} (95%) rename urijs/{URI.d.ts => URIjs.d.ts} (100%) diff --git a/urijs/URI-tests.ts b/urijs/URIjs-tests.ts similarity index 95% rename from urijs/URI-tests.ts rename to urijs/URIjs-tests.ts index 2ccd29d9c..2dfd15618 100644 --- a/urijs/URI-tests.ts +++ b/urijs/URIjs-tests.ts @@ -1,4 +1,4 @@ -/// +/// URI(); URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag'); diff --git a/urijs/URI.d.ts b/urijs/URIjs.d.ts similarity index 100% rename from urijs/URI.d.ts rename to urijs/URIjs.d.ts From eed636e1e9b4a9de3d15c157f79e22fbafcb27ba Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 21:45:59 -0300 Subject: [PATCH 298/534] piwik-tracker: Add test file --- piwik-tracker/piwik-tracker-tests.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 piwik-tracker/piwik-tracker-tests.ts diff --git a/piwik-tracker/piwik-tracker-tests.ts b/piwik-tracker/piwik-tracker-tests.ts new file mode 100644 index 000000000..f509fe57e --- /dev/null +++ b/piwik-tracker/piwik-tracker-tests.ts @@ -0,0 +1,28 @@ +/// +/// + +// Example code taken from https://www.npmjs.com/package/piwik-tracker + +var PiwikTracker = require('piwik-tracker'); + +// Initialize with your site ID and Piwik URL +var piwik = new PiwikTracker(1, 'http://mywebsite.com/piwik.php'); + +// Optional: Respond to tracking errors +piwik.on('error', function(err) { + console.log('error tracking request: ', err) +}) + +// Track a request URL: +// Either as a simple string … +piwik.track('http://example.com/track/this/url'); + +// … or provide further options: +piwik.track({ + url: 'http://example.com/track/this/url', + action_name: 'This will be shown in your dashboard', + ua: 'Node.js v0.10.24', + cvar: JSON.stringify({ + '1': ['custom variable name', 'custom variable value'] + }) +}); From 513a7049f9df45546d28291dea522c2fa7c4ffa9 Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 21:50:59 -0300 Subject: [PATCH 299/534] piwik-tracker: PiwikTracker should inherit EventEmitter --- piwik-tracker/piwik-tracker.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piwik-tracker/piwik-tracker.d.ts b/piwik-tracker/piwik-tracker.d.ts index ddb1ae133..c40a834b0 100644 --- a/piwik-tracker/piwik-tracker.d.ts +++ b/piwik-tracker/piwik-tracker.d.ts @@ -83,7 +83,7 @@ declare module "piwik-tracker" { send_image? : number; } - class PiwikTracker { + class PiwikTracker extends EventEmitter { constructor(siteId : number, trackerUrl : string); track(options : PiwikTrackOptions) : void; } From abee08ec189f0ea50e16d4b82c37fdf16a799517 Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 21:51:26 -0300 Subject: [PATCH 300/534] piwik-tracker-test: Fix parameter type (implicity any) --- piwik-tracker/piwik-tracker-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/piwik-tracker/piwik-tracker-tests.ts b/piwik-tracker/piwik-tracker-tests.ts index f509fe57e..7d06d6bdc 100644 --- a/piwik-tracker/piwik-tracker-tests.ts +++ b/piwik-tracker/piwik-tracker-tests.ts @@ -9,7 +9,7 @@ var PiwikTracker = require('piwik-tracker'); var piwik = new PiwikTracker(1, 'http://mywebsite.com/piwik.php'); // Optional: Respond to tracking errors -piwik.on('error', function(err) { +piwik.on('error', function(err : Error) { console.log('error tracking request: ', err) }) From 3c378d7859679798d2b859e2087c095d93f6e2c9 Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 21:53:01 -0300 Subject: [PATCH 301/534] piwik-tracker: Should refer node.d.ts --- piwik-tracker/piwik-tracker.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/piwik-tracker/piwik-tracker.d.ts b/piwik-tracker/piwik-tracker.d.ts index c40a834b0..498757002 100644 --- a/piwik-tracker/piwik-tracker.d.ts +++ b/piwik-tracker/piwik-tracker.d.ts @@ -3,6 +3,8 @@ // Definitions by: Guilherme Bernal // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module "piwik-tracker" { export = PiwikTracker; From 917e0a59a0240ccbd59c62edbd399e526993272f Mon Sep 17 00:00:00 2001 From: Guilherme Bernal Date: Mon, 25 May 2015 21:55:53 -0300 Subject: [PATCH 302/534] piwik-tracker: Properly import EventEmitter --- piwik-tracker/piwik-tracker.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/piwik-tracker/piwik-tracker.d.ts b/piwik-tracker/piwik-tracker.d.ts index 498757002..129b714ca 100644 --- a/piwik-tracker/piwik-tracker.d.ts +++ b/piwik-tracker/piwik-tracker.d.ts @@ -7,6 +7,8 @@ declare module "piwik-tracker" { + import events = require('events'); + export = PiwikTracker; // refer to http://developer.piwik.org/api-reference/tracking-api @@ -85,7 +87,7 @@ declare module "piwik-tracker" { send_image? : number; } - class PiwikTracker extends EventEmitter { + class PiwikTracker extends events.EventEmitter { constructor(siteId : number, trackerUrl : string); track(options : PiwikTrackOptions) : void; } From 3eb36c97b6a438a44709d7c06ad0f98abb63cc2c Mon Sep 17 00:00:00 2001 From: Frank Bille Date: Tue, 26 May 2015 16:04:25 +0200 Subject: [PATCH 303/534] Return Firebase as type from $ref This is what really happens in the source code for AngularFire 1.1.1 (and always has), for both AngularFireObject and AngularFireArray. See https://github.com/firebase/angularfire/blob/1aa81906cdfb3e35e7c31fc6dee8a4922b1470ae/src/FirebaseObject.js#L125 --- angularfire/angularfire.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index 46d95750c..04af445d9 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -33,7 +33,7 @@ interface AngularFireObject extends AngularFireSimpleObject { $loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise; - $ref(): AngularFire; + $ref(): Firebase; $bindTo(scope: ng.IScope, varName: string): ng.IPromise; $watch(callback: Function, context?: any): Function; $destroy(): void; @@ -53,7 +53,7 @@ interface AngularFireArray extends Array { $loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; $loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise; - $ref(): AngularFire; + $ref(): Firebase; $watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function; $destroy(): void; } From b67ca7586142caf806555e3bc17ed3586fe22b04 Mon Sep 17 00:00:00 2001 From: Frank Bille Date: Tue, 26 May 2015 16:21:44 +0200 Subject: [PATCH 304/534] Fix tests to expect correct return type. Also stop using deprecated methods and use $firebase(Object|Array) directly instead. --- angularfire/angularfire-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/angularfire/angularfire-tests.ts b/angularfire/angularfire-tests.ts index d636c88e6..c649301e3 100644 --- a/angularfire/angularfire-tests.ts +++ b/angularfire/angularfire-tests.ts @@ -46,7 +46,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi // AngularFireObject { - var obj = sync.$asObject(); + var obj = $FirebaseObject(ref); // $id if (obj.$id !== ref.name()) throw "error"; @@ -63,7 +63,7 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi }); // $ref() - if (obj.$ref() !== sync) throw "error"; + if (obj.$ref() !== ref) throw "error"; // $bindTo() obj.$bindTo($scope, "data").then(function () { @@ -92,10 +92,10 @@ myapp.controller("MyController", ["$scope", "$firebase", '$FirebaseObject', '$Fi // AngularFireArray { - var list = sync.$asArray(); + var list = $FirebaseArray(ref); // $ref() - if (list.$ref() !== sync) throw "error"; + if (list.$ref() !== ref) throw "error"; // $add() list.$add({ foo: "foo value" }); From f35df7ab4ca0747450182d5da657d6eec486c363 Mon Sep 17 00:00:00 2001 From: Frank Bille Date: Tue, 26 May 2015 17:05:10 +0200 Subject: [PATCH 305/534] Added documentation from AngularFire Copied the jsdoc directly from https://github.com/firebase/angularfire/tree/master/src --- angularfire/angularfire.d.ts | 385 +++++++++++++++++++++++++++++++++++ 1 file changed, 385 insertions(+) diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index 46d95750c..9370b2c98 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -10,6 +10,9 @@ interface AngularFireService { (firebase: Firebase, config?: any): AngularFire; } +/** + * @deprecated. Not possible with AngularFire 1.0+ + */ interface AngularFire { $asArray(): AngularFireArray; $asObject(): AngularFireObject; @@ -24,37 +27,279 @@ interface AngularFire { $transaction(key:string, updateFn: (currentData: any) => any, applyLocally?: boolean): ng.IPromise; } +/** + * Creates and maintains a synchronized object, with 2-way bindings between Angular and Firebase. + */ interface AngularFireObject extends AngularFireSimpleObject { $id: string; $priority: number; $value: any; + + /** + * Removes all keys from the FirebaseObject and also removes + * the remote data from the server. + * + * @returns a promise which will resolve after the op completes + */ + $remove(): ng.IPromise; + /** + * Saves all data on the FirebaseObject back to Firebase. + * @returns a promise which will resolve after the save is completed. + */ $save(): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asObject() is now cached + * locally in the object. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} resolve + * @param {Function} reject + * @returns a promise which resolves after initial data is downloaded from Firebase + */ $loaded(resolve?: (x: AngularFireObject) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asObject() is now cached + * locally in the object. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} resolve + * @param {Function} reject + * @returns a promise which resolves after initial data is downloaded from Firebase + */ $loaded(resolve?: (x: AngularFireObject) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asObject() is now cached + * locally in the object. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} resolve + * @param {Function} reject + * @returns a promise which resolves after initial data is downloaded from Firebase + */ $loaded(resolve?: (x: AngularFireObject) => void, reject?: (err: any) => any): ng.IPromise; + + /** + * @returns {Firebase} the original Firebase instance used to create this object. + */ $ref(): AngularFire; + + /** + * Creates a 3-way data sync between this object, the Firebase server, and a + * scope variable. This means that any changes made to the scope variable are + * pushed to Firebase, and vice versa. + * + * If scope emits a $destroy event, the binding is automatically severed. Otherwise, + * it is possible to unbind the scope variable by using the `unbind` function + * passed into the resolve method. + * + * Can only be bound to one scope variable at a time. If a second is attempted, + * the promise will be rejected with an error. + * + * @param {object} scope + * @param {string} varName + * @returns a promise which resolves to an unbind method after data is set in scope + */ $bindTo(scope: ng.IScope, varName: string): ng.IPromise; + + /** + * Listeners passed into this method are notified whenever a new change is received + * from the server. Each invocation is sent an object containing + * { type: 'value', key: 'my_firebase_id' } + * + * This method returns an unbind function that can be used to detach the listener. + * + * @param {Function} cb + * @param {Object} [context] + * @returns {Function} invoke to stop observing events + */ $watch(callback: Function, context?: any): Function; + + /** + * Informs $firebase to stop sending events and clears memory being used + * by this object (delete's its local content). + */ $destroy(): void; } interface AngularFireObjectService { + /** + * Creates a synchronized object with 2-way bindings between Angular and Firebase. + * + * @param {Firebase} ref + * @returns {FirebaseObject} + */ (firebase: Firebase): AngularFireObject; $extend(ChildClass: Object, methods?: Object): Object; } +/** + * Creates and maintains a synchronized list of data. This is a pseudo-read-only array. One should + * not call splice(), push(), pop(), et al directly on this array, but should instead use the + * $remove and $add methods. + * + * It is acceptable to .sort() this array, but it is important to use this in conjunction with + * $watch(), so that it will be re-sorted any time the server data changes. Examples of this are + * included in the $watch documentation. + */ interface AngularFireArray extends Array { + /** + * Create a new record with a unique ID and add it to the end of the array. + * This should be used instead of Array.prototype.push, since those changes will not be + * synchronized with the server. + * + * Any value, including a primitive, can be added in this way. Note that when the record + * is created, the primitive value would be stored in $value (records are always objects + * by default). + * + * Returns a future which is resolved when the data has successfully saved to the server. + * The resolve callback will be passed a Firebase ref representing the new data element. + * + * @param data + * @returns a promise resolved after data is added + */ $add(newData: any): ng.IPromise; + + /** + * Pass either an item in the array or the index of an item and it will be saved back + * to Firebase. While the array is read-only and its structure should not be changed, + * it is okay to modify properties on the objects it contains and then save those back + * individually. + * + * Returns a future which is resolved when the data has successfully saved to the server. + * The resolve callback will be passed a Firebase ref representing the saved element. + * If passed an invalid index or an object which is not a record in this array, + * the promise will be rejected. + * + * @param {int|object} indexOrItem + * @returns a promise resolved after data is saved + */ $save(recordOrIndex: any): ng.IPromise; + + /** + * Pass either an existing item in this array or the index of that item and it will + * be removed both locally and in Firebase. This should be used in place of + * Array.prototype.splice for removing items out of the array, as calling splice + * will not update the value on the server. + * + * Returns a future which is resolved when the data has successfully removed from the + * server. The resolve callback will be passed a Firebase ref representing the deleted + * element. If passed an invalid index or an object which is not a record in this array, + * the promise will be rejected. + * + * @param {int|object} indexOrItem + * @returns a promise which resolves after data is removed + */ $remove(recordOrIndex: any): ng.IPromise; + + /** + * Returns the record for a given Firebase key (record.$id). If the record is not found + * then returns null. + * + * @param {string} key + * @returns {Object|null} a record in this array + */ $getRecord(key: string): AngularFireSimpleObject; + + /** + * Given an item in this array or the index of an item in the array, this returns the + * Firebase key (record.$id) for that record. If passed an invalid key or an item which + * does not exist in this array, it will return null. + * + * @param {int|object} indexOrItem + * @returns {null|string} + */ $keyAt(recordOrIndex: any): string; + + /** + * The inverse of $keyAt, this method takes a Firebase key (record.$id) and returns the + * index in the array where that record is stored. If the record is not in the array, + * this method returns -1. + * + * @param {String} key + * @returns {int} -1 if not found + */ $indexFor(key: string): number; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asArray() is now cached + * locally in the array. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} [resolve] + * @param {Function} [reject] + * @returns a promise + */ $loaded(resolve?: (x: AngularFireArray) => ng.IHttpPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asArray() is now cached + * locally in the array. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} [resolve] + * @param {Function} [reject] + * @returns a promise + */ $loaded(resolve?: (x: AngularFireArray) => ng.IPromise<{}>, reject?: (err: any) => any): ng.IPromise; + + /** + * The loaded method is invoked after the initial batch of data arrives from the server. + * When this resolves, all data which existed prior to calling $asArray() is now cached + * locally in the array. + * + * As a shortcut is also possible to pass resolve/reject methods directly into this + * method just as they would be passed to .then() + * + * @param {Function} [resolve] + * @param {Function} [reject] + * @returns a promise + */ $loaded(resolve?: (x: AngularFireArray) => void, reject?: (err: any) => any): ng.IPromise; + + /** + * @returns {Firebase} the original Firebase ref used to create this object. + */ $ref(): AngularFire; + + /** + * Listeners passed into this method are notified whenever a new change (add, updated, + * move, remove) is received from the server. Each invocation is sent an object + * containing { type: 'child_added|child_updated|child_moved|child_removed', + * key: 'key_of_item_affected'} + * + * Additionally, added and moved events receive a prevChild parameter, containing the + * key of the item before this one in the array. + * + * This method returns a function which can be invoked to stop observing events. + * + * @param {Function} cb + * @param {Object} [context] + * @returns {Function} used to stop observing + */ $watch(cb: (event: string, key: string, prevChild: string) => void, context?: any): Function; + + /** + * Informs $firebase to stop sending events and clears memory being used + * by this array (delete's its local content). + */ $destroy(): void; } interface AngularFireArrayService { @@ -75,20 +320,160 @@ interface AngularFireAuthService { } interface AngularFireAuth { + /** + * Authenticates the Firebase reference with a custom authentication token. + * + * @param {string} authToken An authentication token or a Firebase Secret. A Firebase Secret + * should only be used for authenticating a server process and provides full read / write + * access to the entire Firebase. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authWithCustomToken(authToken: string, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference anonymously. + * + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authAnonymously(options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with an email/password user. + * + * @param {Object} credentials An object containing email and password attributes corresponding + * to the user account. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authWithPassword(credentials: FirebaseCredentials, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with the OAuth popup flow. + * + * @param {string} provider The unique string identifying the OAuth provider to authenticate + * with, e.g. google. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authWithOAuthPopup(provider: string, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with the OAuth redirect flow. + * + * @param {string} provider The unique string identifying the OAuth provider to authenticate + * with, e.g. google. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authWithOAuthRedirect(provider: string, options?: Object): ng.IPromise; + + /** + * Authenticates the Firebase reference with an OAuth token. + * + * @param {string} provider The unique string identifying the OAuth provider to authenticate + * with, e.g. google. + * @param {string|Object} credentials Either a string, such as an OAuth 2.0 access token, or an + * Object of key / value pairs, such as a set of OAuth 1.0a credentials. + * @param {Object} [options] An object containing optional client arguments, such as configuring + * session persistence. + * @return {Promise} A promise fulfilled with an object containing authentication data. + */ $authWithOAuthToken(provider: string, credentials: Object|string, options?: Object): ng.IPromise; + + /** + * Synchronously retrieves the current authentication data. + * + * @return {Object} The client's authentication data. + */ $getAuth(): FirebaseAuthData; + + /** + * Asynchronously fires the provided callback with the current authentication data every time + * the authentication data changes. It also fires as soon as the authentication data is + * retrieved from the server. + * + * @param {function} callback A callback that fires when the client's authenticate state + * changes. If authenticated, the callback will be passed an object containing authentication + * data according to the provider used to authenticate. Otherwise, it will be passed null. + * @param {string} [context] If provided, this object will be used as this when calling your + * callback. + * @return {function} A function which can be used to deregister the provided callback. + */ $onAuth(callback: Function, context?: any): Function; + + /** + * Unauthenticates the Firebase reference. + */ $unauth(): void; + + /** + * Utility method which can be used in a route's resolve() method to grab the current + * authentication data. + * + * @returns {Promise} A promise fulfilled with the client's current authentication + * state, which will be null if the client is not authenticated. + */ $waitForAuth(): ng.IPromise; + + /** + * Utility method which can be used in a route's resolve() method to require that a route has + * a logged in client. + * + * @returns {Promise} A promise fulfilled with the client's current authentication + * state or rejected if the client is not authenticated. + */ $requireAuth(): ng.IPromise; + + /** + * Creates a new email/password user. Note that this function only creates the user, if you + * wish to log in as the newly created user, call $authWithPassword() after the promise for + * this method has been resolved. + * + * @param {Object} credentials An object containing the email and password of the user to create. + * @return {Promise} A promise fulfilled with the user object, which contains the + * uid of the created user. + */ $createUser(credentials: FirebaseCredentials): ng.IPromise; + + /** + * Removes an email/password user. + * + * @param {Object} credentials An object containing the email and password of the user to remove. + * @return {Promise<>} An empty promise fulfilled once the user is removed. + */ $removeUser(credentials: FirebaseCredentials): ng.IPromise; + + /** + * Changes the email for an email/password user. + * + * @param {Object} credentials An object containing the old email, new email, and password of + * the user whose email is to change. + * @return {Promise<>} An empty promise fulfilled once the email change is complete. + */ $changeEmail(credentials: FirebaseChangeEmailCredentials): ng.IPromise; + + /** + * Changes the password for an email/password user. + * + * @param {Object} credentials An object containing the email, old password, and new password of + * the user whose password is to change. + * @return {Promise<>} An empty promise fulfilled once the password change is complete. + */ $changePassword(credentials: FirebaseChangePasswordCredentials): ng.IPromise; + + /** + * Sends a password reset email to an email/password user. + * + * @param {Object} credentials An object containing the email of the user to send a reset + * password email to. + * @return {Promise<>} An empty promise fulfilled once the reset password email is sent. + */ $resetPassword(credentials: FirebaseResetPasswordCredentials): ng.IPromise; } From 767f577db3fb20d624ba635a00faf1f4210b7833 Mon Sep 17 00:00:00 2001 From: Neil Culver Date: Tue, 26 May 2015 16:51:50 +0100 Subject: [PATCH 306/534] Added overload for definition of a custom CSS class Bumped version number. Added to definitions by. Corrected return type of JQuery method. --- jquery.placeholder/jquery.placeholder-tests.ts | 4 ++++ jquery.placeholder/jquery.placeholder.d.ts | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/jquery.placeholder/jquery.placeholder-tests.ts b/jquery.placeholder/jquery.placeholder-tests.ts index 072c03721..b0e7629f3 100644 --- a/jquery.placeholder/jquery.placeholder-tests.ts +++ b/jquery.placeholder/jquery.placeholder-tests.ts @@ -2,3 +2,7 @@ /// $('input').placeholder(); + +// specify custom class +$('input').placeholder({ customClass: 'my-placeholder' }); + diff --git a/jquery.placeholder/jquery.placeholder.d.ts b/jquery.placeholder/jquery.placeholder.d.ts index b9af72494..d475adfce 100644 --- a/jquery.placeholder/jquery.placeholder.d.ts +++ b/jquery.placeholder/jquery.placeholder.d.ts @@ -1,13 +1,12 @@ -// Type definitions for jquery.placeholder.js 2.0.7 +// Type definitions for jquery.placeholder.js 2.1.1 // Project: https://github.com/mathiasbynens/jquery-placeholder -// Definitions by: Peter Gill +// Definitions by: Peter Gill , Neil Culver // Definitions: https://github.com/borisyankov/DefinitelyTyped /// interface JQuery { - - placeholder() : void; - + placeholder(options: { customClass: string }) : JQuery + placeholder() : JQuery } From 010acb155eb6db6baeaa4a08d713da80534a0573 Mon Sep 17 00:00:00 2001 From: Matt Brooks Date: Tue, 26 May 2015 16:51:49 +0100 Subject: [PATCH 307/534] Added new definition for Farbtastic jQuery plugin Added definition for Farbtastic jQuery color wheel plugin with accompanying tests file. --- farbtastic/farbtastic-tests.ts | 100 +++++++++++++++++++++++++++++++++ farbtastic/farbtastic.d.ts | 40 +++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 farbtastic/farbtastic-tests.ts create mode 100644 farbtastic/farbtastic.d.ts diff --git a/farbtastic/farbtastic-tests.ts b/farbtastic/farbtastic-tests.ts new file mode 100644 index 000000000..ac5eb4074 --- /dev/null +++ b/farbtastic/farbtastic-tests.ts @@ -0,0 +1,100 @@ +/// + +var callback = () => {}; +var domNode = document.createElement("div"); + +// Basic usage + +// Can add a ready() handler to the document which initializes the color picker and links it to the text field +$(document).ready(function() { + $("#colorpicker").farbtastic("#color"); +}); + +// Advanced Usage: jQuery Method + +// Create color pickers in the selected objects +$("#colorpicker").farbtastic(); + +// Optional callback using a callback function +$("#colorpicker").farbtastic(callback); +$("#colourpicker").farbtastic(function (color) { + console.log(typeof color === "string"); +}); + +// Optional callback using a DOM node +$("#colorpicker").farbtastic(domNode); + +// Optional callback using a jQuery object +$("#colorpicker").farbtastic($("#color")); + +// Optional callback using a jQuery selector +$("#colorpicker").farbtastic("#color"); + +// Advanced Usage: Object + +// Can invoke method for returning Farbtastic object instead of a jQuery object +$.farbtastic(domNode); +$.farbtastic($("#color")); +$.farbtastic("#color"); + +// Optional callback using a callback function +$.farbtastic(domNode, callback); +$.farbtastic($("#color"), callback); +$.farbtastic("#color", callback); + +// Optional callback using a DOM node +$.farbtastic(domNode, domNode); +$.farbtastic($("#color"), domNode); +$.farbtastic("#color", domNode); + +// Optional callback using a jQuery object +$.farbtastic(domNode, $("#color")); +$.farbtastic($("#color"), $("#color")); +$.farbtastic("#color", $("#color")); + +// Optional callback using a jQuery selector +$.farbtastic(domNode, "#color"); +$.farbtastic($("#color"), "#color"); +$.farbtastic("#color", "#color"); + +// Advanced Usage: Options +$("#colorpicker").farbtastic({ + callback: (color) => { + console.log(color); + } +}); +$.farbtastic(domNode, { + width: 500 +}); +$.farbtastic($("#color"), { + wheelWidth: 300 +}); +$.farbtastic("#color", {}); + +// Advanced Usage: Methods +$.farbtastic("#colorpicker").linkTo(callback); +$.farbtastic("#colorpicker").linkTo(domNode); +$.farbtastic("#colorpicker").linkTo("#color"); +$.farbtastic("#colorpicker").linkTo($("#color")); + +$.farbtastic("#colorpicker").setColor("#aabbcc"); +$.farbtastic("#colorpicker").setColor([0.1, 0.2, 0.3]); +$.farbtastic("#colorpicker").setHSL([0.1, 0.2, 0.3]); + +// Advanced Usage: Properties +$.farbtastic("#colorpicker").color === "#aabbcc"; +$.farbtastic("#colorpicker").hsl === [0.1, 0.2, 0.3]; +$.farbtastic("#colorpicker").linked === $("#colorpicker"); +$.farbtastic("#colorpicker").linked === callback; + +// Can chain jQuery methods +$("#colorpicker") + .farbtastic() + .addClass("color-picker"); + +// Can chain Farbtastic methods +$.farbtastic("#colorpicker") + .linkTo(domNode) + .setColor("#000000") + .setHSL([0, 0, 0]); + \ No newline at end of file diff --git a/farbtastic/farbtastic.d.ts b/farbtastic/farbtastic.d.ts new file mode 100644 index 000000000..30e93d6f6 --- /dev/null +++ b/farbtastic/farbtastic.d.ts @@ -0,0 +1,40 @@ +// Type definitions for Farbtastic: jQuery Color Wheel v2.0.0-alpha.1 +// Project: http://mattfarina.github.io/farbtastic/ +// Definitions by: Matt Brooks +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQueryFarbtastic { + type Placeholder = string | Element | JQuery; + type CallbackFunction = (color: string) => any; + type Callback = CallbackFunction | Placeholder; + + interface Options { + callback?: Callback; + width?: number; + wheelWidth?: number; + } + + interface Farbtastic { + linked: CallbackFunction | JQuery; + color: string; + hsl: number[]; + + linkTo(callback: Callback): Farbtastic; + setColor(color: string | number[]): Farbtastic; + setHSL(hsl: number[]): Farbtastic; + } +} + +interface JQueryStatic { + farbtastic(placeholder: JQueryFarbtastic.Placeholder, callback: JQueryFarbtastic.Callback): JQueryFarbtastic.Farbtastic; + farbtastic(placeholder: JQueryFarbtastic.Placeholder, options: JQueryFarbtastic.Options): JQueryFarbtastic.Farbtastic; + farbtastic(placeholder: JQueryFarbtastic.Placeholder): JQueryFarbtastic.Farbtastic; +} + +interface JQuery { + farbtastic(callback: JQueryFarbtastic.Callback): JQuery; + farbtastic(options: JQueryFarbtastic.Options): JQuery; + farbtastic(): JQuery; +} \ No newline at end of file From 9f902efd3550bb53e9072ca843881eac2a604e51 Mon Sep 17 00:00:00 2001 From: Sam Albert Date: Tue, 26 May 2015 13:31:01 -0400 Subject: [PATCH 308/534] Added _.get definition to lodash with updated test file. --- lodash/lodash-tests.ts | 2 ++ lodash/lodash.d.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 6a48e20c1..a96b0b6f3 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -922,6 +922,8 @@ result = _.methods(_); result = <_.LoDashArrayWrapper>_(_).functions(); result = <_.LoDashArrayWrapper>_(_).methods(); +result = _.get({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); + result = _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); interface FirstSecond { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 602b05d31..4b96e01e5 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5836,6 +5836,22 @@ declare module _ { methods(): _.LoDashArrayWrapper; } + //_.get + interface LoDashStatic { + /** + * Gets the property value at path of object. If the resolved + * value is undefined the defaultValue is used in its place. + * @param object The object to query. + * @param path The path of the property to get. + * @param defaultValue The value returned if the resolved value is undefined. + * @return Returns the resolved value. + **/ + get(object : Object, + path:string|string[], + defaultValue?:T + ): T; + } + //_.has interface LoDashStatic { /** From 244a4c42774617e240d6a3116cc20ecf476b7c82 Mon Sep 17 00:00:00 2001 From: Kamyar Nazeri Date: Tue, 26 May 2015 23:33:57 +0430 Subject: [PATCH 309/534] Add definitions for multiplexjs --- multiplexjs/multiplexjs-tests.ts | 2496 +++++++++++++++++++++++++++++ multiplexjs/multiplexjs.d.ts | 2551 ++++++++++++++++++++++++++++++ 2 files changed, 5047 insertions(+) create mode 100644 multiplexjs/multiplexjs-tests.ts create mode 100644 multiplexjs/multiplexjs.d.ts diff --git a/multiplexjs/multiplexjs-tests.ts b/multiplexjs/multiplexjs-tests.ts new file mode 100644 index 000000000..2b9d7e9e9 --- /dev/null +++ b/multiplexjs/multiplexjs-tests.ts @@ -0,0 +1,2496 @@ +/// +/// + + +module MxTests { + + "use strict"; + + import Enumerator = mx.Enumerator; + import Enumerable = mx.Enumerable; + import Comparer = mx.Comparer; + import EqualityComparer = mx.EqualityComparer; + import Collection = mx.Collection; + import List = mx.List; + import ReadOnlyCollection = mx.ReadOnlyCollection; + import Dictionary = mx.Dictionary; + import SortedList = mx.SortedList; + import HashSet = mx.HashSet; + import LinkedList = mx.LinkedList; + import Queue = mx.Queue; + import Stack = mx.Stack; + import Lookup = mx.Lookup; + import RuntimeComparer = mx.RuntimeComparer; + + + var Enumerator = mx.Enumerator, + Enumerable = mx.Enumerable, + Comparer = mx.Comparer, + EqualityComparer = mx.EqualityComparer, + Collection = mx.Collection, + List = mx.List, + ReadOnlyCollection = mx.ReadOnlyCollection, + KeyValuePair = mx.KeyValuePair, + Dictionary = mx.Dictionary, + SortedList = mx.SortedList, + HashSet = mx.HashSet, + LinkedList = mx.LinkedList, + LinkedListNode = mx.LinkedListNode, + Queue = mx.Queue, + Stack = mx.Stack; + + + + + + + /* Classes + ---------------------------------------------------------------------- */ + + interface SimpleObject { + name: string; + value: number; + } + + // class without equality-comparer + class SimpleClass { + }; + + + // class overriding '__hash__' and '__equals__' methods. + class SimpleClassWithComparer implements RuntimeComparer, SimpleObject { + + constructor(val: number) { + this.value = val; + this.name = val.toString(); + } + + public name: string; + public value: number; + + __hash__(): number { + return mx.hash(this.value, this.name); + } + + __equals__(obj: any) { + return obj instanceof SimpleClassWithComparer && obj.value === this.value && obj.name === this.name; + } + }; + + + + + + + /* Tests + ---------------------------------------------------------------------- */ + + module MultiplexTests { + + QUnit.module("Multiplex"); + + + QUnit.test("Multiplex Array", function (assert) { + + var _source = mx([1, 2, 3, 4]); + assert.ok(MxCount(_source) === 4, "Passed!"); + }); + + + QUnit.test("Multiplex String", function (assert) { + var _source = mx("Multiplex"); + assert.ok(MxCount(_source) === 9, "Passed!"); + }); + + + QUnit.test("Multiplex Object", function (assert) { + var _source = mx({ name: "mx", id: 1 }); + assert.ok(MxCount(_source) === 2, "Passed!"); + }); + + + QUnit.test("Multiplex Array-like", function (assert) { + var _source = mx(arguments); + assert.ok(MxCount(_source) === 1, "Passed!"); + }); + + + //QUnit.test("Multiplex Iterable", function (assert) { + // var _set = new Set(), + // _source = mx(_set); + + // _set.add(1); + // _set.add(2); + // _set.add(3); + // assert.ok(MxCount(_source) === 3, "Passed!"); + //}); + + + QUnit.test("Multiplex Custom Enumerator", function (assert) { + var _source = mx(>{ + getEnumerator: function (): Enumerator { + var count = 3, index = 0; + return { + current: undefined, + next: function () { + if (index++ < count) { + this.current = index; + return true; + } + else { + this.current = undefined; + return false; + } + } + }; + } + }); + assert.ok(MxCount(_source) === 3, "Passed!"); + }); + + + QUnit.test("Multiplex Generator", function (assert) { + try { + var _source = eval("mx(function* () { yield 1; yield 2; yield 3; })"); + assert.ok(MxCount(_source) === 3, "Passed!"); + } + catch (e) { assert.ok(true, "Generator not implemented by the browser"); } + }); + + + QUnit.test("Multiplex Legacy Generator", function (assert) { + var _source = mx(function () { + var count = 3, + index = 0; + + return new Enumerator(function (yielder) { + if (index++ < count) { + yielder(index); + } + }); + }); + assert.ok(MxCount(_source) === 3, "Passed!"); + }); + + + QUnit.test("mx.range", function (assert) { + var _source = mx.range(0, 4); + assert.deepEqual(_source.toArray(), [0, 1, 2, 3], "Passed!"); + }); + + + QUnit.test("mx.repeat", function (assert) { + var _source = mx.repeat(1, 4); + assert.deepEqual(_source.toArray(), [1, 1, 1, 1], "Passed!"); + }); + + + QUnit.test("mx.empty", function (assert) { + var _source = mx.empty(); + assert.ok(MxCount(_source) === 0, "Passed!"); + }); + + + QUnit.test("mx.is", function (assert) { + assert.ok(mx.is(mx.range(1, 10)), "Enumerable Passed!"); + assert.ok(mx.is([1]), "Array Passed!"); + assert.ok(mx.is("mx"), "String Passed!"); + //assert.ok(mx.is(new Set()), "Iterable Passed!"); + + assert.ok(mx.is({ + getEnumerator: function (): Enumerator { + var count = 3, index = 0; + return { + current: undefined, + next: function () { + if (index++ < count) { + this.current = index; + return true; + } + else { + this.current = undefined; + return false; + } + } + }; + } + }), "Custom Enumerator Passed!"); + + try { + assert.ok(mx.is(eval("mx(function* () { yield 1; yield 2; yield 3; })")), "Generator Passed!"); + } + catch (e) { assert.ok(true, "Generator not implemented by the browser"); } + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function MxCount(source: Enumerable): number { + var _e = source.getEnumerator(), + _i = 0; + + while (_e.next()) { + _i++; + } + + return _i; + } + } + + + module RuntimeTests { + + QUnit.module("Runtime"); + + + QUnit.test("hash", function (assert) { + + assert.ok(mx.hash(null) === 0, "hash null!"); + assert.ok(mx.hash(undefined) === 0, "hash undefined!"); + assert.ok(mx.hash(10) === mx.hash(10), "hash integer number!"); + assert.ok(mx.hash(10.5) === mx.hash(10.5), "hash float number!"); + assert.ok(mx.hash("string") === mx.hash("string"), "hash string!"); + assert.ok(mx.hash(true) === mx.hash(true), "hash boolean!"); + assert.ok(mx.hash(new Date(2015, 0, 1)) === mx.hash(new Date(2015, 0, 1)), "hash date!"); + assert.ok(mx.hash({ name: "A" }) === mx.hash({ name: "A" }), "hash object literal!"); + assert.ok(mx.hash(new SimpleClass()) !== mx.hash(new SimpleClass()), "hash class instance!"); + assert.ok(mx.hash(new SimpleClassWithComparer(10)) === mx.hash(new SimpleClassWithComparer(10)), "hash class instance overriding __hash__ method!"); + assert.ok(mx.hash(10, 10.5, "string", new Date(2015, 0, 1)) === mx.hash(10, 10.5, "string", new Date(2015, 0, 1)), "combine hash codes!"); + }); + + + QUnit.test("equals", function (assert) { + + assert.ok(mx.equals(null, null) === true, "equals null!"); + assert.ok(mx.equals(undefined, undefined) === true, "equals undefined!"); + assert.ok(mx.equals(10, 10), "equals integer number!"); + assert.ok(mx.equals(10.5, 10.5), "equals float number!"); + assert.ok(mx.equals("string", "string"), "equals string!"); + assert.ok(mx.equals(true, true), "equals boolean!"); + assert.ok(mx.equals(new Date(2015, 0, 1), new Date(2015, 0, 1)), "equals date!"); + assert.ok(mx.equals({ name: "A" }, { name: "A" }), "equals object literal!"); + assert.ok(mx.equals(new SimpleClass(), new SimpleClass()) === false, "equals class instance!"); + assert.ok(mx.equals(new SimpleClass(), new SimpleClass(), EqualityComparer.create((obj) => 0, (a, b) => true)), "equals class instance using comparer!"); + assert.ok(mx.equals(new SimpleClassWithComparer(10), new SimpleClassWithComparer(10)), "equals class instance overriding __equals__ method!"); + }); + + + QUnit.test("compare", function (assert) { + + assert.ok(mx.compare(1, null) === 1 && mx.compare(null, 1) === -1 && mx.compare(null, null) === 0, "compare null!"); + assert.ok(mx.compare(1, 0) === 1 && mx.compare(0, 1) === -1 && mx.compare(1, 1) === 0, "compare numbers!"); + assert.ok(mx.compare("B", "A") === 1 && mx.compare("A", "B") === -1 && mx.compare("A", "A") === 0, "compare string!"); + assert.ok(mx.compare(true, false) === 1 && mx.compare(false, true) === -1 && mx.compare(true, true) === 0, "compare bolean!"); + assert.ok(mx.compare(new Date(2015, 0, 2), new Date(2015, 0, 1)) === 1 && mx.compare(new Date(2015, 0, 1), new Date(2015, 0, 2)) === -1 && mx.compare(new Date(2015, 0, 1), new Date(2015, 0, 1)) === 0, "compare date!"); + assert.ok(mx.compare({ name: "A" }, { name: "B" }) === 0, "compare objects!"); + }); + + + QUnit.test("lambda", function (assert) { + + var _f1 = mx.runtime.lambda("t => t * t"), + _f2 = mx.runtime.lambda("(t, u) => t + u"), + _f3 = mx.runtime.lambda("(t, u, r) => t + u + r"), + _f4 = mx.runtime.lambda("(t, u) => {id:t, name:u}"); + + assert.ok(_f1(2) === 4, "square root lambda!"); + assert.ok(_f2(1, 2) === 3, "sum of 2 numbers lambda!"); + assert.ok(_f3(1, 2, 3) === 6, "sum of 3 numbers lambda!"); + assert.ok(_f4(1, "A").id === 1 && _f4(1, "A").name === "A", "object literal lambda!"); + }); + } + + + module LinqTests { + + QUnit.module("Linq"); + + + QUnit.test("aggregate", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).aggregate((a, b) => a + b) === 45, "Aggregate 10 numbers without seed!"); + assert.ok(mx(_arr).aggregate(10, (a, b) => a + b) === 55, "Aggregate 10 numbers with seed!"); + assert.ok(mx(_arr).aggregate(10, (a, b) => a + b, t => t * 2) === 110, "Aggregate 10 numbers with seed and result selector!"); + }); + + + QUnit.test("all", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).all(t => t < 100) === true, "First 10 numbers less than 100!"); + assert.ok(mx(_arr).all(t => t < 5) === false, "First 10 numbers less than 5!"); + }); + + + QUnit.test("any", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).any() === true, "First 10 numbers!"); + assert.ok(mx(_arr).any(t => t % 2 === 0) === true, "Any of the first 10 numbers is even!"); + assert.ok(mx(_arr).any(t => t > 10) === false, "Any of the first 10 numbers greater than 10!"); + }); + + + QUnit.test("average", function (assert) { + + assert.ok(mx(CreateNumberArray()).average() === 4.5, "Average of the first 10 numbers!"); + assert.throws(() => mx(CreateObjectLiteralArray()).average(), "throws an exception for average of non numeric values!"); + assert.throws(() => mx([]).average(), "throws an exception for average of empty collection!"); + }); + + + QUnit.test("concat", function (assert) { + var _s1 = [1, 2, 3], + _s2 = [3, 4], + _arr = CreateNumberArray(); + + assert.deepEqual(mx(_s1).concat(_s2).toArray(), [1, 2, 3, 3, 4], "Concat two array!"); + assert.ok(mx(_arr).concat(_arr).count() === 20, "Concat the first 10 numbers to itself!"); + }); + + + QUnit.test("contains", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateSimpleClassArray(), + _arr3 = CreateSimpleClassWithComparerArray(), + _arr4 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).contains(1) === true, "1 contains in the first 10 numbers!"); + assert.ok(mx(_arr1).contains(10) === false, "10 does not contains in the first 10 numbers!"); + + assert.ok(mx(_arr2).contains(new SimpleClass()) === false, "Class instance without equality-comparer!"); + assert.ok(mx(_arr2).contains(new SimpleClass(), { hash: () => 0, equals: () => true }) === true, "Class instance with equality-comparer!"); + + assert.ok(mx(_arr3).contains(new SimpleClassWithComparer(5)) === true, "Class instance overriding equality-comparer!"); + + assert.ok(mx(_arr4).contains({ name: "n5", inner: { index: 5, val: {} } }) === true, "Object literal without equality-comparer!"); + assert.ok(mx(_arr4).contains({ name: "n5", inner: null }, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }) === true, "Object literal with equality-comparer!"); + }); + + + QUnit.test("count", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).count() === 10, "Count of the first 10 numbers!"); + assert.ok(mx(_arr).count(t => t % 2 === 0) === 5, "Count of the first even 10 numbers!"); + }); + + + QUnit.test("defaultIfEmpty", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx([]).defaultIfEmpty(1).toArray(), [1], "Empty array devalut value!"); + assert.ok(mx(_arr).defaultIfEmpty(1).count() === 10, "Count of the first 10 numbers with defaultIfEmpty!"); + assert.ok(mx(_arr).where(t => t > 100).defaultIfEmpty(10).count() === 1, "Count of the first 10 numbers greater than 100 with defaultIfEmpty!"); + }); + + + QUnit.test("distinct", function (assert) { + + var _arr1 = CreateObjectLiteralArray(), + _arr2 = CreateComplexObjectLiteralArray(), + _arr3 = CreateNumberArray(), + _arr4 = CreateFloatNumberArray(), + _arr5 = CreateStringArray(), + _arr6 = CreateDateArray(), + _arr7 = CreateBooleanArray(), + _arr8 = CreateSimpleClassWithComparerArray(), + _arr9 = CreateSimpleClassArray(); + + assert.ok(mx(_arr1).distinct().count() === 1, "Array of 10 empty object literal!"); + assert.ok(mx(_arr2).distinct().count() === 10, "Array of 10 distinct complex object literal!"); + assert.ok(mx(_arr3).distinct().count() === 10, "Array of 10 distinct numbers!"); + assert.ok(mx(_arr4).distinct().count() === 10, "Array of 10 distinct float numbers!"); + assert.ok(mx(_arr5).distinct().count() === 10, "Array of 10 distinct strings!"); + assert.ok(mx(_arr6).distinct().count() === 10, "Array of 10 distinct date objects!"); + assert.ok(mx(_arr7).distinct().count() === 2, "Array of 10 boolean values!"); + assert.ok(mx(_arr8).distinct().count() === 10, "Array of 10 distinct class instances overriding equality-comparer!"); + assert.ok(mx(_arr9).distinct().count() === 10, "Array of 10 distinct class instances!"); + assert.ok(mx(_arr2).distinct({ + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).count() === 10, "Array of 10 distinct complex object literal with equality-comparer!"); + }); + + + QUnit.test("except", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateObjectLiteralArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).except(CreateNumberArray()).count() === 0, "Array of first 10 numbers except first 10 numbers!"); + assert.deepEqual(mx(_arr1).except([0, 1, 2, 3, 4]).toArray(), [5, 6, 7, 8, 9], "Array of first 10 numbers except first 5 numbers!"); + assert.ok(mx(_arr2).except([{}]).count() === 0, "Array of 10 empty object literal except an empty object literal!"); + assert.ok(mx(_arr3).except([{ name: "n5", inner: null }]).count() === 10, "Array of 10 distinct complex object literal without equality-comparer!"); + assert.ok(mx(_arr3).except([{ name: "n5", inner: null }], { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).count() === 9, "Array of 10 distinct complex object literal with equality-comparer!"); + }); + + + QUnit.test("elementAt", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).elementAt(0) === 0, "First element of the first 10 numbers!"); + assert.throws(() => mx(_arr).elementAt(100), "throws an exception for 100th element of the first 10 numbers!"); + }); + + + QUnit.test("first", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).first() === 0, "First element of the first 10 numbers!"); + assert.ok(mx(_arr).first(t => t > 5) === 6, "First element greater than 5 of the first 10 numbers!"); + assert.throws(() => mx([]).first(), "throws an exception getting first element of an empty collection!"); + assert.throws(() => mx(_arr).first(t => t > 100), "throws an exception getting first element greater than 100 of the first 10 numbers!"); + }); + + + QUnit.test("firstOrDefault", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).firstOrDefault() === 0, "First element of the first 10 numbers or default!"); + assert.ok(mx(_arr).firstOrDefault(t => t > 5) === 6, "First element greater than 5 of the first 10 numbers or default!"); + assert.ok(mx(_arr).firstOrDefault(t => t > 100) === null, "First element greater than 100 of the first 10 numbers or default!"); + assert.ok(mx(_arr).firstOrDefault(t => t > 100, 100) === 100, "First element greater than 100 of the first 10 numbers or 100 as default!"); + }); + + + QUnit.test("forEach", function (assert) { + + var _arr = CreateNumberArray(), + _sum = 0; + + mx(_arr).forEach(t => _sum += t); + assert.ok(_sum === 45, "ForEach operation on the first 10 numbers!"); + }); + + + QUnit.test("groupBy", function (assert) { + + var _arr1 = CreateObjectLiteralArray(), + _arr2 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).groupBy(t => t).count() === 1, "Group 10 distinct empty object literals!"); + assert.ok(mx(_arr2).groupBy(t => t.name).count() === 10, "Group 10 distinct complex object literals by name!"); + assert.ok(mx(_arr2).groupBy(t => t.name).first().key === "n0", "Group 10 distinct complex object literals by name, retrieve first key!"); + assert.ok(mx(_arr2).groupBy(t => t.name).first().count() === 1, "Group 10 distinct complex object literals by name, retrieve first group count!"); + }); + + + QUnit.test("groupJoin", function (assert) { + + var _arr1 = [{ name: "A", val: 1 }, { name: "B", val: 2 }, { name: "C", val: 3 }, { name: "D", val: 4 }], + _arr2 = [{ code: "A" }, { code: "A" }, { code: "B" }, { code: "B" }, { code: "C" }], + _result = mx(_arr1).groupJoin(_arr2, t => t.name, u => u.code, (t, u) => ({ item: t, group: u })); + + assert.ok(_result.count() === 4, "groupJoin 2 complex-object array, getting count"); + assert.ok(_result.first().item.name === "A", "groupJoin 2 complex-object array, getting item"); + assert.ok(_result.first().group.count() === 2, "groupJoin 2 complex-object array, getting group count"); + assert.ok(_result.last().group.count() === 0, "groupJoin 2 complex-object array, getting empty group count"); + }); + + + QUnit.test("intersect", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateObjectLiteralArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).intersect(CreateNumberArray()).count() === 10, "Array of first 10 numbers intersect with first 10 numbers!"); + assert.deepEqual(mx(_arr1).intersect([2, 3, 4]).toArray(), [2, 3, 4], "Array of first 10 numbers intersect with 3 numbers!"); + assert.ok(mx(_arr2).intersect([{}]).count() === 10, "Array of 10 empty object literal intersect with an empty object literal!"); + assert.ok(mx(_arr3).intersect([{ name: "n5", inner: null }]).count() === 0, "Array of 10 distinct complex object literal without equality-comparer!"); + assert.ok(mx(_arr3).intersect([{ name: "n5", inner: null }], { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).count() === 1, "Array of 10 distinct complex object literal with equality-comparer!"); + }); + + + QUnit.test("join", function (assert) { + var _arr1 = [{ name: "A", val: 1 }, { name: "B", val: 2 }, { name: "C", val: 3 }, { name: "D", val: 4 }], + _arr2 = [{ code: "A" }, { code: "A" }, { code: "B" }, { code: "B" }, { code: "C" }], + _arr3 = CreateObjectLiteralArray(), + _result = mx(_arr1).join(_arr2, t => t.name, u => u.code, (t, u) => ({ item1: t, item2: u })); + + assert.ok(_result.count() === 5, "join 2 complex-object array, getting count"); + assert.ok(_result.first().item1.name === "A" && _result.first().item2.code === "A", "join 2 complex-object array, getting item"); + assert.ok(mx(_arr3).join(mx(CreateObjectLiteralArray()), t => t, u => u, (t, u) => t).count() === 100, "join 2 empty object-literal array"); + assert.ok(mx(mx.empty()).join(mx(_arr3), t => t, u => u, (t, u) => t).count() === 0, "join empty collection with an array"); + }); + + + QUnit.test("last", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).last() === 9, "Last element of the first 10 numbers!"); + assert.ok(mx(_arr).last(t => t < 5) === 4, "Last element less than 5 of the first 10 numbers!"); + assert.throws(() => mx([]).last(), "throws an exception getting last element of an empty collection!"); + assert.throws(() => mx(_arr).last(t => t > 100), "throws an exception getting first element greater than 100 of the first 10 numbers!"); + }); + + + QUnit.test("lastOrDefault", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).lastOrDefault() === 9, "Last element of the first 10 numbers or default!"); + assert.ok(mx(_arr).lastOrDefault(t => t < 5) === 4, "Last element greater than 5 of the first 10 numbers or default!"); + assert.ok(mx(_arr).lastOrDefault(t => t > 100) === null, "Last element greater than 100 of the first 10 numbers or default!"); + assert.ok(mx(_arr).lastOrDefault(t => t > 100, 100) === 100, "Last element greater than 100 of the first 10 numbers or 100 as default!"); + }); + + + QUnit.test("max", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateStringArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).max() === 9, "Maximum of the first 10 numbers!"); + assert.ok(mx(_arr2).max() === "9_string", "Maximum of the 10 string array!"); + assert.ok(mx(_arr3).max(t => t.name) === "n9", "Maximum of a complex array by selector!"); + assert.throws(() => mx([]).max(), "throws an exception getting maximum of an empty collection!"); + }); + + + QUnit.test("min", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateStringArray(), + _arr3 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).min() === 0, "Minimum of the first 10 numbers!"); + assert.ok(mx(_arr2).min() === "0_string", "Minimum of the 10 string array!"); + assert.ok(mx(_arr3).min(t => t.name) === "n0", "Minimum of a complex array by selector!"); + assert.throws(() => mx([]).min(), "throws an exception getting minimum of an empty collection!"); + }); + + + QUnit.test("ofType", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).ofType(Number).count() === 10, "Cast array of numbers to number!"); + assert.ok(mx(_arr).ofType(String).count() === 0, "Cast array of numbers to string!"); + }); + + + QUnit.test("orderBy", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(), + _arr3 = [{ name: "a", val: 1 }, { name: "a", val: 2 }, { name: "b", val: 1 }, { name: "c", val: 2 }], + _result = [{ name: "a", val: 1 }, { name: "b", val: 1 }, { name: "a", val: 2 }, { name: "c", val: 2 }] + + assert.deepEqual(mx(_arr1).orderBy(t => t).take(5).toArray(), [0, 1, 2, 3, 4], "Order array of numbers ascending!"); + assert.ok(mx(_arr2).orderBy(t => t.name).thenByDescending(t => t.inner.index).first().name === "n0", "Order array of complex object by 'name' ascending then by 'inner.index' descending !"); + assert.deepEqual(mx(_arr3).orderBy(t => t.val).thenBy(t => t.name).toArray(), _result, "Order and thenBy!"); + assert.ok(mx(_arr2).orderBy(t => t.name, { + hash: o => mx.hash(o), + equals: (a, b) => a === b + }).first().name === "n0", "Order array of complex object ascending with comparer!"); + }); + + + QUnit.test("orderByDescending", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(), + _arr3 = [{ name: "a", val: 1 }, { name: "a", val: 2 }, { name: "b", val: 1 }, { name: "c", val: 2 }], + _result = [{ name: "a", val: 2 }, { name: "c", val: 2 }, { name: "a", val: 1 }, { name: "b", val: 1 }]; + + assert.deepEqual(mx(_arr1).orderByDescending(t => t).take(5).toArray(), [9, 8, 7, 6, 5], "Order array of numbers descending!"); + assert.ok(mx(_arr2).orderByDescending(t => t.name).thenByDescending(t => t.inner.index).first().name === "n9", "Order array of complex object by 'name' descending then by 'inner.index' descending !"); + assert.deepEqual(mx(_arr3).orderByDescending(t => t.val).thenBy(t => t.name).toArray(), _result, "Order descending and thenBy!"); + assert.ok(mx(_arr2).orderByDescending(t => t.name, { + hash: o => mx.hash(o), + equals: (a, b) => a === b + }).first().name === "n9", "Order array of complex object descending with comparer!"); + }); + + + QUnit.test("reverse", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateStringArray(); + + assert.deepEqual(mx(_arr1).reverse().take(5).toArray(), [9, 8, 7, 6, 5], "Reverse array of first 10 numbers!"); + assert.ok(mx(_arr2).reverse().first() === "9_string", "Reverse array of strings!"); + }); + + + QUnit.test("sequenceEqual", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).sequenceEqual(mx(CreateNumberArray())), "sequenceEqual on array of numbers!"); + assert.ok(mx([1, 2, 3]).sequenceEqual(mx([1, 2])) === false, "sequenceEqual on inharmonic arrays of numbers!"); + assert.ok(mx([{ name: "a" }]).sequenceEqual(mx([{ name: "a", val: 1 }]), { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }), "sequenceEqual on arrays of objects with comparer!"); + }); + + + QUnit.test("select", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).select(t => t + 100).first() === 100, "select first 10 numbers plus 100!"); + assert.ok(mx(_arr).select((t, i) => i).last() === 9, "select index while enumerating 10 numbers!"); + }); + + + QUnit.test("selectMany", function (assert) { + + var _arr = [{ name: "A", values: [1, 2, 3, 4] }, { name: "B", values: [5, 6, 7, 8] }]; + + assert.ok(mx(_arr).selectMany(t => t.values).count() === 8, "selectMany on complex objects!"); + assert.deepEqual(mx(_arr).selectMany(t => t.values, (t, u) => ({ name: t.name, value: u })).first(), { name: "A", value: 1 }, "selectMany on complex objects with result selector!"); + }); + + + QUnit.test("single", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx([1]).single() === 1, "Single element of a single array!"); + assert.ok(mx(_arr).single(t => t === 1) === 1, "Single element equal to 1 of the first 10 numbers!"); + assert.throws(() => mx([]).single(), "throws an exception getting single element of an empty collection!"); + assert.throws(() => mx(_arr).single(), "throws an exception getting single element of an collection containing more than one element!"); + assert.throws(() => mx(_arr).single(t => t > 100), "throws an exception getting single element greater than 100 of the first 10 numbers!"); + assert.throws(() => mx(_arr).single(t => t < 10), "throws an exception getting single element less than 10 of the first 10 numbers!"); + }); + + + QUnit.test("singleOrDefault", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx([1]).singleOrDefault() === 1, "Single element of a single array or default!"); + assert.ok(mx([]).singleOrDefault() === null, "Single element of an empty array or default!"); + assert.ok(mx(_arr).singleOrDefault(t => t === 1) === 1, "Single element equal to 1 of the first 10 numbers or default!"); + assert.ok(mx(_arr).singleOrDefault(t => t === 100, 100) === 100, "Single element of an empty array or default!"); + assert.throws(() => mx(_arr).singleOrDefault(), "throws an exception getting single element of an collection containing more than one element!"); + assert.throws(() => mx(_arr).singleOrDefault(t => t < 10), "throws an exception getting single element less than 10 of the first 10 numbers!"); + }); + + + QUnit.test("skip", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).skip(5).toArray(), [5, 6, 7, 8, 9], "Skip 5 element of a the first 10 numbers!"); + assert.deepEqual(mx(_arr).where(t => t % 2 === 0).skip(3).toArray(), [6, 8], "Skip 3 element of a the first 10 even numbers!"); + assert.ok(mx(_arr).skip(0).count() === 10, "Skip no items!"); + assert.ok(mx(_arr).skip(100).count() === 0, "Skip more than count of the collection!"); + }); + + + QUnit.test("skipWhile", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).skipWhile(t => t < 5).toArray(), [5, 6, 7, 8, 9], "Skip while elements are less than 5 from the first 10 even numbers!"); + assert.ok(mx(_arr).skipWhile(t => t > 5).count() === 10, "Skip while elements are greater than 5 from the first 10 even numbers!"); + }); + + + QUnit.test("sum", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).sum() === 45, "Sum of the first 10 numbers!"); + assert.ok(mx(_arr).sum(t => t * 2) === 90, "Sum of the first 10 numbers multiply by 2!"); + assert.throws(() => mx(CreateObjectLiteralArray()).sum(), "throws an exception getting sum of non numeric elements!"); + assert.throws(() => mx(CreateComplexObjectLiteralArray()).sum(t => t.name), "throws an exception getting sum of non numeric properties!"); + }); + + + QUnit.test("take", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).take(5).toArray(), [0, 1, 2, 3, 4], "Take 5 element of a the first 10 numbers!"); + assert.deepEqual(mx(_arr).where(t => t % 2 === 0).take(3).toArray(), [0, 2, 4], "Take 3 element of a the first 10 even numbers!"); + assert.ok(mx(_arr).take(0).count() === 0, "Take no items!"); + assert.ok(mx(_arr).take(100).count() === 10, "Take more than count of the collection!"); + }); + + + QUnit.test("takeWhile", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).takeWhile(t => t < 5).toArray(), [0, 1, 2, 3, 4], "Take while elements are less than 5 from the first 10 even numbers!"); + assert.ok(mx(_arr).takeWhile(t => t > 5).count() === 0, "Take while elements are greater than 5 from the first 10 even numbers!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _arr = CreateNumberArray(); + + assert.deepEqual(mx(_arr).where(t => t < 5).toArray(), [0, 1, 2, 3, 4], "Elements less than 5 from the first 10 even numbers!"); + }); + + + QUnit.test("toDictionary", function (assert) { + + var _arr = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr).toDictionary(t => t.name).count() === 10, "toDictionary key-selector!"); + assert.ok(mx(_arr).toDictionary(t => t.name, t => t.inner.index).first().value === 0, "toDictionary key-selector & element-selector!"); + assert.ok(mx(_arr).toDictionary(t => t, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().key.name === "n0", "toDictionary key-selector & comparer!"); + + assert.ok(mx(_arr).toDictionary(t => t, t => t.inner.index, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().value === 0, "toDictionary key-selector, element-selector & comparer!"); + + assert.throws(() => mx([1, 1, 2]).toDictionary(t => t), "throws an exception with duplicate keys!"); + }); + + + QUnit.test("toList", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).toList().count() === 10, "toList first 10 numbers!"); + assert.ok(mx(_arr).toList()[1] === 1, "toList indexer first 10 numbers!"); + }); + + + QUnit.test("toLookup", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).toLookup(t => t).count() === 10, "toLookup first 10 numbers!"); + assert.ok(mx(_arr1).toLookup(t => t).get(1).count() === 1, "toLookup indexer first 10 numbers!"); + + assert.ok(mx(_arr2).toLookup(t => t, { + hash: o => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().first().name === "n0", "toLookup with key-selector and comparer!"); + + assert.ok(mx(_arr2).toLookup(t => t, t => t.name, { + hash: (o) => mx.hash(o.name), + equals: (a, b) => a.name === b.name + }).first().first() === "n0", "toLookup with key-selector, element-selector and comparer!"); + }); + + + QUnit.test("union", function (assert) { + + var _arr = CreateNumberArray(); + + assert.ok(mx(_arr).union(CreateNumberArray()).count() === 10, "Union first 10 numbers with itself!"); + assert.deepEqual(mx([1, 2]).union(mx([2, 3])).toArray(), [1, 2, 3], "Union two arrays!"); + }); + + + QUnit.test("where", function (assert) { + + var _arr1 = CreateNumberArray(), + _arr2 = CreateComplexObjectLiteralArray(); + + assert.ok(mx(_arr1).where(t => t < 5).count() === 5, "Filter first 10 numbers less than 10!"); + assert.ok(mx(_arr2).where(t => t.inner.index < 5).count() === 5, "Filter complex object by value!"); + assert.deepEqual(mx(_arr1).where(t => t <= 1).toArray(), [0, 1], "Deep equal check!"); + }); + + + QUnit.test("zip", function (assert) { + + assert.ok(mx([1, 2]).zip([3, 4], (t, u) => t + u).first() === 4, "Zip two numeric array!"); + assert.ok(mx([1, 2]).zip([3], (t, u) => t + u).count() === 1, "Zip two inharmonic numeric array!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateObjectLiteralArray(): Object[] { + return mx.range(0, 10).select(t => ({})).toArray(); + } + + function CreateComplexObjectLiteralArray(): { name: string; inner: { index: number; val: Object } }[] { + return mx.range(0, 10).select(t => ({ + name: "n" + t, + inner: { + index: t, + val: {} + } + })).toArray(); + } + + function CreateSimpleClassArray(): SimpleClass[] { + return mx.range(0, 10).select(t => new SimpleClass()).toArray(); + } + + function CreateSimpleClassWithComparerArray(): SimpleClassWithComparer[] { + return mx.range(0, 10).select(t => new SimpleClassWithComparer(t)).toArray(); + } + + function CreateNumberArray(): number[] { + return mx.range(0, 10).toArray(); + } + + function CreateFloatNumberArray(): number[] { + return mx.range(0, 10).select(t => t + 0.1).toArray(); + } + + function CreateStringArray(): string[] { + return mx.range(0, 10).select(t => t + "_string").toArray(); + } + + function CreateDateArray(): Date[] { + return mx.range(0, 10).select(t => new Date(new Date().getTime() + t)).toArray(); + } + + function CreateBooleanArray(): boolean[] { + return mx.range(0, 10).select(t => t % 2 === 0).toArray(); + } + } + + + module CollectionTests { + + QUnit.module("Collection"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(CreateCollection().count() === 5, "initialize a Collection using specified collection!"); + }); + + + QUnit.test("count", function (assert) { + + var _col = CreateCollection(); + assert.ok(_col.count() === 5, "collection containing count!"); + assert.throws(() => new Collection().count(), "throws an error getting count of an empty collection."); + }); + + + QUnit.test("copyTo", function (assert) { + + var _col = CreateCollection(), + _arr = new Array(_col.count()); + + _col.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "Collection copy to an array!"); + assert.throws(() => _col.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("collection enumerable", function (assert) { + + var _col = CreateCollection(); + assert.deepEqual(_col.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a collection!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateCollection(): Collection { + return new Collection(mx.range(1, 5)); + } + } + + + module ListTests { + + QUnit.module("List"); + + + QUnit.test("constructor", function (assert) { + assert.ok(new List().count() === 0, "an empty list!"); + assert.ok(new List(10).count() === 10, "an empty list with initial capacity!"); + assert.ok(new List(1, 2, 3, 4, 5).count() === 5, "list initializer!"); + assert.ok(new List(mx.range(0, 10)).count() === 10, "list from an Enumerable!"); + }); + + + QUnit.test("indexer", function (assert) { + + var _list = CreateList(); + + assert.ok(_list[0] === 1, "indexer get!"); + + _list[0] = 0; + assert.ok(_list[0] === 0 && _list.first() === 0, "indexer set!"); + }); + + + QUnit.test("add", function (assert) { + + var _list = new List(); + + _list.add(1); + assert.ok(_list[0] === 1, "add!"); + assert.ok(_list.count() === 1, "add count!"); + }); + + + QUnit.test("addRange", function (assert) { + + var _list = new List(); + + _list.addRange(mx.range(0, 10)); + assert.ok(_list.count() === 10, "add range of numbers!"); + }); + + + QUnit.test("asReadOnly", function (assert) { + + var _rlist = new List(mx.range(0, 10)).asReadOnly(); + + assert.ok(_rlist.count() === 10, "readOnlyCollection count!"); + assert.ok(_rlist[0] === 0, "readOnlyCollection get!"); + }); + + + QUnit.test("binarySearch", function (assert) { + + var _list1 = new List(mx.range(0, 100)), + _list2 = new List<{ index: number }>(mx.range(0, 100).select(t => ({ index: t }))); + + assert.ok(_list1.binarySearch(50) === 50, "binary-search to find an item!"); + assert.ok(_list1.binarySearch(100) < 0, "binary-search item not found!"); + + assert.ok(_list2.binarySearch({ index: 50 }, { compare: (a, b) => a.index - b.index }) === 50, "binary-search find an item with comparer!"); + assert.ok(_list2.binarySearch({ index: 80 }, 50, 40, { compare: (a, b) => a.index - b.index }) === 80, "binary-search find an item with index, count and comparer!"); + }); + + + QUnit.test("clear", function (assert) { + + var _list = CreateList(); + + _list.clear(); + assert.ok(_list.count() === 0, "Clear list!"); + }); + + + QUnit.test("contains", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.contains(3) === true, "list contains!"); + assert.ok(_list.contains(6) === false, "list not containing!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _list = CreateList(), + _arr = new Array(_list.count()); + + _list.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "list copyTo an array!"); + }); + + + QUnit.test("exists", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.exists(t => t % 2 === 0), "an even number exists in a list of the first 5 number!"); + assert.ok(_list.exists(t => t > 5) === false, "6 exists in a list of the first 5 number!"); + }); + + + QUnit.test("find", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.find(t => t % 2 === 0) === 2, "find an even number in a list of the first 5 number!"); + assert.ok(_list.find(t => t > 5) === null, "find a number greater than 5 in a list of the first 5 number!"); + }); + + + QUnit.test("findIndex", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.findIndex(t => t % 2 === 0) === 1, "find index of an even numbers in a list of the first 5 number!"); + assert.ok(_list.findIndex(2, t => t % 2 === 0) === 3, "find index of an even numbers in a list of the first 5 number, starting from 2!"); + assert.ok(_list.findIndex(2, 1, t => t % 2 === 0) === -1, "find index of an even numbers in a list of the first 5 number, starting from 3, for 1 attempt!"); + }); + + + QUnit.test("findLast", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.findLast(t => t % 2 === 0) === 4, "find last even number in a list of the first 5 number!"); + assert.ok(_list.findLast(t => t > 5) === null, "find last number greater than 5 in a list of the first 5 number!"); + }); + + + QUnit.test("findLastIndex", function (assert) { + + var _list = new List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); + + assert.ok(_list.findLastIndex(t => t % 2 === 0) === 8, "find last index of an even numbers in a list of the first 10 number!"); + assert.ok(_list.findLastIndex(5, t => t % 2 === 0) === 4, "find last index of an even numbers in a list of the first 10 number, starting from 5!"); + assert.ok(_list.findLastIndex(5, 1, t => t % 2 === 0) === -1, "find last index of an even numbers in a list of the first 10 number, starting from 5, for 1 attempt!"); + }); + + + QUnit.test("forEach", function (assert) { + + var _list = CreateList(), + _count = 0; + + _list.forEach(t => _count += t); + + assert.ok(_count === 15, "forEach to get sum of a the items in a list!"); + }); + + + QUnit.test("get", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.get(1) === 2, "get item at index 1 from a list of 5 numbers!"); + assert.throws(() => _list.get(10), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("getRange", function (assert) { + + var _list = CreateList(); + + assert.deepEqual(_list.getRange(0, 3).toArray(), [1, 2, 3], "get range of first 3 items of a list of first 5 numbers!"); + assert.throws(() => _list.getRange(0, 10), "throws an error getting first 10 items from a list of 5 numbers!"); + }); + + + QUnit.test("indexOf", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.indexOf(3) === 2, "get index of 3 in a list of first 5 numbers!"); + assert.ok(_list.indexOf(10) === -1, "get index of 10 in a list of first 5 numbers!"); + assert.ok(_list.indexOf(3, 4) === -1, "get index of 3 in a list of first 5 numbers, starting from index 4!"); + }); + + + QUnit.test("insert", function (assert) { + + var _list = CreateList(); + + _list.insert(3, 0); + + assert.ok(_list.count() === 6, "insert an item in a list of 5 numbers, get count!"); + assert.ok(_list[3] === 0, "insert an item in a list of 5 numbers, get item!"); + assert.throws(() => _list.insert(10, 0), "throws an error inserting in 10th index of a list of 5 numbers!"); + }); + + + QUnit.test("insertRange", function (assert) { + + var _list = CreateList(); + + _list.insertRange(3, mx.range(0, 3)); + + assert.ok(_list.count() === 8, "insert range of items in a list of 5 numbers, get count!"); + assert.ok(_list[3] === 0 && _list[4] === 1 && _list[5] === 2, "insert range of items in a list of 5 numbers, get items!"); + assert.throws(() => _list.insertRange(10, mx.range(0, 3)), "throws an error inserting range of items in 10th index of a list of 5 numbers!"); + }); + + + QUnit.test("lastIndexOf", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.lastIndexOf(3) === 2, "get last index of 3 in a list of first 5 numbers!"); + assert.ok(_list.lastIndexOf(10) === -1, "get last index of 10 in a list of first 5 numbers!"); + assert.ok(_list.lastIndexOf(3, 1) === -1, "get last index of 3 in a list of first 5 numbers, starting from index 1!"); + }); + + + QUnit.test("remove", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.remove(2) === true && _list.count() === 4, "remove an item from a list, get count!"); + assert.ok(_list.remove(10) === false && _list.count() === 4, "remove an item which does not exist in a list, get count!"); + }); + + + QUnit.test("removeAll", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.removeAll(t => t % 2 === 0) === 2 && _list.count() === 3, "remove all even numbers from a list of first 5 numbers, get count!"); + assert.ok(_list.removeAll(t => t % 2 === 0) === 0 && _list.count() === 3, "remove all even numbers from a list of first 3 odd numbers, get count!"); + }); + + + QUnit.test("removeAt", function (assert) { + + var _list = CreateList(); + + _list.removeAt(2); + + assert.ok(_list[2] === 4 && _list.count() === 4, "remove item from 2nd index of a list of first 5 numbers, get count!"); + assert.throws(() => _list.removeAt(10), "throws an error removing item from 10th index of a list of first 5 numbers!"); + }); + + + QUnit.test("removeRange", function (assert) { + + var _list = CreateList(); + + _list.removeRange(1, 3); + + assert.ok(_list[0] === 1 && _list[1] === 5 && _list.count() === 2, "remove range of 3 items, starting from 1st index from a list of first 5 numbers, get count!"); + assert.throws(() => _list.removeRange(10, 10), "throws an error removing a range of items starting from 10th index of a list of first 5 numbers!"); + }); + + + QUnit.test("reverse", function (assert) { + + var _arr = [1, 2, 3, 4, 5], + _list1 = new List(_arr), + _list2 = new List(_arr); + + _list1.reverse(); + _list2.reverse(0, 3); + + assert.deepEqual(_list1.toArray(), [5, 4, 3, 2, 1], "reverse list of 5 first numbers!"); + assert.deepEqual(_list2.toArray(), [3, 2, 1, 4, 5], "reverse first 3 items of a list of 5 first numbers!"); + }); + + + QUnit.test("set", function (assert) { + + var _list = CreateList(); + + _list.set(1, 0); + + assert.ok(_list[1] === 0, "set value at index 1 of a list!"); + assert.throws(() => _list.set(10, 1), "throws an error setting item at index 10 from a list of 5 numbers!"); + }); + + + QUnit.test("sort", function (assert) { + + var _arr = [7, 1, 8, 3, 2, 0, 9, 6, 4, 5], + _list1 = new List(_arr), + _list2 = new List(_arr), + _list3 = new List(_arr), + _list4 = new List(_arr), + _sorter = (a: number, b: number) => a - b; + + _list1.sort(); + _list2.sort(_sorter); + _list3.sort({ compare: _sorter }); + _list4.sort(0, 5, { compare: _sorter }); + + assert.deepEqual(_list1.toArray(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "sort list of first 10 numbers!"); + assert.deepEqual(_list2.toArray(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "sort list of first 10 numbers with a comparison function!"); + assert.deepEqual(_list3.toArray(), [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "sort list of first 10 numbers with a comparer!"); + assert.deepEqual(_list4.toArray(), [1, 2, 3, 7, 8, 0, 9, 6, 4, 5], "sort 5 first items of list of first 10 numbers with a comparer!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _list = CreateList(); + + assert.deepEqual(_list.toArray(), [1, 2, 3, 4, 5], "converts a list of numbers to an array!"); + }); + + + QUnit.test("trueForAll", function (assert) { + + var _list = CreateList(); + + assert.ok(_list.trueForAll(t => t < 10) === true, "checks whether all items in a list of 5 first numbers are less than 10!"); + assert.ok(_list.trueForAll(t => t < 3) === false, "checks whether all items in a list of 5 first numbers are less than 3!"); + }); + + + QUnit.test("list enumerable", function (assert) { + + var _list = CreateList(); + + assert.deepEqual(_list.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a list!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateList(): List { + return new List(1, 2, 3, 4, 5); + } + } + + + module ReadOnlyCollectionTests { + + QUnit.module("ReadOnlyCollection"); + + + QUnit.test("constructor", function (assert) { + assert.ok(CreateReadOnlyCollection().count() === 5, "initialize a ReadOnlyCollection!"); + assert.throws(() => new ReadOnlyCollection(null), "throws an exception creating an ampty ReadOnlyCollection!"); + }); + + + QUnit.test("indexer", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col[0] === 1, "indexer get!"); + assert.ok(function () { + try { _col[0] = 0; } + catch (e) { } + return _col[0] === 1; + }, "indexer set!"); + + assert.ok(function () { + try { _col[10] = 0; } + catch (e) { } + return _col[10] === undefined; + }, "out of range indexer set!"); + }); + + + QUnit.test("get", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col.get(1) === 2, "get item at index 1 from a collection of 5 numbers!"); + assert.throws(() => _col.get(10), "throws error getting item at index 10 from a collection of 5 numbers!"); + }); + + + QUnit.test("contains", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col.contains(3) === true, "collection contains!"); + assert.ok(_col.contains(6) === false, "collection not containing!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _col = CreateReadOnlyCollection(), + _arr = new Array(_col.count()); + + _col.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "collection copyTo an array!"); + assert.throws(() => _col.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("indexOf", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.ok(_col.indexOf(3) === 2, "get index of 3 in a collection of first 5 numbers!"); + assert.ok(_col.indexOf(10) === -1, "get index of 10 in a collection of first 5 numbers!"); + }); + + + QUnit.test("collection enumerable", function (assert) { + + var _col = CreateReadOnlyCollection(); + + assert.deepEqual(_col.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a collection!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateReadOnlyCollection(): ReadOnlyCollection { + return new ReadOnlyCollection(new List(1, 2, 3, 4, 5)); + } + } + + + module SortedListTests { + + QUnit.module("SortedList"); + + + QUnit.test("constructor", function (assert) { + + var _comparer = Comparer.create((a: number, b: number) => a - b), + _dic = CreateDictionary(), + _s1 = new SortedList(), + _s2 = new SortedList(5), + _s3 = new SortedList(_dic), + _s4 = new SortedList(_comparer), + _s5 = new SortedList(5, _comparer), + _s6 = new SortedList(_dic, _comparer); + + + assert.ok(_s1.count() === 0 && _s1.capacity() === 0, "initialize a SortedList!"); + assert.ok(_s2.count() === 0 && _s2.capacity() === 5, "initialize a SortedList using initial capacity!"); + assert.ok(_s3.count() === 5 && _s3.capacity() === 5, "initialize a SortedList using specified dictionary!"); + assert.ok(_s4.count() === 0 && _s4.capacity() === 0, "initialize a SortedList using specified comparer!"); + assert.ok(_s5.count() === 0 && _s5.capacity() === 5, "initialize a SortedList using using initial capacity and comparer!"); + assert.ok(_s6.count() === 5 && _s6.capacity() === 5, "initialize a SortedList using specified dictionary and comparer!"); + }); + + + QUnit.test("add", function (assert) { + + assert.ok(CreateSortedList().count() == 5, "sorted-list add!"); + assert.throws(() => CreateSortedList().add(1, "AA"), "throws an error adding existing key to the list!"); + }); + + + QUnit.test("get", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.get(1) === "A", "sorted-list get!"); + assert.throws(() => _list.get(10), "throws an error getting invalid key!"); + }); + + + QUnit.test("capacity", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.capacity() > 0, "get sorted-list capacity!"); + + _list.capacity(10); + assert.ok(_list.capacity() === 10, "set sorted-list capacity!"); + }); + + + QUnit.test("clear", function (assert) { + + var _list = CreateSortedList(); + + _list.clear(); + assert.ok(_list.count() === 0 && _list.capacity() === 0, "clear sorted-list!"); + }); + + + QUnit.test("comparer", function (assert) { + + var _comparer = CreateSortedList().comparer(); + + assert.ok(_comparer.compare(5, 1) > 0 && _comparer.compare(1, 5) < 0 && _comparer.compare(1, 1) === 0, "sorted-list comparer!"); + }); + + + QUnit.test("containsKey", function (assert) { + + var _list1 = CreateSortedList(), + _list2 = new SortedList<{ id: number; name: string }, number>({ compare: (a, b) => a.name.localeCompare(b.name) }); + + assert.ok(_list1.containsKey(1) === true, "sorted-list contains key!"); + assert.ok(_list1.containsKey(10) === false, "sorted-list does not contain key!"); + + + _list2.add({ id: 2, name: "B" }, 2); + _list2.add({ id: 5, name: "E" }, 5); + _list2.add({ id: 4, name: "D" }, 4); + _list2.add({ id: 3, name: "C" }, 3); + _list2.add({ id: 1, name: "A" }, 1); + + assert.ok(_list2.containsKey({ id: 3, name: "C" }), "sorted-list contains key using specified comparer"); + }); + + + QUnit.test("containsValue", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.containsValue("A") === true, "sorted-list contains value!"); + assert.ok(_list.containsValue("Z") === false, "sorted-list does not contain value!"); + }); + + + QUnit.test("keys", function (assert) { + + var _list = CreateSortedList(); + + assert.deepEqual(_list.keys().toArray(), [1, 2, 3, 4, 5], "sorted-list keys!"); + assert.deepEqual(new SortedList().keys().toArray(), [], "empty sorted-list keys!"); + }); + + + QUnit.test("values", function (assert) { + + var _list = CreateSortedList(); + + assert.deepEqual(_list.values().toArray(), ["A", "B", "C", "D", "E"], "sorted-list values!"); + assert.deepEqual(new SortedList().values().toArray(), [], "empty sorted-list values!"); + }); + + + QUnit.test("indexOfKey", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.indexOfKey(1) === 0, "sorted-list index of key!"); + assert.ok(_list.indexOfKey(10) < 0, "sorted-list index of invalid key!"); + }); + + + QUnit.test("indexOfValue", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.indexOfValue("A") === 0, "sorted-list index of value!"); + assert.ok(_list.indexOfValue("Z") < 0, "sorted-list index of invalid value!"); + }); + + + QUnit.test("remove", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(_list.remove(1) === true && _list.count() === 4 && _list.indexOfKey(1) < 0, "sorted-list remove key!"); + assert.ok(_list.remove(1) === false && _list.count() === 4, "sorted-list remove invalid key!"); + }); + + + QUnit.test("removeAt", function (assert) { + + var _list = CreateSortedList(); + + _list.removeAt(0); + assert.ok(_list.count() === 4 && _list.indexOfKey(1) < 0, "sorted-list remove at index!"); + assert.throws(() => _list.removeAt(10), "throws an error removing item at invalid index"); + }); + + + QUnit.test("set", function (assert) { + + var _list = CreateSortedList(); + + _list.set(1, "AA"); + assert.ok(_list.count() === 5 && _list.get(1) === "AA", "sorted-list set exisiting key's value!"); + + _list.set(6, "F"); + assert.ok(_list.count() === 6 && _list.get(6) === "F", "sorted-list set new key and value!"); + }); + + + QUnit.test("tryGetValue", function (assert) { + + var _list = CreateSortedList(); + + assert.ok(function () { + var value: string; + var res = _list.tryGetValue(1, val => value = val); + + return res && value === "A"; + + }, "sorted-list tryGetValue, exisiting key!"); + + + assert.ok(function () { + var value: string; + var res = _list.tryGetValue(10, val => value = val); + + return res === false; + + }, "sorted-list tryGetValue, invalid key!"); + }); + + + QUnit.test("sorted-list enumerable", function (assert) { + + var _list = CreateSortedList(); + + assert.deepEqual(_list.select(t => t.key * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a sorted-list!"); + assert.deepEqual(_list.where(t => t.key > 2).select(t => t.value).toArray(), ["C", "D", "E"], "where-select-toArray over a sorted-list!"); + }); + + + QUnit.test("evaluate sorting", function (assert) { + + var _list1 = CreateSortedList(), + _list2 = new SortedList<{ id: number; name: string }, number>({ compare: (a, b) => a.name.localeCompare(b.name) }); + + _list1.remove(5); + _list1.add(6, "F"); + _list1.remove(4); + _list1.add(7, "G"); + _list1.remove(3); + _list1.add(8, "H"); + _list1.remove(2); + _list1.add(9, "I"); + _list1.remove(1); + _list1.add(10, "J"); + + assert.deepEqual(_list1.keys().toArray(), [6, 7, 8, 9, 10], "evaluate sorted keys after multiple add/remove"); + assert.deepEqual(_list1.values().toArray(), ["F", "G", "H", "I", "J"], "evaluate sorted values after multiple add/remove"); + + + + _list2.add({ id: 2, name: "B" }, 2); + _list2.add({ id: 5, name: "E" }, 5); + _list2.add({ id: 4, name: "D" }, 4); + _list2.add({ id: 3, name: "C" }, 3); + _list2.add({ id: 1, name: "A" }, 1); + + assert.deepEqual(_list2.keys().select(t => t.id).toArray(), [1, 2, 3, 4, 5], "evaluate sorted keys after multiple add/remove using specified comparer!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateDictionary(): Dictionary { + var _dic = new Dictionary(); + _dic.add(1, "A"); + _dic.add(2, "B"); + _dic.add(3, "C"); + _dic.add(4, "D"); + _dic.add(5, "E"); + + return _dic; + } + + function CreateSortedList(): SortedList { + var _list = new SortedList(); + _list.add(5, "E"); + _list.add(3, "C"); + _list.add(2, "B"); + _list.add(4, "D"); + _list.add(1, "A"); + + return _list; + } + } + + + module DictionaryTests { + + QUnit.module("Dictionary"); + + + QUnit.test("constructor", function (assert) { + + var _comparer = EqualityComparer.create(o => mx.hash(o), (a, b) => a === b), + _d1 = new Dictionary(), + _d2 = new Dictionary(CreateDictionary()), + _d3 = new Dictionary(_comparer), + _d4 = new Dictionary(5), + _d5 = new Dictionary(5, _comparer), + _d6 = new Dictionary(CreateDictionary(), _comparer); + + + assert.ok(_d1.count() === 0, "initialize a Dictionary!"); + assert.ok(_d2.count() === 5, "initialize a Dictionary using specified dictionary!"); + assert.ok(_d3.count() === 0, "initialize a Dictionary using specified comparer!"); + assert.ok(_d4.count() === 0, "initialize a Dictionary using initial capacity!"); + assert.ok(_d5.count() === 0, "initialize a Dictionary using using initial capacity and comparer!"); + assert.ok(_d6.count() === 5, "initialize a Dictionary using specified dictionary and comparer!"); + }); + + + QUnit.test("add", function (assert) { + var _dic = new Dictionary(); + _dic.add(1, "A"); + + assert.ok(_dic.count() === 1, "ditionary add"); + assert.throws(() => _dic.add(1, "B"), "throws an error adding duplicate key"); + }); + + + QUnit.test("clear", function (assert) { + var _dic = CreateDictionary(); + _dic.clear(); + + assert.ok(_dic.count() === 0, "ditionary clear!"); + }); + + + QUnit.test("containsKey", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.containsKey(1) === true, "dictionary contains key!"); + assert.ok(_dic.containsKey(10) === false, "dictionary does not contain key!"); + }); + + + QUnit.test("containsValue", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.containsValue("A") === true, "dictionary contains value!"); + assert.ok(_dic.containsValue("Z") === false, "dictionary does not contain value!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _dic = CreateDictionary(), + _arr = new Array(_dic.count()); + + _dic.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "dictionary copy to an array!"); + assert.throws(() => _dic.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("keys", function (assert) { + + var _dic = CreateDictionary(); + + assert.deepEqual(_dic.keys().toArray(), [1, 2, 3, 4, 5], "dictionary keys!"); + assert.deepEqual(new Dictionary().keys().toArray(), [], "empty dictionary keys!"); + }); + + + QUnit.test("values", function (assert) { + + var _dic = CreateDictionary(); + + assert.deepEqual(_dic.values().toArray(), ["A", "B", "C", "D", "E"], "dictionary values!"); + assert.deepEqual(new Dictionary().values().toArray(), [], "empty dictionary values!"); + }); + + + QUnit.test("get", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.get(1) === "A", "dictionary get value!"); + assert.throws(() => _dic.get(10), "throws an error getting non existing key!"); + }); + + + QUnit.test("set", function (assert) { + + var _dic = CreateDictionary(); + + _dic.set(1, "AA"); + assert.ok(_dic.get(1) === "AA", "dictionary set value!"); + + _dic.set(6, "F"); + assert.ok(_dic.count() === 6 && _dic.get(6) === "F", "dictionary set new key and value!"); + }); + + + QUnit.test("tryGetValue", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(function () { + var value: string; + var res = _dic.tryGetValue(1, val => value = val); + + return res && value === "A"; + + }, "dictionary tryGetValue, exisiting key!"); + + + assert.ok(function () { + var value: string; + var res = _dic.tryGetValue(10, val => value = val); + + return res === false; + + }, "dictionary tryGetValue, invalid key!"); + }); + + + QUnit.test("remove", function (assert) { + + var _dic = CreateDictionary(); + + assert.ok(_dic.remove(1) === true && _dic.count() === 4, "dictionary remove key!"); + assert.ok(_dic.remove(10) === false && _dic.count() === 4, "dictionary remove non existing key!"); + }); + + + QUnit.test("key-value pair", function (assert) { + + var _pair1 = new KeyValuePair(1, "A"), + _pair2 = new KeyValuePair(1, "A"); + + assert.ok(_pair1.key === 1 && _pair1.value === "A", "KeyValuePair get key/value!"); + assert.throws(() => _pair1.key = 2, "throws an error trysing to set KeyValuePair key!"); + assert.throws(() => _pair1.value = "B", "throws an error trysing to set KeyValuePair value!"); + assert.ok(mx.hash(_pair1) === mx.hash(_pair2), "KeyValuePair get hash code!"); + assert.ok(mx.equals(_pair1, _pair2), "KeyValuePair equality check!"); + }); + + + QUnit.test("dictionary enumerable", function (assert) { + + var _dic = CreateDictionary(); + + assert.deepEqual(_dic.select(t => t.key).toArray(), [1, 2, 3, 4, 5], "dictionary select keys, to array!"); + assert.deepEqual(_dic.select(t => t.value).toArray(), ["A", "B", "C", "D", "E"], "dictionary select values, to array!"); + assert.ok(_dic.toArray()[0].key === 1 && _dic.toArray()[0].value === "A", "dictionary select key-value items!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateDictionary(): Dictionary { + var _dic = new Dictionary(); + _dic.add(1, "A"); + _dic.add(2, "B"); + _dic.add(3, "C"); + _dic.add(4, "D"); + _dic.add(5, "E"); + + return _dic; + } + } + + + module HashSetTests { + + QUnit.module("Hashset"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new HashSet().count() === 0, "initialize an empty HashSet!"); + assert.ok(new HashSet(mx.range(1, 5)).count() === 5, "initialize a HashSet using specified collection!"); + assert.ok(new HashSet(mx.EqualityComparer.defaultComparer).count() === 0, "initialize a HashSet using specified equality comparer!"); + assert.ok(CreateObjectHashSet().count() === 2, "initialize a HashSet using specified collection and equality comparer!"); + }); + + + QUnit.test("add", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.add(6) === true, "add item to a HashSet of numbers!"); + assert.ok(_hash1.add(1) === false, "add existing item to a HashSet of numbers!"); + assert.ok(_hash2.add({ name: "C", value: 5 }) === true, "add item to a HashSet of objects!"); + assert.ok(_hash2.add({ name: "A", value: 5 }) === false, "add an existing item to a HashSet of objects!"); + }); + + + QUnit.test("clear", function (assert) { + + var _hash = CreateNumericHashSet(); + + _hash.clear(); + assert.ok(_hash.count() === 0, "clear a HashSet!"); + }); + + + QUnit.test("contains", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.contains(1) === true, "HashSet of numbers contains an item!"); + assert.ok(_hash1.contains(6) === false, "HashSet of numbers does not contain an item!"); + assert.ok(_hash2.contains({ name: "A", value: 5 }) === true, "HashSet of objects contains an item!"); + assert.ok(_hash2.contains({ name: "C", value: 5 }) === false, "HashSet of objects does not contain an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _hash = CreateNumericHashSet(), + _arr = new Array(_hash.count()); + + _hash.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "HashSet copy to an array!"); + assert.throws(() => _hash.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("comparer", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.comparer() === mx.EqualityComparer.defaultComparer, "HashSet default comparer!"); + assert.ok(_hash2.comparer().equals({ name: "A", value: 1 }, { name: "A", value: 2 }), "HashSet custom comparer!"); + }); + + + QUnit.test("remove", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.remove(1) === true, "HashSet of numbers remove an item!"); + assert.ok(_hash1.remove(1) === false, "HashSet of numbers remove non existing item!"); + assert.ok(_hash2.remove({ name: "A", value: 1 }) === true, "HashSet of objects remove an item!"); + assert.ok(_hash2.remove({ name: "A", value: 1 }) === false, "HashSet of objects remove non existing item!"); + }); + + + QUnit.test("removeWhere", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.removeWhere(t => t < 3) === 2, "HashSet of numbers remove with predicate, get number of items removed!"); + assert.ok(_hash1.removeWhere(t => t < 3) === 0, "HashSet of numbers remove with invalid predicate, get number of items removed!"); + assert.ok(_hash1.count() === 3, "HashSet of numbers remove with predicate, get count!"); + + assert.ok(_hash2.removeWhere(t => t.value < 3) === 1, "HashSet of objects remove with predicate, get number of items removed!"); + assert.ok(_hash2.removeWhere(t => t.value < 3) === 0, "HashSet of objects remove with invalid predicate, get number of items removed!"); + assert.ok(_hash2.count() === 1, "HashSet of objects remove with predicate, get count!"); + }); + + + QUnit.test("exceptWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.exceptWith([1, 2, 3]); + _hash2.exceptWith([{ name: "A", value: 0 }]); + _hash3.exceptWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 2 && _hash1.contains(1) === false, "HashSet of numbers except a collection, get count!"); + assert.ok(_hash2.count() === 1 && _hash2.contains({ name: "A", value: 0 }) === false, "HashSet of objects except a collection, get count!"); + assert.ok(_hash3.count() === 0, "HashSet of numbers except an equal set, get count!"); + }); + + + QUnit.test("intersectWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.intersectWith([1, 2, 3]); + _hash2.intersectWith([{ name: "A", value: 0 }]); + _hash3.intersectWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 3 && _hash1.contains(1) === true, "HashSet of numbers intersect with a collection, get count!"); + assert.ok(_hash2.count() === 1 && _hash2.contains({ name: "A", value: 0 }) === true, "HashSet of objects intersect with a collection, get count!"); + assert.ok(_hash3.count() === 5, "HashSet of numbers intersect with an equal set, get count!"); + }); + + + QUnit.test("isProperSubsetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isProperSubsetOf([1, 2, 3]) === true, "an empty set is a proper subset of any other collection!"); + assert.ok(new HashSet().isProperSubsetOf([]) === false, "an empty set is not a proper subset of another empty collection!"); + assert.ok(_hash.isProperSubsetOf([1, 2, 3, 4]) === false, "a hash set is not a proper subset of another collection when count is greater than the number of elements in other!"); + assert.ok(_hash.isProperSubsetOf([1, 2, 3, 4, 5]) === false, "a hash set is not a proper subset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isProperSubsetOf([1, 2, 3, 4, 5, 6]) === true, "hash set proper subset!"); + }); + + + QUnit.test("isProperSupersetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isProperSupersetOf([1, 2, 3]) === false, "an empty set is a not superset of any other collection!"); + assert.ok(new HashSet().isProperSupersetOf([]) === false, "an empty set is not a proper superset of another empty collection!"); + assert.ok(_hash.isProperSupersetOf([1, 2, 3, 4, 5, 6]) === false, "a hash set is not a proper superset of another collection when count is less than the number of elements in other!"); + assert.ok(_hash.isProperSupersetOf([1, 2, 3, 4, 5]) === false, "a hash set is not a proper superset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isProperSupersetOf([1, 2, 3]) === true, "hash set proper superset!"); + }); + + + QUnit.test("isSubsetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isSubsetOf([1, 2, 3]) === true, "an empty set is a subset of any other collection!"); + assert.ok(new HashSet().isSubsetOf([]) === true, "an empty set is a subset of another empty collection!"); + assert.ok(_hash.isSubsetOf([1, 2, 3, 4]) === false, "a hash set is not a subset of another collection when count is greater than the number of elements in other!"); + assert.ok(_hash.isSubsetOf([1, 2, 3, 4, 5]) === true, "a hash set is a proper subset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isSubsetOf([1, 2, 3, 4, 5, 6]) === true, "hash set subset!"); + }); + + + QUnit.test("isSupersetOf", function (assert) { + + var _hash = CreateNumericHashSet(); + + assert.ok(new HashSet().isSupersetOf([1, 2, 3]) === false, "an empty set is a not superset of any other collection!"); + assert.ok(new HashSet().isSupersetOf([]) === true, "an empty set is superset of another empty collection!"); + assert.ok(_hash.isSupersetOf([1, 2, 3, 4, 5, 6]) === false, "a hash set is not a superset of another collection when count is less than the number of elements in other!"); + assert.ok(_hash.isSupersetOf([1, 2, 3, 4, 5]) === true, "a hash set is a proper superset of another collection when count is equal to the number of elements in other!"); + assert.ok(_hash.isSupersetOf([1, 2, 3]) === true, "hash set superset!"); + }); + + + QUnit.test("overlaps", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.ok(_hash1.overlaps([1, 2, 3]) === true, "HashSet of numbers overlaps with another collection!"); + assert.ok(_hash2.overlaps([{ name: "A", value: 0 }]) === true, "HashSet of objects overlaps with another collection!"); + assert.ok(new HashSet().overlaps([1, 2, 3]) === false, "an empty HashSet does not overlap with another collection!"); + }); + + + QUnit.test("setEquals", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateNumericHashSet(); + + assert.ok(_hash1.setEquals(_hash2) === true, "HashSet of numbers equals with another HashSet!"); + assert.ok(_hash1.setEquals([1, 2, 3, 4, 5]) === true, "HashSet of numbers equals with another collection!"); + assert.ok(new HashSet().setEquals([]) === true, "an empty HashSet equals with an empty collection!"); + assert.ok(new HashSet().setEquals([1, 2, 3]) === false, "an empty HashSet does not equals with another collection!"); + }); + + + QUnit.test("symmetricExceptWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.symmetricExceptWith([2, 3, 4]); + _hash2.symmetricExceptWith([{ name: "A", value: 0 }]); + _hash3.exceptWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 2, "HashSet of numbers symmetric except another collection, get count!"); + assert.ok(_hash1.contains(1) === true && _hash1.contains(5) === true, "HashSet of numbers symmetric except another collection, check contains!"); + assert.ok(_hash2.count() === 1, "HashSet of objects symmetric except another collection, get count!"); + assert.ok(_hash2.contains({ name: "A", value: 0 }) === false && _hash2.contains({ name: "B", value: 0 }) === true, "HashSet of objects symmetric except another collection, check contains!"); + assert.ok(_hash3.count() === 0, "HashSet of numbers symmetric except an equal set, get count!"); + }); + + + QUnit.test("unionWith", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(), + _hash3 = CreateNumericHashSet(); + + _hash1.unionWith([5, 6, 7, 8]); + _hash2.unionWith([{ name: "A", value: 5 }, { name: "B", value: 6 }, { name: "C", value: 7 }, { name: "D", value: 8 }]); + _hash3.unionWith(CreateNumericHashSet()); + + assert.ok(_hash1.count() === 8, "HashSet of numbers union with another collection, get count!"); + assert.ok(_hash1.contains(1) === true && _hash1.contains(8) === true, "HashSet of numbers union with another collection, check contains!"); + assert.ok(_hash2.count() === 4, "HashSet of objects union with another collection, get count!"); + assert.ok(_hash2.contains({ name: "A", value: 0 }) === true && _hash2.contains({ name: "D", value: 0 }) === true, "HashSet of objects union with another collection, check contains!"); + assert.ok(_hash3.count() === 5, "HashSet of numbers union with an equal set, get count!"); + }); + + + QUnit.test("set enumerable", function (assert) { + + var _hash1 = CreateNumericHashSet(), + _hash2 = CreateObjectHashSet(); + + assert.deepEqual(_hash1.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a HashSet of numbers!"); + assert.deepEqual(_hash2.select(t => t.value * 2).where(t => t > 5).toArray(), [6], "select-where-toArray over a HashSet of objects!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateNumericHashSet(): HashSet { + return new HashSet(mx.range(1, 5)); + } + + function CreateObjectHashSet(): HashSet { + + var _items: SimpleObject[] = [{ name: "A", value: 1 }, { name: "A", value: 2 }, { name: "B", value: 3 }, { name: "B", value: 4 }], + _comparer = EqualityComparer.create(obj => mx.hash(obj.name), (a, b) => a.name === b.name); + + return new HashSet(_items, _comparer); + } + } + + + module LinkedListTests { + + QUnit.module("LinkedList"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new LinkedList().count() === 0, "initialize an empty LinkedList!"); + assert.ok(CreateLinkedList().count() === 5, "initialize a LinkedList using specified collection!"); + }); + + + QUnit.test("add", function (assert) { + + var _list = CreateLinkedList(); + + _list.add(6); + assert.ok(_list.count() === 6, "add an item to a LinkedList!"); + }); + + + QUnit.test("clear", function (assert) { + + var _list = CreateLinkedList(); + + _list.clear(); + assert.ok(_list.count() === 0, "clear a LinkedList!"); + }); + + + QUnit.test("contains", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.contains(1) && _list.contains(5), "LinkedList contains an item!"); + assert.ok(_list.contains(10) === false, "LinkedList does not contains an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _list = CreateLinkedList(), + _arr = new Array(_list.count()); + + _list.copyTo(_arr, 0); + + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "LinkedList copy to an array!"); + assert.throws(() => _list.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("getFirst", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.getFirst().value() === 1, "LinkedList first item!"); + assert.ok(new LinkedList().getFirst() === null, "empty LinkedList first item!"); + }); + + + QUnit.test("getLast", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.getLast().value() === 5, "LinkedList last item!"); + assert.ok(new LinkedList().getLast() === null, "empty LinkedList last item!"); + }); + + + QUnit.test("addAfter", function (assert) { + + var _list = CreateLinkedList(), + _first = _list.getFirst(), + _node = new LinkedListNode(6); + + _list.addAfter(_first, _node); + _list.addAfter(_first, 7); + + assert.ok(_list.count() === 7, "LinkedList add after item, get count!"); + assert.ok(_list.contains(6) && _list.contains(7), "LinkedList add after item, check contains!"); + }); + + + QUnit.test("addBefore", function (assert) { + + var _list = CreateLinkedList(), + _last = _list.getLast(), + _node = new LinkedListNode(6); + + _list.addBefore(_last, _node); + _list.addBefore(_last, 7); + + assert.ok(_list.count() === 7, "LinkedList add before item, get count!"); + assert.ok(_list.contains(6) && _list.contains(7), "LinkedList add before item, check contains!"); + }); + + + QUnit.test("addFirst", function (assert) { + + var _list = CreateLinkedList(), + _node = new LinkedListNode(0); + + _list.addFirst(_node); + _list.addFirst(-1); + + assert.ok(_list.count() === 7, "LinkedList add first, get count!"); + assert.ok(_list.contains(0) && _list.contains(-1), "LinkedList add first, check contains!"); + assert.ok(_list.getFirst().value() === -1, "LinkedList add first, get first!"); + }); + + + QUnit.test("addLast", function (assert) { + + var _list = CreateLinkedList(), + _node = new LinkedListNode(6); + + _list.addLast(_node); + _list.addLast(7); + + assert.ok(_list.count() === 7, "LinkedList add last, get count!"); + assert.ok(_list.contains(6) && _list.contains(7), "LinkedList add last, check contains!"); + assert.ok(_list.getLast().value() === 7, "LinkedList add last, get last!"); + }); + + + QUnit.test("find", function (assert) { + + var _list = CreateLinkedList(); + + assert.ok(_list.find(4).value() === 4, "LinkedList find an item!"); + assert.ok(_list.find(10) === null, "LinkedList does not find an item!"); + }); + + + QUnit.test("findLast", function (assert) { + + var _list = CreateLinkedList(), + _node = new LinkedListNode(1); + + _list.addLast(_node); + + assert.ok(_list.findLast(1) === _node, "LinkedList find last!"); + assert.ok(_list.findLast(10) === null, "LinkedList does not find last item!"); + }); + + + QUnit.test("remove", function (assert) { + + var _list = CreateLinkedList(), + _last = _list.getLast(); + + assert.ok(_list.remove(1) === true, "LinkedList remove an item!"); + assert.ok(_list.remove(1) === false, "LinkedList remove non existing item!"); + assert.ok(_list.remove(_last) === true, "LinkedList remove a node!"); + assert.throws(() => _list.remove(_last), "throws an error when removing non existing or invalid node!"); + assert.ok(_list.count() === 3, "LinkedList remove, get count!"); + }); + + + QUnit.test("removeFirst", function (assert) { + + var _list = CreateLinkedList(); + + _list.removeFirst(); + + assert.ok(_list.count() === 4 && _list.contains(1) === false, "LinkedList remove first node!"); + assert.throws(() => new LinkedList().removeFirst(), "throws an error removing from an empty linked list!"); + }); + + + QUnit.test("removeLast", function (assert) { + + var _list = CreateLinkedList(); + + _list.removeLast(); + + assert.ok(_list.count() === 4 && _list.contains(5) === false, "LinkedList remove last node!"); + assert.throws(() => new LinkedList().removeLast(), "throws an error removing from an empty linked list!"); + }); + + + QUnit.test("linked-list enumerable", function (assert) { + + var _list = CreateLinkedList(); + assert.deepEqual(_list.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a linked-list!"); + }); + + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateLinkedList(): LinkedList { + return new LinkedList(mx.range(1, 5)); + } + } + + + module QueueTests { + + QUnit.module("Queue"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new Queue().count() === 0, "initialize an empty Queue!"); + assert.ok(CreateQueue().count() === 5, "initialize a Queue using specified collection!"); + }); + + + QUnit.test("clear", function (assert) { + + var _queue = CreateQueue(); + + _queue.clear(); + assert.ok(_queue.count() === 0, "clears a Queue!"); + }); + + + QUnit.test("contains", function (assert) { + + var _queue = CreateQueue(); + + assert.ok(_queue.contains(1) === true, "queue containing an item!"); + assert.ok(_queue.contains(10) === false, "queue does not contain an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _queue = CreateQueue(), + _arr = new Array(_queue.count()); + + _queue.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "queue copy to an array!"); + assert.throws(() => _queue.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("dequeue", function (assert) { + + var _queue = CreateQueue(); + + assert.ok(_queue.dequeue() === 1, "queue dequeue an item!"); + + _queue.clear(); + assert.throws(() => _queue.dequeue(), "throws an error dequeue from empty queue!"); + }); + + + QUnit.test("enqueue", function (assert) { + + var _queue = CreateQueue(); + + _queue.enqueue(6); + assert.ok(_queue.count() === 6 && _queue.peek() === 1, "queue dequeue an item!"); + }); + + + QUnit.test("peek", function (assert) { + + var _queue = CreateQueue(); + + assert.ok(_queue.peek() === 1, "queue peek an item!"); + + _queue.clear(); + assert.throws(() => _queue.peek(), "throws an error peek from empty queue!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _queue = CreateQueue(); + + assert.deepEqual(_queue.toArray(), [1, 2, 3, 4, 5], "queue to array!"); + }); + + + QUnit.test("queue enumerable", function (assert) { + + var _queue = CreateQueue(); + + assert.deepEqual(_queue.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a queue!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateQueue(): Queue { + return new Queue(mx.range(1, 5)); + } + } + + + module StackTests { + + QUnit.module("Stack"); + + + QUnit.test("constructor", function (assert) { + + assert.ok(new Stack().count() === 0, "initialize an empty Stack!"); + assert.ok(CreateStack().count() === 5, "initialize a Stack using specified collection!"); + }); + + + QUnit.test("clear", function (assert) { + + var _stack = CreateStack(); + + _stack.clear(); + assert.ok(_stack.count() === 0, "clears a Stack!"); + }); + + + QUnit.test("contains", function (assert) { + + var _stack = CreateStack(); + + assert.ok(_stack.contains(1) === true, "stack containing an item!"); + assert.ok(_stack.contains(10) === false, "stack does not contain an item!"); + }); + + + QUnit.test("copyTo", function (assert) { + + var _stack = CreateStack(), + _arr = new Array(_stack.count()); + + _stack.copyTo(_arr, 0); + assert.deepEqual(_arr, [1, 2, 3, 4, 5], "stack copy to an array!"); + assert.throws(() => _stack.copyTo([], 0), "throws an error when the number of elements is greater than the number of elements that the destination array can contain!"); + }); + + + QUnit.test("peek", function (assert) { + + var _stack = CreateStack(); + + assert.ok(_stack.peek() === 5, "stack peek an item!"); + + _stack.clear(); + assert.throws(() => _stack.peek(), "throws an error peek from empty stack!"); + }); + + + QUnit.test("pop", function (assert) { + + var _stack = CreateStack(); + + assert.ok(_stack.pop() === 5, "stack pop an item!"); + + _stack.clear(); + assert.throws(() => _stack.pop(), "throws an error pop from empty stack!"); + }); + + + QUnit.test("push", function (assert) { + + var _stack = CreateStack(); + + _stack.push(6); + assert.ok(_stack.count() === 6 && _stack.peek() === 6, "stack push an item!"); + }); + + + QUnit.test("toArray", function (assert) { + + var _stack = CreateStack(); + + assert.deepEqual(_stack.toArray(), [1, 2, 3, 4, 5], "stack to array!"); + }); + + + QUnit.test("stack enumerable", function (assert) { + + var _stack = CreateStack(); + + assert.deepEqual(_stack.select(t => t * 2).where(t => t > 5).toArray(), [6, 8, 10], "select-where-toArray over a stack!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateStack(): Stack { + return new Stack(mx.range(1, 5)); + } + } + + + module LookupTests { + + QUnit.module("Lookup"); + + + QUnit.test("contains", function (assert) { + + var _lookup = CreateLookup(); + + assert.ok(_lookup.contains(1) === true, "lookup contains an item!"); + assert.ok(_lookup.contains(10) === false, "lookup does not an item!"); + }); + + + QUnit.test("count", function (assert) { + + var _lookup = CreateLookup(); + + assert.ok(_lookup.count() === 4, "lookup count!"); + }); + + + QUnit.test("get", function (assert) { + + var _lookup = CreateLookup(); + + assert.ok(_lookup.get(1).count() === 2, "lookup get an item!"); + assert.ok(_lookup.get(10).count() === 0, "lookup get non existing item!"); + }); + + + QUnit.test("lookup enumerable", function (assert) { + + var _lookup = CreateLookup(); + + assert.deepEqual(_lookup.select(t => t.key).toArray(), [1, 2, 3, 4], "lookup select keys, to array!"); + assert.deepEqual(_lookup.selectMany(t => t).toArray(), [1, 1, 2, 3, 3, 4, 4, 4], "lookup select all items, to array!"); + assert.deepEqual(_lookup.select(t => t.count()).toArray(), [2, 1, 2, 3], "lookup select items count!"); + }); + + + + /* Factory methods + ---------------------------------------------------------------------- */ + + function CreateLookup(): Lookup { + return mx([1, 1, 2, 3, 3, 4, 4, 4]).toLookup(t => t); + } + } +} \ No newline at end of file diff --git a/multiplexjs/multiplexjs.d.ts b/multiplexjs/multiplexjs.d.ts new file mode 100644 index 000000000..dc39fe6b6 --- /dev/null +++ b/multiplexjs/multiplexjs.d.ts @@ -0,0 +1,2551 @@ +// Type definitions for Multiplex.js 0.9 +// Project: http://github.com/multiplex/multiplex.js +// Definitions by: Kamyar Nazeri +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + + +declare var multiplex: multiplex.MultiplexStatic; + + +// Support AMD require +declare module 'multiplex' { + export = multiplex; +} + + +// Collapse multiplex into mx +import mx = multiplex; + + +// ES6 compatibility +interface Array extends multiplex.Iterable { } +interface String extends multiplex.Iterable { } + + + +declare module multiplex { + + /** + * ES6 Iterable + */ + interface Iterable { + "@@iterator"(): Iterator + } + interface Iterator { + next(): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; + } + interface IteratorResult { + done: boolean; + value?: T; + } + + + + /** + * Supports a simple iteration over a collection. + */ + interface Enumerator { + + /** + * Advances the enumerator to the next element of the collection. + */ + next(): boolean; + + /** + * Gets the element in the collection at the current position of the enumerator. + */ + current: T; + } + interface EnumeratorConstructor { + new (generator: (yielder: (value: T) => T) => any): Enumerator; + } + + + + /** + * Exposes the enumerator, which supports a simple iteration over a collection of a specified type. + * Enumerable uses ES6 Iteration protocol. + */ + interface Enumerable extends Iterable { + + /** + * Returns an enumerator that iterates through the collection. + */ + getEnumerator(): Enumerator; + } + interface EnumerableConstructor { + + /** + * Exposes the enumerator, which supports an iteration over the specified Enumerable object. + * @param obj An Iterable object. eg. Enumerable, Array, String, Set, Map, Iterable & Generators + */ + new (obj: Iterable): Enumerable; + + + /** + * Defines an enumerator, which supports an iteration over the specified Generator function. + * @param factory An Enumerator factory function. + */ + new (factory: () => Enumerator): Enumerable; + + /** + * Defines an enumerator, which supports an iteration over the items of the specified Array-like object. + * An Array-like object is an object which has the "length" property and indexed properties access, eg. jQuery + * @param obj An Array-like object. + */ + new (obj: ArrayLike): Enumerable; + + /** + * Defines an enumerator, which supports an iteration over the arguments local variable available within all functions. + * @param obj arguments local variable available within all functions. + */ + new (obj: IArguments): Enumerable; + + /** + * Defines an enumerator, which supports an iteration over the properties of the specified object. + * @param obj A regular Object. + */ + new (obj: Object): Enumerable>; + + + + + /** + * Returns an empty Enumerable. + */ + empty(): Enumerable; + + /** + * Detects if an object is Enumerable. + * @param obj An object to check its Enumerability. + */ + is(obj: any): boolean; + + /** + * Generates a sequence of integral numbers within a specified range. + * @param start The value of the first integer in the sequence. + * @param count The number of sequential integers to generate. + */ + range(start: number, count: number): Enumerable; + + /** + * Generates a sequence that contains one repeated value. + * @param element The value to be repeated. + * @param count The number of times to repeat the value in the generated sequence. + */ + repeat(element: T, count: number): Enumerable; + } + + + + /** + * Defines a method that a type implements to compare two objects. + */ + interface Comparer { + /** + * Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other. + * returns An integer that indicates the relative values of x and y, as shown in the following table: + * Less than zero x is less than y. + * Zero x equals y. + * Greater than zero x is greater than y.. + * @param x The first object to compare. + * @param y The second object to compare. + */ + compare(x: T, y: T): number; + } + interface ComparerConstructor { + + /** + * Returns a default sort order comparer for the type specified by the generic argument. + */ + defaultComparer: Comparer; + + /** + * Creates a comparer by using the specified comparison. + * @param comparison The comparison to use. + */ + create(comparison: (x: T, y: T) => number): Comparer; + } + + + + /** + * Provides a base class for implementations of the EqualityComparer. + */ + interface EqualityComparer { + + /** + * Determines whether the specified objects are equal. + * @param x The first object of type Object to compare. + * @param y The second object of type Object to compare. + */ + equals(x: T, y: T): boolean; + + + /** + * Returns a hash code for the specified object. + * @param obj The Object for which a hash code is to be returned. + */ + hash(obj: T): number + } + interface EqualityComparerConstructor { + + /** + * Gets a default equality comparer for the type specified by the generic argument. + */ + defaultComparer: EqualityComparer; + + + /** + * Creates an EqualityComparer by using the specified equality and hashCodeProvider. + * @param hashCodeProvider The hashCodeProvider to use for a hash code is to be returned. + * @param equality The equality function. + */ + create(hashCodeProvider: (obj: T) => number, equality: (x: T, y: T) => boolean): EqualityComparer; + } + + + + /** + * Initializes a new instance of the abstract Collection class. + */ + interface Collection extends Enumerable { + + /** + * Gets the number of elements contained in the Collection. + */ + count(): number; + + + /** + * Copies the Collection to an existing one-dimensional Array, starting at the specified array index. + * @param array The one-dimensional Array that is the destination of the elements copied from Dictionary keys. + * @param arrayIndex The zero-based index in array at which copying begins. + */ + copyTo(array: T[], arrayIndex: number): void + } + interface CollectionConstructor { + + /** + * Initializes a new instance of the Collection class that is empty. + */ + new (): Collection + + + /** + * Initializes a new instance of the Collection class that is wrapper around the specified Enumerable. + * @param value The Iterable to wrap. + */ + new (value: Iterable): Collection + } + + + + /** + * Initializes a new instance of the abstract Collection class. + */ + interface ReadOnlyCollection extends Collection { + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + [index: number]: T; + + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + get(index: number): T + + + /** + * Determines whether the ReadOnlyCollection contains a specific value. + * @param item The object to locate in the ReadOnlyCollection. + */ + contains(item: T): boolean + + + /** + * Searches for the specified object and returns the zero-based index of the first occurrence within the entire ReadOnlyCollection. + * @param item The object to locate in the ReadOnlyCollection. + */ + indexOf(item: T): number + } + interface ReadOnlyCollectionConstructor { + + /** + * Initializes a new instance of the ReadOnlyCollection class that is a read-only wrapper around the specified list. + * @param list The list to wrap. + */ + new (list: List): ReadOnlyCollection + } + + + + /** + * Represents a strongly typed list of objects that can be accessed by index. + */ + interface List extends Collection { + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + [index: number]: T; + + + /** + * Adds an object to the end of the List. + * @param item The object to be added to the end of the List. + */ + add(item: T): void + + + /** + * Adds the elements of the specified collection to the end of the List. + * @param collection The collection whose elements should be added to the end of the List. + */ + addRange(collection: Iterable): void + + + /** + * Returns a read-only wrapper for the current list. + */ + asReadOnly(): ReadOnlyCollection + + + /** + * Searches the entire sorted List for an element using the default comparer and returns the zero-based index of the element. + * Returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number + * that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, + * the bitwise complement of List.count(). + * @param item The object to locate. The value can be null for reference types. + */ + binarySearch(item: T): number + + + /** + * Searches the entire sorted List for an element using the specified comparer and returns the zero-based index of the element. + * returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number + * that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, + * the bitwise complement of List.count(). + * @param item The object to locate. The value can be null for reference types. + * @param comparer The Comparer implementation to use when comparing elements. + */ + binarySearch(item: T, comparer: Comparer): number + + + /** + * Searches a range of elements in the sorted List for an element using the specified comparer and returns the zero-based index of the element. + * returns The zero-based index of item in the sorted List, if item is found; otherwise, a negative number + * that is the bitwise complement of the index of the next element that is larger than item or, if there is no larger element, + * the bitwise complement of List.count(). + * @param item The object to locate. The value can be null for reference types. + * @param index The zero-based starting index of the range to search. + * @param count The length of the range to search. + * @param comparer The Comparer implementation to use when comparing elements. + */ + binarySearch(item: T, index: number, count: number, comparer: Comparer): number + + + /** + * Removes all items from the List. + */ + clear(): void + + + /** + * Determines whether the List contains elements that match the conditions defined by the specified predicate. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + exists(match: (item: T) => boolean): boolean + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire List. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + find(match: (item: T) => boolean): T + + + /** + * Retrieves all the elements that match the conditions defined by the specified predicate. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findAll(match: (item: T) => boolean): List + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the first occurrence within the entire List, if found; otherwise, –1. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findIndex(match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the first occurrence within the range of elements + * in the List that extends from the specified index to the last element, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findIndex(startIndex: number, match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the first occurrence within the range of elements + * in the List that starts at the specified index and contains the specified number of elements, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param count The number of elements in the section to search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findIndex(startIndex: number, count: number, match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the last occurrence within the entire List. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLast(match: (item: T) => boolean): T + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the last occurrence within the entire List, if found; otherwise, –1. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLastIndex(match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the last occurrence within the range of elements + * in the List that extends from the first element to the specified index, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLastIndex(startIndex: number, match: (item: T) => boolean): number + + + /** + * Searches for an element that matches the conditions defined by the specified predicate, + * and returns the zero-based index of the last occurrence within the range of elements + * in the List that contains the specified number of elements and ends at the specified index, if found; otherwise, –1. + * @param startIndex The zero-based starting index of the search. + * @param count The number of elements in the section to search. + * @param match The predicate function that defines the conditions of the elements to search for. + */ + findLastIndex(startIndex: number, count: number, match: (item: T) => boolean): number + + + /** + * Performs the specified action on each element of the List. + * @param action The action function to perform on each element of the List. + */ + forEach(action: (item: T) => void): void + + + /** + * Gets the element at the specified index. + * @param index The zero-based index of the element to get. + */ + get(index: number): T + + + /** + * Creates a shallow copy of a range of elements in the source List. + * @param index The zero-based List index at which the range starts. + * @param count The number of elements in the range. + */ + getRange(index: number, count: number): List + + + /** + * Searches for the specified object and returns the zero-based index of the first occurrence within the entire List, if found; otherwise, –1. + * @param item The object to locate in the List. + */ + indexOf(item: T): number + + + /** + * Searches for the specified object and returns the zero-based index of the first occurrence within + * the range of elements in the List that extends from the specified index to the last element, if found; otherwise, –1. + * @param item The object to locate in the List. + * @param index The zero-based starting index of the search. 0 (zero) is valid in an empty list. + */ + indexOf(item: T, index: number): number + + + /** + * Inserts an element into the List at the specified index. + * @param index The zero-based index at which item should be inserted. + * @param item The object to insert. The value can be null for reference types. + */ + insert(index: number, item: T): void + + + /** + * Inserts the elements of a collection into the List at the specified index. + * @param index The zero-based index at which item should be inserted. + * @param collection The collection whose elements should be inserted into the List. + */ + insertRange(index: number, collection: Iterable): void + + + /** + * Gets an Array wrapper around the List. + */ + items(): T[] + + + /** + * Searches for the specified object and returns the zero-based index of the last occurrence within the entire List, if found; otherwise, –1. + * @param item The object to locate in the List. + */ + lastIndexOf(item: T): number + + + /** + * Searches for the specified object and returns the zero-based index of the last occurrence + * within the range of elements in the List that extends from the specified index to the last element if found; otherwise, –1. + * @param item The object to locate in the List. + * @param index The zero-based starting index of the search. 0 (zero) is valid in an empty list. + */ + lastIndexOf(item: T, index: number): number + + + /** + * Removes the first occurrence of a specific object from the List. + * @param item The object to remove from the List. + */ + remove(item: T): boolean + + + /** + * Removes all the elements that match the conditions defined by the specified predicate. + * @param match The predicate function that defines the conditions of the elements to remove. + */ + removeAll(match: (item: T) => boolean): number + + + /** + * Removes the element at the specified index of the List. + * @param index The zero-based index of the element to remove. + */ + removeAt(index: number): void + + + /** + * Removes a range of elements from the List. + * @param index The zero-based index of the element to remove. + * @param count The number of elements to remove. + */ + removeRange(index: number, count: number): void + + + /** + * Reverses the order of the elements in the entire List + */ + reverse(): any + + + /** + * Reverses the order of the elements in the entire List + * @param index The zero-based starting index of the range to reverse. + * @param count The number of elements in the range to reverse. + */ + reverse(index: number, count: number): void + + + /** + * Sets the element at the specified index. + * @param index The zero-based index of the element to set. + * @param item The object to be added at the specified index. + */ + set(index: number, value: T): void + + + /** + * Sorts the elements in the entire List using the default comparer. + */ + sort(): void + + + /** + * Sorts the elements in the entire List using the specified Comparison. + * @param comparison The comparison function to use when comparing elements. + */ + sort(comparison: (x: T, y: T) => number): void + + + /** + * Sorts the elements in the entire List using the specified comparer. + * @param comparer The Comparer implementation to use when comparing elements. + */ + sort(comparer: Comparer): void + + + /** + * Sorts the elements in a range of elements in List using the specified comparer. + * @param index The zero-based starting index of the range to sort. + * @param count The length of the range to sort. + * @param comparer The Comparer implementation to use when comparing elements. + */ + sort(index: number, count: number, comparer: Comparer): void + + + /** + * Copies the elements of the List to a new array. + */ + toArray(): T[] + + + /** + * Determines whether every element in the List matches the conditions defined by the specified predicate. + * @param match The Predicate function that defines the conditions to check against the elements. + */ + trueForAll(match: (item: T) => boolean): boolean + } + interface ListConstructor { + + /** + * Initializes a new instance of the List class that is empty. + */ + new (): List + + + /** + * Initializes a new instance of the List class that is empty and has the specified initial capacity. + * @param capacity The number of elements that the new list can initially store. + */ + new (capacity: number): List + + + /** + * Initializes a new instance of the List class that contains elements copied from the specified arguments + * @param args Arbitrary number of arguments to copy to the new list. + */ + new (...args: T[]): List + + + /** + * Initializes a new instance of the List class that contains elements copied from the specified collection + * and has sufficient capacity to accommodate the number of elements copied. + * @param collection The collection whose elements are copied to the new list. + */ + new (collection: Iterable): List + } + + + + /** + * Represents a collection of key/value pairs that are sorted by key based on the associated Comparer implementation. + */ + interface SortedList extends Collection> { + + /** + * Adds an element with the specified key and value into the SortedList. + * @param key The key of the element to add. + * @param value The value of the element to add. The value can be null for reference types. + */ + add(key: TKey, value: TValue): void + + + /** + * Gets the value associated with the specified key. + * @param key The key whose value to get. + */ + get(key: TKey): TValue + + + /** + * Gets or sets the number of elements that the SortedList can contain. + * @param value The number of elements that the SortedList can contain. + */ + capacity(value?: number): number + + + /** + * Removes all elements from the SortedList. + */ + clear(): void + + + /** + * Gets the Comparer for the sorted list. + */ + comparer(): Comparer + + + /** + * Determines whether the SortedList contains a specific key. + * @param key The key to locate in the SortedList. + */ + containsKey(key: TKey): boolean + + + /** + * Determines whether the SortedList contains a specific value. + * @param value The value to locate in the SortedList. + */ + containsValue(value: TValue): boolean + + + /** + * Gets a collection containing the keys in the SortedList, in sorted order. + */ + keys(): Collection + + + /** + * Gets a collection containing the values in the SortedLis. + */ + values(): Collection + + + /** + * Searches for the specified key and returns the zero-based index within the entire SortedList. + * @param key The key to locate in the SortedList. + */ + indexOfKey(key: TKey): number + + + /** + * Searches for the specified value and returns the zero-based index of the first occurrence within the entire SortedList. + * @param value The value to locate in the SortedList. + */ + indexOfValue(value: TValue): number + + + /** + * Removes the element with the specified key from the SortedList. + * Returns true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original SortedList. + * @param key The key of the element to remove. + */ + remove(key: TKey): boolean + + + /** + * Removes the element at the specified index of the SortedList. + * @param index The zero-based index of the element to remove. + */ + removeAt(index: number): void + + + /** + * Sets the value associated with the specified key. + * @param key The key whose value to get or set. + * @param value The value associated with the specified key. + */ + set(key: TKey, value: TValue): void + + + /** + * Sets the capacity to the actual number of elements in the SortedList, if that number is less than 90 percent of current capacity. + */ + trimExcess(): void + + + /** + * Gets the value associated with the specified key. + * @param key The key whose value to get. + * @param callback When this method returns, callback method is called with the value + * associated with the specified key, if the key is found; otherwise, null for the type of the value parameter. + */ + tryGetValue(key: TKey, callback: (value: TValue) => void): boolean + } + interface SortedListConstructor { + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the default initial capacity, and uses the default Comparer. + */ + new (): SortedList + + + /** + * Initializes a new instance of the SortedList class that contains elements copied from the specified Dictionary, + * has sufficient capacity to accommodate the number of elements copied, and uses the default Comparer. + * @param dictionary The Dictionary whose elements are copied to the new SortedList. + */ + new (dictionary: Dictionary): SortedList + + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the default initial capacity, and uses the specified Comparer. + * @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key. + */ + new (comparer: Comparer): SortedList + + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the specified initial capacity, and uses the default Comparer. + * @param capacity The initial number of elements that the SortedList can contain. + */ + new (capacity: number): SortedList + + + /** + * Initializes a new instance of the SortedList class that contains elements copied from the specified Dictionary, + * has sufficient capacity to accommodate the number of elements copied, and uses the specified Comparer. + * @param dictionary The Dictionary whose elements are copied to the new SortedList. + * @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key. + */ + new (dictionary: Dictionary, comparer: Comparer): SortedList + + + /** + * Initializes a new instance of the SortedList class that is empty, + * has the specified initial capacity, and uses the specified Comparer. + * @param capacity The initial number of elements that the SortedList can contain. + * @param comparer The Comparer implementation to use when comparing keys.-or-null to use the default Comparer for the type of the key. + */ + new (capacity: number, comparer: Comparer): SortedList + } + + + + /** + * Defines a key/value pair that can be set or retrieved. + */ + interface KeyValuePair { + + /** + * Gets the key in the key/value pair. + */ + key: TKey; + + + /** + * Gets the value in the key/value pair. + */ + value: TValue; + } + interface KeyValuePairConstructor { + + /** + * Initializes a new instance of the KeyValuePair with the specified key and value. + * @param key The object defined in each key/value pair. + * @param value The definition associated with key. + */ + new (key: TKey, value: TValue): KeyValuePair + } + + + + /** + * Represents a collection of keys and values. + */ + interface Dictionary extends Collection> { + + /** + * Adds an element with the provided key and value to the Dictionary. + * @param key The object to use as the key of the element to add. + * @param value The object to use as the value of the element to add. + */ + add(key: TKey, value: TValue): void + + + /** + * Removes all keys and values from the Dictionary. + */ + clear(): void + + + /** + * Determines whether the Dictionary contains the specified key. + * @param key The key to locate in the Dictionary. + */ + containsKey(key: TKey): boolean + + + /** + * Determines whether the Dictionary contains a specific value. + * @param value The value to locate in the Dictionary. + */ + containsValue(value: TValue): boolean + + + /** + * Copies the Dictionary keys to an existing one-dimensional Array, starting at the specified array index. + * @param array The one-dimensional Array that is the destination of the elements copied from Dictionary keys. + * @param arrayIndex The zero-based index in array at which copying begins. + */ + copyTo(array: TKey[], arrayIndex: number): void + copyTo(array: KeyValuePair[], arrayIndex: number): void + + + /** + * Gets a Collection containing the keys of the Dictionary. + */ + keys(): Collection + + + /** + * Gets a Collection containing the values in the Dictionary. + */ + values(): Collection + + + /** + * Gets element with the specified key. + * @param key The key of the element to get. + */ + get(key: TKey): TValue + + + /** + * Sets the element with the specified key. + * @param key The key of the element to set. + * @param value The object to use as the value of the element to set. + */ + set(key: TKey, value: TValue): void + + + /** + * Gets the value associated with the specified key. + * @param key The key whose value to get. + * @param callback When this method returns, callback method is called with the value + * associated with the specified key, if the key is found; otherwise, null for the type of the value parameter. + */ + tryGetValue(key: TKey, callback: (value: TValue) => void): boolean + + + /** + * Removes the element with the specified key from the Dictionary. + * @param key The key of the element to remove. + */ + remove(key: TKey): boolean + } + interface DictionaryConstructor { + + /** + * Initializes a new instance of the Dictionary class that is empty, + */ + new (): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that contains elements copied + * from the specified Dictionary and uses the default equality comparer for the key type. + * @param dictionary The Dictionary whose elements are copied to the new Dictionary. + */ + new (dictionary: Dictionary): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that is empty, and uses the specified EqualityComparer. + * @param comparer The EqualityComparer implementation to use when comparing keys. + */ + new (comparer: EqualityComparer): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that is empty, has the specified initial capacity, and uses the default equality comparer for the key type. + * @param capacity The initial number of elements that the Dictionary can contain. + */ + new (capacity: number): Dictionary + + + /** + * Initializes a new instance of the Dictionary that is empty, has the specified initial capacity, and uses the specified EqualityComparer. + * @param capacity The initial number of elements that the Dictionary can contain. + * @param comparer The EqualityComparer implementation to use when comparing keys. + */ + new (capacity: number, comparer: EqualityComparer): Dictionary + + + /** + * Initializes a new instance of the Dictionary class that contains elements copied + * from the specified Dictionary and uses the specified EqualityComparer. + * @param dictionary The Dictionary whose elements are copied to the new Dictionary. + * @param comparer The EqualityComparer implementation to use when comparing keys. + */ + new (dictionary: Dictionary, comparer: EqualityComparer): Dictionary + } + + + + /** + * Represents a set of values. + */ + interface HashSet extends Collection { + + /** + * Adds an element to the current set. + * @param item The element to add to the set. + */ + add(item: T): boolean + + + /** + * Removes all elements from a HashSet object. + */ + clear(): void + + + /** + * Copies the elements of a HashSet object to an array. + * @param array The one-dimensional array that is the destination of the elements copied from the HashSet object. + */ + copyTo(array: T[]): void + + + /** + * Copies the elements of a HashSet object to an array. starting at the specified array index. + * @param array The one-dimensional array that is the destination of the elements copied from the HashSet object. + * @param arrayIndex The zero-based index in array at which copying begins. + */ + copyTo(array: T[], arrayIndex: number): void + + + /** + * Copies the elements of a HashSet object to an array. + * @param array The one-dimensional array that is the destination of the elements copied from the HashSet object. + * @param arrayIndex The zero-based index in array at which copying begins. + * @param count The number of elements to copy to array. + */ + copyTo(array: T[], arrayIndex: number, count: number): void + + + /** + * Gets the EqualityComparer object that is used to determine equality for the values in the set. + */ + comparer(): EqualityComparer + + + /** + * Removes the specified element from a HashSet object. + * @param item The element to remove. + */ + remove(item: T): boolean + + + /** + * Removes all elements that match the conditions defined by the specified predicate from a HashSet collection. + * @param match The predicate function that defines the conditions of the elements to remove. + */ + removeWhere(match: (item: T) => boolean): number + + + /** + * Removes all elements in the specified collection from the current set. + * @param other The collection of items to remove from the set. + */ + exceptWith(other: Iterable): void + + + /** + * Modifies the current set so that it contains only elements that are also in a specified collection. + * @param other The collection to compare to the current set. + */ + intersectWith(other: Iterable): void + + + /** + * Determines whether the current set is a proper (strict) subset of a specified collection. + * @param other The collection to compare to the current set. + */ + isProperSubsetOf(other: Iterable): boolean + + + /** + * Determines whether the current set is a proper (strict) superset of a specified collection. + * @param other The collection to compare to the current set. + */ + isProperSupersetOf(other: Iterable): boolean + + + /** + * Determines whether a set is a subset of a specified collection. + * @param other The collection to compare to the current set. + */ + isSubsetOf(other: Iterable): boolean + + + /** + * Determines whether the current set is a superset of a specified collection. + * @param other The collection to compare to the current set. + */ + isSupersetOf(other: Iterable): boolean + + + /** + * Determines whether the current set overlaps with the specified collection. + * @param other The collection to compare to the current set. + */ + overlaps(other: Iterable): boolean + + + /** + * Determines whether the current set and the specified collection contain the same elements. + * @param other The collection to compare to the current set. + */ + setEquals(other: Iterable): boolean + + + /** + * Modifies the current set so that it contains only elements that are present + * either in the current set or in the specified collection, but not both. + * @param other The collection to compare to the current set. + */ + symmetricExceptWith(other: Iterable): void + + + /** + * Modifies the current set so that it contains all elements that are present + * in either the current set or the specified collection. + * @param other The collection to compare to the current set. + */ + unionWith(other: Iterable): void + + } + interface HashSetConstructor { + + /** + * Initializes a new instance of the HashSet class that is empty and uses the default equality comparer for the set type. + */ + new (): HashSet + + + /** + * Initializes a new instance of the HashSet class that uses the default equality comparer for the set type, + * and contains elements copied from the specified collection. + * @param collection The collection whose elements are copied to the new set. + */ + new (collection: Iterable): HashSet + + + /** + * Initializes a new instance of the HashSet class that is empty and uses the specified equality comparer for the set type. + * @param comparer The EqualityComparer implementation to use when comparing values in the set. + */ + new (comparer: EqualityComparer): HashSet + + + /** + * Initializes a new instance of the HashSet class that uses the specified equality comparer for the set type, + * contains elements copied from the specified collection, and uses the specified equality comparer for the set type. + * @param collection The collection whose elements are copied to the new set. + * @param comparer The EqualityComparer implementation to use when comparing values in the set. + */ + new (collection: Iterable, comparer: EqualityComparer): HashSet + } + + + + /** + * Represents a node in a LinkedList. + */ + interface LinkedListNode { + + /** + * Gets the value contained in the node. + */ + value(): T + + + /** + * Gets the LinkedList that the LinkedListNode belongs to. + */ + list(): LinkedList + + + /** + * Gets the next node in the LinkedList. + */ + next(): LinkedListNode + + + /** + * Gets the previous node in the LinkedList. + */ + previous(): LinkedListNode + } + interface LinkedListNodeConstructor { + + /** + * Initializes a new instance of the LinkedListNode class, containing the specified value. + * @param value The value to contain in the LinkedListNode + */ + new (value: T): LinkedListNode + } + + + + /** + * Represents a doubly linked list. + */ + interface LinkedList extends Collection { + + /** + * Adds an item to the LinkedList. + * @param item The object to add to the LinkedList. + */ + add(item: T): void + + + /** + * Removes all nodes from the LinkedList. + */ + clear(): void + + + /** + * Determines whether a value is in the LinkedList. + * @param value The value to locate in the LinkedList. The value can be null for reference types. + */ + contains(item: T): boolean + + + /** + * Gets the first node of the LinkedList. + */ + getFirst(): LinkedListNode + + + /** + * Gets the last node of the LinkedList. + */ + getLast(): LinkedListNode + + + /** + * Adds the specified new node after the specified existing node in the LinkedList and returns the new LinkedListNode. + * @param node The LinkedListNode after which to insert newNode. + * @param newNode The new LinkedListNode to add to the LinkedList. + */ + addAfter(node: LinkedListNode, newNode: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node after the specified existing node in the LinkedList. + * returns The new LinkedListNode containing value. + * @param node The LinkedListNode after which to insert newNode. + * @param value The value to add to the LinkedList. + */ + addAfter(node: LinkedListNode, value: T): LinkedListNode + + + /** + * Adds the specified new node before the specified existing node in the LinkedList. + * returns The new LinkedListNode. + * @param node The LinkedListNode before which to insert newNode. + * @param newNode The new LinkedListNode to add to the LinkedList. + */ + addBefore(node: LinkedListNode, newNode: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node before the specified existing node in the LinkedList. + * returns The new LinkedListNode containing value. + * @param node The LinkedListNode before which to insert newNode. + * @param value The value to add to the LinkedList. + */ + addBefore(node: LinkedListNode, value: T): LinkedListNode + + + /** + * Adds the specified new node at the start of the LinkedList. + * returns The new LinkedListNode. + * @param node The new LinkedListNode to add at the start of the LinkedList. + */ + addFirst(node: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node at the start of the LinkedList. + * returns The new LinkedListNode containing value. + * @param value The value to add at the start of the LinkedList. + */ + addFirst(value: T): LinkedListNode + + + /** + * Adds the specified new node at the end of the LinkedList. + * returns The new LinkedListNode. + * @param node The new LinkedListNode to add at the end of the LinkedList. + */ + addLast(node: LinkedListNode): LinkedListNode + + + /** + * Adds the specified new node at the end of the LinkedList. + * returns The new LinkedListNode containing value. + * @param value The value to add at the end of the LinkedList. + */ + addLast(value: T): LinkedListNode + + + /** + * Finds the first node that contains the specified value. + * @param value The value to locate in the LinkedList. + */ + find(value: T): LinkedListNode + + + /** + * Finds the last node that contains the specified value. + * @param value The value to locate in the LinkedList. + */ + findLast(value: T): LinkedListNode + + /** + * Removes the node at the start of the LinkedList. + * returns true if the node is successfully removed; otherwise, false. + * This method also returns false if value was not found in the original LinkedList. + * @param node + */ + remove(node: LinkedListNode): boolean + + + /** + * Removes the first occurrence of the specified value from the LinkedList. + * returns true if the element containing value is successfully removed; otherwise, false. + * This method also returns false if value was not found in the original LinkedList. + * @param value The value to remove from the LinkedList. + */ + remove(value: T): boolean + + + /** + * Removes the node at the start of the LinkedList. + */ + removeFirst(): void + + + /** + * Removes the node at the end of the LinkedList. + */ + removeLast(): void + } + interface LinkedListConstructor { + + /** + * Initializes a new instance of the LinkedList class that is empty. + */ + new (): LinkedList + + + /** + * Initializes a new instance of the LinkedList class that contains elements copied from the specified Enumerable. + * @param collection The collection to copy elements from. + */ + new (collection: Iterable): LinkedList + } + + + + /** + * Represents a first-in, first-out collection of objects. + */ + interface Queue extends Collection { + + /** + * Removes all objects from the Queue. + */ + clear(): void + + + /** + * Determines whether an element is in the Queue. + * @param item The object to locate in the Queue. + */ + contains(item: T): boolean + + + /** + * Removes and returns the object at the beginning of the Queue. + */ + dequeue(): T + + /** + * Adds an object to the end of the Queue. + * @param item The object to add to the Queue. + */ + enqueue(item: T): void + + + /** + * Returns the object at the beginning of the Queue without removing it. + */ + peek(): T + + + /** + * Copies the Queue to a new array. + */ + toArray(): T[] + } + interface QueueConstructor { + + /** + * Initializes a new instance of the Queue class that is empty. + */ + new (): Queue + + + /** + * Initializes a new instance of the Queue class that contains elements copied from the specified collection. + * @param collection The collection to copy elements from. + */ + new (collection: Iterable): Queue + } + + + + /** + * Represents a variable size last-in-first-out (LIFO) collection of instances of the same arbitrary type. + */ + interface Stack extends Collection { + + /** + * Removes all objects from the Stack. + */ + clear(): void + + + /** + * Determines whether an element is in the Stack. + * @param item The object to locate in the Stack. + */ + contains(item: T): boolean + + + /** + * Returns the object at the top of the Stack without removing it. + */ + peek(): T + + + /** + * Removes and returns the object at the top of the Stack. + */ + pop(): T + + + /** + * Inserts an object at the top of the Stack. + * @param item The object to push onto the Stack. + */ + push(item: T): void + + + /** + * Copies the Stack to a new array. + */ + toArray(): T[] + } + interface StackConstructor { + + /** + * Initializes a new instance of the Stack class that is empty. + */ + new (): Stack + + + /** + * Initializes a new instance of the Stack class that contains elements copied from the specified collection. + * @param collection The collection to copy elements from. + */ + new (collection: Iterable): Stack + } + + + + /** + * Defines a data structures that map keys to Enumerable sequences of values. + */ + interface Lookup extends Collection> { + + /** + * Determines whether a specified key exists in the Lookup. + * @param key The key to search for in the Lookup. + */ + contains(key: TKey): boolean + contains(item: Grouping): boolean + + + + /** + * Gets the value associated with the specified key. + * @param key The key of the element to add. + */ + get(key: TKey): Enumerable + } + + + + /** + * Represents a collection of objects that have a common key. + */ + interface Grouping extends Collection { + + /** + * Gets the key of the Grouping. + */ + key: TKey + } + + + + /** + * Exposes the enumerator, which supports a simple iteration over a collection of a specified type. + */ + interface OrderedEnumerable extends Enumerable { + + /** + * Performs a subsequent ordering on the elements of an OrderedEnumerable according to a key. + * @param keySelector The selector used to extract the key for each element. + * @param comparer The Comparer used to compare keys for placement in the returned sequence. + * @param descending true to sort the elements in descending order; false to sort the elements in ascending order. + */ + createOrderedEnumerable(keySelector: (item: TElement) => TKey, comparer: Comparer, descending: boolean): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in descending order, according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + */ + thenBy(keySelector: (item: TElement) => TKey): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in ascending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + thenBy(keySelector: (item: TElement) => TKey, comparer: Comparer): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in descending order, according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + */ + thenByDescending(keySelector: (item: TElement) => TKey): OrderedEnumerable + + + /** + * Performs a subsequent ordering of the elements in a sequence in descending order, according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + thenByDescending(keySelector: (item: TElement) => TKey, comparer: Comparer): OrderedEnumerable + } + + + + /** + * Defines Enumerable extention methods applied on Enumerable + */ + interface Enumerable { + + + /** + * Applies an accumulator function over a sequence. + * Returns the final accumulator value. + * @param func An accumulator function to be invoked on each element. + */ + aggregate(func: (accumulate: T, item: T) => T): T + + + /** + * Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. + * Returns the final accumulator value. + * @param seed The initial accumulator value. + * @param func An accumulator function to be invoked on each element. + */ + aggregate(seed: TAccumulate, func: (accumulate: TAccumulate, item: T) => TAccumulate): TAccumulate + + + /** + * Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, + * and the specified function is used to select the result value. + * Returns the final accumulator value. + * @param seed The initial accumulator value. + * @param func An accumulator function to be invoked on each element. + * @param resultSelector A function to transform the final accumulator value into the result value. + */ + aggregate(seed: TAccumulate, func: (accumulate: TAccumulate, item: T) => TAccumulate, resultSelector: (accumulate: TAccumulate) => TResult): TResult; + + + /** + * Determines whether all elements of a sequence satisfy a condition. + * Returns true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false. + * @param predicate A function to test each element for a condition. + */ + all(predicate: (item: T) => boolean): boolean + + + /** + * Determines whether a sequence contains any elements. + * Returns true if the source sequence contains any elements; otherwise, false. + */ + any(): boolean + + + /** + * Determines whether any element of a sequence satisfies a condition. + * Returns true if any elements in the source sequence pass the test in the specified predicate; otherwise, false. + * @param predicate A function to test each element for a condition. + */ + any(predicate: (item: T) => boolean): boolean + + + /** + * Returns the input typed as Enumerable. + */ + asEnumerable(): Enumerable + + + /** + * Computes the average of a sequence of numeric values. + */ + average(): number + + + /** + * Computes the average of a sequence of numeric values that are obtained by invoking a transform function on each element of the input sequence. + * @param selector A transform function to apply to each element. + */ + average(selector: (item: number) => number): number + + + /** + * Concatenates two sequences. + * @param second The sequence to concatenate to the first sequence. + */ + concat(second: Iterable): Enumerable + + + /** + * Determines whether a sequence contains a specified element by using the default equality comparer. + * @param value The value to locate in the sequence. + */ + contains(value: T): boolean + + + /** + * Returns the last element of a sequence that satisfies a specified condition. + * @param value The value to locate in the sequence. + * @param comparer An equality comparer to compare values. + */ + contains(value: T, comparer: EqualityComparer): boolean + + + /** + * Returns the number of elements in a sequence. + */ + count(): number + + + /** + * Returns a number that represents how many elements in the specified sequence satisfy a condition. + * @param predicate A function to test each element for a condition. + */ + count(predicate: (item: T) => boolean): number + + + /** + * Returns the elements of the specified sequence or null if the sequence is empty. + */ + defaultIfEmpty(): Enumerable + + + /** + * Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty. + * @param defaultValue The value to return if the sequence is empty. + */ + defaultIfEmpty(defaultValue: T): Enumerable + + + /** + * Returns distinct elements from a sequence by using the default equality comparer to compare values. + */ + distinct(): Enumerable + + + /** + * Produces the set difference of two sequences by using the EqualityComparer to compare values. + * @param comparer An EqualityComparer to compare values. + */ + distinct(comparer: EqualityComparer): Enumerable + + + /** + * Produces the set difference of two sequences by using the default equality comparer to compare values. + * @param second An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence. + */ + except(second: Iterable): Enumerable + + + /** + * Produces the set difference of two sequences by using the specified EqualityComparer to compare values. + * @param second An Iterable whose elements that also occur in the first sequence will cause those elements to be removed from the returned sequence. + * @param comparer An EqualityComparer to compare values. + */ + except(second: Iterable, comparer: EqualityComparer): Enumerable + + + /** + * Returns the element at a specified index in a sequence. Throws an error if the index is less than 0 or greater than or equal to the number of elements in source. + * @param index The zero-based index of the element to retrieve. + */ + elementAt(index: number): T + + + /** + * Returns the first element of a sequence. this method throws an exception if there is no element in the sequence. + */ + first(): T + + + /** + * Returns the first element in a sequence that satisfies a specified condition. this method throws an exception if there is no element in the sequence. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + first(predicate: (item: T) => boolean): T + + + /** + * Returns the first element of a sequence, or null if the sequence contains no elements. + */ + firstOrDefault(): T + + + /** + * Returns the first element of the sequence that satisfies a condition or null if no such element is found. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + firstOrDefault(predicate: (item: T) => boolean): T + + + /** + * Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + * @param defaultValue The value to return if no element exists with specified condition. + */ + firstOrDefault(predicate: (item: T) => boolean, defaultValue: T): T + + + /** + * Performs the specified action on each element of an Enumerable. + * @param action The action function to perform on each element of an Enumerable. + */ + forEach(action: (item: T) => void): void + + + /** + * Performs the specified action on each element of an Enumerable. + * @param action The action function to perform on each element of an Enumerable; the second parameter of the function represents the index of the source element. + */ + forEach(action: (item: T, index: number) => void): void + + + /** + * Groups the elements of a sequence according to a specified key selector function. + * @param keySelector A function to extract the key for each element. + */ + groupBy(keySelector: (item: T) => TKey): Enumerable>; + + + /** + * Groups the elements of a sequence according to a specified key selector function. + * @param keySelector A function to extract the key for each element. + * @param comparer An equality comparer to compare values. + */ + groupBy(keySelector: (item: T) => TKey, comparer: EqualityComparer): Enumerable>; + + + /** + * Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement): Enumerable>; + + + /** + * Groups the elements of a sequence according to a key selector function. + * The keys are compared by using a comparer and each group's elements are projected by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + * @param comparer An equality comparer to compare values. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, comparer: EqualityComparer): Enumerable>; + + + /** + * Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + * @param resultSelector A function to extract the key for each element. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, resultSelector: (key: TKey, elements: Iterable) => TResult): Enumerable; + + + /** + * Groups the elements of a sequence according to a key selector function. + * The keys are compared by using a comparer and each group's elements are projected by using a specified function. + * @param keySelector A function to extract the key for each element. + * @param elementSelector A function to map each source element to an element in the Grouping. + * @param resultSelector A function to extract the key for each element. + * @param comparer An equality comparer to compare values. + */ + groupBy(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, resultSelector: (key: TKey, elements: Iterable) => TResult, comparer: EqualityComparer): Enumerable; + + + /** + * Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + */ + groupJoin(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: Enumerable) => TResult): Enumerable; + + + /** + * Correlates the elements of two sequences based on key equality and groups the results. A specified EqualityComparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + * @param comparer An equality comparer to compare values. + */ + groupJoin(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: Enumerable) => TResult, comparer: EqualityComparer): Enumerable; + + + /** + * Produces the set intersection of two sequences by using the default equality comparer to compare values. + * @param second An Iterable whose distinct elements that also appear in the first sequence will be returned. + */ + intersect(second: Iterable): Enumerable; + + + /** + * Produces the set intersection of two sequences by using the default equality comparer to compare values. + * @param second An Iterable whose distinct elements that also appear in the first sequence will be returned. + * @param comparer An EqualityComparer to compare values. + */ + intersect(second: Iterable, comparer: EqualityComparer): Enumerable; + + + /** + * Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + */ + join(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: TInner) => TResult): Enumerable; + + + /** + * Correlates the elements of two sequences based on matching keys. A specified EqualityComparer is used to compare keys. + * @param inner The sequence to join to the current sequence. + * @param outerKeySelector A function to extract the join key from each element of the first sequence. + * @param innerKeySelector A function to extract the join key from each element of the second sequence. + * @param resultSelector A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence. + * @param comparer An equality comparer to compare values. + */ + join(inner: Iterable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector: (outer: T, inner: TInner) => TResult, comparer: EqualityComparer): Enumerable; + + + /** + * Returns the last element of a sequence. + */ + last(): T + + + /** + * Returns the last element of a sequence that satisfies a specified condition. + * @param predicate A function to test each source element for a condition. + */ + last(predicate: (item: T) => boolean): T + + + /** + * Returns the first element of a sequence, or null if the sequence contains no elements. + */ + lastOrDefault(): T + + + /** + * Returns the last element of a sequence, or null if the sequence contains no elements. + * @param predicate A function to test each source element for a condition. + */ + lastOrDefault(predicate: (item: T) => boolean): T + + + /** + * Returns the last element of a sequence that satisfies a condition or null if no such element is found. + * @param predicate A function to test each source element for a condition. + * @param defaultValue The value to return if no element exists with specified condition. + */ + lastOrDefault(predicate: (item: T) => boolean, defaultValue: T): T + + + /** + * Returns the maximum value in a sequence of values. + */ + max(): T + + + /** + * Invokes a transform function on each element of a sequence and returns the maximum value. + * @param selector A transform function to apply to each element. + */ + max(selector: (item: T) => TResult): TResult + + + /** + * Returns the minimum value in a sequence of values. + */ + min(): T + + + /** + * Invokes a transform function on each element of a sequence and returns the minimum value. + * @param selector A transform function to apply to each element. + */ + min(selector: (item: T) => TResult): TResult + + + /** + * Filters the elements of an Enumerable based on a specified type. + * @param type The type to filter the elements of the sequence on. + */ + ofType(type: { new (...args: any[]): TResult }): Enumerable + + + /** + * Sorts the elements of a sequence in ascending order by using a specified comparer. + * @param keySelector A function to extract a key from each element. + */ + orderBy(keySelector: (item: T) => TKey): OrderedEnumerable + + + /** + * Sorts the elements of a sequence in ascending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + orderBy(keySelector: (item: T) => TKey, comparer: EqualityComparer): OrderedEnumerable + + + /** + * Sorts the elements of a sequence in descending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted according to a key. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + */ + orderByDescending(keySelector: (item: T) => TKey): OrderedEnumerable + + + /** + * Sorts the elements of a sequence in descending order by using a specified comparer. + * Returns an OrderedEnumerable whose elements are sorted in descending order according to a key. + * @param keySelector A function to extract a key from each element. + * @param comparer A Comparer to compare keys. + */ + orderByDescending(keySelector: (item: T) => TKey, comparer: EqualityComparer): OrderedEnumerable + + + /** + * Inverts the order of the elements in a sequence. + */ + reverse(): Enumerable + + + /** + * Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type. + * @param second An Iterable to compare to the first sequence. + */ + sequenceEqual(second: Iterable): boolean + + + /** + * Determines whether two sequences are equal by comparing their elements by using a specified EqualityComparer. + * @param second An Iterable to compare to the first sequence. + * @param comparer The EqualityComparer to compare values. + */ + sequenceEqual(second: Iterable, comparer: EqualityComparer): boolean + + + /** + * Projects each element of a sequence into a new form. + * @param selector A transform function to apply to each source element. + */ + select(selector: (item: T) => TResult): Enumerable + + + /** + * Projects each element of a sequence into a new form by incorporating the element's index. + * @param selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + */ + select(selector: (item: T, index: number) => TResult): Enumerable + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. + * @param collectionSelector A transform function to apply to each source element. + */ + selectMany(selector: (item: T) => Iterable): Enumerable; + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element. + * @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + */ + selectMany(selector: (item: T, index: number) => Iterable): Enumerable; + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. + * @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + * @param resultSelector A transform function to apply to each element of the intermediate sequence. + */ + selectMany(collectionSelector: (item: T) => Iterable, resultSelector: (item: T, collection: TCollection) => TResult): Enumerable; + + + /** + * Projects each element of a sequence to an Enumerable and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element. + * @param collectionSelector A transform function to apply to each source element; the second parameter of the function represents the index of the source element. + * @param resultSelector A transform function to apply to each element of the intermediate sequence. + */ + selectMany(collectionSelector: (item: T, index: number) => Iterable, resultSelector: (item: T, collection: TCollection) => TResult): Enumerable; + + + /** + * Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence. + */ + single(): T + + + /** + * Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists. + * @param predicate A function to test each source element for a condition. + */ + single(predicate: (item: T) => boolean): T + + + /** + * Returns the only element of a sequence, or a null if the sequence is empty; this method throws an exception if there is more than one element in the sequence. + */ + singleOrDefault(): T + + + /** + * Returns the only element of a sequence that satisfies a specified condition or a null if no such element exists; this method throws an exception if more than one element satisfies the condition. + * @param predicate A function to test each source element for a condition. + */ + singleOrDefault(predicate: (item: T) => boolean): T + + + /** + * Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. + * @param predicate A function to test each source element for a condition. + * @param defaultValue The value to return if no element exists with specified condition. + */ + singleOrDefault(predicate: (item: T) => boolean, defaultValue: T): T + + + /** + * Bypasses a specified number of elements in a sequence and then returns the remaining elements. + * @param count The number of elements to skip before returning the remaining elements. + */ + skip(count: number): Enumerable + + + /** + * Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. + * @param predicate A function to test each source element for a condition. + */ + skipWhile(predicate: (item: T) => boolean): Enumerable + + + /** + * Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + skipWhile(predicate: (item: T, index: number) => boolean): Enumerable + + + /** + * Computes the sum of a sequence of values. + */ + sum(): number + + + /** + * Computes the sum of the sequence of values that are obtained by invoking a transform function on each element of the input sequence. + * @param selector A transform function to apply to each element. + */ + sum(selector: (item: T) => number): number + + + /** + * Returns a specified number of contiguous elements from the start of a sequence. + * @param count The number of elements to return. + */ + take(count: number): Enumerable + + + /** + * Returns elements from a sequence as long as a specified condition is true. + * @param predicate A function to test each source element for a condition. + */ + takeWhile(predicate: (item: T) => boolean): Enumerable + + + /** + * Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + takeWhile(predicate: (item: T, index: number) => boolean): Enumerable + + + /** + * Creates an array from an Enumerable. + */ + toArray(): T[] + + + /** + * Creates a Dictionary from an Enumerable according to a specified key selector function. + * @param keySelector A function to extract a key from each element. + */ + toDictionary(keySelector: (item: T) => TKey): Dictionary; + + + /** + * Creates a Dictionary from an Enumerable according to specified key selector and comparer. + * @param keySelector A function to extract a key from each element. + * @param comparer An equality comparer to compare values. + */ + toDictionary(keySelector: (item: T) => TKey, comparer: EqualityComparer): Dictionary; + + + /** + * Creates a Dictionary from an Enumerable according to specified key selector and element selector functions. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + */ + toDictionary(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement): Dictionary; + + + /** + * Creates a Dictionary from an Enumerable according to a specified key selector function, a comparer, and an element selector function. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + * @param comparer An equality comparer to compare values. + */ + toDictionary(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, comparer: EqualityComparer): Dictionary; + + + /** + * Creates a List from an Enumerable. + */ + toList(): List + + + /** + * Creates a Lookup from an Enumerable according to a specified key selector function. + * @param keySelector A function to extract a key from each element. + */ + toLookup(keySelector: (item: T) => TKey): Lookup; + + + /** + * Creates a Lookup from an Enumerable according to a specified key selector function and comparer. + * @param keySelector A function to extract a key from each element. + * @param comparer An equality comparer to compare values. + */ + toLookup(keySelector: (item: T) => TKey, comparer: EqualityComparer): Lookup; + + + /** + * Creates a Lookup from an Enumerable according to specified key selector and element selector functions. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + */ + toLookup(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement): Lookup; + + + /** + * Creates a Lookup from an Enumerable according to a specified key selector function, a comparer and an element selector function. + * @param keySelector A function to extract a key from each element. + * @param elementSelector A transform function to produce a result element value from each element. + * @param comparer An equality comparer to compare values. + */ + toLookup(keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, comparer: EqualityComparer): Lookup; + + + /** + * Produces the set union of two sequences by using the default equality comparer. + * @param second An Iterable whose distinct elements form the second set for the union. + */ + union(second: Iterable): Enumerable + + + /** + * Produces the set union of two sequences by using a specified EqualityComparer. + * @param second An Iterable whose distinct elements form the second set for the union. + * @param comparer The EqualityComparer to compare values. + */ + union(second: Iterable, comparer: EqualityComparer): Enumerable + + + /** + * Filters a sequence of values based on a predicate. + * @param predicate A function to test each source element for a condition. + */ + where(predicate: (item: T) => boolean): Enumerable; + + + /** + * Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. + * @param predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element. + */ + where(predicate: (item: T, index: number) => boolean): Enumerable; + + + /** + * Merges two sequences by using the specified predicate function. + * @param second The second sequence to merge. + * @param resultSelector A function that specifies how to merge the elements from the two sequences. + */ + zip(second: Iterable, resultSelector: (first: T, second: TSecond) => TResult): Enumerable; + } + + + + /** + * Represents Array-like objects which has the "length" property and indexed properties access, eg. jQuery + */ + interface ArrayLike { + length: number; + [n: number]: T; + } + + + + /** + * Provides 'hash' and 'equals' functions for a particular type, suitable for use in hashing algorithms and data structures such as a hash table. + */ + interface RuntimeComparer { + + /** + * Serves as a hash function for a particular type. + */ + __hash__(): number; + + /** + * Determines whether the specified Object is equal to the current Object. + */ + __equals__(obj: any): boolean; + } + + + + /** + * Provides a set of static methods that provide support for internal operations. + */ + interface MultiplexRuntime { + + /** + * Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures such as a hash table. + * @param obj An object to retrieve the hash code for. + */ + hash(obj: any): number; + + + /** + * Determines whether the specified object instances are considered equal. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + equals(objA: any, objB: any): boolean; + + + /** + * Performs a comparison of two objects of the same type and returns a value indicating whether one object is less than, equal to, or greater than the other. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + compare(objA: T, objB: T): number; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (obj: T) => TResult; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (obj1: T1, obj2: T2) => TResult; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (obj1: T1, obj2: T2, obj3: T3) => TResult; + + + /** + * Creates A function expression from the specified string lambda expression + * @param exp String lambda expression. + */ + lambda(exp: string): (...args: any[]) => TResult; + + + /** + * Defines new or modifies existing properties directly on the specified object, returning the object. + * @param obj The object on which to define or modify properties. + * @param prop The name of the property to be defined or modified. + * @param attributes The descriptor for the property being defined or modified. + */ + define(obj: T, prop: String, attributes: PropertyDescriptor): T; + + + /** + * Extends the given object by implementing supplied members. + * @param obj The object on which to define or modify properties. + * @param properties Represetnts the mixin source object + * @param attributes The descriptor for the property being defined or modified. + */ + mixin(obj: T, properties: Object, attributes?: PropertyDescriptor): T; + } + + + + /** + * Defines MultiplexStatic module members + */ + interface MultiplexStatic { + + + + /* Factory Methods + --------------------------------------------------------------------------*/ + + /** + * Exposes the enumerator, which supports an iteration over the specified Enumerable object. + * @param obj An Iterable object. eg. Enumerable, Array, String, Set, Map, Iterable & Generators + */ + (obj: Iterable): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the specified Generator function. + * @param factory An Enumerator factory function. + */ + (factory: () => Enumerator): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the items of the specified Array-like object. + * An Array-like object is an object which has the "length" property and indexed properties access, eg. jQuery + * @param obj An Array-like object. + */ + (obj: ArrayLike): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the arguments local variable available within all functions. + * @param obj arguments local variable available within all functions. + */ + (obj: IArguments): Enumerable + + + /** + * Defines an enumerator, which supports an iteration over the properties of the specified object. + * @param obj A regular Object. + */ + (obj: Object): Enumerable> + + + + + + + /* Static Methods + --------------------------------------------------------------------------*/ + + /** + * Gets and combines hash code for the given parameters, calls the overridden "hash" method when available. + * @param objs Optional number of objects to combine their hash codes. + */ + hash(...obj: any[]): number; + + + /** + * Determines whether the specified object instances are considered equal. calls the overridden "equals" method when available. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + equals(objA: any, objB: any): boolean; + + + /** + * Determines whether the specified object instances are considered equal. calls the overridden "equals" method when available. + * @param objA The first object to compare. + * @param objB The second object to compare. + * @param comparer An equality comparer to compare values. + */ + equals(objA: any, objB: any, comparer: EqualityComparer): boolean; + + + /** + * Performs a comparison of two objects of the same type and returns a value indicating whether one object is less than, equal to, or greater than the other. + * @param objA The first object to compare. + * @param objB The second object to compare. + */ + compare(objA: T, objB: T): number; + + + /** + * Extends Enumerable extension methods to the given type + * @param type The type to extend. + */ + enumerableExtend(type: Function): void; + + + /** + * Returns an empty Enumerable. + */ + empty(): Enumerable; + + + /** + * Detects if an object is Enumerable. + * @param obj An object to check its Enumerability. + */ + is(obj: any): boolean; + + + /** + * Generates a sequence of integral numbers within a specified range. + * @param start The value of the first integer in the sequence. + * @param count The number of sequential integers to generate. + */ + range(start: number, count: number): Enumerable; + + + /** + * Generates a sequence that contains one repeated value. + * @param element The value to be repeated. + * @param count The number of times to repeat the value in the generated sequence. + */ + repeat(element: T, count: number): Enumerable; + + + + + + + /* Mutiplex Types + --------------------------------------------------------------------------*/ + + /** + * Provides a set of static methods that provide support for internal operations. + */ + runtime: MultiplexRuntime + + /** + * Supports a simple iteration over a collection. + */ + Enumerator: EnumeratorConstructor + + /** + * Exposes the enumerator, which supports a simple iteration over a collection of a specified type. + */ + Enumerable: EnumerableConstructor + + /** + * Provides a base class for implementations of Comparer generic interface. + */ + Comparer: ComparerConstructor + + /** + * Provides a base class for implementations of the EqualityComparer. + */ + EqualityComparer: EqualityComparerConstructor + + /** + * Initializes a new instance of the abstract Collection class. + */ + Collection: CollectionConstructor + + /** + * Initializes a new instance of the abstract Collection class. + */ + ReadOnlyCollection: ReadOnlyCollectionConstructor + + /** + * Represents a strongly typed list of objects that can be accessed by index. + */ + List: ListConstructor + + /** + * Represents a collection of key/value pairs that are sorted by key based on the associated Comparer implementation. + */ + SortedList: SortedListConstructor + + /** + * Defines a key/value pair that can be set or retrieved. + */ + KeyValuePair: KeyValuePairConstructor + + /** + * Represents a collection of keys and values. + */ + Dictionary: DictionaryConstructor + + /** + * Represents a set of values. + */ + HashSet: HashSetConstructor + + /** + * Represents a node in a LinkedList. + */ + LinkedListNode: LinkedListNodeConstructor + + /** + * Represents a doubly linked list. + */ + LinkedList: LinkedListConstructor + + /** + * Represents a first-in, first-out collection of objects. + */ + Queue: QueueConstructor + + /** + * Represents a variable size last-in-first-out (LIFO) collection of instances of the same arbitrary type. + */ + Stack: StackConstructor + } +} \ No newline at end of file From 3724099e05645107f2680428d6e0d237790051e8 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Date: Tue, 26 May 2015 16:44:06 -0300 Subject: [PATCH 310/534] test > tests --- hashids/{hashids-test.ts => hashids-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename hashids/{hashids-test.ts => hashids-tests.ts} (100%) diff --git a/hashids/hashids-test.ts b/hashids/hashids-tests.ts similarity index 100% rename from hashids/hashids-test.ts rename to hashids/hashids-tests.ts From 4ed4731d6b9f802846b9f8bc1be55d1ffdde43f2 Mon Sep 17 00:00:00 2001 From: Dominic Alie Date: Tue, 26 May 2015 15:44:24 -0400 Subject: [PATCH 311/534] Update angular-file-upload definitions Add abort and xhr methods to the upload promise --- angular-file-upload/angular-file-upload-tests.ts | 4 ++++ angular-file-upload/angular-file-upload.d.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/angular-file-upload/angular-file-upload-tests.ts b/angular-file-upload/angular-file-upload-tests.ts index 8b8fe7490..85dcb7853 100644 --- a/angular-file-upload/angular-file-upload-tests.ts +++ b/angular-file-upload/angular-file-upload-tests.ts @@ -29,6 +29,10 @@ module controllers { }, file: file }) + .abort() + .xhr((evt: any) => { + console.log('xhr'); + }) .progress((evt: angular.angularFileUpload.IFileProgressEvent) => { var percent = parseInt((100.0 * evt.loaded / evt.total).toString(), 10); console.log("upload progress: " + percent + "% for " + evt.config.file.name); diff --git a/angular-file-upload/angular-file-upload.d.ts b/angular-file-upload/angular-file-upload.d.ts index fa7aaa54e..d38c43226 100644 --- a/angular-file-upload/angular-file-upload.d.ts +++ b/angular-file-upload/angular-file-upload.d.ts @@ -14,8 +14,9 @@ declare module angular.angularFileUpload { } interface IUploadPromise extends IHttpPromise { - + abort(): IUploadPromise; progress(callback: IHttpPromiseCallback): IUploadPromise; + xhr(callback: IHttpPromiseCallback): IUploadPromise; } interface IFileUploadConfig extends IRequestConfig { From e96b92628f8ec90da6aebc58f44445f10e2cb655 Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Tue, 26 May 2015 21:42:24 -0300 Subject: [PATCH 312/534] Initial Commit --- magicsuggest/magicsuggest.d.ts | 463 +++++++++++++++++++++++++++++++++ 1 file changed, 463 insertions(+) create mode 100644 magicsuggest/magicsuggest.d.ts diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts new file mode 100644 index 000000000..4d031c39f --- /dev/null +++ b/magicsuggest/magicsuggest.d.ts @@ -0,0 +1,463 @@ +// Type definitions for MagicSuggest 2.1.4 +// Project: http://nicolasbize.com/magicsuggest +// Definitions by: Leonardo Chaia +// Definitions: http://github.com/leonardochaia + +/// +interface JQuery { + magicSuggest: (configurationObject: MagicSuggest.Configuration) => MagicSuggest.Instance; +} + +declare module MagicSuggest { + interface Configuration { + /********** CONFIGURATION PROPERTIES ************/ + /** + * Restricts or allows the user to validate typed entries. + * Defaults to true. + */ + allowFreeEntries?: boolean; + + /** + * Restricts or allows the user to add the same entry more than once + * Defaults to false. + */ + allowDuplicates?: boolean; + + /** + * Additional config object passed to each $.ajax call + */ + ajaxConfig?: JQueryAjaxSettings; + + /** + * If a single suggestion comes out, it is preselected. + */ + autoSelect?: boolean; + + /** + * Auto select the first matching item with multiple items shown + */ + selectFirst?: boolean; + + /** + * Allow customization of query parameter + */ + queryParam?: string; + + /** + * A function triggered just before the ajax request is sent, similar to jQuery + */ + beforeSend?: () => void; + + /** + * A custom CSS class to apply to the field's underlying element. + */ + cls?: string; + + /** + * JSON Data source used to populate the combo box. 3 options are available here: + * No Data Source (default) + * When left null, the combo box will not suggest anything. It can still enable the user to enter + * multiple entries if allowFreeEntries is * set to true (default). + * Static Source + * You can pass an array of JSON objects, an array of strings or even a single CSV string as the + * data source.For ex. data: [* {id:0,name:"Paris"}, {id: 1, name: "New York"}] + * You can also pass any json object with the results property containing the json array. + * Url + * You can pass the url from which the component will fetch its JSON data.Data will be fetched + * using a POST ajax request that will * include the entered text as 'query' parameter. The results + * fetched from the server can be: + * - an array of JSON objects (ex: [{id:...,name:...},{...}]) + * - a string containing an array of JSON objects ready to be parsed (ex: "[{id:...,name:...},{...}]") + * - a JSON object whose data will be contained in the results property + * (ex: {results: [{id:...,name:...},{...}] + * Function + * You can pass a function which returns an array of JSON objects (ex: [{id:...,name:...},{...}]) + * The function can return the JSON data or it can use the first argument as function to handle the data. + * Only one (callback function or return value) is needed for the function to succeed. + * See the following example: + * function (response) { var myjson = [{name: 'test', id: 1}]; response(myjson); return myjson; } + */ + data?: any; + + /** + * Additional parameters to the ajax call + */ + dataUrlParams?: Object; + + /** + * Start the component in a disabled state. + */ + disabled?: boolean; + + /** + * Name of JSON object property that defines the disabled behaviour + */ + disabledField?: string; + + /** + * Name of JSON object property displayed in the combo list + */ + displayField?: string; + + /** + * Set to false if you only want mouse interaction. In that case the combo will + * automatically expand on focus. + */ + editable?: boolean; + + /** + * Set starting state for combo. + */ + expanded?: boolean; + + /** + * Automatically expands combo on focus. + */ + expandOnFocus?: boolean; + + /** + * JSON property by which the list should be grouped + */ + groupBy?: string; + + /** + * Set to true to hide the trigger on the right + */ + hideTrigger?: boolean; + + /** + * Set to true to highlight search input within displayed suggestions + */ + highlight?: boolean; + + /** + * A custom ID for this component + */ + id?: string; + + /** + * A class that is added to the info message appearing on the top-right part of the component + */ + infoMsgCls?: string; + + /** + * Additional parameters passed out to the INPUT tag. Enables usage of AngularJS's custom tags for ex. + */ + inputCfg?: any; + + /** + * The class that is applied to show that the field is invalid + */ + invalidCls?: string; + + /** + * Set to true to filter data results according to case. Useless if the data is fetched remotely + */ + matchCase?: boolean; + + /** + * Once expanded, the combo's height will take as much room as the # of available results. + * In case there are too many results displayed, this will fix the drop down height. + */ + maxDropHeight?: number; + + /** + * Defines how long the user free entry can be. Set to null for no limit. + */ + maxEntryLength?: number; + + /** + * A function that defines the helper text when the max entry length has been surpassed. + */ + maxEntryRenderer?: (v?: number) => void; + + /** + * The maximum number of results displayed in the combo drop down at once. + */ + maxSuggestions?: number; + + /** + * The maximum number of items the user can select if multiple selection is allowed. + * Set to null to remove the limit. + */ + maxSelection?: number; + + /** + * A function that defines the helper text when the max selection amount has been reached. The function has a single + * parameter which is the number of selected elements. + */ + maxSelectionRenderer?: (v: number) => void; + + /** + * The method used by the ajax request. + */ + method?: string; + + /** + * The minimum number of characters the user must type before the combo expands and offers suggestions. + */ + minChars?: number; + + /** + * A function that defines the helper text when not enough letters are set. The function has a single + * parameter which is the difference between the required amount of letters and the current one. + */ + minCharsRenderer?: (v: number) => void; + + /** + * Whether or not sorting / filtering should be done remotely or locally. + * Use either 'local' or 'remote' + */ + mode?: string; + + /** + * The name used as a form element. + */ + name?: string; + + /** + * The text displayed when there are no suggestions. + */ + noSuggestionText?: string; + + /** + * The default placeholder text when nothing has been entered + */ + placeholder?: string; + + /** + * A function used to define how the items will be presented in the combo + */ + renderer?: (item: any) => void; + + /** + * Whether or not this field should be required + */ + required?: boolean; + + /** + * Set to true to render selection as a delimited string + */ + resultAsString?: boolean; + + /** + * Text delimiter to use in a delimited string. + */ + resultAsStringDelimiter?: string; + + /** + * Name of JSON object property that represents the list of suggested objects + */ + resultsField?: string; + + /** + * A custom CSS class to add to a selected item + */ + selectionCls?: string; + + /** + * An optional element replacement in which the selection is rendered + */ + selectionContainer?: JQuery; + + /** + * Where the selected items will be displayed. Only 'right', 'bottom' and 'inner' are valid values + */ + selectionPosition?: string; + + /** + * A function used to define how the items will be presented in the tag list + */ + selectionRenderer?: (item: any) => void; + + /** + * Set to true to stack the selectioned items when positioned on the bottom + * Requires the selectionPosition to be set to 'bottom' + */ + selectionStacked?: boolean; + + /** + * Direction used for sorting. Only 'asc' and 'desc' are valid values + */ + sortDir?: string; + + /** + * name of JSON object property for local result sorting. + * Leave null if you do not wish the results to be ordered or if they are already ordered remotely. + */ + sortOrder?: string; + + /** + * If set to boolean; suggestions will have to start by user input (and not simply contain it as a substring) + */ + strictSuggest?: boolean; + + /** + * Custom style added to the component container. + */ + style?: string; + + /** + * If set to boolean; the combo will expand / collapse when clicked upon + */ + toggleOnClick?: boolean; + + + /** + * Amount (in ms) between keyboard registers. + */ + typeDelay?: number; + + /** + * If set to boolean; tab won't blur the component but will be registered as the ENTER key + */ + useTabKey?: boolean; + + /** + * If set to boolean; using comma will validate the user's choice + */ + useCommaKey?: boolean; + + + /** + * Determines whether or not the results will be displayed with a zebra table style + */ + useZebraStyle?: boolean; + + /** + * initial value for the field + */ + value?: any; + + /** + * name of JSON object property that represents its underlying value + */ + valueField?: string; + + /** + * regular expression to validate the values against + */ + vregex?: any; + + /** + * type to validate against + */ + vtype?: any; + } + + interface Instance { + /** + * Add one or multiple json items to the current selection + * @param items - json object or array of json objects + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + addToSelection(objs: Array, isSilent?: boolean): void; + + /** + * Clears the current selection + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + clear(isSilent?: boolean): void; + + /** + * Collapse the drop down part of the combo + */ + collapse(): void; + + /** + * Set the component in a disabled state. + */ + disable(): void; + + /** + * Empties out the combo user text + */ + empty(): void; + + /** + * Set the component in a enable state. + */ + enable(): void; + + /** + * Retrieve component enabled status + * @return {boolean} + */ + isDisabled(): boolean; + + /** + * Checks whether the field is valid or not + * @return {boolean} + */ + isValid(): boolean; + + /** + * Gets the data params for current ajax request + */ + getDataUrlParams(): Object; + + /** + * Gets the name given to the form input + */ + getName(): string; + + /** + * Retrieve an array of selected json objects + * @return {Array} + */ + getSelection(): Array; + + /** + * Retrieve the current text entered by the user + */ + getRawValue(): string; + + /** + * Retrieve an array of selected values + */ + getValue(): Array; + + /** + * Remove one or multiples json items from the current selection + * @param items - json object or array of json objects + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + removeFromSelection(items: any, isSilent: boolean): void; + + /** + * Set up some combo data after it has been rendered + * @param data + */ + setData(data: any): void; + + /** + * Get current data + */ + getData(): any; + + /** + * Sets the name for the input field so it can be fetched in the form + * @param name + */ + setName(name: string): void; + + /** + * Sets the current selection with the JSON items provided + * @param items + */ + setSelection(items: Array): void; + + /** + * Sets a value for the combo box. Value must be an array of values with data type matching valueField one. + * @param data + */ + setValue(values: Array): void; + + /** + * Sets data params for subsequent ajax requests + * @param params + */ + setDataUrlParams(params: any): void; + + } +} \ No newline at end of file From 2f6e9b996c5c5005f187d1f0991d7a96b6c84d2b Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Tue, 26 May 2015 21:44:01 -0300 Subject: [PATCH 313/534] Changed definitios url --- magicsuggest/magicsuggest.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts index 4d031c39f..9cb09e3e8 100644 --- a/magicsuggest/magicsuggest.d.ts +++ b/magicsuggest/magicsuggest.d.ts @@ -1,7 +1,7 @@ // Type definitions for MagicSuggest 2.1.4 // Project: http://nicolasbize.com/magicsuggest // Definitions by: Leonardo Chaia -// Definitions: http://github.com/leonardochaia +// Definitions: http://github.com/leonardochaia/DefinitelyTyped /// interface JQuery { @@ -460,4 +460,4 @@ declare module MagicSuggest { setDataUrlParams(params: any): void; } -} \ No newline at end of file +} From 21de100cfeacc11fe002874d6ed824c81ce1c26f Mon Sep 17 00:00:00 2001 From: Sam Albert Date: Tue, 26 May 2015 22:14:56 -0400 Subject: [PATCH 314/534] Updated callback to support indefinite number of buffer params --- node_zeromq/zmq-tests.ts | 2 +- node_zeromq/zmq.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node_zeromq/zmq-tests.ts b/node_zeromq/zmq-tests.ts index 696a98c13..a62d97a6c 100644 --- a/node_zeromq/zmq-tests.ts +++ b/node_zeromq/zmq-tests.ts @@ -19,7 +19,7 @@ function test3() { var sock = zmq.socket('push'); sock.bindSync('tcp://127.0.0.1:3000'); sock.send(['hello', 'world']); - sock.on('message', function (buffer: Buffer) { + sock.on('message', function (buffer1: Buffer, buffer2: Buffer) { // }); } diff --git a/node_zeromq/zmq.d.ts b/node_zeromq/zmq.d.ts index 8d29e0569..3ab2d1f25 100644 --- a/node_zeromq/zmq.d.ts +++ b/node_zeromq/zmq.d.ts @@ -182,7 +182,7 @@ declare module 'zmq' { * @param eventName {string} * @param callback {Function} */ - on(eventName: string, callback: (buffer: Buffer) => void): void; + on(eventName: string, callback: (...buffer: Buffer[]) => void): void; // Socket Options _fd: any; From 7094689c1f419280d40305c6fa9a8474c36ecdba Mon Sep 17 00:00:00 2001 From: Seulgi Kim Date: Wed, 27 May 2015 20:29:52 +0900 Subject: [PATCH 315/534] gulp-istanbul 0.9.0 adds enforceThresholds function. --- gulp-istanbul/gulp-istanbul-0.8.1.d.ts | 51 ++++++++++++++++++++++++++ gulp-istanbul/gulp-istanbul-tests.ts | 13 +++++++ gulp-istanbul/gulp-istanbul.d.ts | 17 ++++++++- 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 gulp-istanbul/gulp-istanbul-0.8.1.d.ts diff --git a/gulp-istanbul/gulp-istanbul-0.8.1.d.ts b/gulp-istanbul/gulp-istanbul-0.8.1.d.ts new file mode 100644 index 000000000..3a10dfdba --- /dev/null +++ b/gulp-istanbul/gulp-istanbul-0.8.1.d.ts @@ -0,0 +1,51 @@ +// Type definitions for gulp-istanbul v0.8.1 +// Project: https://github.com/SBoudrias/gulp-istanbul +// Definitions by: Asana +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-istanbul" { + function GulpIstanbul(opts?: GulpIstanbul.Options): NodeJS.ReadWriteStream; + + module GulpIstanbul { + export function hookRequire(): NodeJS.ReadWriteStream; + export function summarizeCoverage(opts?: {coverageVariable?: string}): Coverage; + export function writeReports(opts?: ReportOptions): NodeJS.ReadWriteStream; + + interface Options { + coverageVariable?: string; + includeUntested?: boolean; + embedSource?: boolean; + preserveComments?: boolean; + noCompact?: boolean; + noAutoWrap?: boolean; + codeGenerationOptions?: Object; + debug?: boolean; + walkDebug?: boolean; + } + + interface Coverage { + lines: CoverageStats; + statements: CoverageStats; + functions: CoverageStats; + branches: CoverageStats; + } + + interface CoverageStats { + total: number; + covered: number; + skipped: number; + pct: number; + } + + interface ReportOptions { + dir?: string; + reporters?: string[]; + reportOpts?: {dir?: string}; + coverageVariable?: string; + } + } + + export = GulpIstanbul; +} diff --git a/gulp-istanbul/gulp-istanbul-tests.ts b/gulp-istanbul/gulp-istanbul-tests.ts index 7f2327d07..0d64b53d0 100644 --- a/gulp-istanbul/gulp-istanbul-tests.ts +++ b/gulp-istanbul/gulp-istanbul-tests.ts @@ -29,4 +29,17 @@ gulp.task('test', function (cb) { .pipe(istanbul.writeReports({reporters: ['text']})) // Creating the reports after tests runned .on('end', cb); }); +}); + +gulp.task('test', function (cb) { + gulp.src(['lib/**/*.js', 'main.js']) + .pipe(istanbul({includeUntested: true})) // Covering files + .pipe(istanbul.hookRequire()) + .on('finish', function () { + gulp.src(['test/*.html']) + .pipe(testFramework()) + .pipe(istanbul.writeReports({reporters: ['text']})) // Creating the reports after tests runned + .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) // + .on('end', cb); + }); }); \ No newline at end of file diff --git a/gulp-istanbul/gulp-istanbul.d.ts b/gulp-istanbul/gulp-istanbul.d.ts index bf7a13bb0..d917d64b1 100644 --- a/gulp-istanbul/gulp-istanbul.d.ts +++ b/gulp-istanbul/gulp-istanbul.d.ts @@ -1,4 +1,4 @@ -// Type definitions for gulp-istanbul +// Type definitions for gulp-istanbul v0.9.0 // Project: https://github.com/SBoudrias/gulp-istanbul // Definitions by: Asana // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -12,6 +12,7 @@ declare module "gulp-istanbul" { export function hookRequire(): NodeJS.ReadWriteStream; export function summarizeCoverage(opts?: {coverageVariable?: string}): Coverage; export function writeReports(opts?: ReportOptions): NodeJS.ReadWriteStream; + export function enforceThresholds(opts?: ThresholdOptions): NodeJS.ReadWriteStream; interface Options { coverageVariable?: string; @@ -45,7 +46,19 @@ declare module "gulp-istanbul" { reportOpts?: {dir?: string}; coverageVariable?: string; } + + interface ThresholdOptions { + coverageVariable?: string; + thresholds?: { global?: Coverage|number; each?: Coverage|number }; + } + + interface CoverageOptions { + lines?: number; + statements?: number; + functions?: number; + branches?: number; + } } export = GulpIstanbul; -} \ No newline at end of file +} From a5efba8589f59949da9d7f0367cd4bfc53a8269c Mon Sep 17 00:00:00 2001 From: Seulgi Kim Date: Wed, 27 May 2015 20:55:26 +0900 Subject: [PATCH 316/534] Fix username --- mpromise/mpromise.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpromise/mpromise.d.ts b/mpromise/mpromise.d.ts index ba6961362..2a99964c2 100644 --- a/mpromise/mpromise.d.ts +++ b/mpromise/mpromise.d.ts @@ -1,6 +1,6 @@ // Type definitions for mpromise 0.5.4 // Project: https://github.com/aheckmann/mpromise -// Definitions by: Seulgi Kim +// Definitions by: Seulgi Kim // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module "mpromise" { From f2603afffaabe8c70b95d77961745c29036fe858 Mon Sep 17 00:00:00 2001 From: Kevin Wilson Date: Wed, 27 May 2015 15:00:54 +0100 Subject: [PATCH 317/534] Added static method and wrapped in module. Updated to include static Routie methods. Wrapped types up into a module definition. --- routie/routie.d.ts | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/routie/routie.d.ts b/routie/routie.d.ts index 9317904d4..d6e4cd281 100644 --- a/routie/routie.d.ts +++ b/routie/routie.d.ts @@ -3,15 +3,33 @@ // Definitions by: Adilson // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface Route { - constructor(path: string, name: string): Route; - addHandler(fn: Function): void; - removeHandler(fn: Function): void; - run(params: any): void; - match(path: string, params: any): boolean; - toURL(params: any): string; +declare module routie { + interface Route { + constructor(path: string, name: string): Route; + addHandler(fn: Function): void; + removeHandler(fn: Function): void; + run(params: any): void; + match(path: string, params: any): boolean; + toURL(params: any): string; + } + + interface Routie extends RoutieStatic { + (path: string): void; + (path: string, fn: Function): void; + (routes: { [key: string]: Function }): void; + } + + interface RoutieStatic { + lookup(name: string, fn: Function): string; + remove(path: string, fn: Function): void; + removeAll(): void; + navigate(path: string, options: RouteOptions): void; + noConflict(): Routie; + } + + interface RouteOptions { + silent?: boolean; + } } -declare function routie(path: string): void; -declare function routie(path: string, fn: Function): void; -declare function routie(routes: { [key: string]: Function }): void; \ No newline at end of file +declare var routie: routie.Routie; From 34ef6f1dd3ce8c4ead9c1234ca96f2e582f08160 Mon Sep 17 00:00:00 2001 From: Kevin Wilson Date: Wed, 27 May 2015 15:02:08 +0100 Subject: [PATCH 318/534] Added to change log. --- routie/routie.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/routie/routie.d.ts b/routie/routie.d.ts index d6e4cd281..cd3bb09dc 100644 --- a/routie/routie.d.ts +++ b/routie/routie.d.ts @@ -1,6 +1,7 @@ // Type definitions for routie 0.3.2 // Project: https://github.com/jgallen23/routie // Definitions by: Adilson +// Definitions by: kwilson // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module routie { From e2e6bdb50df936afdcfd91e2e1bdcdb28f392a11 Mon Sep 17 00:00:00 2001 From: Kevin Wilson Date: Wed, 27 May 2015 15:13:48 +0100 Subject: [PATCH 319/534] Added tests for static functions. --- routie/routie-tests.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/routie/routie-tests.ts b/routie/routie-tests.ts index 323142c7e..12ee397c4 100644 --- a/routie/routie-tests.ts +++ b/routie/routie-tests.ts @@ -54,4 +54,24 @@ routie("users/12312312"); routie("*", function () { }); -routie("anything"); \ No newline at end of file +routie("anything"); + +// STATIC + +// Lookup +var existing = routie.lookup("users/bob", () => { +}); + +// Remove +routie.remove("users/bob", () => { +}); + +// RemoveAll +routie.removeAll(); + +// Navigate +routie.navigate("users/bob"); +routie.navigate("users/bob", { silent: true }); + +// NoConflict +var myRoutie = routie.noConflict(); From 45d69d19cbc7beae195cfeb5d4d6c085b9073545 Mon Sep 17 00:00:00 2001 From: Kevin Wilson Date: Wed, 27 May 2015 15:14:21 +0100 Subject: [PATCH 320/534] Fixed missing optional flag for navigate options. --- routie/routie.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routie/routie.d.ts b/routie/routie.d.ts index cd3bb09dc..8f32c3d78 100644 --- a/routie/routie.d.ts +++ b/routie/routie.d.ts @@ -24,7 +24,7 @@ declare module routie { lookup(name: string, fn: Function): string; remove(path: string, fn: Function): void; removeAll(): void; - navigate(path: string, options: RouteOptions): void; + navigate(path: string, options?: RouteOptions): void; noConflict(): Routie; } From fa7330d6fe18c795891fc8465445662ba5cd9675 Mon Sep 17 00:00:00 2001 From: Kevin Wilson Date: Wed, 27 May 2015 15:16:53 +0100 Subject: [PATCH 321/534] Fixed heading error. --- routie/routie.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/routie/routie.d.ts b/routie/routie.d.ts index 8f32c3d78..79ab2dc8a 100644 --- a/routie/routie.d.ts +++ b/routie/routie.d.ts @@ -1,7 +1,6 @@ // Type definitions for routie 0.3.2 // Project: https://github.com/jgallen23/routie // Definitions by: Adilson -// Definitions by: kwilson // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module routie { From 79bdd9caf3545c421646c522a49e0c306ddcf00a Mon Sep 17 00:00:00 2001 From: Chris Wrench Date: Wed, 27 May 2015 15:20:33 +0100 Subject: [PATCH 322/534] Add Stripe Checkout definitions Fixes #4366. --- stripe-checkout/stripe-checkout-tests.ts | 38 ++++++++++++++++++++++++ stripe-checkout/stripe-checkout.d.ts | 35 ++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 stripe-checkout/stripe-checkout-tests.ts create mode 100644 stripe-checkout/stripe-checkout.d.ts diff --git a/stripe-checkout/stripe-checkout-tests.ts b/stripe-checkout/stripe-checkout-tests.ts new file mode 100644 index 000000000..c054b2365 --- /dev/null +++ b/stripe-checkout/stripe-checkout-tests.ts @@ -0,0 +1,38 @@ +/// + +// Test the minimum amount of configuration required. +var handler = StripeCheckout.configure({ + key: "my-secret-key", + token: function(token: StripeTokenResponse) { + console.log(token.id); + } +}); + +handler.open(); + +handler.close(); + +// Test all configuration options. +var options = { + key: "my-secret-key", + token: function(token: StripeTokenResponse) { + console.log(token.id); + }, + image: "http://placehold.it/128x128", + name: "Definitely Typed", + description: "A DefinitelyTyped test for Stripe Checkout", + amount: Number.MAX_VALUE, + currency: "USD", + panelLabel: "Pay Definitely Typed {{amount}}", + label: "Pay Definitely Typed", + zipCode: false, + email: "test@example.com", + allowRememberMe: false, + bitcoin: false, + opened: function() {}, + closed: function() {} +} + +handler = StripeCheckout.configure(options); + +handler.open(options); \ No newline at end of file diff --git a/stripe-checkout/stripe-checkout.d.ts b/stripe-checkout/stripe-checkout.d.ts new file mode 100644 index 000000000..f648a1bb3 --- /dev/null +++ b/stripe-checkout/stripe-checkout.d.ts @@ -0,0 +1,35 @@ +// Type definitions for Stripe Checkout +// Project: https://stripe.com/checkout +// Definitions by: Chris Wrench +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface StripeCheckoutStatic { + configure(options: StripeCheckoutOptions): StripeCheckoutHandler; +} + +interface StripeCheckoutHandler { + open(options?: StripeCheckoutOptions): void; + close(): void; +} + +interface StripeCheckoutOptions { + key: string; + token: (token: StripeTokenResponse) => void; + image?: string; + name?: string; + description?: string; + amount?: number; + currency?: string; + panelLabel?: string; + zipCode?: boolean; + email?: string; + label?: string; + allowRememberMe?: boolean; + bitcoin?: boolean; + opened?: () => void; + closed?: () => void; +} + +declare var StripeCheckout: StripeCheckoutStatic; \ No newline at end of file From 8f7a306a4875d0fb1124e67a84c7ab3eea3f8d09 Mon Sep 17 00:00:00 2001 From: Reto Rezzonico Date: Wed, 27 May 2015 16:28:51 +0200 Subject: [PATCH 323/534] Add definitions for angular-jwt --- angular-jwt/angular-jwt-tests.ts | 17 +++++++++++++++++ angular-jwt/angular-jwt.d.ts | 30 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 angular-jwt/angular-jwt-tests.ts create mode 100644 angular-jwt/angular-jwt.d.ts diff --git a/angular-jwt/angular-jwt-tests.ts b/angular-jwt/angular-jwt-tests.ts new file mode 100644 index 000000000..2e7ccbc08 --- /dev/null +++ b/angular-jwt/angular-jwt-tests.ts @@ -0,0 +1,17 @@ +/// +/// + +var app = angular.module("angular-jwt-tests", ["angular-jwt"]); + +var $jwtHelper: angular.jwt.IJwtHelper; + +var expToken = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3NhbXBsZXMuYXV0aDAuY29tLyIsInN1YiI6ImZhY2Vib29rfDEwMTU0Mjg3MDI3NTEwMzAyIiwiYXVkIjoiQlVJSlNXOXg2MHNJSEJ3OEtkOUVtQ2JqOGVESUZ4REMiLCJleHAiOjE0MTIyMzQ3MzAsImlhdCI6MTQxMjE5ODczMH0.7M5sAV50fF1-_h9qVbdSgqAnXVF7mz3I6RjS6JiH0H8'; +var tokenPayload = $jwtHelper.decodeToken(expToken); +var date = $jwtHelper.getTokenExpirationDate(expToken); +var bool = $jwtHelper.isTokenExpired(expToken); + +var $jwtInterceptor: angular.jwt.IJwtInterceptor; + +$jwtInterceptor.tokenGetter = () => { + return expToken; +} \ No newline at end of file diff --git a/angular-jwt/angular-jwt.d.ts b/angular-jwt/angular-jwt.d.ts new file mode 100644 index 000000000..ec0e03e16 --- /dev/null +++ b/angular-jwt/angular-jwt.d.ts @@ -0,0 +1,30 @@ +// Type definitions for angular-jwt 0.0.8 +// Project: https://github.com/auth0/angular-jwt +// Definitions by: Reto Rezzonico +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module angular.jwt { + + interface JwtToken { + iss: string; + sub: string; + aud: string; + exp: number; + nbf: number; + iat: number; + jti: string; + unique_name: string; + } + + interface IJwtHelper { + decodeToken(token: string): JwtToken; + getTokenExpirationDate(token: any): Date; + isTokenExpired(token: any, offsetSeconds?: number): boolean; + } + + interface IJwtInterceptor { + tokenGetter(): string; + } +} \ No newline at end of file From 989b586b954819ef65a894634ffb0fa0ca0bb84d Mon Sep 17 00:00:00 2001 From: Reto Rezzonico Date: Wed, 27 May 2015 16:32:52 +0200 Subject: [PATCH 324/534] Linebreaks --- angular-jwt/angular-jwt-tests.ts | 2 +- angular-jwt/angular-jwt.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-jwt/angular-jwt-tests.ts b/angular-jwt/angular-jwt-tests.ts index 2e7ccbc08..7f66f2611 100644 --- a/angular-jwt/angular-jwt-tests.ts +++ b/angular-jwt/angular-jwt-tests.ts @@ -14,4 +14,4 @@ var $jwtInterceptor: angular.jwt.IJwtInterceptor; $jwtInterceptor.tokenGetter = () => { return expToken; -} \ No newline at end of file +} diff --git a/angular-jwt/angular-jwt.d.ts b/angular-jwt/angular-jwt.d.ts index ec0e03e16..55bb3e4f6 100644 --- a/angular-jwt/angular-jwt.d.ts +++ b/angular-jwt/angular-jwt.d.ts @@ -27,4 +27,4 @@ declare module angular.jwt { interface IJwtInterceptor { tokenGetter(): string; } -} \ No newline at end of file +} From 4c024ccc5b6d4258dfec002bc41b8c68de648c01 Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Wed, 27 May 2015 17:57:12 -0300 Subject: [PATCH 325/534] Added tests file. Bugfixes on definitions --- magicsuggest/magicsuggest-tests.ts | 24 ++++++++++++++++++++++++ magicsuggest/magicsuggest.d.ts | 7 +++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 magicsuggest/magicsuggest-tests.ts diff --git a/magicsuggest/magicsuggest-tests.ts b/magicsuggest/magicsuggest-tests.ts new file mode 100644 index 000000000..993f6cde3 --- /dev/null +++ b/magicsuggest/magicsuggest-tests.ts @@ -0,0 +1,24 @@ + +function basicTest() { + $('#magicSuggest').magicSuggest(); +} + +function testWithConfigurationOptions() { + $('#magicSuggest').magicSuggest({ + data: [ + { id: 1, name: "Buenos Aires" }, + { id: 2, name: "New York" }, + { id: 3, name: "Madrid" }, + ], + maxDropHeight: 500, + maxSelection: 2, + expandOnFocus: true, + }); +} + +function testSomeMethods() { + var ms = $('#magicSuggest').magicSuggest(); + ms.addToSelection([{ id: 1, name: "Mexico" }]); + console.info(ms.getSelection()); + ms.disable() +} \ No newline at end of file diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts index 9cb09e3e8..f1ac71a2e 100644 --- a/magicsuggest/magicsuggest.d.ts +++ b/magicsuggest/magicsuggest.d.ts @@ -5,7 +5,10 @@ /// interface JQuery { - magicSuggest: (configurationObject: MagicSuggest.Configuration) => MagicSuggest.Instance; + /** + * Initialize MagicSuggest on this selector + */ + magicSuggest(configurationObject?: MagicSuggest.Configuration): MagicSuggest.Instance; } declare module MagicSuggest { @@ -460,4 +463,4 @@ declare module MagicSuggest { setDataUrlParams(params: any): void; } -} +} \ No newline at end of file From 220ded7238f0cd09b1f456ffb562aa61190335be Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Wed, 27 May 2015 18:02:55 -0300 Subject: [PATCH 326/534] Forgot to add the reference to typings on test file --- magicsuggest/magicsuggest-tests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/magicsuggest/magicsuggest-tests.ts b/magicsuggest/magicsuggest-tests.ts index 993f6cde3..b41cf9f71 100644 --- a/magicsuggest/magicsuggest-tests.ts +++ b/magicsuggest/magicsuggest-tests.ts @@ -1,4 +1,6 @@ - +/// +/// + function basicTest() { $('#magicSuggest').magicSuggest(); } From dc9c8d2d5f4822cec81f7c4184f6103e3c340eee Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Tue, 26 May 2015 21:42:24 -0300 Subject: [PATCH 327/534] Initial Commit --- magicsuggest/magicsuggest.d.ts | 463 +++++++++++++++++++++++++++++++++ 1 file changed, 463 insertions(+) create mode 100644 magicsuggest/magicsuggest.d.ts diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts new file mode 100644 index 000000000..4d031c39f --- /dev/null +++ b/magicsuggest/magicsuggest.d.ts @@ -0,0 +1,463 @@ +// Type definitions for MagicSuggest 2.1.4 +// Project: http://nicolasbize.com/magicsuggest +// Definitions by: Leonardo Chaia +// Definitions: http://github.com/leonardochaia + +/// +interface JQuery { + magicSuggest: (configurationObject: MagicSuggest.Configuration) => MagicSuggest.Instance; +} + +declare module MagicSuggest { + interface Configuration { + /********** CONFIGURATION PROPERTIES ************/ + /** + * Restricts or allows the user to validate typed entries. + * Defaults to true. + */ + allowFreeEntries?: boolean; + + /** + * Restricts or allows the user to add the same entry more than once + * Defaults to false. + */ + allowDuplicates?: boolean; + + /** + * Additional config object passed to each $.ajax call + */ + ajaxConfig?: JQueryAjaxSettings; + + /** + * If a single suggestion comes out, it is preselected. + */ + autoSelect?: boolean; + + /** + * Auto select the first matching item with multiple items shown + */ + selectFirst?: boolean; + + /** + * Allow customization of query parameter + */ + queryParam?: string; + + /** + * A function triggered just before the ajax request is sent, similar to jQuery + */ + beforeSend?: () => void; + + /** + * A custom CSS class to apply to the field's underlying element. + */ + cls?: string; + + /** + * JSON Data source used to populate the combo box. 3 options are available here: + * No Data Source (default) + * When left null, the combo box will not suggest anything. It can still enable the user to enter + * multiple entries if allowFreeEntries is * set to true (default). + * Static Source + * You can pass an array of JSON objects, an array of strings or even a single CSV string as the + * data source.For ex. data: [* {id:0,name:"Paris"}, {id: 1, name: "New York"}] + * You can also pass any json object with the results property containing the json array. + * Url + * You can pass the url from which the component will fetch its JSON data.Data will be fetched + * using a POST ajax request that will * include the entered text as 'query' parameter. The results + * fetched from the server can be: + * - an array of JSON objects (ex: [{id:...,name:...},{...}]) + * - a string containing an array of JSON objects ready to be parsed (ex: "[{id:...,name:...},{...}]") + * - a JSON object whose data will be contained in the results property + * (ex: {results: [{id:...,name:...},{...}] + * Function + * You can pass a function which returns an array of JSON objects (ex: [{id:...,name:...},{...}]) + * The function can return the JSON data or it can use the first argument as function to handle the data. + * Only one (callback function or return value) is needed for the function to succeed. + * See the following example: + * function (response) { var myjson = [{name: 'test', id: 1}]; response(myjson); return myjson; } + */ + data?: any; + + /** + * Additional parameters to the ajax call + */ + dataUrlParams?: Object; + + /** + * Start the component in a disabled state. + */ + disabled?: boolean; + + /** + * Name of JSON object property that defines the disabled behaviour + */ + disabledField?: string; + + /** + * Name of JSON object property displayed in the combo list + */ + displayField?: string; + + /** + * Set to false if you only want mouse interaction. In that case the combo will + * automatically expand on focus. + */ + editable?: boolean; + + /** + * Set starting state for combo. + */ + expanded?: boolean; + + /** + * Automatically expands combo on focus. + */ + expandOnFocus?: boolean; + + /** + * JSON property by which the list should be grouped + */ + groupBy?: string; + + /** + * Set to true to hide the trigger on the right + */ + hideTrigger?: boolean; + + /** + * Set to true to highlight search input within displayed suggestions + */ + highlight?: boolean; + + /** + * A custom ID for this component + */ + id?: string; + + /** + * A class that is added to the info message appearing on the top-right part of the component + */ + infoMsgCls?: string; + + /** + * Additional parameters passed out to the INPUT tag. Enables usage of AngularJS's custom tags for ex. + */ + inputCfg?: any; + + /** + * The class that is applied to show that the field is invalid + */ + invalidCls?: string; + + /** + * Set to true to filter data results according to case. Useless if the data is fetched remotely + */ + matchCase?: boolean; + + /** + * Once expanded, the combo's height will take as much room as the # of available results. + * In case there are too many results displayed, this will fix the drop down height. + */ + maxDropHeight?: number; + + /** + * Defines how long the user free entry can be. Set to null for no limit. + */ + maxEntryLength?: number; + + /** + * A function that defines the helper text when the max entry length has been surpassed. + */ + maxEntryRenderer?: (v?: number) => void; + + /** + * The maximum number of results displayed in the combo drop down at once. + */ + maxSuggestions?: number; + + /** + * The maximum number of items the user can select if multiple selection is allowed. + * Set to null to remove the limit. + */ + maxSelection?: number; + + /** + * A function that defines the helper text when the max selection amount has been reached. The function has a single + * parameter which is the number of selected elements. + */ + maxSelectionRenderer?: (v: number) => void; + + /** + * The method used by the ajax request. + */ + method?: string; + + /** + * The minimum number of characters the user must type before the combo expands and offers suggestions. + */ + minChars?: number; + + /** + * A function that defines the helper text when not enough letters are set. The function has a single + * parameter which is the difference between the required amount of letters and the current one. + */ + minCharsRenderer?: (v: number) => void; + + /** + * Whether or not sorting / filtering should be done remotely or locally. + * Use either 'local' or 'remote' + */ + mode?: string; + + /** + * The name used as a form element. + */ + name?: string; + + /** + * The text displayed when there are no suggestions. + */ + noSuggestionText?: string; + + /** + * The default placeholder text when nothing has been entered + */ + placeholder?: string; + + /** + * A function used to define how the items will be presented in the combo + */ + renderer?: (item: any) => void; + + /** + * Whether or not this field should be required + */ + required?: boolean; + + /** + * Set to true to render selection as a delimited string + */ + resultAsString?: boolean; + + /** + * Text delimiter to use in a delimited string. + */ + resultAsStringDelimiter?: string; + + /** + * Name of JSON object property that represents the list of suggested objects + */ + resultsField?: string; + + /** + * A custom CSS class to add to a selected item + */ + selectionCls?: string; + + /** + * An optional element replacement in which the selection is rendered + */ + selectionContainer?: JQuery; + + /** + * Where the selected items will be displayed. Only 'right', 'bottom' and 'inner' are valid values + */ + selectionPosition?: string; + + /** + * A function used to define how the items will be presented in the tag list + */ + selectionRenderer?: (item: any) => void; + + /** + * Set to true to stack the selectioned items when positioned on the bottom + * Requires the selectionPosition to be set to 'bottom' + */ + selectionStacked?: boolean; + + /** + * Direction used for sorting. Only 'asc' and 'desc' are valid values + */ + sortDir?: string; + + /** + * name of JSON object property for local result sorting. + * Leave null if you do not wish the results to be ordered or if they are already ordered remotely. + */ + sortOrder?: string; + + /** + * If set to boolean; suggestions will have to start by user input (and not simply contain it as a substring) + */ + strictSuggest?: boolean; + + /** + * Custom style added to the component container. + */ + style?: string; + + /** + * If set to boolean; the combo will expand / collapse when clicked upon + */ + toggleOnClick?: boolean; + + + /** + * Amount (in ms) between keyboard registers. + */ + typeDelay?: number; + + /** + * If set to boolean; tab won't blur the component but will be registered as the ENTER key + */ + useTabKey?: boolean; + + /** + * If set to boolean; using comma will validate the user's choice + */ + useCommaKey?: boolean; + + + /** + * Determines whether or not the results will be displayed with a zebra table style + */ + useZebraStyle?: boolean; + + /** + * initial value for the field + */ + value?: any; + + /** + * name of JSON object property that represents its underlying value + */ + valueField?: string; + + /** + * regular expression to validate the values against + */ + vregex?: any; + + /** + * type to validate against + */ + vtype?: any; + } + + interface Instance { + /** + * Add one or multiple json items to the current selection + * @param items - json object or array of json objects + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + addToSelection(objs: Array, isSilent?: boolean): void; + + /** + * Clears the current selection + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + clear(isSilent?: boolean): void; + + /** + * Collapse the drop down part of the combo + */ + collapse(): void; + + /** + * Set the component in a disabled state. + */ + disable(): void; + + /** + * Empties out the combo user text + */ + empty(): void; + + /** + * Set the component in a enable state. + */ + enable(): void; + + /** + * Retrieve component enabled status + * @return {boolean} + */ + isDisabled(): boolean; + + /** + * Checks whether the field is valid or not + * @return {boolean} + */ + isValid(): boolean; + + /** + * Gets the data params for current ajax request + */ + getDataUrlParams(): Object; + + /** + * Gets the name given to the form input + */ + getName(): string; + + /** + * Retrieve an array of selected json objects + * @return {Array} + */ + getSelection(): Array; + + /** + * Retrieve the current text entered by the user + */ + getRawValue(): string; + + /** + * Retrieve an array of selected values + */ + getValue(): Array; + + /** + * Remove one or multiples json items from the current selection + * @param items - json object or array of json objects + * @param isSilent - (optional) set to true to suppress 'selectionchange' event from being triggered + */ + removeFromSelection(items: any, isSilent: boolean): void; + + /** + * Set up some combo data after it has been rendered + * @param data + */ + setData(data: any): void; + + /** + * Get current data + */ + getData(): any; + + /** + * Sets the name for the input field so it can be fetched in the form + * @param name + */ + setName(name: string): void; + + /** + * Sets the current selection with the JSON items provided + * @param items + */ + setSelection(items: Array): void; + + /** + * Sets a value for the combo box. Value must be an array of values with data type matching valueField one. + * @param data + */ + setValue(values: Array): void; + + /** + * Sets data params for subsequent ajax requests + * @param params + */ + setDataUrlParams(params: any): void; + + } +} \ No newline at end of file From 68dd8244f14677b3bf8f17dbb50090721c65175d Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Tue, 26 May 2015 21:44:01 -0300 Subject: [PATCH 328/534] Changed definitios url --- magicsuggest/magicsuggest.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts index 4d031c39f..9cb09e3e8 100644 --- a/magicsuggest/magicsuggest.d.ts +++ b/magicsuggest/magicsuggest.d.ts @@ -1,7 +1,7 @@ // Type definitions for MagicSuggest 2.1.4 // Project: http://nicolasbize.com/magicsuggest // Definitions by: Leonardo Chaia -// Definitions: http://github.com/leonardochaia +// Definitions: http://github.com/leonardochaia/DefinitelyTyped /// interface JQuery { @@ -460,4 +460,4 @@ declare module MagicSuggest { setDataUrlParams(params: any): void; } -} \ No newline at end of file +} From 69750463b614f599f4f95496daed88ce8a489610 Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Wed, 27 May 2015 17:57:12 -0300 Subject: [PATCH 329/534] Added tests file. Bugfixes on definitions --- magicsuggest/magicsuggest-tests.ts | 24 ++++++++++++++++++++++++ magicsuggest/magicsuggest.d.ts | 7 +++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 magicsuggest/magicsuggest-tests.ts diff --git a/magicsuggest/magicsuggest-tests.ts b/magicsuggest/magicsuggest-tests.ts new file mode 100644 index 000000000..993f6cde3 --- /dev/null +++ b/magicsuggest/magicsuggest-tests.ts @@ -0,0 +1,24 @@ + +function basicTest() { + $('#magicSuggest').magicSuggest(); +} + +function testWithConfigurationOptions() { + $('#magicSuggest').magicSuggest({ + data: [ + { id: 1, name: "Buenos Aires" }, + { id: 2, name: "New York" }, + { id: 3, name: "Madrid" }, + ], + maxDropHeight: 500, + maxSelection: 2, + expandOnFocus: true, + }); +} + +function testSomeMethods() { + var ms = $('#magicSuggest').magicSuggest(); + ms.addToSelection([{ id: 1, name: "Mexico" }]); + console.info(ms.getSelection()); + ms.disable() +} \ No newline at end of file diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts index 9cb09e3e8..f1ac71a2e 100644 --- a/magicsuggest/magicsuggest.d.ts +++ b/magicsuggest/magicsuggest.d.ts @@ -5,7 +5,10 @@ /// interface JQuery { - magicSuggest: (configurationObject: MagicSuggest.Configuration) => MagicSuggest.Instance; + /** + * Initialize MagicSuggest on this selector + */ + magicSuggest(configurationObject?: MagicSuggest.Configuration): MagicSuggest.Instance; } declare module MagicSuggest { @@ -460,4 +463,4 @@ declare module MagicSuggest { setDataUrlParams(params: any): void; } -} +} \ No newline at end of file From 99d72aacf41a3b2bc6c48a3da50940989a3c5563 Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Wed, 27 May 2015 18:02:55 -0300 Subject: [PATCH 330/534] Forgot to add the reference to typings on test file --- magicsuggest/magicsuggest-tests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/magicsuggest/magicsuggest-tests.ts b/magicsuggest/magicsuggest-tests.ts index 993f6cde3..b41cf9f71 100644 --- a/magicsuggest/magicsuggest-tests.ts +++ b/magicsuggest/magicsuggest-tests.ts @@ -1,4 +1,6 @@ - +/// +/// + function basicTest() { $('#magicSuggest').magicSuggest(); } From 0f894228dfd3ad45b843dbf2fd445e4da04e8e55 Mon Sep 17 00:00:00 2001 From: Dmitry Radkovskiy Date: Thu, 28 May 2015 00:43:38 +0300 Subject: [PATCH 331/534] Moved declarations to moment-node.d.ts --- moment/moment-node.d.ts | 482 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 482 insertions(+) create mode 100644 moment/moment-node.d.ts diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts new file mode 100644 index 000000000..13f1b9362 --- /dev/null +++ b/moment/moment-node.d.ts @@ -0,0 +1,482 @@ +// Type definitions for Moment.js 2.8.0 +// Project: https://github.com/timrwood/moment +// Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module moment { + + interface MomentInput { + + years?: number; + y?: number; + + months?: number; + M?: number; + + weeks?: number; + w?: number; + + days?: number; + d?: number; + + hours?: number; + h?: number; + + minutes?: number; + m?: number; + + seconds?: number; + s?: number; + + milliseconds?: number; + ms?: number; + + } + + interface Duration { + + humanize(withSuffix?: boolean): string; + + as(units: string): number; + + milliseconds(): number; + asMilliseconds(): number; + + seconds(): number; + asSeconds(): number; + + minutes(): number; + asMinutes(): number; + + hours(): number; + asHours(): number; + + days(): number; + asDays(): number; + + months(): number; + asMonths(): number; + + years(): number; + asYears(): number; + + add(n: number, p: string): Duration; + add(n: number): Duration; + add(d: Duration): Duration; + + subtract(n: number, p: string): Duration; + subtract(n: number): Duration; + subtract(d: Duration): Duration; + + toISOString(): string; + + } + + interface Moment { + + format(format: string): string; + format(): string; + + fromNow(withoutSuffix?: boolean): string; + + startOf(unitOfTime: string): Moment; + endOf(unitOfTime: string): Moment; + + /** + * Mutates the original moment by adding time. (deprecated in 2.8.0) + * + * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) + * @param amount the amount you want to add + */ + add(unitOfTime: string, amount: number): Moment; + /** + * Mutates the original moment by adding time. + * + * @param amount the amount you want to add + * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) + */ + add(amount: number, unitOfTime: string): Moment; + /** + * Mutates the original moment by adding time. Note that the order of arguments can be flipped. + * + * @param amount the amount you want to add + * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) + */ + add(amount: string, unitOfTime: string): Moment; + /** + * Mutates the original moment by adding time. + * + * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} + */ + add(objectLiteral: MomentInput): Moment; + /** + * Mutates the original moment by adding time. + * + * @param duration a length of time + */ + add(duration: Duration): Moment; + + /** + * Mutates the original moment by subtracting time. (deprecated in 2.8.0) + * + * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) + * @param amount the amount you want to subtract + */ + subtract(unitOfTime: string, amount: number): Moment; + /** + * Mutates the original moment by subtracting time. + * + * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) + * @param amount the amount you want to subtract + */ + subtract(amount: number, unitOfTime: string): Moment; + /** + * Mutates the original moment by subtracting time. Note that the order of arguments can be flipped. + * + * @param amount the amount you want to add + * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) + */ + subtract(amount: string, unitOfTime: string): Moment; + /** + * Mutates the original moment by subtracting time. + * + * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} + */ + subtract(objectLiteral: MomentInput): Moment; + /** + * Mutates the original moment by subtracting time. + * + * @param duration a length of time + */ + subtract(duration: Duration): Moment; + + calendar(): string; + calendar(start: Moment): string; + + clone(): Moment; + + /** + * @return Unix timestamp, or milliseconds since the epoch. + */ + valueOf(): number; + + local(): Moment; // current date/time in local mode + + utc(): Moment; // current date/time in UTC mode + + isValid(): boolean; + + year(y: number): Moment; + year(): number; + quarter(): number; + quarter(q: number): Moment; + month(M: number): Moment; + month(M: string): Moment; + month(): number; + day(d: number): Moment; + day(d: string): Moment; + day(): number; + date(d: number): Moment; + date(): number; + hour(h: number): Moment; + hour(): number; + hours(h: number): Moment; + hours(): number; + minute(m: number): Moment; + minute(): number; + minutes(m: number): Moment; + minutes(): number; + second(s: number): Moment; + second(): number; + seconds(s: number): Moment; + seconds(): number; + millisecond(ms: number): Moment; + millisecond(): number; + milliseconds(ms: number): Moment; + milliseconds(): number; + weekday(): number; + weekday(d: number): Moment; + isoWeekday(): number; + isoWeekday(d: number): Moment; + weekYear(): number; + weekYear(d: number): Moment; + isoWeekYear(): number; + isoWeekYear(d: number): Moment; + week(): number; + week(d: number): Moment; + weeks(): number; + weeks(d: number): Moment; + isoWeek(): number; + isoWeek(d: number): Moment; + isoWeeks(): number; + isoWeeks(d: number): Moment; + weeksInYear(): number; + isoWeeksInYear(): number; + dayOfYear(): number; + dayOfYear(d: number): Moment; + + from(f: Moment): string; + from(f: Moment, suffix: boolean): string; + from(d: Date): string; + from(s: string): string; + from(date: number[]): string; + + diff(b: Moment): number; + diff(b: Moment, unitOfTime: string): number; + diff(b: Moment, unitOfTime: string, round: boolean): number; + + toArray(): number[]; + toDate(): Date; + toISOString(): string; + toJSON(): string; + unix(): number; + + isLeapYear(): boolean; + zone(): number; + zone(b: number): Moment; + zone(b: string): Moment; + utcOffset(): number; + utcOffset(b: number): Moment; + utcOffset(b: string): Moment; + daysInMonth(): number; + isDST(): boolean; + + isBefore(): boolean; + isBefore(b: Moment): boolean; + isBefore(b: string): boolean; + isBefore(b: Number): boolean; + isBefore(b: Date): boolean; + isBefore(b: number[]): boolean; + isBefore(b: Moment, granularity: string): boolean; + isBefore(b: String, granularity: string): boolean; + isBefore(b: Number, granularity: string): boolean; + isBefore(b: Date, granularity: string): boolean; + isBefore(b: number[], granularity: string): boolean; + + isAfter(): boolean; + isAfter(b: Moment): boolean; + isAfter(b: string): boolean; + isAfter(b: Number): boolean; + isAfter(b: Date): boolean; + isAfter(b: number[]): boolean; + isAfter(b: Moment, granularity: string): boolean; + isAfter(b: String, granularity: string): boolean; + isAfter(b: Number, granularity: string): boolean; + isAfter(b: Date, granularity: string): boolean; + isAfter(b: number[], granularity: string): boolean; + + isSame(b: Moment): boolean; + isSame(b: string): boolean; + isSame(b: Number): boolean; + isSame(b: Date): boolean; + isSame(b: number[]): boolean; + isSame(b: Moment, granularity: string): boolean; + isSame(b: String, granularity: string): boolean; + isSame(b: Number, granularity: string): boolean; + isSame(b: Date, granularity: string): boolean; + isSame(b: number[], granularity: string): boolean; + + // Deprecated as of 2.8.0. + lang(language: string): Moment; + lang(reset: boolean): Moment; + lang(): MomentLanguage; + + locale(language: string): Moment; + locale(reset: boolean): Moment; + locale(): string; + + localeData(language: string): Moment; + localeData(reset: boolean): Moment; + localeData(): MomentLanguage; + + // Deprecated as of 2.7.0. + max(date: Date): Moment; + max(date: number): Moment; + max(date: any[]): Moment; + max(date: string): Moment; + max(date: string, format: string): Moment; + max(clone: Moment): Moment; + + // Deprecated as of 2.7.0. + min(date: Date): Moment; + min(date: number): Moment; + min(date: any[]): Moment; + min(date: string): Moment; + min(date: string, format: string): Moment; + min(clone: Moment): Moment; + + get(unit: string): number; + set(unit: string, value: number): Moment; + + } + + interface MomentCalendar { + + lastDay: any; + sameDay: any; + nextDay: any; + lastWeek: any; + nextWeek: any; + sameElse: any; + + } + + interface BaseMomentLanguage { + months ?: any; + monthsShort ?: any; + weekdays ?: any; + weekdaysShort ?: any; + weekdaysMin ?: any; + relativeTime ?: MomentRelativeTime; + meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string; + calendar ?: MomentCalendar; + ordinal ?: (num: number) => string; + } + + interface MomentLanguage extends BaseMomentLanguage { + longDateFormat?: MomentLongDateFormat; + } + + interface MomentLanguageData extends BaseMomentLanguage { + /** + * @param formatType should be L, LL, LLL, LLLL. + */ + longDateFormat(formatType: string): string; + } + + interface MomentLongDateFormat { + + L: string; + LL: string; + LLL: string; + LLLL: string; + LT: string; + l?: string; + ll?: string; + lll?: string; + llll?: string; + lt?: string; + + } + + interface MomentRelativeTime { + + future: any; + past: any; + s: any; + m: any; + mm: any; + h: any; + hh: any; + d: any; + dd: any; + M: any; + MM: any; + y: any; + yy: any; + + } + + interface MomentStatic { + + version: string; + + (): Moment; + (date: number): Moment; + (date: number[]): Moment; + (date: string, format?: string, strict?: boolean): Moment; + (date: string, format?: string, language?: string, strict?: boolean): Moment; + (date: string, formats: string[], strict?: boolean): Moment; + (date: string, formats: string[], language?: string, strict?: boolean): Moment; + (date: string, specialFormat: () => void, strict?: boolean): Moment; + (date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment; + (date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment; + (date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment; + (date: Date): Moment; + (date: Moment): Moment; + (date: Object): Moment; + + utc(): Moment; + utc(date: number): Moment; + utc(date: number[]): Moment; + utc(date: string, format?: string, strict?: boolean): Moment; + utc(date: string, format?: string, language?: string, strict?: boolean): Moment; + utc(date: string, formats: string[], strict?: boolean): Moment; + utc(date: string, formats: string[], language?: string, strict?: boolean): Moment; + utc(date: Date): Moment; + utc(date: Moment): Moment; + utc(date: Object): Moment; + + unix(timestamp: number): Moment; + + invalid(parsingFlags?: Object): Moment; + isMoment(): boolean; + isMoment(m: any): boolean; + isDuration(): boolean; + isDuration(d: any): boolean; + + // Deprecated in 2.8.0. + lang(language?: string): string; + lang(language?: string, definition?: MomentLanguage): string; + + locale(language?: string): string; + locale(language?: string[]): string; + locale(language?: string, definition?: MomentLanguage): string; + + localeData(language?: string): MomentLanguageData; + + longDateFormat: any; + relativeTime: any; + meridiem: (hour: number, minute: number, isLowercase: boolean) => string; + calendar: any; + ordinal: (num: number) => string; + + duration(milliseconds: Number): Duration; + duration(num: Number, unitOfTime: string): Duration; + duration(input: MomentInput): Duration; + duration(object: any): Duration; + duration(): Duration; + + parseZone(date: string): Moment; + + months(): string[]; + months(index: number): string; + months(format: string): string[]; + months(format: string, index: number): string; + monthsShort(): string[]; + monthsShort(index: number): string; + monthsShort(format: string): string[]; + monthsShort(format: string, index: number): string; + + weekdays(): string[]; + weekdays(index: number): string; + weekdays(format: string): string[]; + weekdays(format: string, index: number): string; + weekdaysShort(): string[]; + weekdaysShort(index: number): string; + weekdaysShort(format: string): string[]; + weekdaysShort(format: string, index: number): string; + weekdaysMin(): string[]; + weekdaysMin(index: number): string; + weekdaysMin(format: string): string[]; + weekdaysMin(format: string, index: number): string; + + min(moments: Moment[]): Moment; + max(moments: Moment[]): Moment; + + normalizeUnits(unit: string): string; + relativeTimeThreshold(threshold: string, limit: number): void; + + /** + * Constant used to enable explicit ISO_8601 format parsing. + */ + ISO_8601(): void; + + } + +} + +declare module 'moment' { + var moment: moment.MomentStatic; + export = moment; +} From a1575b96ec38e916750629839d2110cb96210f89 Mon Sep 17 00:00:00 2001 From: Dmitry Radkovskiy Date: Thu, 28 May 2015 00:46:21 +0300 Subject: [PATCH 332/534] Modified moment.d.ts to use moment-node.d.ts --- moment/moment.d.ts | 477 +-------------------------------------------- 1 file changed, 1 insertion(+), 476 deletions(-) diff --git a/moment/moment.d.ts b/moment/moment.d.ts index e09aab1d5..736956e5d 100644 --- a/moment/moment.d.ts +++ b/moment/moment.d.ts @@ -3,481 +3,6 @@ // Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module moment { - - interface MomentInput { - - years?: number; - y?: number; - - months?: number; - M?: number; - - weeks?: number; - w?: number; - - days?: number; - d?: number; - - hours?: number; - h?: number; - - minutes?: number; - m?: number; - - seconds?: number; - s?: number; - - milliseconds?: number; - ms?: number; - - } - - interface Duration { - - humanize(withSuffix?: boolean): string; - - as(units: string): number; - - milliseconds(): number; - asMilliseconds(): number; - - seconds(): number; - asSeconds(): number; - - minutes(): number; - asMinutes(): number; - - hours(): number; - asHours(): number; - - days(): number; - asDays(): number; - - months(): number; - asMonths(): number; - - years(): number; - asYears(): number; - - add(n: number, p: string): Duration; - add(n: number): Duration; - add(d: Duration): Duration; - - subtract(n: number, p: string): Duration; - subtract(n: number): Duration; - subtract(d: Duration): Duration; - - toISOString(): string; - - } - - interface Moment { - - format(format: string): string; - format(): string; - - fromNow(withoutSuffix?: boolean): string; - - startOf(unitOfTime: string): Moment; - endOf(unitOfTime: string): Moment; - - /** - * Mutates the original moment by adding time. (deprecated in 2.8.0) - * - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - * @param amount the amount you want to add - */ - add(unitOfTime: string, amount: number): Moment; - /** - * Mutates the original moment by adding time. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - */ - add(amount: number, unitOfTime: string): Moment; - /** - * Mutates the original moment by adding time. Note that the order of arguments can be flipped. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc) - */ - add(amount: string, unitOfTime: string): Moment; - /** - * Mutates the original moment by adding time. - * - * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} - */ - add(objectLiteral: MomentInput): Moment; - /** - * Mutates the original moment by adding time. - * - * @param duration a length of time - */ - add(duration: Duration): Moment; - - /** - * Mutates the original moment by subtracting time. (deprecated in 2.8.0) - * - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - * @param amount the amount you want to subtract - */ - subtract(unitOfTime: string, amount: number): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - * @param amount the amount you want to subtract - */ - subtract(amount: number, unitOfTime: string): Moment; - /** - * Mutates the original moment by subtracting time. Note that the order of arguments can be flipped. - * - * @param amount the amount you want to add - * @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc) - */ - subtract(amount: string, unitOfTime: string): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param objectLiteral an object literal that describes multiple time units {days:7,months:1} - */ - subtract(objectLiteral: MomentInput): Moment; - /** - * Mutates the original moment by subtracting time. - * - * @param duration a length of time - */ - subtract(duration: Duration): Moment; - - calendar(): string; - calendar(start: Moment): string; - - clone(): Moment; - - /** - * @return Unix timestamp, or milliseconds since the epoch. - */ - valueOf(): number; - - local(): Moment; // current date/time in local mode - - utc(): Moment; // current date/time in UTC mode - - isValid(): boolean; - - year(y: number): Moment; - year(): number; - quarter(): number; - quarter(q: number): Moment; - month(M: number): Moment; - month(M: string): Moment; - month(): number; - day(d: number): Moment; - day(d: string): Moment; - day(): number; - date(d: number): Moment; - date(): number; - hour(h: number): Moment; - hour(): number; - hours(h: number): Moment; - hours(): number; - minute(m: number): Moment; - minute(): number; - minutes(m: number): Moment; - minutes(): number; - second(s: number): Moment; - second(): number; - seconds(s: number): Moment; - seconds(): number; - millisecond(ms: number): Moment; - millisecond(): number; - milliseconds(ms: number): Moment; - milliseconds(): number; - weekday(): number; - weekday(d: number): Moment; - isoWeekday(): number; - isoWeekday(d: number): Moment; - weekYear(): number; - weekYear(d: number): Moment; - isoWeekYear(): number; - isoWeekYear(d: number): Moment; - week(): number; - week(d: number): Moment; - weeks(): number; - weeks(d: number): Moment; - isoWeek(): number; - isoWeek(d: number): Moment; - isoWeeks(): number; - isoWeeks(d: number): Moment; - weeksInYear(): number; - isoWeeksInYear(): number; - dayOfYear(): number; - dayOfYear(d: number): Moment; - - from(f: Moment): string; - from(f: Moment, suffix: boolean): string; - from(d: Date): string; - from(s: string): string; - from(date: number[]): string; - - diff(b: Moment): number; - diff(b: Moment, unitOfTime: string): number; - diff(b: Moment, unitOfTime: string, round: boolean): number; - - toArray(): number[]; - toDate(): Date; - toISOString(): string; - toJSON(): string; - unix(): number; - - isLeapYear(): boolean; - zone(): number; - zone(b: number): Moment; - zone(b: string): Moment; - utcOffset(): number; - utcOffset(b: number): Moment; - utcOffset(b: string): Moment; - daysInMonth(): number; - isDST(): boolean; - - isBefore(): boolean; - isBefore(b: Moment): boolean; - isBefore(b: string): boolean; - isBefore(b: Number): boolean; - isBefore(b: Date): boolean; - isBefore(b: number[]): boolean; - isBefore(b: Moment, granularity: string): boolean; - isBefore(b: String, granularity: string): boolean; - isBefore(b: Number, granularity: string): boolean; - isBefore(b: Date, granularity: string): boolean; - isBefore(b: number[], granularity: string): boolean; - - isAfter(): boolean; - isAfter(b: Moment): boolean; - isAfter(b: string): boolean; - isAfter(b: Number): boolean; - isAfter(b: Date): boolean; - isAfter(b: number[]): boolean; - isAfter(b: Moment, granularity: string): boolean; - isAfter(b: String, granularity: string): boolean; - isAfter(b: Number, granularity: string): boolean; - isAfter(b: Date, granularity: string): boolean; - isAfter(b: number[], granularity: string): boolean; - - isSame(b: Moment): boolean; - isSame(b: string): boolean; - isSame(b: Number): boolean; - isSame(b: Date): boolean; - isSame(b: number[]): boolean; - isSame(b: Moment, granularity: string): boolean; - isSame(b: String, granularity: string): boolean; - isSame(b: Number, granularity: string): boolean; - isSame(b: Date, granularity: string): boolean; - isSame(b: number[], granularity: string): boolean; - - // Deprecated as of 2.8.0. - lang(language: string): Moment; - lang(reset: boolean): Moment; - lang(): MomentLanguage; - - locale(language: string): Moment; - locale(reset: boolean): Moment; - locale(): string; - - localeData(language: string): Moment; - localeData(reset: boolean): Moment; - localeData(): MomentLanguage; - - // Deprecated as of 2.7.0. - max(date: Date): Moment; - max(date: number): Moment; - max(date: any[]): Moment; - max(date: string): Moment; - max(date: string, format: string): Moment; - max(clone: Moment): Moment; - - // Deprecated as of 2.7.0. - min(date: Date): Moment; - min(date: number): Moment; - min(date: any[]): Moment; - min(date: string): Moment; - min(date: string, format: string): Moment; - min(clone: Moment): Moment; - - get(unit: string): number; - set(unit: string, value: number): Moment; - - } - - interface MomentCalendar { - - lastDay: any; - sameDay: any; - nextDay: any; - lastWeek: any; - nextWeek: any; - sameElse: any; - - } - - interface BaseMomentLanguage { - months ?: any; - monthsShort ?: any; - weekdays ?: any; - weekdaysShort ?: any; - weekdaysMin ?: any; - relativeTime ?: MomentRelativeTime; - meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string; - calendar ?: MomentCalendar; - ordinal ?: (num: number) => string; - } - - interface MomentLanguage extends BaseMomentLanguage { - longDateFormat?: MomentLongDateFormat; - } - - interface MomentLanguageData extends BaseMomentLanguage { - /** - * @param formatType should be L, LL, LLL, LLLL. - */ - longDateFormat(formatType: string): string; - } - - interface MomentLongDateFormat { - - L: string; - LL: string; - LLL: string; - LLLL: string; - LT: string; - l?: string; - ll?: string; - lll?: string; - llll?: string; - lt?: string; - - } - - interface MomentRelativeTime { - - future: any; - past: any; - s: any; - m: any; - mm: any; - h: any; - hh: any; - d: any; - dd: any; - M: any; - MM: any; - y: any; - yy: any; - - } - - interface MomentStatic { - - version: string; - - (): Moment; - (date: number): Moment; - (date: number[]): Moment; - (date: string, format?: string, strict?: boolean): Moment; - (date: string, format?: string, language?: string, strict?: boolean): Moment; - (date: string, formats: string[], strict?: boolean): Moment; - (date: string, formats: string[], language?: string, strict?: boolean): Moment; - (date: string, specialFormat: () => void, strict?: boolean): Moment; - (date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment; - (date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment; - (date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment; - (date: Date): Moment; - (date: Moment): Moment; - (date: Object): Moment; - - utc(): Moment; - utc(date: number): Moment; - utc(date: number[]): Moment; - utc(date: string, format?: string, strict?: boolean): Moment; - utc(date: string, format?: string, language?: string, strict?: boolean): Moment; - utc(date: string, formats: string[], strict?: boolean): Moment; - utc(date: string, formats: string[], language?: string, strict?: boolean): Moment; - utc(date: Date): Moment; - utc(date: Moment): Moment; - utc(date: Object): Moment; - - unix(timestamp: number): Moment; - - invalid(parsingFlags?: Object): Moment; - isMoment(): boolean; - isMoment(m: any): boolean; - isDuration(): boolean; - isDuration(d: any): boolean; - - // Deprecated in 2.8.0. - lang(language?: string): string; - lang(language?: string, definition?: MomentLanguage): string; - - locale(language?: string): string; - locale(language?: string[]): string; - locale(language?: string, definition?: MomentLanguage): string; - - localeData(language?: string): MomentLanguageData; - - longDateFormat: any; - relativeTime: any; - meridiem: (hour: number, minute: number, isLowercase: boolean) => string; - calendar: any; - ordinal: (num: number) => string; - - duration(milliseconds: Number): Duration; - duration(num: Number, unitOfTime: string): Duration; - duration(input: MomentInput): Duration; - duration(object: any): Duration; - duration(): Duration; - - parseZone(date: string): Moment; - - months(): string[]; - months(index: number): string; - months(format: string): string[]; - months(format: string, index: number): string; - monthsShort(): string[]; - monthsShort(index: number): string; - monthsShort(format: string): string[]; - monthsShort(format: string, index: number): string; - - weekdays(): string[]; - weekdays(index: number): string; - weekdays(format: string): string[]; - weekdays(format: string, index: number): string; - weekdaysShort(): string[]; - weekdaysShort(index: number): string; - weekdaysShort(format: string): string[]; - weekdaysShort(format: string, index: number): string; - weekdaysMin(): string[]; - weekdaysMin(index: number): string; - weekdaysMin(format: string): string[]; - weekdaysMin(format: string, index: number): string; - - min(moments: Moment[]): Moment; - max(moments: Moment[]): Moment; - - normalizeUnits(unit: string): string; - relativeTimeThreshold(threshold: string, limit: number): void; - - /** - * Constant used to enable explicit ISO_8601 format parsing. - */ - ISO_8601(): void; - - } - -} +/// declare var moment: moment.MomentStatic; - -declare module 'moment' { - export = moment; -} From 4e99d96891661b1d8885e2748b812b7d1ea19dbb Mon Sep 17 00:00:00 2001 From: LCHProducciones Date: Wed, 27 May 2015 19:43:27 -0300 Subject: [PATCH 333/534] Bugfixes on definitions --- magicsuggest/magicsuggest.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/magicsuggest/magicsuggest.d.ts b/magicsuggest/magicsuggest.d.ts index f1ac71a2e..660a58c5c 100644 --- a/magicsuggest/magicsuggest.d.ts +++ b/magicsuggest/magicsuggest.d.ts @@ -447,8 +447,9 @@ declare module MagicSuggest { /** * Sets the current selection with the JSON items provided * @param items + * @param isSilent - (optional) */ - setSelection(items: Array): void; + setSelection(items: Array, isSilet?: boolean): void; /** * Sets a value for the combo box. Value must be an array of values with data type matching valueField one. From 3ca8ceb795a971e425d8a9873de74a509aec9d43 Mon Sep 17 00:00:00 2001 From: Vincent Siao Date: Wed, 27 May 2015 18:28:29 -0700 Subject: [PATCH 334/534] [react] Make var addons into a module This lets you do import aliasing (eg. `import TestUtils = React.addons.TestUtils;`) --- react/react-addons-global.d.ts | 172 +++++++++++++++++---------------- react/react-addons-tests.ts | 10 +- react/react-addons.d.ts | 172 +++++++++++++++++---------------- 3 files changed, 188 insertions(+), 166 deletions(-) diff --git a/react/react-addons-global.d.ts b/react/react-addons-global.d.ts index bccd3f427..cda3edcc8 100644 --- a/react/react-addons-global.d.ts +++ b/react/react-addons-global.d.ts @@ -9,33 +9,39 @@ declare module React { // React.addons // ---------------------------------------------------------------------- - export var addons: { - CSSTransitionGroup: CSSTransitionGroup; - LinkedStateMixin: LinkedStateMixin; - PureRenderMixin: PureRenderMixin; - TransitionGroup: TransitionGroup; + export module addons { + export var CSSTransitionGroup: CSSTransitionGroup; + export var TransitionGroup: TransitionGroup; - batchedUpdates(callback: (a: A, b: B) => any, a: A, b: B): void; - batchedUpdates(callback: (a: A) => any, a: A): void; - batchedUpdates(callback: () => any): void; + export var LinkedStateMixin: LinkedStateMixin; + export var PureRenderMixin: PureRenderMixin; + + export function batchedUpdates( + callback: (a: A, b: B) => any, a: A, b: B): void; + export function batchedUpdates(callback: (a: A) => any, a: A): void; + export function batchedUpdates(callback: () => any): void; // deprecated: use petehunt/react-classset or JedWatson/classnames - classSet(cx: { [key: string]: boolean }): string; - classSet(...classList: string[]): string; + export function classSet(cx: { [key: string]: boolean }): string; + export function classSet(...classList: string[]): string; - cloneWithProps

    (element: DOMElement

    , props: P): DOMElement

    ; - cloneWithProps

    (element: ClassicElement

    , props: P): ClassicElement

    ; - cloneWithProps

    (element: ReactElement

    , props: P): ReactElement

    ; + export function cloneWithProps

    ( + element: DOMElement

    , props: P): DOMElement

    ; + export function cloneWithProps

    ( + element: ClassicElement

    , props: P): ClassicElement

    ; + export function cloneWithProps

    ( + element: ReactElement

    , props: P): ReactElement

    ; - createFragment(object: { [key: string]: ReactNode }): ReactFragment; + export function createFragment( + object: { [key: string]: ReactNode }): ReactFragment; - update(value: any[], spec: UpdateArraySpec): any[]; - update(value: {}, spec: UpdateSpec): any; + export function update(value: any[], spec: UpdateArraySpec): any[]; + export function update(value: {}, spec: UpdateSpec): any; // Development tools - Perf: ReactPerf; - TestUtils: ReactTestUtils; - }; + export import Perf = ReactPerf; + export import TestUtils = ReactTestUtils; + } // // React.addons (Transitions) @@ -114,14 +120,14 @@ declare module React { totalTime: number; } - interface ReactPerf { - start(): void; - stop(): void; - printInclusive(measurements: Measurements[]): void; - printExclusive(measurements: Measurements[]): void; - printWasted(measurements: Measurements[]): void; - printDOM(measurements: Measurements[]): void; - getLastMeasurements(): Measurements[]; + module ReactPerf { + export function start(): void; + export function stop(): void; + export function printInclusive(measurements: Measurements[]): void; + export function printExclusive(measurements: Measurements[]): void; + export function printWasted(measurements: Measurements[]): void; + export function printDOM(measurements: Measurements[]): void; + export function getLastMeasurements(): Measurements[]; } // @@ -132,55 +138,59 @@ declare module React { new(): any; } - interface ReactTestUtils { - Simulate: Simulate; + module ReactTestUtils { + export import Simulate = ReactSimulate; - renderIntoDocument

    (element: ReactElement

    ): Component; - renderIntoDocument>(element: ReactElement): C; + export function renderIntoDocument

    ( + element: ReactElement

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

    ( + export function scryRenderedComponentsWithType

    ( tree: Component, type: ComponentClass

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

    ( + export function findRenderedComponentWithType

    ( tree: Component, type: ComponentClass

    ): Component; - findRenderedComponentWithType>( + export function findRenderedComponentWithType>( tree: Component, type: ComponentClass): C; - createRenderer(): ShallowRenderer; + export function createRenderer(): ShallowRenderer; } interface SyntheticEventData { @@ -222,40 +232,40 @@ declare module React { (component: Component, eventData?: SyntheticEventData): void; } - interface Simulate { - blur: EventSimulator; - change: EventSimulator; - click: EventSimulator; - cut: EventSimulator; - doubleClick: EventSimulator; - drag: EventSimulator; - dragEnd: EventSimulator; - dragEnter: EventSimulator; - dragExit: EventSimulator; - dragLeave: EventSimulator; - dragOver: EventSimulator; - dragStart: EventSimulator; - drop: EventSimulator; - focus: EventSimulator; - input: EventSimulator; - keyDown: EventSimulator; - keyPress: EventSimulator; - keyUp: EventSimulator; - mouseDown: EventSimulator; - mouseEnter: EventSimulator; - mouseLeave: EventSimulator; - mouseMove: EventSimulator; - mouseOut: EventSimulator; - mouseOver: EventSimulator; - mouseUp: EventSimulator; - paste: EventSimulator; - scroll: EventSimulator; - submit: EventSimulator; - touchCancel: EventSimulator; - touchEnd: EventSimulator; - touchMove: EventSimulator; - touchStart: EventSimulator; - wheel: EventSimulator; + module ReactSimulate { + export var blur: EventSimulator; + export var change: EventSimulator; + export var click: EventSimulator; + export var cut: EventSimulator; + export var doubleClick: EventSimulator; + export var drag: EventSimulator; + export var dragEnd: EventSimulator; + export var dragEnter: EventSimulator; + export var dragExit: EventSimulator; + export var dragLeave: EventSimulator; + export var dragOver: EventSimulator; + export var dragStart: EventSimulator; + export var drop: EventSimulator; + export var focus: EventSimulator; + export var input: EventSimulator; + export var keyDown: EventSimulator; + export var keyPress: EventSimulator; + export var keyUp: EventSimulator; + export var mouseDown: EventSimulator; + export var mouseEnter: EventSimulator; + export var mouseLeave: EventSimulator; + export var mouseMove: EventSimulator; + export var mouseOut: EventSimulator; + export var mouseOver: EventSimulator; + export var mouseUp: EventSimulator; + export var paste: EventSimulator; + export var scroll: EventSimulator; + export var submit: EventSimulator; + export var touchCancel: EventSimulator; + export var touchEnd: EventSimulator; + export var touchMove: EventSimulator; + export var touchStart: EventSimulator; + export var wheel: EventSimulator; } class ShallowRenderer { diff --git a/react/react-addons-tests.ts b/react/react-addons-tests.ts index 72d6db486..f67072c5f 100644 --- a/react/react-addons-tests.ts +++ b/react/react-addons-tests.ts @@ -1,6 +1,8 @@ /// import React = require("react/addons"); +import TestUtils = React.addons.TestUtils; + interface Props extends React.Props { hello: string; world?: string; @@ -397,12 +399,12 @@ React.createFactory(React.addons.CSSTransitionGroup)({ // -------------------------------------------------------------------------- var node: Element; -React.addons.TestUtils.Simulate.click(node); -React.addons.TestUtils.Simulate.change(node); -React.addons.TestUtils.Simulate.keyDown(node, { key: "Enter" }); +TestUtils.Simulate.click(node); +TestUtils.Simulate.change(node); +TestUtils.Simulate.keyDown(node, { key: "Enter" }); var renderer: React.ShallowRenderer = - React.addons.TestUtils.createRenderer(); + TestUtils.createRenderer(); renderer.render(React.createElement(Timer)); var output: Timer = renderer.getRenderOutput(); diff --git a/react/react-addons.d.ts b/react/react-addons.d.ts index c4e768f27..4ddf17152 100644 --- a/react/react-addons.d.ts +++ b/react/react-addons.d.ts @@ -744,33 +744,39 @@ declare module "react/addons" { // React.addons // ---------------------------------------------------------------------- - export var addons: { - CSSTransitionGroup: CSSTransitionGroup; - LinkedStateMixin: LinkedStateMixin; - PureRenderMixin: PureRenderMixin; - TransitionGroup: TransitionGroup; + export module addons { + export var CSSTransitionGroup: CSSTransitionGroup; + export var TransitionGroup: TransitionGroup; - batchedUpdates(callback: (a: A, b: B) => any, a: A, b: B): void; - batchedUpdates(callback: (a: A) => any, a: A): void; - batchedUpdates(callback: () => any): void; + export var LinkedStateMixin: LinkedStateMixin; + export var PureRenderMixin: PureRenderMixin; + + export function batchedUpdates( + callback: (a: A, b: B) => any, a: A, b: B): void; + export function batchedUpdates(callback: (a: A) => any, a: A): void; + export function batchedUpdates(callback: () => any): void; // deprecated: use petehunt/react-classset or JedWatson/classnames - classSet(cx: { [key: string]: boolean }): string; - classSet(...classList: string[]): string; + export function classSet(cx: { [key: string]: boolean }): string; + export function classSet(...classList: string[]): string; - cloneWithProps

    (element: DOMElement

    , props: P): DOMElement

    ; - cloneWithProps

    (element: ClassicElement

    , props: P): ClassicElement

    ; - cloneWithProps

    (element: ReactElement

    , props: P): ReactElement

    ; + export function cloneWithProps

    ( + element: DOMElement

    , props: P): DOMElement

    ; + export function cloneWithProps

    ( + element: ClassicElement

    , props: P): ClassicElement

    ; + export function cloneWithProps

    ( + element: ReactElement

    , props: P): ReactElement

    ; - createFragment(object: { [key: string]: ReactNode }): ReactFragment; + export function createFragment( + object: { [key: string]: ReactNode }): ReactFragment; - update(value: any[], spec: UpdateArraySpec): any[]; - update(value: {}, spec: UpdateSpec): any; + export function update(value: any[], spec: UpdateArraySpec): any[]; + export function update(value: {}, spec: UpdateSpec): any; // Development tools - Perf: ReactPerf; - TestUtils: ReactTestUtils; - }; + export import Perf = ReactPerf; + export import TestUtils = ReactTestUtils; + } // // React.addons (Transitions) @@ -849,14 +855,14 @@ declare module "react/addons" { totalTime: number; } - interface ReactPerf { - start(): void; - stop(): void; - printInclusive(measurements: Measurements[]): void; - printExclusive(measurements: Measurements[]): void; - printWasted(measurements: Measurements[]): void; - printDOM(measurements: Measurements[]): void; - getLastMeasurements(): Measurements[]; + module ReactPerf { + export function start(): void; + export function stop(): void; + export function printInclusive(measurements: Measurements[]): void; + export function printExclusive(measurements: Measurements[]): void; + export function printWasted(measurements: Measurements[]): void; + export function printDOM(measurements: Measurements[]): void; + export function getLastMeasurements(): Measurements[]; } // @@ -867,55 +873,59 @@ declare module "react/addons" { new(): any; } - interface ReactTestUtils { - Simulate: Simulate; + module ReactTestUtils { + export import Simulate = ReactSimulate; - renderIntoDocument

    (element: ReactElement

    ): Component; - renderIntoDocument>(element: ReactElement): C; + export function renderIntoDocument

    ( + element: ReactElement

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

    ( + export function scryRenderedComponentsWithType

    ( tree: Component, type: ComponentClass

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

    ( + export function findRenderedComponentWithType

    ( tree: Component, type: ComponentClass

    ): Component; - findRenderedComponentWithType>( + export function findRenderedComponentWithType>( tree: Component, type: ComponentClass): C; - createRenderer(): ShallowRenderer; + export function createRenderer(): ShallowRenderer; } interface SyntheticEventData { @@ -957,40 +967,40 @@ declare module "react/addons" { (component: Component, eventData?: SyntheticEventData): void; } - interface Simulate { - blur: EventSimulator; - change: EventSimulator; - click: EventSimulator; - cut: EventSimulator; - doubleClick: EventSimulator; - drag: EventSimulator; - dragEnd: EventSimulator; - dragEnter: EventSimulator; - dragExit: EventSimulator; - dragLeave: EventSimulator; - dragOver: EventSimulator; - dragStart: EventSimulator; - drop: EventSimulator; - focus: EventSimulator; - input: EventSimulator; - keyDown: EventSimulator; - keyPress: EventSimulator; - keyUp: EventSimulator; - mouseDown: EventSimulator; - mouseEnter: EventSimulator; - mouseLeave: EventSimulator; - mouseMove: EventSimulator; - mouseOut: EventSimulator; - mouseOver: EventSimulator; - mouseUp: EventSimulator; - paste: EventSimulator; - scroll: EventSimulator; - submit: EventSimulator; - touchCancel: EventSimulator; - touchEnd: EventSimulator; - touchMove: EventSimulator; - touchStart: EventSimulator; - wheel: EventSimulator; + module ReactSimulate { + export var blur: EventSimulator; + export var change: EventSimulator; + export var click: EventSimulator; + export var cut: EventSimulator; + export var doubleClick: EventSimulator; + export var drag: EventSimulator; + export var dragEnd: EventSimulator; + export var dragEnter: EventSimulator; + export var dragExit: EventSimulator; + export var dragLeave: EventSimulator; + export var dragOver: EventSimulator; + export var dragStart: EventSimulator; + export var drop: EventSimulator; + export var focus: EventSimulator; + export var input: EventSimulator; + export var keyDown: EventSimulator; + export var keyPress: EventSimulator; + export var keyUp: EventSimulator; + export var mouseDown: EventSimulator; + export var mouseEnter: EventSimulator; + export var mouseLeave: EventSimulator; + export var mouseMove: EventSimulator; + export var mouseOut: EventSimulator; + export var mouseOver: EventSimulator; + export var mouseUp: EventSimulator; + export var paste: EventSimulator; + export var scroll: EventSimulator; + export var submit: EventSimulator; + export var touchCancel: EventSimulator; + export var touchEnd: EventSimulator; + export var touchMove: EventSimulator; + export var touchStart: EventSimulator; + export var wheel: EventSimulator; } class ShallowRenderer { From 23b92b854f13406ad47da99ecdcc4855f7e2cc28 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Thu, 28 May 2015 15:36:30 +0200 Subject: [PATCH 335/534] Type definitions for urlsafe-base64 v1.0.0 --- urlsafe-base64/urlsafe-base64-tests.ts | 9 +++++ urlsafe-base64/urlsafe-base64.d.ts | 50 ++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 urlsafe-base64/urlsafe-base64-tests.ts create mode 100644 urlsafe-base64/urlsafe-base64.d.ts diff --git a/urlsafe-base64/urlsafe-base64-tests.ts b/urlsafe-base64/urlsafe-base64-tests.ts new file mode 100644 index 000000000..2c7d4722f --- /dev/null +++ b/urlsafe-base64/urlsafe-base64-tests.ts @@ -0,0 +1,9 @@ +/// + +import URLSafeBase64 = require('urlsafe-base64'); + +var base64 = URLSafeBase64.encode(new Buffer('3Rpbmd1aXNoZWQ', 'base64')); + +var buf = URLSafeBase64.decode('3Rpbmd1aXNoZWQ'); + +var isValid = URLSafeBase64.validate('3Rpbmd1aXNoZWQ'); diff --git a/urlsafe-base64/urlsafe-base64.d.ts b/urlsafe-base64/urlsafe-base64.d.ts new file mode 100644 index 000000000..c9c6ed0b9 --- /dev/null +++ b/urlsafe-base64/urlsafe-base64.d.ts @@ -0,0 +1,50 @@ +// Type definitions for urlsafe-base64 v1.0.0 +// Project: https://github.com/RGBboy/urlsafe-base64 +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'urlsafe-base64' { + /** + * Library version. + */ + export var version: string; + + /** + * .encode + * + * return an encoded Buffer as URL Safe Base64 + * + * Note: This function encodes to the RFC 4648 Spec where '+' is encoded + * as '-' and '/' is encoded as '_'. The padding character '=' is + * removed. + * + * @param {Buffer} buffer + * @return {String} + * @api public + */ + export function encode(buffer: Buffer): string; + + /** + * .decode + * + * return an decoded URL Safe Base64 as Buffer + * + * @param {String} + * @return {Buffer} + * @api public + */ + export function decode(base64: string): Buffer; + + /** + * .validate + * + * Validates a string if it is URL Safe Base64 encoded. + * + * @param {String} + * @return {Boolean} + * @api public + */ + export function validate(base64: string): boolean; +} From f7ceda504602664f36d5a7bf303068dc45d5e824 Mon Sep 17 00:00:00 2001 From: Vadim Macagon Date: Thu, 28 May 2015 22:37:24 +0700 Subject: [PATCH 336/534] Add PrettyStream constructor with options, and some doc comments --- bunyan-prettystream/bunyan-prettystream.d.ts | 22 +++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/bunyan-prettystream/bunyan-prettystream.d.ts b/bunyan-prettystream/bunyan-prettystream.d.ts index 9f9fa4f57..12e399ea3 100644 --- a/bunyan-prettystream/bunyan-prettystream.d.ts +++ b/bunyan-prettystream/bunyan-prettystream.d.ts @@ -1,6 +1,6 @@ -// Type definitions for bunyan-prettystream +// Type definitions for bunyan-prettystream 0.1.3 // Project: https://www.npmjs.com/package/bunyan-prettystream -// Definitions by: Jason Swearingen +// Definitions by: Jason Swearingen , Vadim Macagon // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -8,7 +8,23 @@ declare module "bunyan-prettystream" { import stream = require("stream"); class PrettyStream extends stream.Writable { - public pipe(destination: T, options?: { end?: boolean; }): T; + /** + * @param options.mode Output format, can be either `long`, `short`, or `dev`, + * defaults to `long`. + * @param options.useColor Indicates whether or not output should be colored, + * defaults to `true`. + */ + constructor(options?: { mode?: string; useColor?: boolean }); + + /** + * Pipes data from this stream to another. + * + * @param destination Stream to write data to. + * @param options.end Indicates whether `end()` should be called on the `destination` + * stream when this stream emits `end`, defaults to `true`. + * @return The `destination` stream. + */ + pipe(destination: T, options?: { end?: boolean; }): T; } export = PrettyStream; } \ No newline at end of file From 9920fd383c8a426d91eaae34ed33ab23046d8ae5 Mon Sep 17 00:00:00 2001 From: LeandroDG Date: Thu, 28 May 2015 13:25:04 -0300 Subject: [PATCH 337/534] Adding basic authentication support Added property "auth" to options class and method "request.auth" to provide basic authentication --- request/request.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/request/request.d.ts b/request/request.d.ts index eff35ada6..e94a04ad1 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -62,6 +62,7 @@ declare module 'request' { callback?: (error: any, response: any, body: any) => void; jar?: any; // CookieJar form?: any; // Object or string + auth?: AuthOptions; oauth?: OAuthOptions; aws?: AWSOptions; hawk ?: HawkOptions; @@ -107,6 +108,7 @@ declare module 'request' { multipart(multipart: RequestPart[]): Request; json(val: any): Request; aws(opts: AWSOptions, now?: boolean): Request; + auth(username: string, password: string, sendInmediately?: boolean, bearer?: string): Request; oauth(oauth: OAuthOptions): Request; jar(jar: CookieJar): Request; From 292104d982d25965eefa0411ce0e1118323b4dc7 Mon Sep 17 00:00:00 2001 From: LeandroDG Date: Thu, 28 May 2015 18:13:44 -0300 Subject: [PATCH 338/534] Changed response type to http.IncomingMessage --- request/request.d.ts | 50 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/request/request.d.ts b/request/request.d.ts index e94a04ad1..e16eafadb 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -15,40 +15,40 @@ declare module 'request' { export = RequestAPI; - function RequestAPI(uri: string, options?: RequestAPI.Options, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request; - function RequestAPI(uri: string, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request; - function RequestAPI(options: RequestAPI.Options, callback?: (error: any, response: any, body: any) => void): RequestAPI.Request; + function RequestAPI(uri: string, options?: RequestAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request; + function RequestAPI(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request; + function RequestAPI(options: RequestAPI.Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): RequestAPI.Request; module RequestAPI { export function defaults(options: Options): typeof RequestAPI; - export function request(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function request(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function request(options?: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function request(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function request(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function request(options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function get(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function get(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function get(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function get(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function get(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function get(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function post(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function post(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function post(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function post(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function post(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function post(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function put(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function put(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function put(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function put(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function put(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function put(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function head(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function head(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function head(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function head(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function head(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function head(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function patch(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function patch(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function patch(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function patch(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function patch(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function patch(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; - export function del(uri: string, options?: Options, callback?: (error: any, response: any, body: any) => void): Request; - export function del(uri: string, callback?: (error: any, response: any, body: any) => void): Request; - export function del(options: Options, callback?: (error: any, response: any, body: any) => void): Request; + export function del(uri: string, options?: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function del(uri: string, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; + export function del(options: Options, callback?: (error: any, response: http.IncomingMessage, body: any) => void): Request; export function forever(agentOptions: any, optionsArg: any): Request; export function jar(): CookieJar; @@ -59,7 +59,7 @@ declare module 'request' { export interface Options { url?: string; uri?: string; - callback?: (error: any, response: any, body: any) => void; + callback?: (error: any, response: http.IncomingMessage, body: any) => void; jar?: any; // CookieJar form?: any; // Object or string auth?: AuthOptions; From bb793321c6797c8b94da0da2517b8bb5a4af09c3 Mon Sep 17 00:00:00 2001 From: Vincent Siao Date: Thu, 28 May 2015 14:18:58 -0700 Subject: [PATCH 339/534] [React] change ShallowRenderer output to ReactElement --- react/react-addons-global.d.ts | 3 ++- react/react-addons-tests.ts | 4 ++-- react/react-addons.d.ts | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/react/react-addons-global.d.ts b/react/react-addons-global.d.ts index cda3edcc8..508ae0522 100644 --- a/react/react-addons-global.d.ts +++ b/react/react-addons-global.d.ts @@ -269,7 +269,8 @@ declare module React { } class ShallowRenderer { - getRenderOutput>(): C; + getRenderOutput>(): E; + getRenderOutput(): ReactElement; render(element: ReactElement, context?: any): void; unmount(): void; } diff --git a/react/react-addons-tests.ts b/react/react-addons-tests.ts index f67072c5f..b07b7fd58 100644 --- a/react/react-addons-tests.ts +++ b/react/react-addons-tests.ts @@ -406,5 +406,5 @@ TestUtils.Simulate.keyDown(node, { key: "Enter" }); var renderer: React.ShallowRenderer = TestUtils.createRenderer(); renderer.render(React.createElement(Timer)); -var output: Timer = renderer.getRenderOutput(); - +var output: React.ReactElement> = + renderer.getRenderOutput(); diff --git a/react/react-addons.d.ts b/react/react-addons.d.ts index 4ddf17152..40693cb80 100644 --- a/react/react-addons.d.ts +++ b/react/react-addons.d.ts @@ -1004,7 +1004,8 @@ declare module "react/addons" { } class ShallowRenderer { - getRenderOutput>(): C; + getRenderOutput>(): E; + getRenderOutput(): ReactElement; render(element: ReactElement, context?: any): void; unmount(): void; } From 4c7693c94dcb63654c8e1fe643f232300767eff7 Mon Sep 17 00:00:00 2001 From: Robert Baker Date: Thu, 28 May 2015 14:50:38 -0700 Subject: [PATCH 340/534] Fixed MDPalette definition. --- angular-material/angular-material.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 06c1ecf25..1517c295f 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -150,8 +150,8 @@ declare module angular.material { A400?: string; A700?: string; contrastDefaultColor?: string; - contrastDarkColors?: string; - contrastStrongLightColors?: string; + contrastDarkColors?: string[]; + contrastLightColors?: string[]; } interface MDThemeHues { From 1cc5ea01d8986ba5793072de8c63822947298ce2 Mon Sep 17 00:00:00 2001 From: Vincent Siao Date: Thu, 28 May 2015 15:30:16 -0700 Subject: [PATCH 341/534] [React] Update HTMLAttributes interface removes `scrollLeft`, `scrollTop` (0.12.0) adds `formAction`, `formEncType`, `formMethod`, `formTarget`, `marginHeight`, `marginWidth` (0.12.2) adds `scoped`, `high`, `low`, `optimum`, `unselectable` (0.13.2) --- react/react-addons.d.ts | 14 ++++++++++++-- react/react-global.d.ts | 14 ++++++++++++-- react/react.d.ts | 14 ++++++++++++-- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/react/react-addons.d.ts b/react/react-addons.d.ts index 40693cb80..37cde636d 100644 --- a/react/react-addons.d.ts +++ b/react/react-addons.d.ts @@ -435,10 +435,16 @@ declare module "react/addons" { draggable?: boolean; encType?: string; form?: string; + formAction?: string; + formEncType?: string; + formMethod?: string; formNoValidate?: boolean; + formTarget?: string; frameBorder?: number | string; + headers?: string; height?: number | string; hidden?: boolean; + high?: number; href?: string; hrefLang?: string; htmlFor?: string; @@ -449,7 +455,10 @@ declare module "react/addons" { lang?: string; list?: string; loop?: boolean; + low?: number; manifest?: string; + marginHeight?: number; + marginWidth?: number; max?: number | string; maxLength?: number; media?: string; @@ -461,6 +470,7 @@ declare module "react/addons" { name?: string; noValidate?: boolean; open?: boolean; + optimum?: number; pattern?: string; placeholder?: string; poster?: string; @@ -474,9 +484,8 @@ declare module "react/addons" { rowSpan?: number; sandbox?: string; scope?: string; - scrollLeft?: number; + scoped?: boolean; scrolling?: string; - scrollTop?: number; seamless?: boolean; selected?: boolean; shape?: string; @@ -506,6 +515,7 @@ declare module "react/addons" { itemProp?: string; itemScope?: boolean; itemType?: string; + unselectable?: boolean; } interface SVGAttributes extends DOMAttributes { diff --git a/react/react-global.d.ts b/react/react-global.d.ts index c3fa9fc7c..5a4893862 100644 --- a/react/react-global.d.ts +++ b/react/react-global.d.ts @@ -435,10 +435,16 @@ declare module React { draggable?: boolean; encType?: string; form?: string; + formAction?: string; + formEncType?: string; + formMethod?: string; formNoValidate?: boolean; + formTarget?: string; frameBorder?: number | string; + headers?: string; height?: number | string; hidden?: boolean; + high?: number; href?: string; hrefLang?: string; htmlFor?: string; @@ -449,7 +455,10 @@ declare module React { lang?: string; list?: string; loop?: boolean; + low?: number; manifest?: string; + marginHeight?: number; + marginWidth?: number; max?: number | string; maxLength?: number; media?: string; @@ -461,6 +470,7 @@ declare module React { name?: string; noValidate?: boolean; open?: boolean; + optimum?: number; pattern?: string; placeholder?: string; poster?: string; @@ -474,9 +484,8 @@ declare module React { rowSpan?: number; sandbox?: string; scope?: string; - scrollLeft?: number; + scoped?: boolean; scrolling?: string; - scrollTop?: number; seamless?: boolean; selected?: boolean; shape?: string; @@ -506,6 +515,7 @@ declare module React { itemProp?: string; itemScope?: boolean; itemType?: string; + unselectable?: boolean; } interface SVGAttributes extends DOMAttributes { diff --git a/react/react.d.ts b/react/react.d.ts index d92279305..0b202f20e 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -435,10 +435,16 @@ declare module "react" { draggable?: boolean; encType?: string; form?: string; + formAction?: string; + formEncType?: string; + formMethod?: string; formNoValidate?: boolean; + formTarget?: string; frameBorder?: number | string; + headers?: string; height?: number | string; hidden?: boolean; + high?: number; href?: string; hrefLang?: string; htmlFor?: string; @@ -449,7 +455,10 @@ declare module "react" { lang?: string; list?: string; loop?: boolean; + low?: number; manifest?: string; + marginHeight?: number; + marginWidth?: number; max?: number | string; maxLength?: number; media?: string; @@ -461,6 +470,7 @@ declare module "react" { name?: string; noValidate?: boolean; open?: boolean; + optimum?: number; pattern?: string; placeholder?: string; poster?: string; @@ -474,9 +484,8 @@ declare module "react" { rowSpan?: number; sandbox?: string; scope?: string; - scrollLeft?: number; + scoped?: boolean; scrolling?: string; - scrollTop?: number; seamless?: boolean; selected?: boolean; shape?: string; @@ -506,6 +515,7 @@ declare module "react" { itemProp?: string; itemScope?: boolean; itemType?: string; + unselectable?: boolean; } interface SVGAttributes extends DOMAttributes { From 7b47d0c9776b0dc18ce2b0d6f5e406692309019a Mon Sep 17 00:00:00 2001 From: Vincent Siao Date: Thu, 28 May 2015 15:33:04 -0700 Subject: [PATCH 342/534] [React] Update README (0.13.3) --- react/README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/react/README.md b/react/README.md index 0c773fd38..1f4cb7f03 100644 --- a/react/README.md +++ b/react/README.md @@ -1,10 +1,11 @@ -# React v0.13.0 Type Definitions +# React v0.13.3 Type Definitions This folder contains the following `.d.ts` files: -* `react-0.13.0.d.ts` declares the external module `"react"` -* `react-addons-0.13.0.d.ts` declares the external module `"react/addons"` -* `react-global-0.13.0.d.ts` declares the internal module `React` in the global namespace -* `react-addons-global-0.13.0.d.ts` extends the global `React` module with `addons` +* `react.d.ts` declares the external module `"react"` +* `react-addons.d.ts` declares the external module `"react/addons"` +* `react-global.d.ts` declares the internal module `React` in the global namespace +* `react-addons-global.d.ts` extends the global `React` module with `addons` -Interfaces are duplicated between these files; please take care to keep them in sync when making changes. See [#3615](https://github.com/borisyankov/DefinitelyTyped/pull/3615) for relevant discussion. +Interfaces are duplicated between these files; please take care to keep them in sync when making changes. +See [#3615](https://github.com/borisyankov/DefinitelyTyped/pull/3615) for relevant discussion. From 3afd16a3691da4a9be175374f127730fbf87dc7a Mon Sep 17 00:00:00 2001 From: Fabian Raetz Date: Fri, 29 May 2015 00:33:31 +0200 Subject: [PATCH 343/534] add test case for fulfilled --- chai-as-promised/chai-as-promised-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/chai-as-promised/chai-as-promised-tests.ts b/chai-as-promised/chai-as-promised-tests.ts index a2dcb72ed..95a433517 100644 --- a/chai-as-promised/chai-as-promised-tests.ts +++ b/chai-as-promised/chai-as-promised-tests.ts @@ -9,6 +9,7 @@ chai.use(chaiAsPromised); var promise: any; chai.expect(promise).to.eventually.equal(3); chai.expect(promise).to.become(3); +chai.expect(promise).to.be.fulfilled; chai.expect(promise).to.be.rejected; chai.expect(promise).to.be.rejectedWith(Error); chai.expect(promise).to.notify(() => console.log('done')); From 5b0830b61e0cd5ba8dfe37bca50e47af2d3d1575 Mon Sep 17 00:00:00 2001 From: Fabian Raetz Date: Fri, 29 May 2015 00:34:31 +0200 Subject: [PATCH 344/534] add fulfilled to Assertion --- chai-as-promised/chai-as-promised.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/chai-as-promised/chai-as-promised.d.ts b/chai-as-promised/chai-as-promised.d.ts index 6ff150eb4..106bbf41e 100644 --- a/chai-as-promised/chai-as-promised.d.ts +++ b/chai-as-promised/chai-as-promised.d.ts @@ -14,6 +14,7 @@ declare module Chai { interface Assertion { become(expected: any): Assertion; + fulfilled: Assertion; rejected: Assertion; rejectedWith(expected: any): Assertion; notify(fn: Function): Assertion; From 5294692073a4dc3c04ae971809d8bba93452ba6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20K=C3=B6nig?= Date: Fri, 29 May 2015 09:59:37 +0200 Subject: [PATCH 345/534] AngularJS 1.4 - `bindToController` object definition This commit supports using `bindToController` as an object (see: https://github.com/angular/angular.js/blob/master/CHANGELOG.md#features-9). --- angularjs/angular.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 719e84139..29dd32c68 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular JS 1.3+ +// Type definitions for Angular JS 1.4+ // Project: http://angularjs.org // Definitions by: Diego Vilar // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -1550,7 +1550,7 @@ declare module angular { compile?: IDirectiveCompileFn; controller?: any; controllerAs?: string; - bindToController?: boolean; + bindToController?: any; link?: IDirectiveLinkFn | IDirectivePrePost; name?: string; priority?: number; From 58d0e244a7a608835ada3382f70732b23d6f9b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20K=C3=B6nig?= Date: Fri, 29 May 2015 10:06:25 +0200 Subject: [PATCH 346/534] union type for `bindToController` --- angularjs/angular.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 29dd32c68..bdb804ff2 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -1550,7 +1550,7 @@ declare module angular { compile?: IDirectiveCompileFn; controller?: any; controllerAs?: string; - bindToController?: any; + bindToController?: boolean|Object; link?: IDirectiveLinkFn | IDirectivePrePost; name?: string; priority?: number; From 4b7a72361277c3c5daf95bc2f9e7e69b5f51a9ab Mon Sep 17 00:00:00 2001 From: Vadim Macagon Date: Fri, 29 May 2015 13:40:07 +0700 Subject: [PATCH 347/534] Add type definitions for pty.js --- pty.js/pty.js-tests.ts | 21 +++++++ pty.js/pty.js.d.ts | 133 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 pty.js/pty.js-tests.ts create mode 100644 pty.js/pty.js.d.ts diff --git a/pty.js/pty.js-tests.ts b/pty.js/pty.js-tests.ts new file mode 100644 index 000000000..cf73af384 --- /dev/null +++ b/pty.js/pty.js-tests.ts @@ -0,0 +1,21 @@ +/// + +import pty = require('pty.js'); + +var term: pty.Terminal = pty.spawn('bash', [], { + name: 'xterm-color', + cols: 80, + rows: 30, + cwd: process.env.HOME, + env: process.env +}); + +term.on('data', function(data: any) { + console.log(data); +}); + +term.write('ls\r'); +term.resize(100, 40); +term.write('ls /\r'); + +console.log(term.process); diff --git a/pty.js/pty.js.d.ts b/pty.js/pty.js.d.ts new file mode 100644 index 000000000..937dff0c0 --- /dev/null +++ b/pty.js/pty.js.d.ts @@ -0,0 +1,133 @@ +// Type definitions for pty.js 0.2.7-1 +// Project: https://github.com/chjj/pty.js +// Definitions by: Vadim Macagon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'pty.js' { + /** Options that can be used when creating a new pseudo-terminal. */ + interface TerminalOptions { + name?: string; + cols?: number; + rows?: number; + cwd?: string; + env?: any; + uid?: number; + gid?: number; + } + + import stream = require('stream'); + import net = require('net'); + + export class Terminal implements stream.Stream { + /** Read-only name of the terminal. */ + name: string; + /** Read-only number of columns in the terminal. */ + cols: number; + /** Read-only number of rows in the terminal. */ + rows: number; + /** + * Read-only identifier of the spawned process associated with the slave end of the + * pseudo-terminal. This will be null if the terminal was created via [[Terminal.open]]. + */ + pid: number; + /** Read-only file descriptor of the master end of the pseudo-terminal. */ + fd: number; + /** Read-only name of the slave end of the pseudo-terminal. */ + pty: string; + /** Read-only filename of the executable associated with the slave end of the pseudo-terminal. */ + file: string; + /** Read-only name of the process associated with the slave end of the pseudo-terminal. */ + process: string; + stdout: Terminal; + /** Note that an exception will be thrown if an attempt is made to access this property. */ + stderr: Terminal; + stdin: Terminal; + socket: net.Socket; + + /** + * Creates a new pseudo-terminal, spawns a child process, and associates it with the slave + * end of the pseudo-terminal. + */ + constructor(file?: string, args?: string[], opt?: TerminalOptions); + + resize(cols?: number, rows?: number): void; + /** + * Sends a signal to the spawned process associated with the slave end of the + * pseudo-terminal (this only works if [[pid]] is not null). + */ + kill(signal?: string): void; + redraw(): void; + + // NodeJS Socket-like interface (wrappers for this.socket) + + write(data: any): boolean; + end(data: any): void; + pause(): void; + resume(): void; + setEncoding(encoding: string): void; + /** + * Closes the master end of the pseudo-terminal, and attempts to kill the spawned process + * associated with the slave end of the pseudo-terminal (but only if [[pid]] is not null). + */ + destroy(): void; + + // NodeJS Stream interface + + pipe(destination: T, options?: { end?: boolean; }): T; + + // NodeJS EventEmitter interface + + addListener(event: string, listener: Function): NodeJS.EventEmitter; + on(event: string, listener: Function): NodeJS.EventEmitter; + once(event: string, listener: Function): NodeJS.EventEmitter; + removeListener(event: string, listener: Function): NodeJS.EventEmitter; + removeAllListeners(event?: string): NodeJS.EventEmitter; + // NOTE: this method is not actually defined in pty.js + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + } + + /** + * Creates a new pseudo-terminal, spawns a child process, and associates it with the slave + * end of the pseudo-terminal. + */ + export function createTerminal(file?: string, args?: string[], opt?: TerminalOptions): Terminal; + /** Alias for [[createTerminal]]. */ + export function fork(file?: string, args?: string[], opt?: TerminalOptions): Terminal; + /** Alias for [[createTerminal]]. */ + export function spawn(file?: string, args?: string[], opt?: TerminalOptions): Terminal; + /** + * Creates a new pseudo-terminal. + * This function is not available on Windows, use [[fork]] there instead. + */ + export function open(opt?: { cols?: number; rows?: number }): Terminal; + + // Internal stuff that probably isn't very useful but is exported by pty.js + export module native { + /** Unix-only. */ + export function fork( + file: string, args: string[], env: any, cwd: string, cols: number, rows: number, + uid?: number, gid?: number + ): { fd: number; pid: number; pty: string }; + /** Unix-only. */ + export function open( + cols: number, rows: number + ): { master: number; slave: number; pty: string }; + /** Unix-only. */ + export function process(fd: number, tty: string): string; + /** Windows-only. */ + export function open( + dataPipe: string, cols: number, rows: number, debug: boolean + ): { pid: number; pty: number; fd: number }; + /** Windows-only. */ + export function startProcess( + pid: number, file: string, cmdline: string, env: string[], cwd: string + ): void; + /** Windows-only. */ + export function kill(pid: number): void; + export function resize(fd: number, cols: number, rows: number): void; + } +} From 08f4725531229e124af715130d0ead425f999ee7 Mon Sep 17 00:00:00 2001 From: Martin McWhorter Date: Fri, 29 May 2015 11:45:53 +0100 Subject: [PATCH 348/534] Add mobile-detect type definitions --- mobile-detect/mobile-detect-tests.ts | 14 ++++++++++++++ mobile-detect/mobile-detect.d.ts | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 mobile-detect/mobile-detect-tests.ts create mode 100644 mobile-detect/mobile-detect.d.ts diff --git a/mobile-detect/mobile-detect-tests.ts b/mobile-detect/mobile-detect-tests.ts new file mode 100644 index 000000000..694d3cd89 --- /dev/null +++ b/mobile-detect/mobile-detect-tests.ts @@ -0,0 +1,14 @@ +/// + +var md: MobileDetect; + +var mobie: string = md.mobile() +var phone: string = md.phone() +var tablet: string = md.tablet() +var userAgent: string = md.userAgent() +var os: string = md.os() +var isPhone: boolean = md.is('iPhone') +var bot: boolean = md.is('bot') +var version: number = md.version('Webkit') +var versionStr: string = md.versionStr('Build') +var match: boolean = md.match('playstation|xbox') \ No newline at end of file diff --git a/mobile-detect/mobile-detect.d.ts b/mobile-detect/mobile-detect.d.ts new file mode 100644 index 000000000..e6149848d --- /dev/null +++ b/mobile-detect/mobile-detect.d.ts @@ -0,0 +1,22 @@ +// Type definitions for mobile-detect v1.2.0 +// Project: http://hgoebl.github.io/mobile-detect.js/ +// Definitions by: Martin McWhorter +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + + +declare class MobileDetect { + + contructor(userAgent: string, maxPhoneWidth?: number); + + is(key: string): boolean; + match(pattern: string|RegExp): boolean + mobile(): string; + mobileGrade(): string; + os(): string; + phone(): string; + tablet(): string; + userAgent(): string; + version(value: string): number; + versionStr(value: string): string; +} From f6ce2b2a27c5aa64432700c16b87938a3fd540f0 Mon Sep 17 00:00:00 2001 From: Martin McWhorter Date: Fri, 29 May 2015 11:48:18 +0100 Subject: [PATCH 349/534] fix vertical whitespace --- mobile-detect/mobile-detect.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/mobile-detect/mobile-detect.d.ts b/mobile-detect/mobile-detect.d.ts index e6149848d..f37793ced 100644 --- a/mobile-detect/mobile-detect.d.ts +++ b/mobile-detect/mobile-detect.d.ts @@ -3,8 +3,6 @@ // Definitions by: Martin McWhorter // Definitions: https://github.com/borisyankov/DefinitelyTyped - - declare class MobileDetect { contructor(userAgent: string, maxPhoneWidth?: number); From 9fffdcf779c2fa49e0b6b0b1e332004d5a5026c5 Mon Sep 17 00:00:00 2001 From: Martin McWhorter Date: Fri, 29 May 2015 12:16:47 +0100 Subject: [PATCH 350/534] Fix tests --- mobile-detect/mobile-detect.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile-detect/mobile-detect.d.ts b/mobile-detect/mobile-detect.d.ts index f37793ced..c24b2ea67 100644 --- a/mobile-detect/mobile-detect.d.ts +++ b/mobile-detect/mobile-detect.d.ts @@ -5,7 +5,7 @@ declare class MobileDetect { - contructor(userAgent: string, maxPhoneWidth?: number); + contructor(userAgent: string, maxPhoneWidth?: number): MobileDetect; is(key: string): boolean; match(pattern: string|RegExp): boolean From 3aee09a07cbd608a23a17c6c28ae26dc51499dc9 Mon Sep 17 00:00:00 2001 From: Martin McWhorter Date: Fri, 29 May 2015 13:10:45 +0100 Subject: [PATCH 351/534] Fix contructor --- mobile-detect/mobile-detect-tests.ts | 2 +- mobile-detect/mobile-detect.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile-detect/mobile-detect-tests.ts b/mobile-detect/mobile-detect-tests.ts index 694d3cd89..64dbddc1a 100644 --- a/mobile-detect/mobile-detect-tests.ts +++ b/mobile-detect/mobile-detect-tests.ts @@ -1,6 +1,6 @@ /// -var md: MobileDetect; +var md: MobileDetect = new MobileDetect(window.navigator.userAgent); var mobie: string = md.mobile() var phone: string = md.phone() diff --git a/mobile-detect/mobile-detect.d.ts b/mobile-detect/mobile-detect.d.ts index c24b2ea67..180fd0664 100644 --- a/mobile-detect/mobile-detect.d.ts +++ b/mobile-detect/mobile-detect.d.ts @@ -5,7 +5,7 @@ declare class MobileDetect { - contructor(userAgent: string, maxPhoneWidth?: number): MobileDetect; + constructor(userAgent: string, maxPhoneWidth?: number); is(key: string): boolean; match(pattern: string|RegExp): boolean From dfc08933163f1e36ba0bad0390bcc2a1a4636bd3 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 29 May 2015 13:24:40 +0100 Subject: [PATCH 352/534] Update angular.d.ts - JSDoc-ed $filter --- angularjs/angular.d.ts | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 92784af38..1b12c2026 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -736,17 +736,37 @@ declare module angular { eventFn(element: Node, doneFn: () => void): Function; } - /////////////////////////////////////////////////////////////////////////// - // FilterService - // see http://docs.angularjs.org/api/ng.$filter - // see http://docs.angularjs.org/api/ng.$filterProvider - /////////////////////////////////////////////////////////////////////////// + /** + * $filter - $filterProvider - service in module ng + * + * Filters are used for formatting data displayed to the user. + * + * see https://docs.angularjs.org/api/ng/service/$filter + */ interface IFilterService { + /** + * Usage: + * $filter(name); + * + * @param name Name of the filter function to retrieve + */ (name: string): Function; } + /** + * $filterProvider - $filter - provider in module ng + * + * Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To achieve this a filter definition consists of a factory function which is annotated with dependencies and is responsible for creating a filter function. + * + * see https://docs.angularjs.org/api/ng/provider/$filterProvider + */ interface IFilterProvider extends IServiceProvider { - register(name: string, filterFactory: Function): IServiceProvider; + /** + * register(name); + * + * @param name Name of the filter function, or an object map of filters where the keys are the filter names and the values are the filter factories. Note: Filter names must be valid angular Expressions identifiers, such as uppercase or orderBy. Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace your filters, then you can use capitalization (myappSubsectionFilterx) or underscores (myapp_subsection_filterx). + */ + register(name: string | {}): IServiceProvider; } /////////////////////////////////////////////////////////////////////////// From cec0beaa1c72b9a0178541a82b74af384708bf98 Mon Sep 17 00:00:00 2001 From: Adam Kalman Date: Fri, 29 May 2015 14:17:17 -0700 Subject: [PATCH 353/534] 90296 add in map values definitions add in definitions for map values when used within a chain generated via _.chain or _(). --- lodash/lodash.d.ts | 569 ++++++++++++++++++++++++--------------------- 1 file changed, 302 insertions(+), 267 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 84db97b2d..cf7ab8851 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -13,27 +13,27 @@ declare module _ { * In addition to Lo-Dash methods, wrappers also have the following Array methods: * concat, join, pop, push, reverse, shift, slice, sort, splice, and unshift * - * Chaining is supported in custom builds as long as the value method is implicitly or + * Chaining is supported in custom builds as long as the value method is implicitly or * explicitly included in the build. * * The chainable wrapper functions are: - * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, - * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, - * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, - * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, - * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, - * remove, rest, reverse, shuffle, slice, sort, sortBy, splice, tap, throttle, times, + * after, assign, bind, bindAll, bindKey, chain, chunk, compact, compose, concat, countBy, + * createCallback, curry, debounce, defaults, defer, delay, difference, filter, flatten, + * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, + * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, + * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, + * remove, rest, reverse, shuffle, slice, sort, sortBy, splice, tap, throttle, times, * toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip * * The non-chainable wrapper functions are: - * clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast, - * findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean, - * isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, - * isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin, - * noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some, + * clone, cloneDeep, contains, escape, every, find, findIndex, findKey, findLast, + * findLastIndex, findLastKey, has, identity, indexOf, isArguments, isArray, isBoolean, + * isDate, isElement, isEmpty, isEqual, isFinite, isFunction, isNaN, isNull, isNumber, + * isObject, isPlainObject, isRegExp, isString, isUndefined, join, lastIndexOf, mixin, + * noConflict, parseInt, pop, random, reduce, reduceRight, result, shift, size, some, * sortedIndex, runInContext, template, unescape, uniqueId, and value * - * The wrapper functions first and last return wrapped values when n is provided, otherwise + * The wrapper functions first and last return wrapped values when n is provided, otherwise * they return unwrapped values. * * Explicit chaining can be enabled by using the _.chain method. @@ -56,14 +56,14 @@ declare module _ { support: Support; /** - * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby + * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby * (ERB). Change the following template settings to use alternative delimiters. **/ templateSettings: TemplateSettings; } /** - * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby + * By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby * (ERB). Change the following template settings to use alternative delimiters. **/ interface TemplateSettings { @@ -108,7 +108,7 @@ declare module _ { argsObject: boolean; /** - * Detect if name or message properties of Error.prototype are enumerable by default. + * Detect if name or message properties of Error.prototype are enumerable by default. * (IE < 9, Safari < 5.1) **/ enumErrorProps: boolean; @@ -119,7 +119,7 @@ declare module _ { fastBind: boolean; /** - * Detect if functions can be decompiled by Function#toString (all but PS3 and older Opera + * Detect if functions can be decompiled by Function#toString (all but PS3 and older Opera * mobile browsers & avoided in Windows 8 apps). **/ funcDecomp: boolean; @@ -130,7 +130,7 @@ declare module _ { funcNames: boolean; /** - * Detect if arguments object indexes are non-enumerable (Firefox < 4, IE < 9, PhantomJS, + * Detect if arguments object indexes are non-enumerable (Firefox < 4, IE < 9, PhantomJS, * Safari < 5.1). **/ nonEnumArgs: boolean; @@ -138,7 +138,7 @@ declare module _ { /** * Detect if properties shadowing those on Object.prototype are non-enumerable. * - * In IE < 9 an objects own properties, shadowing non-enumerable ones, are made + * In IE < 9 an objects own properties, shadowing non-enumerable ones, are made * non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). **/ nonEnumShadows: boolean; @@ -151,9 +151,9 @@ declare module _ { /** * Detect if Array#shift and Array#splice augment array-like objects correctly. * - * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array shift() and splice() - * functions that fail to remove the last element, value[0], of array-like objects even - * though the length property is set to 0. The shift() method is buggy in IE 8 compatibility + * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array shift() and splice() + * functions that fail to remove the last element, value[0], of array-like objects even + * though the length property is set to 0. The shift() method is buggy in IE 8 compatibility * mode, while splice() is buggy regardless of mode in IE < 9 and buggy in compatibility mode * in IE 9. **/ @@ -162,7 +162,7 @@ declare module _ { /** * Detect lack of support for accessing string characters by index. * - * IE < 8 can't access characters by index and IE 8 can only access characters by index on + * IE < 8 can't access characters by index and IE 8 can only access characters by index on * string literals. **/ unindexedChars: boolean; @@ -232,8 +232,8 @@ declare module _ { //_.tap interface LoDashStatic { /** - * Invokes interceptor with the value as the first argument and then returns value. The - * purpose of this method is to "tap into" a method chain in order to perform operations on + * Invokes interceptor with the value as the first argument and then returns value. The + * purpose of this method is to "tap into" a method chain in order to perform operations on * intermediate results within the chain. * @param value The value to provide to interceptor * @param interceptor The function to invoke. @@ -254,7 +254,7 @@ declare module _ { /********* * Arrays * **********/ - + //_.chunk interface LoDashStatic { /** @@ -271,7 +271,7 @@ declare module _ { **/ chunk(array: List, size?: number): T[][]; } - + interface LoDashArrayWrapper { /** * @see _.chunk @@ -338,10 +338,10 @@ declare module _ { //_.findIndex interface LoDashStatic { /** - * This method is like _.find except that it returns the index of the first element that passes + * This method is like _.find except that it returns the index of the first element that passes * the callback check, instead of the element itself. * @param array The array to search. - * @param {(Function|Object|string)} callback The function called per iteration. If a property name or object is provided it will be + * @param {(Function|Object|string)} callback The function called per iteration. If a property name or object is provided it will be * used to create a ".pluck" or ".where" style callback, respectively. * @param thisArg The this binding of callback. * @return Returns the index of the found element, else -1. @@ -393,7 +393,7 @@ declare module _ { /** * This method is like _.findIndex except that it iterates over elements of a collection from right to left. * @param array The array to search. - * @param {(Function|Object|string)} callback The function called per iteration. If a property name or object is provided it will be + * @param {(Function|Object|string)} callback The function called per iteration. If a property name or object is provided it will be * used to create a ".pluck" or ".where" style callback, respectively. * @param thisArg The this binding of callback. * @return Returns the index of the found element, else -1. @@ -443,12 +443,12 @@ declare module _ { //_.first interface LoDashStatic { /** - * Gets the first element or first n elements of an array. If a callback is provided - * elements at the beginning of the array are returned as long as the callback returns - * truey. The callback is bound to thisArg and invoked with three arguments; (value, + * Gets the first element or first n elements of an array. If a callback is provided + * elements at the beginning of the array are returned as long as the callback returns + * truey. The callback is bound to thisArg and invoked with three arguments; (value, * index, array). * - * If a property name is provided for callback the created "_.pluck" style callback + * If a property name is provided for callback the created "_.pluck" style callback * will return the property value of the given element. * * If an object is provided for callback the created "_.where" style callback will return ] @@ -769,15 +769,15 @@ declare module _ { //_.flatten interface LoDashStatic { /** - * Flattens a nested array (the nesting can be to any depth). If isShallow is truey, the - * array will only be flattened a single level. If a callback is provided each element of - * the array is passed through the callback before flattening. The callback is bound to + * Flattens a nested array (the nesting can be to any depth). If isShallow is truey, the + * array will only be flattened a single level. If a callback is provided each element of + * the array is passed through the callback before flattening. The callback is bound to * thisArg and invoked with three arguments; (value, index, array). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array The array to flatten. * @param shallow If true then only flatten one level, optional, default = false. @@ -936,8 +936,8 @@ declare module _ { //_.indexOf interface LoDashStatic { /** - * Gets the index at which the first occurrence of value is found using strict equality - * for comparisons, i.e. ===. If the array is already sorted providing true for fromIndex + * Gets the index at which the first occurrence of value is found using strict equality + * for comparisons, i.e. ===. If the array is already sorted providing true for fromIndex * will run a faster binary search. * @param array The array to search. * @param value The value to search for. @@ -995,15 +995,15 @@ declare module _ { //_.initial interface LoDashStatic { /** - * Gets all but the last element or last n elements of an array. If a callback is provided - * elements at the end of the array are excluded from the result as long as the callback - * returns truey. The callback is bound to thisArg and invoked with three arguments; + * Gets all but the last element or last n elements of an array. If a callback is provided + * elements at the end of the array are excluded from the result as long as the callback + * returns truey. The callback is bound to thisArg and invoked with three arguments; * (value, index, array). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array The array to query. * @param n Leaves this many elements behind, optional. @@ -1086,7 +1086,7 @@ declare module _ { //_.intersection interface LoDashStatic { /** - * Creates an array of unique values present in all provided arrays using strict + * Creates an array of unique values present in all provided arrays using strict * equality for comparisons, i.e. ===. * @param arrays The arrays to inspect. * @return Returns an array of composite values. @@ -1102,14 +1102,14 @@ declare module _ { //_.last interface LoDashStatic { /** - * Gets the last element or last n elements of an array. If a callback is provided - * elements at the end of the array are returned as long as the callback returns truey. + * Gets the last element or last n elements of an array. If a callback is provided + * elements at the end of the array are returned as long as the callback returns truey. * The callback is bound to thisArg and invoked with three arguments; (value, index, array). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array The array to query. * @return Returns the last element(s) of array. @@ -1191,8 +1191,8 @@ declare module _ { //_.lastIndexOf interface LoDashStatic { /** - * Gets the index at which the last occurrence of value is found using strict equality - * for comparisons, i.e. ===. If fromIndex is negative, it is used as the offset from the + * Gets the index at which the last occurrence of value is found using strict equality + * for comparisons, i.e. ===. If fromIndex is negative, it is used as the offset from the * end of the collection. * @param array The array to search. * @param value The value to search for. @@ -1216,7 +1216,7 @@ declare module _ { //_.pull interface LoDashStatic { /** - * Removes all provided values from the given array using strict equality for comparisons, + * Removes all provided values from the given array using strict equality for comparisons, * i.e. ===. * @param array The array to modify. * @param values The values to remove. @@ -1237,8 +1237,8 @@ declare module _ { //_.range interface LoDashStatic { /** - * Creates an array of numbers (positive and/or negative) progressing from start up - * to but not including end. If start is less than stop a zero-length range is created + * Creates an array of numbers (positive and/or negative) progressing from start up + * to but not including end. If start is less than stop a zero-length range is created * unless a negative step is specified. * @param start The start of the range. * @param end The end of the range. @@ -1262,14 +1262,14 @@ declare module _ { //_.remove interface LoDashStatic { /** - * Removes all elements from an array that the callback returns truey for and returns - * an array of removed elements. The callback is bound to thisArg and invoked with three + * Removes all elements from an array that the callback returns truey for and returns + * an array of removed elements. The callback is bound to thisArg and invoked with three * arguments; (value, index, array). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array The array to modify. * @param callback The function called per iteration. @@ -1325,19 +1325,19 @@ declare module _ { //_.rest interface LoDashStatic { /** - * The opposite of _.initial this method gets all but the first element or first n elements of - * an array. If a callback function is provided elements at the beginning of the array are excluded - * from the result as long as the callback returns truey. The callback is bound to thisArg and + * The opposite of _.initial this method gets all but the first element or first n elements of + * an array. If a callback function is provided elements at the beginning of the array are excluded + * from the result as long as the callback returns truey. The callback is bound to thisArg and * invoked with three arguments; (value, index, array). * - * If a property name is provided for callback the created "_.pluck" style callback will return + * If a property name is provided for callback the created "_.pluck" style callback will return * the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return true + * + * If an object is provided for callback the created "_.where" style callback will return true * for elements that have the properties of the given object, else false. * @param array The array to query. - * @param {(Function|Object|number|string)} [callback=1] The function called per element or the number - * of elements to exclude. If a property name or object is provided it will be used to create a + * @param {(Function|Object|number|string)} [callback=1] The function called per element or the number + * of elements to exclude. If a property name or object is provided it will be used to create a * ".pluck" or ".where" style callback, respectively. * @param {*} [thisArg] The this binding of callback. * @return Returns a slice of array. @@ -1547,15 +1547,15 @@ declare module _ { //_.sortedIndex interface LoDashStatic { /** - * Uses a binary search to determine the smallest index at which a value should be inserted - * into a given sorted array in order to maintain the sort order of the array. If a callback - * is provided it will be executed for value and each element of array to compute their sort + * Uses a binary search to determine the smallest index at which a value should be inserted + * into a given sorted array in order to maintain the sort order of the array. If a callback + * is provided it will be executed for value and each element of array to compute their sort * ranking. The callback is bound to thisArg and invoked with one argument; (value). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array The sorted list. * @param value The value to determine its index within `list`. @@ -1617,7 +1617,7 @@ declare module _ { //_.union interface LoDashStatic { /** - * Creates an array of unique values, in order, of the provided arrays using strict + * Creates an array of unique values, in order, of the provided arrays using strict * equality for comparisons, i.e. ===. * @param arrays The arrays to inspect. * @return Returns an array of composite values. @@ -1633,16 +1633,16 @@ declare module _ { //_.uniq interface LoDashStatic { /** - * Creates a duplicate-value-free version of an array using strict equality for comparisons, - * i.e. ===. If the array is sorted, providing true for isSorted will use a faster algorithm. - * If a callback is provided each element of array is passed through the callback before - * uniqueness is computed. The callback is bound to thisArg and invoked with three arguments; + * Creates a duplicate-value-free version of an array using strict equality for comparisons, + * i.e. ===. If the array is sorted, providing true for isSorted will use a faster algorithm. + * If a callback is provided each element of array is passed through the callback before + * uniqueness is computed. The callback is bound to thisArg and invoked with three arguments; * (value, index, array). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param array Array to remove duplicates from. * @param isSorted True if `array` is already sorted, optiona, default = false. @@ -1969,7 +1969,7 @@ declare module _ { * @param whereValue _.where style callback **/ unique( - whereValue: W): LoDashArrayWrapper; + whereValue: W): LoDashArrayWrapper; } //_.without @@ -2023,12 +2023,12 @@ declare module _ { xor( ...others: List[]): LoDashArrayWrapper; } - + //_.zip interface LoDashStatic { /** - * Creates an array of grouped elements, the first of which contains the first - * elements of the given arrays, the second of which contains the second elements + * Creates an array of grouped elements, the first of which contains the first + * elements of the given arrays, the second of which contains the second elements * of the given arrays, and so on. * @param arrays Arrays to process. * @return A new array of grouped elements. @@ -2066,8 +2066,8 @@ declare module _ { //_.zipObject interface LoDashStatic { /** - * Creates an object composed from arrays of keys and values. Provide either a single - * two dimensional array, i.e. [[key1, value1], [key2, value2]] or two arrays, one of + * Creates an object composed from arrays of keys and values. Provide either a single + * two dimensional array, i.e. [[key1, value1], [key2, value2]] or two arrays, one of * keys and one of corresponding values. * @param keys The array of keys. * @param values The array of values. @@ -2092,10 +2092,10 @@ declare module _ { //_.at interface LoDashStatic { /** - * Creates an array of elements from the specified indexes, or keys, of the collection. + * Creates an array of elements from the specified indexes, or keys, of the collection. * Indexes may be specified as individual arguments or as arrays of indexes. * @param collection The collection to iterate over. - * @param indexes The indexes of collection to retrieve, specified as individual indexes or + * @param indexes The indexes of collection to retrieve, specified as individual indexes or * arrays of indexes. * @return A new array of elements corresponding to the provided indexes. **/ @@ -2142,7 +2142,7 @@ declare module _ { //_.contains interface LoDashStatic { /** - * Checks if a given value is present in a collection using strict equality for comparisons, + * Checks if a given value is present in a collection using strict equality for comparisons, * i.e. ===. If fromIndex is negative, it is used as the offset from the end of the collection. * @param collection The collection to iterate over. * @param target The value to check for. @@ -2218,15 +2218,15 @@ declare module _ { //_.countBy interface LoDashStatic { /** - * Creates an object composed of keys generated from the results of running each element - * of collection through the callback. The corresponding value of each key is the number - * of times the key was returned by the callback. The callback is bound to thisArg and + * Creates an object composed of keys generated from the results of running each element + * of collection through the callback. The corresponding value of each key is the number + * of times the key was returned by the callback. The callback is bound to thisArg and * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -2304,14 +2304,14 @@ declare module _ { //_.every interface LoDashStatic { /** - * Checks if the given callback returns truey value for all elements of a collection. - * The callback is bound to thisArg and invoked with three arguments; (value, index|key, + * Checks if the given callback returns truey value for all elements of a collection. + * The callback is bound to thisArg and invoked with three arguments; (value, index|key, * collection). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -2465,14 +2465,14 @@ declare module _ { //_.filter interface LoDashStatic { /** - * Iterates over elements of a collection, returning an array of all elements the - * callback returns truey for. The callback is bound to thisArg and invoked with three + * Iterates over elements of a collection, returning an array of all elements the + * callback returns truey for. The callback is bound to thisArg and invoked with three * arguments; (value, index|key, collection). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -2677,17 +2677,17 @@ declare module _ { //_.find interface LoDashStatic { /** - * Iterates over elements of a collection, returning the first element that the callback - * returns truey for. The callback is bound to thisArg and invoked with three arguments; + * Iterates over elements of a collection, returning the first element that the callback + * returns truey for. The callback is bound to thisArg and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param collection Searches for a value in this list. - * @param callback The function called per iteration. + * @param callback The function called per iteration. * @param thisArg The this binding of callback. * @return The found element, else undefined. **/ @@ -2930,10 +2930,10 @@ declare module _ { //_.findLast interface LoDashStatic { /** - * This method is like _.find except that it iterates over elements of a collection from + * This method is like _.find except that it iterates over elements of a collection from * right to left. * @param collection Searches for a value in this list. - * @param callback The function called per iteration. + * @param callback The function called per iteration. * @param thisArg The this binding of callback. * @return The found element, else undefined. **/ @@ -3032,8 +3032,8 @@ declare module _ { //_.forEach interface LoDashStatic { /** - * Iterates over elements of a collection, executing the callback for each element. - * The callback is bound to thisArg and invoked with three arguments; (value, index|key, + * Iterates over elements of a collection, executing the callback for each element. + * The callback is bound to thisArg and invoked with three arguments; (value, index|key, * collection). Callbacks may exit iteration early by explicitly returning false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -3139,7 +3139,7 @@ declare module _ { //_.forEachRight interface LoDashStatic { /** - * This method is like _.forEach except that it iterates over elements of a + * This method is like _.forEach except that it iterates over elements of a * collection from right to left. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -3232,14 +3232,14 @@ declare module _ { //_.groupBy interface LoDashStatic { /** - * Creates an object composed of keys generated from the results of running each element - * of a collection through the callback. The corresponding value of each key is an array - * of the elements responsible for generating the key. The callback is bound to thisArg + * Creates an object composed of keys generated from the results of running each element + * of a collection through the callback. The corresponding value of each key is an array + * of the elements responsible for generating the key. The callback is bound to thisArg * and invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -3361,15 +3361,15 @@ declare module _ { //_.indexBy interface LoDashStatic { /** - * Creates an object composed of keys generated from the results of running each element - * of the collection through the given callback. The corresponding value of each key is - * the last element responsible for generating the key. The callback is bound to thisArg + * Creates an object composed of keys generated from the results of running each element + * of the collection through the given callback. The corresponding value of each key is + * the last element responsible for generating the key. The callback is bound to thisArg * and invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -3425,9 +3425,9 @@ declare module _ { //_.invoke interface LoDashStatic { /** - * Invokes the method named by methodName on each element in the collection returning - * an array of the results of each invoked method. Additional arguments will be provided - * to each invoked method. If methodName is a function it will be invoked for, and this + * Invokes the method named by methodName on each element in the collection returning + * an array of the results of each invoked method. Additional arguments will be provided + * to each invoked method. If methodName is a function it will be invoked for, and this * bound to, each element in the collection. * @param collection The collection to iterate over. * @param methodName The name of the method to invoke. @@ -3482,14 +3482,14 @@ declare module _ { //_.map interface LoDashStatic { /** - * Creates an array of values by running each element in the collection through the callback. - * The callback is bound to thisArg and invoked with three arguments; (value, index|key, + * Creates an array of values by running each element in the collection through the callback. + * The callback is bound to thisArg and invoked with three arguments; (value, index|key, * collection). * - * If a property name is provided for callback the created "_.pluck" style callback will return + * If a property name is provided for callback the created "_.pluck" style callback will return * the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return true + * If an object is provided for callback the created "_.where" style callback will return true * for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -3624,15 +3624,15 @@ declare module _ { //_.max interface LoDashStatic { /** - * Retrieves the maximum value of a collection. If the collection is empty or falsey -Infinity is - * returned. If a callback is provided it will be executed for each value in the collection to - * generate the criterion by which the value is ranked. The callback is bound to thisArg and invoked + * Retrieves the maximum value of a collection. If the collection is empty or falsey -Infinity is + * returned. If a callback is provided it will be executed for each value in the collection to + * generate the criterion by which the value is ranked. The callback is bound to thisArg and invoked * with three arguments; (value, index, collection). - * - * If a property name is provided for callback the created "_.pluck" style callback will return the + * + * If a property name is provided for callback the created "_.pluck" style callback will return the * property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return true for + * If an object is provided for callback the created "_.where" style callback will return true for * elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -3735,15 +3735,15 @@ declare module _ { //_.min interface LoDashStatic { /** - * Retrieves the minimum value of a collection. If the collection is empty or falsey - * Infinity is returned. If a callback is provided it will be executed for each value - * in the collection to generate the criterion by which the value is ranked. The callback + * Retrieves the minimum value of a collection. If the collection is empty or falsey + * Infinity is returned. If a callback is provided it will be executed for each value + * in the collection to generate the criterion by which the value is ranked. The callback * is bound to thisArg and invoked with three arguments; (value, index, collection). * - * If a property name is provided for callback the created "_.pluck" style callback + * If a property name is provided for callback the created "_.pluck" style callback * will return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will + * If an object is provided for callback the created "_.where" style callback will * return true for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -3889,10 +3889,10 @@ declare module _ { //_.reduce interface LoDashStatic { /** - * Reduces a collection to a value which is the accumulated result of running each - * element in the collection through the callback, where each successive callback execution - * consumes the return value of the previous execution. If accumulator is not provided the - * first element of the collection will be used as the initial accumulator value. The callback + * Reduces a collection to a value which is the accumulated result of running each + * element in the collection through the callback, where each successive callback execution + * consumes the return value of the previous execution. If accumulator is not provided the + * first element of the collection will be used as the initial accumulator value. The callback * is bound to thisArg and invoked with four arguments; (accumulator, value, index|key, collection). * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -4148,7 +4148,7 @@ declare module _ { //_.reduceRight interface LoDashStatic { /** - * This method is like _.reduce except that it iterates over elements of a collection from + * This method is like _.reduce except that it iterates over elements of a collection from * right to left. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -4259,13 +4259,13 @@ declare module _ { //_.reject interface LoDashStatic { /** - * The opposite of _.filter this method returns the elements of a collection that + * The opposite of _.filter this method returns the elements of a collection that * the callback does not return truey for. * - * If a property name is provided for callback the created "_.pluck" style callback + * If a property name is provided for callback the created "_.pluck" style callback * will return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will + * If an object is provided for callback the created "_.where" style callback will * return true for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -4404,7 +4404,7 @@ declare module _ { //_.shuffle interface LoDashStatic { /** - * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. + * Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. * See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. * @param collection The collection to shuffle. * @return Returns a new shuffled collection. @@ -4439,7 +4439,7 @@ declare module _ { //_.size interface LoDashStatic { /** - * Gets the size of the collection by returning collection.length for arrays and array-like + * Gets the size of the collection by returning collection.length for arrays and array-like * objects or the number of own enumerable properties for objects. * @param collection The collection to inspect. * @return collection.length @@ -4469,14 +4469,14 @@ declare module _ { //_.some interface LoDashStatic { /** - * Checks if the callback returns a truey value for any element of a collection. The function - * returns as soon as it finds a passing value and does not iterate over the entire collection. + * Checks if the callback returns a truey value for any element of a collection. The function + * returns as soon as it finds a passing value and does not iterate over the entire collection. * The callback is bound to thisArg and invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for callback the created "_.pluck" style callback will return + * If a property name is provided for callback the created "_.pluck" style callback will return * the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return true for + * If an object is provided for callback the created "_.where" style callback will return true for * elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -4644,15 +4644,15 @@ declare module _ { //_.sortBy interface LoDashStatic { /** - * Creates an array of elements, sorted in ascending order by the results of running each - * element in a collection through the callback. This method performs a stable sort, that - * is, it will preserve the original sort order of equal elements. The callback is bound + * Creates an array of elements, sorted in ascending order by the results of running each + * element in a collection through the callback. This method performs a stable sort, that + * is, it will preserve the original sort order of equal elements. The callback is bound * to thisArg and invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for callback the created "_.pluck" style callback will + * If a property name is provided for callback the created "_.pluck" style callback will * return the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return + * If an object is provided for callback the created "_.where" style callback will return * true for elements that have the properties of the given object, else false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -4763,7 +4763,7 @@ declare module _ { //_.where interface LoDashStatic { /** - * Performs a deep comparison of each element in a collection to the given properties + * Performs a deep comparison of each element in a collection to the given properties * object, returning an array of all elements that have equivalent property values. * @param collection The collection to iterate over. * @param properties The object of property values to filter by. @@ -4802,7 +4802,7 @@ declare module _ { //_.after interface LoDashStatic { /** - * Creates a function that executes func, with the this binding and arguments of the + * Creates a function that executes func, with the this binding and arguments of the * created function, only after being called n times. * @param n The number of times the function must be called before func is executed. * @param func The function to restrict. @@ -4823,7 +4823,7 @@ declare module _ { //_.bind interface LoDashStatic { /** - * Creates a function that, when called, invokes func with the this binding of thisArg + * Creates a function that, when called, invokes func with the this binding of thisArg * and prepends any additional bind arguments to those provided to the bound function. * @param func The function to bind. * @param thisArg The this binding of func. @@ -4848,11 +4848,11 @@ declare module _ { //_.bindAll interface LoDashStatic { /** - * Binds methods of an object to the object itself, overwriting the existing method. Method - * names may be specified as individual arguments or as arrays of method names. If no method + * Binds methods of an object to the object itself, overwriting the existing method. Method + * names may be specified as individual arguments or as arrays of method names. If no method * names are provided all the function properties of object will be bound. * @param object The object to bind and assign the bound methods to. - * @param methodNames The object method names to bind, specified as individual method names + * @param methodNames The object method names to bind, specified as individual method names * or arrays of method names. * @return object **/ @@ -4871,9 +4871,9 @@ declare module _ { //_.bindKey interface LoDashStatic { /** - * Creates a function that, when called, invokes the method at object[key] and prepends any - * additional bindKey arguments to those provided to the bound function. This method differs - * from _.bind by allowing bound functions to reference methods that will be redefined or don't + * Creates a function that, when called, invokes the method at object[key] and prepends any + * additional bindKey arguments to those provided to the bound function. This method differs + * from _.bind by allowing bound functions to reference methods that will be redefined or don't * yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. * @param object The object the method belongs to. * @param key The key of the method. @@ -4898,9 +4898,9 @@ declare module _ { //_.compose interface LoDashStatic { /** - * Creates a function that is the composition of the provided functions, where each function - * consumes the return value of the function that follows. For example, composing the functions - * f(), g(), and h() produces f(g(h())). Each function is executed with the this binding of the + * Creates a function that is the composition of the provided functions, where each function + * consumes the return value of the function that follows. For example, composing the functions + * f(), g(), and h() produces f(g(h())). Each function is executed with the this binding of the * composed function. * @param funcs Functions to compose. * @return The new composed function. @@ -4918,9 +4918,9 @@ declare module _ { //_.createCallback interface LoDashStatic { /** - * Produces a callback bound to an optional thisArg. If func is a property name the created - * callback will return the property value for a given element. If func is an object the created - * callback will return true for elements that contain the equivalent object properties, + * Produces a callback bound to an optional thisArg. If func is a property name the created + * callback will return the property value for a given element. If func is an object the created + * callback will return true for elements that contain the equivalent object properties, * otherwise it will return false. * @param func The value to convert to a callback. * @param thisArg The this binding of the created callback. @@ -4962,9 +4962,9 @@ declare module _ { //_.curry interface LoDashStatic { /** - * Creates a function which accepts one or more arguments of func that when invoked either - * executes func returning its result, if all func arguments have been provided, or returns - * a function that accepts one or more of the remaining func arguments, and so on. The arity + * Creates a function which accepts one or more arguments of func that when invoked either + * executes func returning its result, if all func arguments have been provided, or returns + * a function that accepts one or more of the remaining func arguments, and so on. The arity * of func can be specified if func.length is not sufficient. * @param func The function to curry. * @param arity The arity of func. @@ -4985,13 +4985,13 @@ declare module _ { //_.debounce interface LoDashStatic { /** - * Creates a function that will delay the execution of func until after wait milliseconds have - * elapsed since the last time it was invoked. Provide an options object to indicate that func - * should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls + * Creates a function that will delay the execution of func until after wait milliseconds have + * elapsed since the last time it was invoked. Provide an options object to indicate that func + * should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls * to the debounced function will return the result of the last func call. * - * Note: If leading and trailing options are true func will be called on the trailing edge of - * the timeout only if the the debounced function is invoked more than once during the wait + * Note: If leading and trailing options are true func will be called on the trailing edge of + * the timeout only if the the debounced function is invoked more than once during the wait * timeout. * @param func The function to debounce. * @param wait The number of milliseconds to delay. @@ -5036,7 +5036,7 @@ declare module _ { //_.defer interface LoDashStatic { /** - * Defers executing the func function until the current call stack has cleared. Additional + * Defers executing the func function until the current call stack has cleared. Additional * arguments will be provided to func when it is invoked. * @param func The function to defer. * @param args Arguments to invoke the function with. @@ -5057,7 +5057,7 @@ declare module _ { //_.delay interface LoDashStatic { /** - * Executes the func function after wait milliseconds. Additional arguments will be provided + * Executes the func function after wait milliseconds. Additional arguments will be provided * to func when it is invoked. * @param func The function to delay. * @param wait The number of milliseconds to delay execution. @@ -5082,10 +5082,10 @@ declare module _ { //_.memoize interface LoDashStatic { /** - * Creates a function that memoizes the result of func. If resolver is provided it will be - * used to determine the cache key for storing the result based on the arguments provided to - * the memoized function. By default, the first argument provided to the memoized function is - * used as the cache key. The func is executed with the this binding of the memoized function. + * Creates a function that memoizes the result of func. If resolver is provided it will be + * used to determine the cache key for storing the result based on the arguments provided to + * the memoized function. By default, the first argument provided to the memoized function is + * used as the cache key. The func is executed with the this binding of the memoized function. * The result cache is exposed as the cache property on the memoized function. * @param func Computationally expensive function that will now memoized results. * @param resolver Hash function for storing the result of `fn`. @@ -5099,8 +5099,8 @@ declare module _ { //_.once interface LoDashStatic { /** - * Creates a function that is restricted to execute func once. Repeat calls to the function - * will return the value of the first call. The func is executed with the this binding of the + * Creates a function that is restricted to execute func once. Repeat calls to the function + * will return the value of the first call. The func is executed with the this binding of the * created function. * @param func Function to only execute once. * @return The new restricted function. @@ -5111,8 +5111,8 @@ declare module _ { //_.partial interface LoDashStatic { /** - * Creates a function that, when called, invokes func with any additional partial arguments - * prepended to those provided to the new function. This method is similar to _.bind except + * Creates a function that, when called, invokes func with any additional partial arguments + * prepended to those provided to the new function. This method is similar to _.bind except * it does not alter the this binding. * @param func The function to partially apply arguments to. * @param args Arguments to be partially applied. @@ -5126,7 +5126,7 @@ declare module _ { //_.partialRight interface LoDashStatic { /** - * This method is like _.partial except that partial arguments are appended to those provided + * This method is like _.partial except that partial arguments are appended to those provided * to the new function. * @param func The function to partially apply arguments to. * @param args Arguments to be partially applied. @@ -5140,12 +5140,12 @@ declare module _ { //_.throttle interface LoDashStatic { /** - * Creates a function that, when executed, will only call the func function at most once per - * every wait milliseconds. Provide an options object to indicate that func should be invoked - * on the leading and/or trailing edge of the wait timeout. Subsequent calls to the throttled + * Creates a function that, when executed, will only call the func function at most once per + * every wait milliseconds. Provide an options object to indicate that func should be invoked + * on the leading and/or trailing edge of the wait timeout. Subsequent calls to the throttled * function will return the result of the last func call. * - * Note: If leading and trailing options are true func will be called on the trailing edge of + * Note: If leading and trailing options are true func will be called on the trailing edge of * the timeout only if the the throttled function is invoked more than once during the wait timeout. * @param func The function to throttle. * @param wait The number of milliseconds to throttle executions to. @@ -5176,8 +5176,8 @@ declare module _ { //_.wrap interface LoDashStatic { /** - * Creates a function that provides value to the wrapper function as its first argument. - * Additional arguments provided to the function are appended to those provided to the + * Creates a function that provides value to the wrapper function as its first argument. + * Additional arguments provided to the function are appended to those provided to the * wrapper function. The wrapper is executed with the this binding of the created function. * @param value The value to wrap. * @param wrapper The wrapper function. @@ -5195,9 +5195,9 @@ declare module _ { //_.assign interface LoDashStatic { /** - * Assigns own enumerable properties of source object(s) to the destination object. Subsequent - * sources will overwrite property assignments of previous sources. If a callback is provided - * it will be executed to produce the assigned values. The callback is bound to thisArg and + * Assigns own enumerable properties of source object(s) to the destination object. Subsequent + * sources will overwrite property assignments of previous sources. If a callback is provided + * it will be executed to produce the assigned values. The callback is bound to thisArg and * invoked with two arguments; (objectValue, sourceValue). * @param object The destination object. * @param s1-8 The source object(s) @@ -5387,9 +5387,9 @@ declare module _ { //_.clone interface LoDashStatic { /** - * Creates a clone of value. If deep is true nested objects will also be cloned, otherwise - * they will be assigned by reference. If a callback is provided it will be executed to produce - * the cloned values. If the callback returns undefined cloning will be handled by the method + * Creates a clone of value. If deep is true nested objects will also be cloned, otherwise + * they will be assigned by reference. If a callback is provided it will be executed to produce + * the cloned values. If the callback returns undefined cloning will be handled by the method * instead. The callback is bound to thisArg and invoked with one argument; (value). * @param value The value to clone. * @param deep Specify a deep clone. @@ -5407,13 +5407,13 @@ declare module _ { //_.cloneDeep interface LoDashStatic { /** - * Creates a deep clone of value. If a callback is provided it will be executed to produce the - * cloned values. If the callback returns undefined cloning will be handled by the method instead. + * Creates a deep clone of value. If a callback is provided it will be executed to produce the + * cloned values. If the callback returns undefined cloning will be handled by the method instead. * The callback is bound to thisArg and invoked with one argument; (value). * - * Note: This method is loosely based on the structured clone algorithm. Functions and DOM nodes - * are not cloned. The enumerable properties of arguments objects and objects created by constructors - * other than Object are cloned to plain Object objects. + * Note: This method is loosely based on the structured clone algorithm. Functions and DOM nodes + * are not cloned. The enumerable properties of arguments objects and objects created by constructors + * other than Object are cloned to plain Object objects. * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. * @param value The value to clone. * @param callback The function to customize cloning values. @@ -5429,8 +5429,8 @@ declare module _ { //_.defaults interface LoDashStatic { /** - * Assigns own enumerable properties of source object(s) to the destination object for all - * destination properties that resolve to undefined. Once a property is set, additional defaults + * Assigns own enumerable properties of source object(s) to the destination object for all + * destination properties that resolve to undefined. Once a property is set, additional defaults * of the same property will be ignored. * @param object The destination object. * @param sources The source objects. @@ -5451,7 +5451,7 @@ declare module _ { //_.findKey interface LoDashStatic { /** - * This method is like _.findIndex except that it returns the key of the first element that + * This method is like _.findIndex except that it returns the key of the first element that * passes the callback check, instead of the element itself. * @param object The object to search. * @param callback The function called per iteration. @@ -5514,8 +5514,8 @@ declare module _ { //_.forIn interface LoDashStatic { /** - * Iterates over own and inherited enumerable properties of an object, executing the callback for - * each property. The callback is bound to thisArg and invoked with three arguments; (value, key, + * Iterates over own and inherited enumerable properties of an object, executing the callback for + * each property. The callback is bound to thisArg and invoked with three arguments; (value, key, * object). Callbacks may exit iteration early by explicitly returning false. * @param object The object to iterate over. * @param callback The function called per iteration. @@ -5548,7 +5548,7 @@ declare module _ { //_.forInRight interface LoDashStatic { /** - * This method is like _.forIn except that it iterates over elements of a collection in the + * This method is like _.forIn except that it iterates over elements of a collection in the * opposite order. * @param object The object to iterate over. * @param callback The function called per iteration. @@ -5581,8 +5581,8 @@ declare module _ { //_.forOwn interface LoDashStatic { /** - * Iterates over own enumerable properties of an object, executing the callback for each - * property. The callback is bound to thisArg and invoked with three arguments; (value, key, + * Iterates over own enumerable properties of an object, executing the callback for each + * property. The callback is bound to thisArg and invoked with three arguments; (value, key, * object). Callbacks may exit iteration early by explicitly returning false. * @param object The object to iterate over. * @param callback The function called per iteration. @@ -5615,7 +5615,7 @@ declare module _ { //_.forOwnRight interface LoDashStatic { /** - * This method is like _.forOwn except that it iterates over elements of a collection in the + * This method is like _.forOwn except that it iterates over elements of a collection in the * opposite order. * @param object The object to iterate over. * @param callback The function called per iteration. @@ -5647,7 +5647,7 @@ declare module _ { //_.functions interface LoDashStatic { /** - * Creates a sorted array of property names of all enumerable properties, own and inherited, of + * Creates a sorted array of property names of all enumerable properties, own and inherited, of * object that have function values. * @param object The object to inspect. * @return An array of property names that have function values. @@ -5675,7 +5675,7 @@ declare module _ { //_.has interface LoDashStatic { /** - * Checks if the specified object property exists and is a direct property, instead of an + * Checks if the specified object property exists and is a direct property, instead of an * inherited property. * @param object The object to check. * @param property The property to check for. @@ -5747,14 +5747,14 @@ declare module _ { //_.isEmpty interface LoDashStatic { /** - * Checks if value is empty. Arrays, strings, or arguments objects with a length of 0 and objects + * Checks if value is empty. Arrays, strings, or arguments objects with a length of 0 and objects * with no own enumerable properties are considered "empty". * @param value The value to inspect. * @return True if the value is empty, else false. **/ isEmpty(value?: any[]|Dictionary|string|any): boolean; } - + //_.isError interface LoDashStatic { /** @@ -5770,9 +5770,9 @@ declare module _ { //_.isEqual interface LoDashStatic { /** - * Performs a deep comparison between two values to determine if they are equivalent to each - * other. If a callback is provided it will be executed to compare values. If the callback - * returns undefined comparisons will be handled by the method instead. The callback is bound to + * Performs a deep comparison between two values to determine if they are equivalent to each + * other. If a callback is provided it will be executed to compare values. If the callback + * returns undefined comparisons will be handled by the method instead. The callback is bound to * thisArg and invoked with two arguments; (a, b). * @param a The value to compare. * @param b The other value to compare. @@ -5792,7 +5792,7 @@ declare module _ { /** * Checks if value is, or can be coerced to, a finite number. * - * Note: This is not the same as native isFinite which will return true for booleans and empty + * Note: This is not the same as native isFinite which will return true for booleans and empty * strings. See http://es5.github.io/#x15.1.2.5. * @param value The value to check. * @return True if the value is finite, else false. @@ -5815,7 +5815,7 @@ declare module _ { /** * Checks if value is NaN. * - * Note: This is not the same as native isNaN which will return true for undefined and other + * Note: This is not the same as native isNaN which will return true for undefined and other * non-numeric values. See http://es5.github.io/#x15.1.2.4. * @param value The value to check. * @return True if the value is NaN, else false. @@ -5848,7 +5848,7 @@ declare module _ { //_.isObject interface LoDashStatic { /** - * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, + * Checks if value is the language type of Object. (e.g. arrays, functions, objects, regexes, * new Number(0), and new String('')) * @param value The value to check. * @return True if the value is an object, else false. @@ -5917,19 +5917,22 @@ declare module _ { interface LoDashStatic { /** * Creates an object with the same keys as object and values generated by running each own - * enumerable property of object through the callback. The callback is bound to thisArg and - * invoked with three arguments; (value, key, object). + * enumerable property of object through iteratee. The iteratee function is bound to thisArg + * and invoked with three arguments: (value, key, object). * - * If a property name is provided for callback the created "_.pluck" style callback will return + * If a property name is provided iteratee the created "_.property" style callback returns * the property value of the given element. * - * If an object is provided for callback the created "_.where" style callback will return true + * If a value is also provided for thisArg the creted "_.matchesProperty" style callback returns + * true for elements that have a matching property value, else false;. + * + * If an object is provided for iteratee the created "_.matches" style callback returns true * for elements that have the properties of the given object, else false. * - * @param object The object to iterate over. - * @param callback The function called per iteration. - * @param thisArg `this` object in `iterator`, optional. - * @return Returns a new object with values of the results of each callback execution. + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration. + * @param {Object} [thisArg] The `this` binding of `iteratee`. + * @return {Object} Returns the new mapped object. */ mapValues(obj: Dictionary, callback: ObjectIterator, thisArg?: any): Dictionary; mapValues(obj: Dictionary, where: Dictionary): Dictionary; @@ -5937,14 +5940,46 @@ declare module _ { mapValues(obj: T, callback: ObjectIterator, thisArg?: any): T; } + interface LoDashObjectWrapper { + /** + * @see _.mapValues + * TValue is the type of the property values of T. + * TResult is the type output by the ObjectIterator function + */ + mapValues(callback: ObjectIterator, thisArg?: any): LoDashObjectWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the property specified by pluck. + * T should be a Dictionary> + */ + mapValues(pluck: string): LoDashObjectWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the property specified by pluck. + * TResult has to extend Dictionary<> for this to return true. + * TResultValueType is the type of the properties on TResult. + * T should be a Dictionary> + */ + mapValues>(pluck: string, where: TResult): LoDashArrayWrapper>; + + /** + * @see _.mapValues + * TResult is the type of the properties of each object in the values of T + * T should be a Dictionary> + */ + mapValues(where: Dictionary): LoDashArrayWrapper; + } + //_.merge interface LoDashStatic { /** - * Recursively merges own enumerable properties of the source object(s), that don't resolve - * to undefined into the destination object. Subsequent sources will overwrite property - * assignments of previous sources. If a callback is provided it will be executed to produce - * the merged values of the destination and source properties. If the callback returns undefined - * merging will be handled by the method instead. The callback is bound to thisArg and invoked + * Recursively merges own enumerable properties of the source object(s), that don't resolve + * to undefined into the destination object. Subsequent sources will overwrite property + * assignments of previous sources. If a callback is provided it will be executed to produce + * the merged values of the destination and source properties. If the callback returns undefined + * merging will be handled by the method instead. The callback is bound to thisArg and invoked * with two arguments; (objectValue, sourceValue). * @param object The destination object. * @param s1-8 The source object(s) @@ -5995,10 +6030,10 @@ declare module _ { //_.omit interface LoDashStatic { /** - * Creates a shallow clone of object excluding the specified properties. Property names may be - * specified as individual arguments or as arrays of property names. If a callback is provided - * it will be executed for each property of object omitting the properties the callback returns - * truey for. The callback is bound to thisArg and invoked with three arguments; (value, key, + * Creates a shallow clone of object excluding the specified properties. Property names may be + * specified as individual arguments or as arrays of property names. If a callback is provided + * it will be executed for each property of object omitting the properties the callback returns + * truey for. The callback is bound to thisArg and invoked with three arguments; (value, key, * object). * @param object The source object. * @param keys The properties to omit. @@ -6048,7 +6083,7 @@ declare module _ { //_.pairs interface LoDashStatic { /** - * Creates a two dimensional array of an object's key-value pairs, + * Creates a two dimensional array of an object's key-value pairs, * i.e. [[key1, value1], [key2, value2]]. * @param object The object to inspect. * @return Aew array of key-value pairs. @@ -6066,10 +6101,10 @@ declare module _ { //_.picks interface LoDashStatic { /** - * Creates a shallow clone of object composed of the specified properties. Property names may be - * specified as individual arguments or as arrays of property names. If a callback is provided - * it will be executed for each property of object picking the properties the callback returns - * truey for. The callback is bound to thisArg and invoked with three arguments; (value, key, + * Creates a shallow clone of object composed of the specified properties. Property names may be + * specified as individual arguments or as arrays of property names. If a callback is provided + * it will be executed for each property of object picking the properties the callback returns + * truey for. The callback is bound to thisArg and invoked with three arguments; (value, key, * object). * @param object Object to strip unwanted key/value pairs. * @param keys Property names to pick @@ -6098,10 +6133,10 @@ declare module _ { //_.transform interface LoDashStatic { /** - * An alternative to _.reduce this method transforms object to a new accumulator object which is - * the result of running each of its elements through a callback, with each callback execution - * potentially mutating the accumulator object. The callback is bound to thisArg and invoked with - * four arguments; (accumulator, value, key, object). Callbacks may exit iteration early by + * An alternative to _.reduce this method transforms object to a new accumulator object which is + * the result of running each of its elements through a callback, with each callback execution + * potentially mutating the accumulator object. The callback is bound to thisArg and invoked with + * four arguments; (accumulator, value, key, object). Callbacks may exit iteration early by * explicitly returning false. * @param collection The collection to iterate over. * @param callback The function called per iteration. @@ -6198,10 +6233,10 @@ declare module _ { //_.parseInt interface LoDashStatic { /** - * Converts the given value into an integer of the specified radix. If radix is undefined or 0 a + * Converts the given value into an integer of the specified radix. If radix is undefined or 0 a * radix of 10 is used unless the value is a hexadecimal, in which case a radix of 16 is used. * - * Note: This method avoids differences in native ES3 and ES5 parseInt implementations. See + * Note: This method avoids differences in native ES3 and ES5 parseInt implementations. See * http://es5.github.io/#E. * @param value The value to parse. * @param radix The radix used to interpret the value to parse. @@ -6265,8 +6300,8 @@ declare module _ { //_.random interface LoDashStatic { /** - * Produces a random number between min and max (inclusive). If only one argument is provided a - * number between 0 and the given number will be returned. If floating is truey or either min or + * Produces a random number between min and max (inclusive). If only one argument is provided a + * number between 0 and the given number will be returned. If floating is truey or either min or * max are floats a floating-point number will be returned instead of an integer. * @param max The maximum possible value. * @param floating Specify returning a floating-point number. @@ -6285,8 +6320,8 @@ declare module _ { //_.result interface LoDashStatic { /** - * Resolves the value of property on object. If property is a function it will be invoked with - * the this binding of object and its result returned, else the property value is returned. If + * Resolves the value of property on object. If property is a function it will be invoked with + * the this binding of object and its result returned, else the property value is returned. If * object is falsey then undefined is returned. * @param object The object to inspect. * @param property The property to get the value of. @@ -6308,10 +6343,10 @@ declare module _ { //_.template interface LoDashStatic { /** - * A micro-templating method that handles arbitrary delimiters, preserves whitespace, and + * A micro-templating method that handles arbitrary delimiters, preserves whitespace, and * correctly escapes quotes within interpolated code. * - * Note: In the development build, _.template utilizes sourceURLs for easier debugging. See + * Note: In the development build, _.template utilizes sourceURLs for easier debugging. See * http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl * * For more information on precompiling templates see: @@ -6352,7 +6387,7 @@ declare module _ { //_.times interface LoDashStatic { /** - * Executes the callback n times, returning an array of the results of each callback execution. + * Executes the callback n times, returning an array of the results of each callback execution. * The callback is bound to thisArg and invoked with one argument; (index). * @param n The number of times to execute the callback. * @param callback The function called per iteration. @@ -6367,7 +6402,7 @@ declare module _ { //_.unescape interface LoDashStatic { /** - * The inverse of _.escape this method converts the HTML entities &, <, >, ", and + * The inverse of _.escape this method converts the HTML entities &, <, >, ", and * ' in string to their corresponding characters. * @param string The string to unescape. * @return The unescaped string. @@ -6385,7 +6420,7 @@ declare module _ { **/ uniqueId(prefix?: string): string; } - + //_.noop interface LoDashStatic { /** @@ -6411,7 +6446,7 @@ declare module _ { */ create(prototype: Object, properties?: Object): Object; } - + interface ListIterator { (value: T, index: number, collection: T[]): TResult; } From fa52db59121913b35e9641a0f73ccc3ffba58840 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Fri, 29 May 2015 17:42:46 -0400 Subject: [PATCH 354/534] Allow optional fs-extra#mkdirs options object --- fs-extra/fs-extra-tests.ts | 4 ++++ fs-extra/fs-extra.d.ts | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/fs-extra/fs-extra-tests.ts b/fs-extra/fs-extra-tests.ts index 939821b6d..0919ef1b0 100644 --- a/fs-extra/fs-extra-tests.ts +++ b/fs-extra/fs-extra-tests.ts @@ -58,9 +58,13 @@ fs.createFile(file, errorCallback); fs.createFileSync(file); fs.mkdirs(dir, errorCallback); +fs.mkdirs(dir, {}, errorCallback); fs.mkdirsSync(dir); +fs.mkdirsSync(dir, {}); fs.mkdirp(dir, errorCallback); +fs.mkdirp(dir, {}, errorCallback); fs.mkdirpSync(dir); +fs.mkdirpSync(dir, {}); fs.outputFile(file, data, errorCallback); fs.outputFileSync(file, data); diff --git a/fs-extra/fs-extra.d.ts b/fs-extra/fs-extra.d.ts index 5b1ecf0b9..852956a71 100644 --- a/fs-extra/fs-extra.d.ts +++ b/fs-extra/fs-extra.d.ts @@ -52,8 +52,10 @@ declare module "fs-extra" { export function mkdirs(dir: string, callback?: (err: Error) => void): void; export function mkdirp(dir: string, callback?: (err: Error) => void): void; - export function mkdirsSync(dir: string): void; - export function mkdirpSync(dir: string): void; + export function mkdirs(dir: string, options?: MkdirOptions, callback?: (err: Error) => void): void; + export function mkdirp(dir: string, options?: MkdirOptions, callback?: (err: Error) => void): void; + export function mkdirsSync(dir: string, options?: MkdirOptions): void; + export function mkdirpSync(dir: string, options?: MkdirOptions): void; export function outputFile(file: string, data: any, callback?: (err: Error) => void): void; export function outputFileSync(file: string, data: any): void; @@ -171,6 +173,11 @@ declare module "fs-extra" { flag?: string; } + export interface MkdirOptions { + fs?: any; + mode?: number; + } + export interface ReadStreamOptions { flags?: string; encoding?: string; From 18fdbd98c7343f8c9fb54199adb40f60ace91484 Mon Sep 17 00:00:00 2001 From: Adam Kalman Date: Fri, 29 May 2015 14:52:58 -0700 Subject: [PATCH 355/534] 90296 add and fix tests add in a test for the new code, and make all the tests pass. --- lodash/lodash-tests.ts | 2 ++ lodash/lodash.d.ts | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 6a48e20c1..a265eda3b 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -143,6 +143,8 @@ result = _('test').value(); result = _([1, 2, 3]).value(); result = <_.Dictionary>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).value(); +result = <_.Dictionary>_({ a: 1, b: 2}).mapValues(function(num: number) { return num * 2; }).value(); + // /************* // * Arrays * // *************/ diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index d06a993f9..81fd2c661 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -6121,12 +6121,10 @@ declare module _ { /** * @see _.mapValues - * TResult is the type of the property specified by pluck. - * TResult has to extend Dictionary<> for this to return true. - * TResultValueType is the type of the properties on TResult. - * T should be a Dictionary> + * TResult is the type of the properties on the object specified by pluck. + * T should be a Dictionary>> */ - mapValues>(pluck: string, where: TResult): LoDashArrayWrapper>; + mapValues(pluck: string, where: Dictionary): LoDashArrayWrapper>; /** * @see _.mapValues From 4f11e3facf42c7691ae89a55fd35bb10b8ecfc0f Mon Sep 17 00:00:00 2001 From: Arvitaly Date: Sat, 30 May 2015 23:49:38 +0300 Subject: [PATCH 356/534] Fixed ur to url for RequestResource in phantomjs --- phantomjs/phantomjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phantomjs/phantomjs.d.ts b/phantomjs/phantomjs.d.ts index 3682024b6..0bb6af7b8 100644 --- a/phantomjs/phantomjs.d.ts +++ b/phantomjs/phantomjs.d.ts @@ -173,7 +173,7 @@ interface ResourceResponse { interface ResourceRequest { id: number; method: string; - ur: string; + url: string; time: Date; headers: { [name: string]: string; }; } From 33c089e9c0a19a94f50aaf4e2fe64fccdb4fce36 Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Sun, 31 May 2015 11:05:24 +1000 Subject: [PATCH 357/534] Update toastr.d.ts --- toastr/toastr.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toastr/toastr.d.ts b/toastr/toastr.d.ts index 2fcdc3840..321177ec2 100644 --- a/toastr/toastr.d.ts +++ b/toastr/toastr.d.ts @@ -197,3 +197,6 @@ interface Toastr { } declare var toastr: Toastr; +declare module "toastr" { + export = toastr; +} From e6057412964979bebb5ca85665b2b39a37b0ccdb Mon Sep 17 00:00:00 2001 From: "Bogdan I. Bursuc" Date: Sun, 31 May 2015 10:30:59 +0300 Subject: [PATCH 358/534] ICurrent route can sometimes have a 5108route param --- angularjs/angular-route.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 4ddf87cab..3ac22c096 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -108,6 +108,8 @@ declare module angular.route { // see http://docs.angularjs.org/api/ng.$route#current interface ICurrentRoute extends IRoute { + $$route?: IRoute; + locals: { $scope: IScope; $template: string; From c32e1df7c5ed02a36a7e911db68440d3daf1e649 Mon Sep 17 00:00:00 2001 From: "Bogdan I. Bursuc" Date: Sun, 31 May 2015 10:32:28 +0300 Subject: [PATCH 359/534] IActionDescriptor can have a url override also --- angularjs/angular-resource.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 057cc1b56..ec8430cb8 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -45,6 +45,7 @@ declare module angular.resource { // Just a reference to facilitate describing new actions interface IActionDescriptor { + url?: string; method: string; isArray?: boolean; params?: any; From 3e6f6339a537c569cb99bc54746d189545345485 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Abuzyarov" Date: Sun, 31 May 2015 13:48:30 +0300 Subject: [PATCH 360/534] Add Decorator definition to IModule --- angularjs/angular-tests.ts | 3 +++ angularjs/angular.d.ts | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index 628b6d1d2..7511f3627 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -201,6 +201,9 @@ mod.constant(My.Namespace); mod.value('name', 23); mod.value('name', "23"); mod.value(My.Namespace); +mod.decorator('name', function($scope:ng.IScope){ }); +mod.decorator('name', ['$scope', function($scope: ng.IScope){ }]); + class TestProvider implements ng.IServiceProvider { constructor(private $scope: ng.IScope) { diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 457a1df35..621f0b3e5 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -384,6 +384,14 @@ declare module angular { value(name: string, value: any): IModule; value(object: Object): IModule; + /** + * Register a service decorator with the $injector. A service decorator intercepts the creation of a service, allowing it to override or modify the behaviour of the service. The object returned by the decorator may be the original service, or a new service object which replaces or wraps and delegates to the original service. + * @param name The name of the service to decorate + * @param decorator This function will be invoked when the service needs to be instantiated and should return the decorated service instance. The function is called using the injector.invoke method and is therefore fully injectable. Local injection arguments: $delegate - The original service instance, which can be monkey patched, configured, decorated or delegated to. + */ + decorator(name:string, decoratorConstructor: Function): IModule; + decorator(name:string, inlineAnnotatedConstructor: any[]): IModule; + // Properties name: string; requires: string[]; From 47ccfe38b576bc6602ac4286f9a5f7bbe46879fc Mon Sep 17 00:00:00 2001 From: Viktor Sidochenko Date: Sun, 31 May 2015 19:37:57 +0500 Subject: [PATCH 361/534] Add chrome.browser type --- chrome/chrome.d.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 23eb24bef..19d5c4d0b 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -43,6 +43,37 @@ declare module chrome.alarms { var onAlarm: AlarmEvent; } +/** + * Use the chrome.browser API to interact with the Chrome browser associated with + * the current application and Chrome profile. + */ +declare module chrome.browser { + interface Options { + /** + * The URL to navigate to when the new tab is initially opened. + */ + url:string; + } + + /** + * Opens a new tab in a browser window associated with the current application + * and Chrome profile. If no browser window for the Chrome profile is opened, + * a new one is opened prior to creating the new tab. + * @param options Configures how the tab should be opened. + * @param callback Called when the tab was successfully + * created, or failed to be created. If failed, runtime.lastError will be set. + */ + export function openTab (options: Options, callback: () => void): void; + + /** + * Opens a new tab in a browser window associated with the current application + * and Chrome profile. If no browser window for the Chrome profile is opened, + * a new one is opened prior to creating the new tab. Since Chrome 42 only. + * @param options Configures how the tab should be opened. + */ + export function openTab (options: Options): void; +} + //////////////////// // Bookmarks //////////////////// From beac5c03fee9705314cdf6162a19d8edc7288849 Mon Sep 17 00:00:00 2001 From: FalloutPL Date: Mon, 1 Jun 2015 01:58:49 +0200 Subject: [PATCH 362/534] Missing id for Client interface It`s exposed in: https://github.com/Automattic/socket.io/blob/master/lib/client.js#L28 --- socket.io/socket.io.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index ac5381f09..3f3c042fe 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -91,5 +91,6 @@ declare module SocketIO { interface Client { conn: any; request: any; + id: string; } } From 83ea26f60b059a307c09cb0b827499a246e1fab2 Mon Sep 17 00:00:00 2001 From: satoru kimura Date: Mon, 1 Jun 2015 12:39:06 +0900 Subject: [PATCH 363/534] Updated a test code for dat-gui. --- dat-gui/dat-gui-tests.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dat-gui/dat-gui-tests.ts b/dat-gui/dat-gui-tests.ts index cd71e2471..19b34dd43 100644 --- a/dat-gui/dat-gui-tests.ts +++ b/dat-gui/dat-gui-tests.ts @@ -157,3 +157,19 @@ var FizzyText = function () { update(); } +// ------------ 11. Object Literal Tests +() => { + var obj = {a:1,b:1}; + var gui = new dat.GUI(); + var controller = gui.add(obj, 'maxSize', 0, 10); + + controller.onChange(function (value) { + // Fires on every change, drag, keypress, etc. + }); + + controller.onFinishChange(function (value) { + // Fires when a controller loses focus. + alert("The new value is " + value); + }); +} + From d9b2f58d6864a8a7e1792a54307a2d5c6dbec9ab Mon Sep 17 00:00:00 2001 From: "Bogdan I. Bursuc" Date: Mon, 1 Jun 2015 09:27:43 +0300 Subject: [PATCH 364/534] IResourceServiceProvider --- angularjs/angular-resource.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index ec8430cb8..7f02a533e 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -21,6 +21,7 @@ declare module angular.resource { stripTrailingSlashes?: boolean; } + /////////////////////////////////////////////////////////////////////////// // ResourceService // see http://docs.angularjs.org/api/ngResource.$resource @@ -144,6 +145,13 @@ declare module angular.resource { ($resource: angular.resource.IResourceService): IResourceClass; >($resource: angular.resource.IResourceService): U; } + + // IResourceServiceProvider used to configure global settings + interface IResourceServiceProvider extends ng.IServiceProvider { + + defaults: IResourceOptions; + } + } /** extensions to base ng based on using angular-resource */ From 480df8744d1c300751cf7225789da0f45cee3497 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Mon, 1 Jun 2015 16:33:43 +0900 Subject: [PATCH 365/534] add `imagemagick-native`s type definition file --- .../imagemagick-native-tests.ts | 128 ++++++++++++++++++ imagemagick-native/imagemagick-native.d.ts | 96 +++++++++++++ 2 files changed, 224 insertions(+) create mode 100644 imagemagick-native/imagemagick-native-tests.ts create mode 100644 imagemagick-native/imagemagick-native.d.ts diff --git a/imagemagick-native/imagemagick-native-tests.ts b/imagemagick-native/imagemagick-native-tests.ts new file mode 100644 index 000000000..a1e42c6a9 --- /dev/null +++ b/imagemagick-native/imagemagick-native-tests.ts @@ -0,0 +1,128 @@ +/// +/// + +import imagemagick = require('imagemagick-native'); +import fs = require('fs'); + + +// Examples + +// * Convert formats +// Convert from one format to another with quality control: +fs.writeFileSync('after.png', imagemagick.convert({ + srcData: fs.readFileSync('before.jpg'), + format: 'PNG', + quality: 100 // (best) to 1 (worst) +})); + +// * Blur +// Blur image: +fs.writeFileSync('after.jpg', imagemagick.convert({ + srcData: fs.readFileSync('before.jpg'), + blur: 5 +})); + +// * Resize +// Resized images by specifying width and height. There are three resizing styles: +// - aspectfill: Default. The resulting image will be exactly the specified size, and may be cropped. +// - aspectfit: Scales the image so that it will not have to be cropped. +// - fill: Squishes or stretches the image so that it fills exactly the specified size. +fs.writeFileSync('after_resize.jpg', imagemagick.convert({ + srcData: fs.readFileSync('before_resize.jpg'), + width: 100, + height: 100, + resizeStyle: 'aspectfill', // is the default, or 'aspectfit' or 'fill' + gravity: 'Center' // optional: position crop area when using 'aspectfill' +})); + +// * Rotate, flip, and mirror +// Rotate and flip images, and combine the two to mirror: +fs.writeFileSync('after_rotateflip.jpg', imagemagick.convert({ + srcData: fs.readFileSync('before_rotateflip.jpg'), + rotate: 180, + flip: true +})); + + +// API Reference + +// * convert(options, [callback]) +// Convert a buffer provided as options.srcData and return a Buffer. +var options = { + srcData: fs.readFileSync('source.jpg'), + srcFormat: 'jpeg', + quality: 90, + trim: true, + trimFuzz: 0.25, + width: 100, + height: 100, + density: 96, + resizeStyle: 'aspectfill', + gravity: 'NorthWest', + format: 'png', + filter: 'Lnaczos', + blur: 3, + strip: true, + rotate: 30, + flip: true, + debug: true, + ignoreWarnings: false +}; + +imagemagick.convert(options, (err: any, buffer: Buffer) => { + // check err, use buffer +}); +fs.createReadStream('input.png') + .pipe(imagemagick.streams.convert(options)) + .pipe(fs.createWriteStream('output.png')); + + +// * identify(options, [callback]) +// Identify a buffer provided as srcData and return an object. +imagemagick.identify({ + srcData: fs.readFileSync('target.jpg'), + debug: true, + ignoreWarnings: false +}, (err: any, result: imagemagick.IIdentifyResult) => { + // check err, use result +}); + +// * quantizeColors(options) +// Quantize the image to a specified amount of colors from a buffer provided as srcData and return an array. +var colors = imagemagick.quantizeColors({ + srcData: fs.readFileSync('target.jpg'), + colors: 3, + debug: true, + ignoreWarnings: false +}); + +// * composite(options, [callback]) +// Composite a buffer provided as options.compositeData on a buffer provided as options.srcData with gravity specified by options.gravity and return a Buffer +imagemagick.composite({ + srcData: fs.readFileSync('target.jpg'), + compositeData: fs.readFileSync('composite.jpg'), + gravity: 'NorthWestGravity', + debug: true, + ignoreWarnings: false +}, (err: any, buffer: Buffer) => { + // check err, use buffer +}); + +// * getConstPixels(options) +// Get pixels of provided rectangular region. +var pixels = imagemagick.getConstPixels({ + srcData: fs.readFileSync('target.jpg'), + x: 0, + y: 0, + columns: 1, + rows: 1 +}); + +// * quantumDepth +// Return ImageMagick's QuantumDepth, which is defined in compile time. +var depth: number = imagemagick.quantumDepth(); + +// * version +// Return ImageMagick's version as string. +var version: string = imagemagick.version(); + diff --git a/imagemagick-native/imagemagick-native.d.ts b/imagemagick-native/imagemagick-native.d.ts new file mode 100644 index 000000000..c69cd6d8d --- /dev/null +++ b/imagemagick-native/imagemagick-native.d.ts @@ -0,0 +1,96 @@ +// Type definitions for imagemagick-native 1.7.0 +// Project: https://www.npmjs.org/package/imagemagick-native +// Definitions by: Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "imagemagick-native" { + + import stream = require('stream'); + export module streams { + export function convert(options: IConvertOptions): stream.Transform; + } + + function convert(options: IConvertOptions): Buffer; + function convert(options: IConvertOptions, callback: (err: any, result: Buffer) => void): void; + function identify(options: IIdentifyOptions): IIdentifyResult; + function identify(options: IIdentifyOptions, callback: (err: any, result: IIdentifyResult) => void): void; + function quantizeColors(options: IQuantizeColorsOptions): IQuantizeColorsItem[]; + function composite(options: ICompositeOptions): Buffer; + function composite(options: ICompositeOptions, callback: (err: any, result: Buffer) => void): void; + function getConstPixels(options: IConstPixelsOptions): IConstPixelsItem[]; + function quantumDepth(): number; + function version(): string; + + export interface IConvertOptions { + srcData: Buffer; + srcFormat?: string; + quality?: number; + trim?: boolean; + trimFuzz?: number; + width?: number; + height?: number; + density?: number; + resizeStyle?: string; + gravity?: string; + format?: string; + filter?: string; + blur?: number; + strip?: boolean; + rotate?: number; + flip?: boolean; + debug?: boolean; + ignoreWarnings?: boolean; + } + export interface IIdentifyOptions { + srcData: Buffer; + debug?: boolean; + ignoreWarnings?: boolean; + } + export interface IIdentifyResult { + format: string; + width: number; + height: number; + depth: number; + density : { + width : number; + height : number; + }; + exif: { + orientation: number; // 0 if none exists or e.g. 3 (portrait iPad pictures) + }; + } + export interface IQuantizeColorsOptions { + srcData: Buffer; + colors: number; + debug?: boolean; + ignoreWarnings?: boolean; + } + export interface IQuantizeColorsItem { + r: number; + g: number; + b: number; + hex: string; + } + export interface ICompositeOptions { + srcData: Buffer; + compositeData: Buffer; + gravity?: string; + debug?: boolean; + ignoreWarnings?: boolean; + } + export interface IConstPixelsOptions { + srcData: Buffer; + x: number; + y: number; + columns: number; + rows: number; + } + export interface IConstPixelsItem { + red: number; + green: number; + blue: number; + opacity: number; + } + +} + From a5db8a65cad22c7b4c9025aa56d93aa0f14eb5fb Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Mon, 1 Jun 2015 16:40:50 +0900 Subject: [PATCH 366/534] add reference to `node.d.ts` --- imagemagick-native/imagemagick-native.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/imagemagick-native/imagemagick-native.d.ts b/imagemagick-native/imagemagick-native.d.ts index c69cd6d8d..e848fa32a 100644 --- a/imagemagick-native/imagemagick-native.d.ts +++ b/imagemagick-native/imagemagick-native.d.ts @@ -3,6 +3,8 @@ // Definitions by: Hiroki Horiuchi // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module "imagemagick-native" { import stream = require('stream'); From eb24f0b44e302d0a40e0b9eeac89b16346001e37 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Mon, 1 Jun 2015 17:33:27 +0900 Subject: [PATCH 367/534] fix `convert` options on stream version --- .../imagemagick-native-tests.ts | 6 +++++- imagemagick-native/imagemagick-native.d.ts | 21 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/imagemagick-native/imagemagick-native-tests.ts b/imagemagick-native/imagemagick-native-tests.ts index a1e42c6a9..efefba8ee 100644 --- a/imagemagick-native/imagemagick-native-tests.ts +++ b/imagemagick-native/imagemagick-native-tests.ts @@ -73,7 +73,11 @@ imagemagick.convert(options, (err: any, buffer: Buffer) => { // check err, use buffer }); fs.createReadStream('input.png') - .pipe(imagemagick.streams.convert(options)) + .pipe(imagemagick.streams.convert({ + quality: 75, + width: 160, + height: 160 + })) .pipe(fs.createWriteStream('output.png')); diff --git a/imagemagick-native/imagemagick-native.d.ts b/imagemagick-native/imagemagick-native.d.ts index e848fa32a..fbf213f68 100644 --- a/imagemagick-native/imagemagick-native.d.ts +++ b/imagemagick-native/imagemagick-native.d.ts @@ -9,7 +9,7 @@ declare module "imagemagick-native" { import stream = require('stream'); export module streams { - export function convert(options: IConvertOptions): stream.Transform; + export function convert(options: IStreamConvertOptions): stream.Transform; } function convert(options: IConvertOptions): Buffer; @@ -23,6 +23,25 @@ declare module "imagemagick-native" { function quantumDepth(): number; function version(): string; + export interface IStreamConvertOptions { + srcFormat?: string; + quality?: number; + trim?: boolean; + trimFuzz?: number; + width?: number; + height?: number; + density?: number; + resizeStyle?: string; + gravity?: string; + format?: string; + filter?: string; + blur?: number; + strip?: boolean; + rotate?: number; + flip?: boolean; + debug?: boolean; + ignoreWarnings?: boolean; + } export interface IConvertOptions { srcData: Buffer; srcFormat?: string; From adab66e6a9f99b9f55c33dd0e4a96fd065dafe0e Mon Sep 17 00:00:00 2001 From: "Bogdan I. Bursuc" Date: Mon, 1 Jun 2015 17:08:15 +0300 Subject: [PATCH 368/534] Remove incorrect ICurrentRoute api --- angularjs/angular-route.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 3ac22c096..4ddf87cab 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -108,8 +108,6 @@ declare module angular.route { // see http://docs.angularjs.org/api/ng.$route#current interface ICurrentRoute extends IRoute { - $$route?: IRoute; - locals: { $scope: IScope; $template: string; From e6360b8507bb68489c17e0a4eeee79276b955612 Mon Sep 17 00:00:00 2001 From: "Bogdan I. Bursuc" Date: Mon, 1 Jun 2015 17:08:46 +0300 Subject: [PATCH 369/534] Add IResourceServiceProvider interface --- angularjs/angular-resource-tests.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/angularjs/angular-resource-tests.ts b/angularjs/angular-resource-tests.ts index 148d40901..189eec3c5 100644 --- a/angularjs/angular-resource-tests.ts +++ b/angularjs/angular-resource-tests.ts @@ -135,4 +135,11 @@ mod = mod.factory('factory name', resourceServiceFactoryFunction); /////////////////////////////////////// // IResource -/////////////////////////////////////// \ No newline at end of file +/////////////////////////////////////// + + +/////////////////////////////////////// +// IResourceServiceProvider +/////////////////////////////////////// +var resourceServiceProvider: angular.resource.IResourceServiceProvider; +resourceServiceProvider.defaults.stripTrailingSlashes = false; From 64d5b5286f6c15426ce4d4e0e535b85ddfc33629 Mon Sep 17 00:00:00 2001 From: "Bogdan I. Bursuc" Date: Mon, 1 Jun 2015 17:14:39 +0300 Subject: [PATCH 370/534] AngularJS: IActionDescriptor test new url parameter --- angularjs/angular-resource-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angularjs/angular-resource-tests.ts b/angularjs/angular-resource-tests.ts index 189eec3c5..f7f248ea8 100644 --- a/angularjs/angular-resource-tests.ts +++ b/angularjs/angular-resource-tests.ts @@ -8,6 +8,7 @@ interface IMyResourceClass extends angular.resource.IResourceClass /////////////////////////////////////// var actionDescriptor: angular.resource.IActionDescriptor; +actionDescriptor.url = '/api/test-url/' actionDescriptor.headers = { header: 'value' }; actionDescriptor.isArray = true; actionDescriptor.method = 'method action'; From 0af334e2c9e088838c33ee3b09172c986fe8d54a Mon Sep 17 00:00:00 2001 From: "Bogdan I. Bursuc" Date: Mon, 1 Jun 2015 17:28:16 +0300 Subject: [PATCH 371/534] ICurrentRoute.locals will also contain any resolved values --- angularjs/angular-route.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 4ddf87cab..662b2c11d 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -109,6 +109,7 @@ declare module angular.route { // see http://docs.angularjs.org/api/ng.$route#current interface ICurrentRoute extends IRoute { locals: { + [index: string]: any; $scope: IScope; $template: string; }; From a6e165ec11d827fe22550c9af868b29e67b9e5b7 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Mon, 1 Jun 2015 11:53:49 -0400 Subject: [PATCH 372/534] Add _.mapObject --- underscore/underscore-tests.ts | 4 ++++ underscore/underscore.d.ts | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/underscore/underscore-tests.ts b/underscore/underscore-tests.ts index 60c1708d0..d530a4334 100644 --- a/underscore/underscore-tests.ts +++ b/underscore/underscore-tests.ts @@ -182,6 +182,10 @@ _.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'name'); _.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'name', 'age'); _.omit({ name: 'moe', age: 50, userid: 'moe1' }, ['name', 'age']); +_.mapObject({ a: 1, b: 2 }, val => val * 2) === _.mapObject({ a: 2, b: 4 }, _.identity); +_.mapObject({ a: 1, b: 2 }, (val, key, o) => o[key] * 2) === _.mapObject({ a: 2, b: 4}, _.identity); +_.mapObject({ x: "string 1", y: "string 2" }, 'length') === _.mapObject({ x: "string 1", y: "string 2"}, _.property('length')); + var iceCream = { flavor: "chocolate" }; _.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" }); diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 03088bffd..653d3ea07 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1170,6 +1170,31 @@ interface UnderscoreStatic { * @return List of all the values on `object`. **/ values(object: any): any[]; + + /** + * Like map, but for objects. Transform the value of each property in turn. + * @param object The object to transform + * @param iteratee The function that transforms property values + * @param context The optional context (value of `this`) to bind to + * @return a new _.Dictionary of property values + */ + mapObject(object: _.Dictionary, iteratee: (val: T, key: string, object: _.Dictionary) => U, context?: any): _.Dictionary; + + /** + * Like map, but for objects. Transform the value of each property in turn. + * @param object The object to transform + * @param iteratee The function that tranforms property values + * @param context The optional context (value of `this`) to bind to + */ + mapObject(object: any, iteratee: (val: any, key: string, object: any) => T, context?: any): _.Dictionary; + + /** + * Like map, but for objects. Retrieves a property from each entry in the object, as if by _.property + * @param object The object to transform + * @param iteratee The property name to retrieve + * @param context The optional context (value of `this`) to bind to + */ + mapObject(object: any, iteratee: string, context?: any): _.Dictionary; /** * Convert an object into a list of [key, value] pairs. From b0371ddc3fdb94af90655e55f5f26d0bd3c3c039 Mon Sep 17 00:00:00 2001 From: Robert Baker Date: Mon, 1 Jun 2015 14:41:33 -0700 Subject: [PATCH 373/534] Changed the MDPalette definition to use a union. --- angular-material/angular-material.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 1517c295f..1383b0beb 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -150,8 +150,8 @@ declare module angular.material { A400?: string; A700?: string; contrastDefaultColor?: string; - contrastDarkColors?: string[]; - contrastLightColors?: string[]; + contrastDarkColors?: string|string[]; + contrastLightColors?: string|string[]; } interface MDThemeHues { From 499811255bde78f457a50f1595746b90ca17131b Mon Sep 17 00:00:00 2001 From: Luzian Zagadinow Date: Tue, 2 Jun 2015 01:34:08 -0400 Subject: [PATCH 374/534] initial commit --- node-calendar/.gitignore | 4 + node-calendar/node-calendar-tests.ts | 126 +++++++++++++ node-calendar/node-calendar.d.ts | 271 +++++++++++++++++++++++++++ node-calendar/package.json | 14 ++ 4 files changed, 415 insertions(+) create mode 100644 node-calendar/.gitignore create mode 100644 node-calendar/node-calendar-tests.ts create mode 100755 node-calendar/node-calendar.d.ts create mode 100755 node-calendar/package.json diff --git a/node-calendar/.gitignore b/node-calendar/.gitignore new file mode 100644 index 000000000..76136c9e9 --- /dev/null +++ b/node-calendar/.gitignore @@ -0,0 +1,4 @@ +*.js +tsconfig.json +node_modules +.settings \ No newline at end of file diff --git a/node-calendar/node-calendar-tests.ts b/node-calendar/node-calendar-tests.ts new file mode 100644 index 000000000..5a4a40a46 --- /dev/null +++ b/node-calendar/node-calendar-tests.ts @@ -0,0 +1,126 @@ +/// +/// + +import node_calendar = require('node-calendar'); + +var cal = new node_calendar.Calendar(node_calendar.SUNDAY); + +assert(cal.getfirstweekday() == node_calendar.SUNDAY); + +cal.setfirstweekday(node_calendar.MONDAY); + +assert(cal.getfirstweekday() == node_calendar.MONDAY); + +assert(node_calendar.MONDAY == 0); +assert(node_calendar.TUESDAY == 1); +assert(node_calendar.WEDNESDAY == 2); +assert(node_calendar.THURSDAY == 3); +assert(node_calendar.FRIDAY == 4); +assert(node_calendar.SATURDAY == 5); +assert(node_calendar.SUNDAY == 6); + +assert(node_calendar.day_name[node_calendar.MONDAY] == 'Monday'); +assert(node_calendar.day_name[node_calendar.TUESDAY] == 'Tuesday'); +assert(node_calendar.day_name[node_calendar.WEDNESDAY] == 'Wednesday'); +assert(node_calendar.day_name[node_calendar.THURSDAY] == 'Thursday'); +assert(node_calendar.day_name[node_calendar.FRIDAY] == 'Friday'); +assert(node_calendar.day_name[node_calendar.SATURDAY] == 'Saturday'); +assert(node_calendar.day_name[node_calendar.SUNDAY] == 'Sunday'); + +assert(node_calendar.day_abbr[node_calendar.MONDAY] == 'Mon'); +assert(node_calendar.day_abbr[node_calendar.TUESDAY] == 'Tue'); +assert(node_calendar.day_abbr[node_calendar.WEDNESDAY] == 'Wed'); +assert(node_calendar.day_abbr[node_calendar.THURSDAY] == 'Thu'); +assert(node_calendar.day_abbr[node_calendar.FRIDAY] == 'Fri'); +assert(node_calendar.day_abbr[node_calendar.SATURDAY] == 'Sat'); +assert(node_calendar.day_abbr[node_calendar.SUNDAY] == 'Sun'); + +assert(node_calendar.JANUARY == 1); +assert(node_calendar.FEBRUARY == 2); +assert(node_calendar.MARCH == 3); +assert(node_calendar.APRIL == 4); +assert(node_calendar.MAY == 5); +assert(node_calendar.JUNE == 6); +assert(node_calendar.JULY == 7); +assert(node_calendar.AUGUST == 8); +assert(node_calendar.SEPTEMBER == 9); +assert(node_calendar.OCTOBER == 10); +assert(node_calendar.NOVEMBER == 11); +assert(node_calendar.DECEMBER == 12); + +assert(node_calendar.month_name[0] == ''); +assert(node_calendar.month_name[node_calendar.JANUARY] == 'January'); +assert(node_calendar.month_name[node_calendar.FEBRUARY] == 'February'); +assert(node_calendar.month_name[node_calendar.MARCH] == 'March'); +assert(node_calendar.month_name[node_calendar.APRIL] == 'April'); +assert(node_calendar.month_name[node_calendar.MAY] == 'May'); +assert(node_calendar.month_name[node_calendar.JUNE] == 'June'); +assert(node_calendar.month_name[node_calendar.JULY] == 'July'); +assert(node_calendar.month_name[node_calendar.AUGUST] == 'August'); +assert(node_calendar.month_name[node_calendar.SEPTEMBER] == 'September'); +assert(node_calendar.month_name[node_calendar.OCTOBER] == 'October'); +assert(node_calendar.month_name[node_calendar.NOVEMBER] == 'November'); +assert(node_calendar.month_name[node_calendar.DECEMBER] == 'December'); + +assert(node_calendar.month_abbr[0] == ''); +assert(node_calendar.month_abbr[node_calendar.JANUARY] == 'Jan'); +assert(node_calendar.month_abbr[node_calendar.FEBRUARY] == 'Feb'); +assert(node_calendar.month_abbr[node_calendar.MARCH] == 'Mar'); +assert(node_calendar.month_abbr[node_calendar.APRIL] == 'Apr'); +assert(node_calendar.month_abbr[node_calendar.MAY] == 'May'); +assert(node_calendar.month_abbr[node_calendar.JUNE] == 'Jun'); +assert(node_calendar.month_abbr[node_calendar.JULY] == 'Jul'); +assert(node_calendar.month_abbr[node_calendar.AUGUST] == 'Aug'); +assert(node_calendar.month_abbr[node_calendar.SEPTEMBER] == 'Sep'); +assert(node_calendar.month_abbr[node_calendar.OCTOBER] == 'Oct'); +assert(node_calendar.month_abbr[node_calendar.NOVEMBER] == 'Nov'); +assert(node_calendar.month_abbr[node_calendar.DECEMBER] == 'Dec'); + +cal.itermonthdates(2015, node_calendar.JANUARY).forEach(assertIsDate); +cal.itermonthdays(2014, node_calendar.FEBRUARY).forEach(assertIsNumber); +cal.itermonthdays2(2013, node_calendar.MARCH).forEach(assertDayOfWeekMonth); +cal.iterweekdays().forEach(assertIsNumber); + +assertMonthGrid(cal.monthdatescalendar(2012, node_calendar.APRIL), assertIsDate); +assertMonthGrid(cal.monthdays2calendar(2011, node_calendar.MAY), assertDayOfWeekMonth); +assertMonthGrid(cal.monthdayscalendar(2010, node_calendar.JUNE), assertIsNumber); + +assertYearGrid(cal.yeardatescalendar(2009, 3), assertIsDate); +assertYearGrid(cal.yeardays2calendar(2008, 2), assertDayOfWeekMonth); +assertYearGrid(cal.yeardayscalendar(2007, 4), assertIsNumber); + +function assertIsDate(d: Date) { + assert(d instanceof Date, 'Should be a date'); +} + +function assertIsNumber(n: number) { + assert(typeof n == 'number', 'Should be a number'); +} + +function assertDayOfWeekMonth(d: IDayOfWeekMonth) { + assert(d instanceof Array, 'Day of weak/month should be an array'); + assert(d.length == 2, 'Day of weak/month array should contain 2 items'); + assert(typeof d[0] == 'number', 'Day of month should be a number'); + assert(typeof d[1] == 'number', 'Day of week should be a number'); +} + +function assertWeekRow(row: IWeekRow, assertItemType: (item: T) => void) { + row.forEach(assertItemType); +} + +function assertMonthGrid(grid: IMonthGrid, assertItemType: (item: T) => void) { + grid.forEach(wr => assertWeekRow(wr, assertItemType)); +} + +function assertMonthRow(row: IMonthRow, assertItemType: (item: T) => void) { + row.forEach(mg => assertMonthGrid(mg, assertItemType)); +} + +function assertYearGrid(grid: IYearGrid, assertItemType: (item: T) => void) { + grid.forEach(mr => assertMonthRow(mr, assertItemType)); +} + +function assert(condition: boolean, msg?: string): void { + if (condition) return; + throw new Error(msg); +} \ No newline at end of file diff --git a/node-calendar/node-calendar.d.ts b/node-calendar/node-calendar.d.ts new file mode 100755 index 000000000..a1c3f0500 --- /dev/null +++ b/node-calendar/node-calendar.d.ts @@ -0,0 +1,271 @@ +// Type definitions for node-calendar v0.1.4 +// Project: https://www.npmjs.com/package/node-calendar +// Definitions by: Luzian Zagadinow +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface IDayOfWeekMonth extends Array { + /** dayOfMonth */ + 0: number; + + /** dayOfWeek */ + 1: number; +} + +interface IWeekRow extends Array { + [dayIndex: number]: T; +} + +interface IMonthGrid extends Array> { + [weekRowIndex: number]: IWeekRow; +} + +interface IMonthRow extends Array> { + [monthColumnIndex: number]: IMonthGrid; +} + +interface IYearGrid extends Array>{ + [monthRowIndex: number]: IMonthRow; +} + +/** + * This module allows you to output calendars like the Unix cal program, and provides + * additional useful functions related to the calendar. By default, these calendars + * have Monday as the first day of the week, and Sunday as the last (the European + * convention). Use setfirstweekday() to set the first day of the week to Sunday + * (6) or to any other weekday. Parameters that specify dates are given as integers. + */ +declare module 'node-calendar' { + /** 0 */ + export var MONDAY: number; + + /** 1 */ + export var TUESDAY: number; + + /** 2 */ + export var WEDNESDAY: number; + + /** 3 */ + export var THURSDAY: number; + + /** 4 */ + export var FRIDAY: number; + + /** 5 */ + export var SATURDAY: number; + + /** 6 */ + export var SUNDAY: number; + + + /** 1 */ + export var JANUARY: number; + + /** 2 */ + export var FEBRUARY: number; + + /** 3 */ + export var MARCH: number; + + /** 4 */ + export var APRIL:number; + + /** 5 */ + export var MAY: number; + + /** 6 */ + export var JUNE: number; + + /** 7 */ + export var JULY: number; + + /** 8 */ + export var AUGUST: number; + + /** 9 */ + export var SEPTEMBER: number; + + /** 10 */ + export var OCTOBER: number; + + /** 11 */ + export var NOVEMBER: number; + + /** 12 */ + export var DECEMBER: number; + + /** + * [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ] + */ + export var day_name: string[]; + + /** + * [ 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' ] + */ + export var day_abbr: string[]; + + /** + * [ '', 'January', 'February', 'March', + * 'April', 'May', 'June', 'July', 'August', + * 'September', 'October', 'November', 'December' ] + */ + export var month_name: string[]; + + /** + * [ '', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', + * 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ] + */ + export var month_abbr: string[]; + + /** + * Base calendar class. This class doesn't do any formatting. It simply provides + * data to subclasses. + */ + export class Calendar { + /** + * @param {number} firstweekday + * Numerical day of the week the calendar weeks should start. + * (0=MON, 1=TUE, ...) Default: 0 + */ + constructor(firstweekday?: number); + + /** + * Numerical day of the week the calendar weeks should start. + * (0=MON, 1=TUE, ...) + * + * @method getfirstweekday + */ + getfirstweekday(): number; + + /** + * Numerical day of the week the calendar weeks should start. + * (0=MON, 1=TUE, ...) + * + * @param {number} firstweekday + * Numerical day of the week the calendar weeks should start. + * (0=MON, 1=TUE, ...) Default: 0 + */ + setfirstweekday(firstweekday: number): void; + + /** + * One week of weekday numbers starting with the configured first one. + */ + iterweekdays(): number[]; + + /** + * Dates for one month. The array will contain Date values and will always + * iterate through complete weeks, so it will yield dates outside the + * specified month. + * + * @param {number} year + * Year for which the calendar should be generated. + * @param {number} month + * Month for which the calendar should be generated. + */ + itermonthdates(year: number, month: number): Date[]; + + /** + * Like itermonthdates(), but will yield day numbers. For days outside + * the specified month the day number is 0. + * + * @param {number} year + * Year for which the calendar should be generated. + * @param {number} month + * Month for which the calendar should be generated. + */ + itermonthdays(year: number, month: number): number[]; + + /** + * Like itermonthdates(), but will yield [day number, weekday number] + * arrays. For days outside the specified month the day number is 0. + * + * @param {number} year + * Year for which the calendar should be generated. + * @param {number} month + * Month for which the calendar should be generated. + */ + itermonthdays2(year: number, month: number): IDayOfWeekMonth[]; + + /** + * A matrix (array of array) representing a month's calendar. + * Each row represents a week; week entries are Date values. + * + * @param {number} year + * Year for which the calendar should be generated. + * @param {number} month + * Month for which the calendar should be generated. + */ + monthdatescalendar(year: number, month: number): IMonthGrid; + + /** + * A matrix representing a month's calendar. Each row represents a week; + * days outside this month are zero. + * + * @param {number} year + * Year for which the calendar should be generated. + * @param {number} month + * Month for which the calendar should be generated. + */ + monthdayscalendar(year: number, month: number): IMonthGrid; + + /** + * Return a matrix representing a month's calendar. Each row represents + * a week; week entries are [day number, weekday number] arrays. Day numbers + * outside this month are zero. + * + * @param {number} year + * Year for which the calendar should be generated. + * @param {number} month + * Month for which the calendar should be generated. + */ + monthdays2calendar(year: number, month: number): IMonthGrid; + + /** + * The specified year ready for formatting. The return value is an array + * of month rows. Each month row contains up to width months. Each month + * contains between 4 and 6 weeks and each week contains 1-7 days. Days + * are Date objects. + * + * @param {number} year + * Year for which the calendar should be generated. + * @param {number} width + * The number of months to include in each row. Default: 3 + */ + yeardatescalendar(year: number, width?: number): IYearGrid; + + /** + * the specified year ready for formatting (similar to yeardatescalendar()). + * Entries in the week arrays are day numbers. Day numbers outside this + * month are zero. + * + * @param {number} year + * Year for which the calendar should be generated. + * @param {number} width + * The number of months to include in each row. Default: 3 + */ + yeardayscalendar(year: number, width?: number): IYearGrid; + + /** + * The specified year ready for formatting (similar to yeardatescalendar()). + * Entries in the week arrays are [day number, weekday number] arrays. + * Day numbers outside this month are zero. + * + * @param {number} year + * Year for which the calendar should be generated. + * @param {number} width + * The number of months to include in each row. Default: 3 + */ + yeardays2calendar(year: number, width?: number): IYearGrid; + } + + // Undocumented + //export function isleap(year: number): boolean; + //export function leapdays(beginYear: number, endYear: number): number; + //export function monthrange(year: number, month: number): number[]; + //export function weekday(year: number, month: number, day: number): number; + //export function timegm(dateParams: number[]): number; + //export function IllegalLocaleError(): Error; + //export function IllegalDayError(): Error; + //export function IllegalMonthError(): Error; + //export function IllegalTimeError(): Error; + //export function IllegalWeekdayError(): Error; +} \ No newline at end of file diff --git a/node-calendar/package.json b/node-calendar/package.json new file mode 100755 index 000000000..8cc162a95 --- /dev/null +++ b/node-calendar/package.json @@ -0,0 +1,14 @@ +{ + "name": "node-calendar.d.ts", + "version": "0.0.1", + "description": "Type definitions for node-calendar v0.1.4", + "main": "node-calendar-tests", + "scripts": { + "test": "node node-calendar-tests" + }, + "author": "Luzian Zagadinow (https://github.com/luzianz)", + "license": "MIT", + "dependencies": { + "node-calendar": "^0.1.4" + } +} \ No newline at end of file From 78deea6ba8f69456d58dcc14099136f73bc7b715 Mon Sep 17 00:00:00 2001 From: Basarat Ali Syed Date: Tue, 2 Jun 2015 17:28:20 +1000 Subject: [PATCH 375/534] Syntax for modernComponent Is this test valid @pspeter3? Regarding : https://github.com/Asana/typed-react/commit/9008be2f41c56bdd975213a08c97f1847333b15d --- react/react-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react/react-tests.ts b/react/react-tests.ts index 2802a34cd..64b59e195 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -150,6 +150,8 @@ var classicComponent: React.ClassicComponent = React.render(classicElement, container); var domComponent: React.DOMComponent = React.render(domElement, container); +var modernComponent = + React.render(React.createElement(ModernComponent, props), container); // Other Top-Level API var unmounted: boolean = React.unmountComponentAtNode(container); From 7026f99eebbca5fe5d35741538a54e089b83f97b Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Tue, 2 Jun 2015 11:03:45 +0200 Subject: [PATCH 376/534] Add UNSTARTED to PlayerState See docs: https://developers.google.com/youtube/iframe_api_reference --- youtube/youtube.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/youtube/youtube.d.ts b/youtube/youtube.d.ts index d7e52ae17..0add84b79 100644 --- a/youtube/youtube.d.ts +++ b/youtube/youtube.d.ts @@ -150,10 +150,11 @@ declare module YT { } export enum PlayerState { + UNSTARTED, BUFFERING, CUED, ENDED, PAUSED, PLAYING } -} \ No newline at end of file +} From 93a0bd7d5083d63eb5ac702ee9081fa5032f018e Mon Sep 17 00:00:00 2001 From: Graham Mendick Date: Tue, 2 Jun 2015 10:21:55 +0100 Subject: [PATCH 377/534] Added Navigation typings and tests --- navigation/navigation-tests.ts | 117 +++++ navigation/navigation.d.ts | 847 +++++++++++++++++++++++++++++++++ 2 files changed, 964 insertions(+) create mode 100644 navigation/navigation-tests.ts create mode 100644 navigation/navigation.d.ts diff --git a/navigation/navigation-tests.ts b/navigation/navigation-tests.ts new file mode 100644 index 000000000..e0871a267 --- /dev/null +++ b/navigation/navigation-tests.ts @@ -0,0 +1,117 @@ +/// + +// History Manager +class LogHistoryManager extends Navigation.HashHistoryManager { + addHistory(state: Navigation.State, url: string) { + console.log('add history'); + super.addHistory(state, url); + } +} + +// State Router +class LogStateRouter extends Navigation.StateRouter { + getData(route: string): { state: Navigation.State; data: any } { + console.log('get data'); + return super.getData(route); + } +} + +// Settings +Navigation.settings.router = new LogStateRouter(); +Navigation.settings.historyManager = new LogHistoryManager(); +Navigation.settings.stateIdKey = 'state'; + +// Configuration +Navigation.StateInfoConfig.build([ + { key: 'home', initial: 'page', states: [ + { key: 'page', route: '' } + ]}, + { key: 'person', initial: 'list', states: [ + { key: 'list', route: 'people/{page}', transitions: [ + { key: 'select', to: 'details' } + ], defaults: { page: 1 }, trackCrumbTrail: false }, + { key: 'details', route: 'person/{id}', defaultTypes: { id: 'number' } } + ]} +]); + +// StateInfo +var dialogs = Navigation.StateInfoConfig.dialogs; +var home = dialogs['home']; +var homePage = home.states['page']; +var homeKey = home.key; +var homePageKey = homePage.key; +homePage = home.initial; +var person = dialogs['person']; +var personList = person.states['list']; +var personDetails = person.states['details']; +var personListSelect = personList.transitions['select']; +personList = personListSelect.parent; +personDetails = personListSelect.to; +var pageDefault = personList.defaults.page; +var idDefaultType = personDetails.defaultTypes.id; + +// StateNavigator +personList.dispose = () => {}; +personList.navigating = (data, url, navigate) => { + navigate(); +}; +personList.navigated = (data) => {}; + +// State Handler +class LogStateHandler extends Navigation.StateHandler { + getNavigationData(state: Navigation.State, url: string): any { + console.log('get navigation data'); + super.getNavigationData(state, url); + } +} +homePage.stateHandler = new LogStateHandler(); +personList.stateHandler = new LogStateHandler(); +personDetails.stateHandler = new LogStateHandler(); + +// Navigation Event +var navigationListener = +(oldState: Navigation.State, state: Navigation.State, data: any) => { + Navigation.StateController.offNavigate(navigationListener); +}; +Navigation.StateController.onNavigate(navigationListener); + +// Navigation +Navigation.start('home'); +Navigation.StateController.navigate('person'); +Navigation.StateController.refresh(); +Navigation.StateController.refresh({ page: 2 }); +Navigation.StateController.navigate('select', { id: 10 }); +var canGoBack: boolean = Navigation.StateController.canNavigateBack(1); +Navigation.StateController.navigateBack(1); + +// Navigation Link +var link = Navigation.StateController.getNavigationLink('person'); +link = Navigation.StateController.getRefreshLink(); +link = Navigation.StateController.getRefreshLink({ page: 2 }); +link = Navigation.StateController.getNavigationLink('select', { id: 10 }); +var nextDialog = Navigation.StateController.getNextState('select').parent; +person = nextDialog; +Navigation.StateController.navigateLink(link); +link = Navigation.StateController.getNavigationBackLink(1); +var crumb = Navigation.StateController.crumbs[0]; +link = crumb.navigationLink; + +// StateContext +Navigation.StateController.navigate('home'); +Navigation.StateController.navigate('person'); +home = Navigation.StateContext.previousDialog; +homePage = Navigation.StateContext.previousState; +person === Navigation.StateContext.dialog; +personList === Navigation.StateContext.state; +var url: string = Navigation.StateContext.url; +var page: number = Navigation.StateContext.data.page; + +// Navigation Data +Navigation.StateController.refresh({ page: 2 }); +var data = Navigation.StateContext.includeCurrentData({ sort: 'name' }, ['page']); +Navigation.StateController.refresh(data); +Navigation.StateContext.clear('sort'); +var data = Navigation.StateContext.includeCurrentData({ pageSize: 10 }); +Navigation.StateController.refresh(data); +Navigation.StateContext.clear(); +Navigation.StateController.refresh(); diff --git a/navigation/navigation.d.ts b/navigation/navigation.d.ts new file mode 100644 index 000000000..7cb830897 --- /dev/null +++ b/navigation/navigation.d.ts @@ -0,0 +1,847 @@ +// Type definitions for Navigation 1.0 +// Project: http://grahammendick.github.io/navigation/ +// Definitions by: Graham Mendick +// Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module 'navigation' { + export = Navigation; +} + +declare module Navigation { + /** + * Defines a contract a class must implement in order to represent a + * logical grouping of child State elements. Navigating across different + * dialogs will initialise the crumb trail + */ + interface IDialog { + /** + * Gets the State children + */ + states: TStates; + /** + * Gets the state to navigate to if the Key is passed as an action + * parameter to the StateController + */ + initial: TState; + /** + * Gets the key, unique across dialogs, which is passed as the action + * parameter to the StateController when navigating + */ + key: string; + /** + * Gets the textual description of the dialog + */ + title?: string; + } + + /** + * Defines a contract a class must implement in order to configure state + * information. A child of a Dialog element, it represents the endpoint of + * a navigation + */ + interface IState { + /** + * Gets the Transition children + */ + transitions?: TTransitions; + /** + * Gets the key, unique within a Parent, used by Dialog and Transition + * elements to specify navigation configuration + */ + key: string; + /** + * Gets the default NavigationData for this State + */ + defaults?: any; + /** + * Gets the default NavigationData Types for this State + */ + defaultTypes?: any; + /** + * Gets the textual description of the state + */ + title?: string; + /** + * Gets the route Url pattern + */ + route: string; + /** + * Gets a value that indicates whether to maintain crumb trail + * information e.g PreviousState. This can be used together with Route + * to produce user friendly Urls + */ + trackCrumbTrail?: boolean; + } + + /** + * Defines a contract a class must implement in order to configure + * transition information. A child of a State element it represents a + * possible navigation from its Parent to a sibling State + */ + interface ITransition { + /** + * Gets the state to navigate to if the Key is passed as an action + * parameter to the StateController + */ + to: TState; + /** + * Gets the key, unique within a Parent, which is passed as the action + * parameter to the StateController when navigating + */ + key: string; + } + + /** + * Configures dialog information. Represents a logical grouping of child + * State elements. Navigating across different dialogs will initialise the + * crumb trail + */ + class Dialog implements IDialog { + /** + * Gets the State children by index + */ + _states: State[]; + /** + * Gets the State children + */ + states: { + [index: string]: State; + }; + /** + * Gets the number of the dialog + */ + index: number; + /** + * Gets the state to navigate to if the Key is passed as an action + * parameter to the StateController + */ + initial: State; + /** + * Gets the key, unique across dialogs, which is passed as the action + * parameter to the StateController when navigating + */ + key: string; + /** + * Gets the textual description of the dialog + */ + title: string; + } + + /** + * Configures state information. A child of a Dialog element, it + * represents the endpoint of a navigation + */ + class State implements IState<{ [index: string]: Transition; }> { + /** + * Gets the Transition children by index + */ + _transitions: Transition[]; + /** + * Gets the Transition children + */ + transitions: { + [index: string]: Transition; + }; + /** + * Gets the parent Dialog configuration item + */ + parent: Dialog; + /** + * Gets the number of the state within its Parent + */ + index: number; + /** + * Gets the unique identifier for this State + */ + id: string; + /** + * Gets the key, unique within a Parent, used by Dialog and Transition + * elements to specify navigation configuration + */ + key: string; + /** + * Gets the default NavigationData for this State + */ + defaults: any; + /** + * Gets the default NavigationData Types for this State + */ + defaultTypes: any; + /** + * Gets the formatted default NavigationData for this State + */ + formattedDefaults: any; + /** + * Gets the textual description of the state + */ + title: string; + /** + * Gets the route Url pattern + */ + route: string; + /** + * Gets a value that indicates whether to maintain crumb trail + * information e.g PreviousState. This can be used together with Route + * to produce user friendly Urls + */ + trackCrumbTrail: boolean; + /** + * Gets or sets the IStateHandler responsible for building and parsing + * avigation links to this State + */ + stateHandler: IStateHandler; + /** + * Called on the old State (this is not the same as the previous + * State) after navigating to a different State + */ + dispose: () => void; + /** + * Called on the current State after navigating to it + * @param data The current NavigationData + */ + navigated: (data: any) => void; + /** + * Called on the new State before navigating to it + * @param data The new NavigationData + * @param url The new target location + * @param navigate The function to call to continue to navigate + */ + navigating: (data: any, url: string, navigate: () => void) => void; + } + + /** + * Configures transition information. A child of a State element it + * represents a possible navigation from its Parent to a sibling State + */ + class Transition implements ITransition { + /** + * Gets the state to navigate to if the Key is passed as an action + * parameter to the StateController + */ + to: State; + /** + * Gets the parent State configuration item + */ + parent: State; + /** + * Gets the number of the transition within its Parent + */ + index: number; + /** + * Gets the key, unique within a Parent, which is passed as the action + * parameter to the StateController when navigating + */ + key: string; + } + + /** + * Provides static access to the Dialog, State and Transition configuration + */ + class StateInfoConfig { + /** + * Gets a collection of Dialog information, by index, with their child + * State information and grandchild Transition information + */ + static _dialogs: Dialog[]; + /** + * Gets a collection of Dialog information with their child State + * information and grandchild Transition information + */ + static dialogs: { + [index: string]: Dialog; + }; + /** + * Builds the Dialog, State and Transition configuration + * @param dialogs A collection of Dialog information with their child + * State information and grandchild Transition information + */ + static build(dialogs: IDialog[]>[]>[]): void; + } + + /** + * Defines a contract a class must implement in order to manage the browser + * Url + */ + interface IHistoryManager { + /** + * Gets or sets a value indicating whether to disable browser history + */ + disabled: boolean; + /** + * Registers browser history event listeners + */ + init(): any; + /** + * Adds browser history + * @param state The State navigated to + * @param url The current url + */ + addHistory(state: State, url: string): void; + /** + * Gets the current location + */ + getCurrentUrl(): string; + /** + * Gets an Href from the url + */ + getHref(url: string): string; + /** + * Gets a Url from the anchor + */ + getUrl(anchor: HTMLAnchorElement): string; + } + + /** + * Manages history using the browser Url's hash. If used in a browser + * without the hashchange event or outside of a browser environment, then + * history is disabled + */ + class HashHistoryManager implements IHistoryManager { + /** + * Gets or sets a value indicating whether to disable browser history. + * Set to true if used in a browser without the hashchange event or + * outside of a browser environment + */ + disabled: boolean; + /** + * Gets or sets a value indicating whether to use '#' in place of '?' + * in Urls. Set to true for Internet explorer 6 and 7 support + */ + replaceQueryIdentifier: boolean; + /** + * Registers a listener for the hashchange event + */ + init(): void; + /** + * Sets the browser Url's hash to the url + * @param state The State navigated to + * @param url The current url + */ + addHistory(state: State, url: string): void; + /** + * Gets the current location + */ + getCurrentUrl(): string; + /** + * Gets an Href from the url + */ + getHref(url: string): string; + /** + * Gets a Url from the anchor + */ + getUrl(anchor: HTMLAnchorElement): string; + } + + /** + * Manages history using the HTML5 history api. If used in a browser + * without the HTML5 history api or outside of a browser environment, then + * history is disabled + */ + class HTML5HistoryManager implements IHistoryManager { + /** + * Gets or sets a value indicating whether to disable browser history. + * Set to true if used in a browser without the HTML5 history api or + * outside of a browser environment + */ + disabled: boolean; + /** + * Registers a listener for the popstate event + */ + init(): void; + /** + * Sets the browser Url to the url using pushState + * @param state The State navigated to + * @param url The current url + */ + addHistory(state: State, url: string): void; + /** + * Gets the current location + */ + getCurrentUrl(): string; + /** + * Gets an Href from the url + */ + getHref(url: string): string; + /** + * Gets a Url from the anchor + */ + getUrl(anchor: HTMLAnchorElement): string; + } + + /** + * Defines a contract a class must implement in order to build and parse + * navigation links + */ + interface IStateHandler { + /** + * Gets a link that navigates to the state passing the data + * @param state The State to navigate to + * @param data The data to pass when navigating + * @returns The navigation link + */ + getNavigationLink(state: State, data: any): string; + /** + * Navigates to the url + * @param oldState The current State + * @param state The State to navigate to + * @param url The target location + */ + navigateLink(oldState: State, state: State, url: string): void; + /** + * Gets the data parsed from the url + * @param state The State navigated to + * @param url The current url + * @returns The navigation data + */ + getNavigationData(state: State, url: string): any; + /** + * Truncates the crumb trail + * @param The State navigated to + * @param The Crumb collection representing the crumb trail + * @returns Truncated crumb trail + */ + truncateCrumbTrail(state: State, crumbs: Crumb[]): Crumb[]; + } + + /** + * Represents one piece of the crumb trail and holds the information need + * to return to and recreate the State as previously visited. In a single + * crumb trail no two crumbs can have the same State but all must have the + * same Dialog + */ + class Crumb { + /** + * Gets the Context Data held at the time of navigating away from this + * State + */ + data: any; + /** + * Gets the configuration information associated with this navigation + */ + state: State; + /** + * Gets a value indicating whether the Crumb is the last in the crumb + * trail + */ + last: boolean; + /** + * Gets the State Title + */ + title: string; + /** + * Gets the hyperlink navigation to return to the State and pass the + * associated Data + */ + navigationLink: string; + /** + * Initializes a new instance of the Crumb class + */ + constructor(data: any, state: State, link: string, last: boolean); + } + + /** + * Provides access to the Navigation Settings configuration + */ + class NavigationSettings { + router: IRouter; + historyManager: IHistoryManager; + /** + * Gets or sets the key that identifies the StateId + */ + stateIdKey: string; + /** + * Gets or sets the key that identifies the PreviousStateId + */ + previousStateIdKey: string; + /** + * Gets or sets the key that identifies the ReturnData + */ + returnDataKey: string; + /** + * Gets or sets the key that identifies the CrumbTrail + */ + crumbTrailKey: string; + /** + * Gets or sets the application path + */ + applicationPath: string; + } + + /** + * Provides static properties for accessing context sensitive navigation + * information. Holds the current State and NavigationData. Also holds the + * previous State (this is not the same as the previous Crumb) + */ + class StateContext { + /** + * Gets the State navigated away from to reach the current State + */ + static previousState: State; + /** + * Gets the parent of the PreviousState property + */ + static previousDialog: Dialog; + /** + * Gets the current State + */ + static state: State; + /** + * Gets the parent of the State property + */ + static dialog: Dialog; + /** + * Gets the NavigationData for the current State. It can be accessed. + * Will become the data stored in a Crumb when part of a crumb trail + */ + static data: any; + /** + * Gets the current Url + */ + static url: string; + /** + * Combines the data with all the current NavigationData + * @param The data to add to the current NavigationData + * @returns The combined data + */ + static includeCurrentData(data: any): any; + /** + * Combines the data with a subset of the current NavigationData + * @param The data to add to the current NavigationData + * @returns The combined data + */ + static includeCurrentData(data: any, keys: string[]): any; + /** + * Removes all items from the NavigationData + */ + static clear(): void; + /** + * Removes a single item from the NavigationData + * @param The key of the item to remove + */ + static clear(key: string): void; + } + + /** + * Manages all navigation. These can be forward using an action parameter; + * backward via a Crumb; or refreshing the current State + */ + class StateController { + /** + * Gets a Crumb collection representing the crumb trail, ordered oldest + * Crumb first + */ + static crumbs: Crumb[]; + /** + * Sets the Context Data with the data returned from the current + * State's IStateHandler + * @param state The current State + * @param url The current Url + */ + static setStateContext(state: State, url: string): void; + /** + * Registers a navigate event listener + * @param handler The navigate event listener + */ + static onNavigate(handler: (oldState: State, state: State, data: any) => void): void; + /** + * Unregisters a navigate event listener + * @param handler The navigate event listener + */ + static offNavigate(handler: (oldState: State, state: State, data: any) => void): void; + /** + * Navigates to a State. Depending on the action will either navigate + * to the 'to' State of a Transition or the 'initial' State of a + * Dialog. It passes no NavigationData + * @param action The key of a child Transition or the key of a Dialog + * @throws action does not match the key of a child Transition or the + * key of a Dialog; or there is NavigationData that cannot be converted + * to a String + * @throws A mandatory route parameter has not been supplied a value + */ + static navigate(action: string): void; + /** + * Navigates to a State. Depending on the action will either navigate + * to the 'to' State of a Transition or the 'initial' State of a + * Dialog + * @param action The key of a child Transition or the key of a Dialog + * @param toData The NavigationData to be passed to the next State and + * stored in the StateContext + * @throws action does not match the key of a child Transition or the + * key of a Dialog; or there is NavigationData that cannot be converted + * to a String + * @throws A mandatory route parameter has not been supplied a value + */ + static navigate(action: string, toData: any): void; + /** + * Gets a Url to navigate to a State. Depending on the action will + * either navigate to the 'to' State of a Transition or the 'initial' + * State of a Dialog. It passes no NavigationData + * @param action The key of a child Transition or the key of a Dialog + * @returns Url that will navigate to State specified in the action + * @throws action does not match the key of a child Transition or the + * key of a Dialog; or there is NavigationData that cannot be converted + * to a String + */ + static getNavigationLink(action: string): string; + /** + * Gets a Url to navigate to a State. Depending on the action will + * either navigate to the 'to' State of a Transition or the 'initial' + * State of a Dialog + * @param action The key of a child Transition or the key of a Dialog + * @param toData The NavigationData to be passed to the next State and + * stored in the StateContext + * @returns Url that will navigate to State specified in the action + * @throws action does not match the key of a child Transition or the + * key of a Dialog; or there is NavigationData that cannot be converted + * to a String + */ + static getNavigationLink(action: string, toData: any): string; + /** + * Determines if the distance specified is within the bounds of the + * crumb trail represented by the Crumbs collection + */ + static canNavigateBack(distance: number): boolean; + /** + * Navigates back to the Crumb contained in the crumb trail, + * represented by the Crumbs collection, as specified by the distance. + * In the crumb trail no two crumbs can have the same State but all + * must have the same Dialog + * @param distance Starting at 1, the number of Crumb steps to go back + * @throws canNavigateBack returns false for this distance + * @throws A mandatory route parameter has not been supplied a value + */ + static navigateBack(distance: number): void; + /** + * Gets a Url to navigate to a Crumb contained in the crumb trail, + * represented by the Crumbs collection, as specified by the distance. + * In the crumb trail no two crumbs can have the same State but all + * must have the same Dialog + * @param distance Starting at 1, the number of Crumb steps to go back + * @throws canNavigateBack returns false for this distance + */ + static getNavigationBackLink(distance: number): string; + /** + * Navigates to the current State passing no NavigationData + * @throws A mandatory route parameter has not been supplied a value + */ + static refresh(): void; + /** + * Navigates to the current State + * @param toData The NavigationData to be passed to the current State + * and stored in the StateContext + * @throws There is NavigationData that cannot be converted to a String + * @throws A mandatory route parameter has not been supplied a value + */ + static refresh(toData: any): void; + /** + * Gets a Url to navigate to the current State passing no + * NavigationData + */ + static getRefreshLink(): string; + /** + * Gets a Url to navigate to the current State + * @param toData The NavigationData to be passed to the current State + * and stored in the StateContext + * @returns Url that will navigate to the current State + * @throws There is NavigationData that cannot be converted to a String + */ + static getRefreshLink(toData: any): string; + /** + * Navigates to the url + * @param url The target location + */ + static navigateLink(url: string): void; + /** + * Gets the next State. Depending on the action will either return the + * 'to' State of a Transition or the 'initial' State of a Dialog + * @param action The key of a child Transition or the key of a Dialog + * @throws action does not match the key of a child Transition or the + * key of a Dialog + */ + static getNextState(action: string): State; + } + + /** + * Implementation of IStateHandler that builds and parses navigation links + */ + class StateHandler implements IStateHandler { + /** + * Gets a link that navigates to the state passing the data + * @param state The State to navigate to + * @param data The data to pass when navigating + * @returns The navigation link + */ + getNavigationLink(state: State, data: any): string; + /** + * Navigates to the url + * @param oldState The current State + * @param state The State to navigate to + * @param url The target location + */ + navigateLink(oldState: State, state: State, url: string): void; + /** + * Gets the data parsed from the url + * @param state The State navigated to + * @param url The current url + * @returns The navigation data + */ + getNavigationData(state: State, url: string): any; + /** + * Truncates the crumb trail whenever a repeated or initial State is + * encountered + * @param The State navigated to + * @param The Crumb collection representing the crumb trail + * @returns Truncated crumb trail + */ + truncateCrumbTrail(state: State, crumbs: Crumb[]): Crumb[]; + } + + /** + * Defines a contract a class must implement in order build and parse + * State routes + */ + interface IRouter { + /** + * Gets the matching State and data for the route + * @param route The route to match + * @returns The matched State and data + */ + getData(route: string): { state: State; data: any; }; + /** + * Gets the matching route and data for the state and data + * @param The state to match + * @param The data to match + * @returns The matched route and data + */ + getRoute(state: State, data: any): { route: string; data: any; }; + /** + * Gets or sets a value indicating whether the route matching supports + * default parameter values + */ + supportsDefaults: boolean; + /** + * Registers all route configuration information + * @param dialogs Collection of Dialogs with their child State route + * information + */ + addRoutes(dialogs: Dialog[]): void; + } + + /** + * Implementation of IRouter that builds and parses State routes using the + * Navigation Router + */ + class StateRouter implements IRouter { + /** + * Gets the underlying Navigation Router + */ + router: Router; + /** + * Gets true, indicating the underlying Navigation Router supports + * defaults + */ + supportsDefaults: boolean; + /** + * Gets the matching State and data for the route + * @param route The route to match + * @returns The matched State and data + */ + getData(route: string): { state: State; data: any; }; + /** + * Gets the matching route and data for the state and data + * @param The state to match + * @param The data to match + * @returns The matched route and data + */ + getRoute(state: State, data: any): { route: string; data: any; }; + /** + * Registers all route configuration information with the underlying + * Navigation Router + * @param dialogs Collection of Dialogs with their child State route + * information + */ + addRoutes(dialogs: Dialog[]): void; + } + + /** + * Holds information about a route + */ + class Route { + /** + * Gets the path pattern of a route + */ + path: string; + /** + * Gets the default parameter values + */ + defaults: any; + /** + * Gets the list of parameters + */ + params: { name: string; optional: boolean; }[]; + /** + * Initializes a new instance of the Route class + * @param path The route pattern + */ + constructor(path: string); + /** + * Initializes a new instance of the Route class + * @param path The route pattern + * @param defaults The default parameter values + */ + constructor(path: string, defaults: any); + /** + * Gets the matching data for the path + * @param path The path to match + * @returns The matched data or null if there's no match + */ + match(path: string): any; + /** + * Gets the route populated with default values + * @returns The built route + */ + build(): string; + /** + * Gets the route populated with data and default values + * @param The data for the route parameters + * @returns The built route + */ + build(data: any): string; + } + + /** + * The default Navigation router implementation + */ + class Router { + /** + * Registers a route + * @param path The route path + * @returns The parsed Route + */ + addRoute(path: string): Route; + /** + * Registers a route with default parameters + * @param path The route path + * @param defaults The route parameter defaults + * @returns The parsed Route + */ + addRoute(path: string, defaults: any): Route; + /** + * Gets the matching route and data for the path + * @param route The path to match + * @returns The matched route and data + */ + match(path: string): { route: Route; data: any; }; + } + + /** + * Gets the Navigation settings + */ + export var settings: NavigationSettings; + + /** + * Initializes the history manager and navigates to the current location. + * If used outside of a browser environment, pass in the Url to navigate to + * @param url If used outside of a browser, the url to navigate to + */ + export var start: (url?: string) => void; +} \ No newline at end of file From 9a8c66d5ac920c19a21fb70cb100eaf3e560d1b0 Mon Sep 17 00:00:00 2001 From: Niklas Mollenhauer Date: Tue, 2 Jun 2015 11:24:36 +0200 Subject: [PATCH 378/534] Fix indentation --- youtube/youtube.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube/youtube.d.ts b/youtube/youtube.d.ts index 0add84b79..30580053f 100644 --- a/youtube/youtube.d.ts +++ b/youtube/youtube.d.ts @@ -150,7 +150,7 @@ declare module YT { } export enum PlayerState { - UNSTARTED, + UNSTARTED, BUFFERING, CUED, ENDED, From d4873ce3f5a4f19a5d88dbca32b8a0daea8385a4 Mon Sep 17 00:00:00 2001 From: Dave Keen Date: Tue, 2 Jun 2015 15:45:34 +0200 Subject: [PATCH 379/534] rx: added missing 'pairs' definition --- rx/rx-lite.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rx/rx-lite.d.ts b/rx/rx-lite.d.ts index 82221d633..c5034c3b7 100644 --- a/rx/rx-lite.d.ts +++ b/rx/rx-lite.d.ts @@ -589,6 +589,8 @@ declare module Rx { merge(scheduler: IScheduler, sources: Observable[]): Observable; merge(scheduler: IScheduler, sources: IPromise[]): Observable; + pairs(obj: { [key: string]: T }, scheduler?: IScheduler): Observable<[string, T]>; + zip(first: Observable, sources: Observable[], resultSelector: (item1: T1, ...right: T2[]) => TResult): Observable; zip(first: Observable, sources: IPromise[], resultSelector: (item1: T1, ...right: T2[]) => TResult): Observable; zip(source1: Observable, source2: Observable, resultSelector: (item1: T1, item2: T2) => TResult): Observable; From 36bc838e4f30c1ccdd5a9530db5ba03f8f331b5d Mon Sep 17 00:00:00 2001 From: jpsfs Date: Tue, 2 Jun 2015 15:03:30 +0100 Subject: [PATCH 380/534] Add missing jasmine-jquery matchers and comments. --- jasmine-jquery/jasmine-jquery-tests.ts | 4 + jasmine-jquery/jasmine-jquery.d.ts | 248 ++++++++++++++++++++++++- 2 files changed, 250 insertions(+), 2 deletions(-) diff --git a/jasmine-jquery/jasmine-jquery-tests.ts b/jasmine-jquery/jasmine-jquery-tests.ts index ef6d8cc79..f6542c216 100644 --- a/jasmine-jquery/jasmine-jquery-tests.ts +++ b/jasmine-jquery/jasmine-jquery-tests.ts @@ -39,6 +39,10 @@ describe("Jasmine jQuery extension", () => { expect($('').focus()).toBeFocused(); //expect($form).toHandle("submit") //expect($form).toHandleWith("submit", yourSubmitCallback) + expect($('

    ')).toBeInDOM(); + expect($('
    ')).toContainElement('span.some-class'); + expect($('

      header

      ')).toContainHtml('
        '); + expect($('

          header

          ')).toContainText('header') }); it("Handles HTML Fixtures", () => { diff --git a/jasmine-jquery/jasmine-jquery.d.ts b/jasmine-jquery/jasmine-jquery.d.ts index e1ed6c3c0..dcff2d12c 100644 --- a/jasmine-jquery/jasmine-jquery.d.ts +++ b/jasmine-jquery/jasmine-jquery.d.ts @@ -81,39 +81,283 @@ declare module jasmine { } interface Matchers { + /** + * Check if DOM element has class. + * + * @param className Name of the class to check. + * + * @example + * // returns true + * expect($('
          ')).toHaveClass("some-class") + */ toHaveClass(className: string): boolean; - toHaveCss(css): boolean; + + /** + * Check if DOM element has the given CSS properties. + * + * @param css Object containing the properties (and values) to check. + * + * @example + * // returns true + * expect($('
          ')).toHaveCss({display: "none", margin: "10px"}) + * + * @example + * // returns true + * expect($('
          ')).toHaveCss({margin: "10px"}) + */ + toHaveCss(css: Object): boolean; + + /** + * Checks if DOM element is visible. + * Elements are considered visible if they consume space in the document. Visible elements have a width or height that is greater than zero. + */ toBeVisible(): boolean; + /** + * Check if DOM element is hidden. + * Elements can be hidden for several reasons: + * - They have a CSS display value of none ; + * - They are form elements with type equal to hidden. + * - Their width and height are explicitly set to 0. + * - An ancestor element is hidden, so the element is not shown on the page. + */ toBeHidden(): boolean; + + /** + * Only for tags that have checked attribute + * + * @example + * // returns true + * expect($('')).toBeSelected() + */ toBeSelected(): boolean; + + /** + * Only for tags that have checked attribute + * @example + * // returns true + * expect($('')).toBeChecked() + */ toBeChecked(): boolean; + + /** + * Checks for child DOM elements or text + */ toBeEmpty(): boolean; + + /** + * Checks if element exists in or out the DOM. + */ toExist(): boolean; + + /** + * Checks if array has the given length. + * + * @param length Expected length + */ toHaveLength(length: number): boolean; + + /** + * Check if DOM element contains an attribute and, optionally, if the value of the attribute is equal to the expected one. + * + * @param attributeName Name of the attribute to check + * @param expectedAttributeValue Expected attribute value + */ toHaveAttr(attributeName: string, expectedAttributeValue?): boolean; + + /** + * Check if DOM element contains a property and, optionally, if the value of the property is equal to the expected one. + * + * @param propertyName Property name to check + * @param expectedPropertyValue Expected property value + */ toHaveProp(propertyName: string, expectedPropertyValue?): boolean; + + /** + * Check if DOM element has the given Id + * + * @param Id Expected identifier + */ toHaveId(id: string): boolean; + + /** + * Check if DOM element has the specified HTML. + * + * @example + * // returns true + * expect($('
          ')).toHaveHtml('') + */ toHaveHtml(html: string): boolean; + + /** + * Check if DOM element contains the specified HTML. + * + * @example + * // returns true + * expect($('

            header

            ')).toContainHtml('
              ') + */ //toContainHtml(html: string): boolean; + + /** + * Check if DOM element has the given Text. + * @param text Accepts a string or regular expression + * + * @example + * // returns true + * expect($('
              some text
              ')).toHaveText('some text') + */ toHaveText(text: string): boolean; + /** + * Check if DOM element contains the specified text. + * + * @example + * // returns true + * expect($('

                header

                ')).toContainText('header') + */ //toContainText(text: string): boolean; + + /** + * Check if DOM element has the given value. + * This can only be applied for element on with jQuery val() can be called. + * + * @example + * // returns true + * expect($('')).toHaveValue('some text') + */ toHaveValue(value): boolean; + + /** + * Check if DOM element has the given data. + * This can only be applied for element on with jQuery data(key) can be called. + * + */ toHaveData(key, expectedValue): boolean; toBe(selector: JQuery): boolean; + + /** + * Check if DOM element is matched by the given selector. + * + * @example + * // returns true + * expect($('
                ')).toContain('some-class') + */ toContain(selector: JQuery): boolean; + + /** + * Check if DOM element exists inside the given parent element. + * + * @example + * // returns true + * expect($('
                ')).toContainElement('span.some-class') + */ + toContainElement(selector: string): boolean; + + /** + * Check to see if the set of matched elements matches the given selector + * + * @example + * expect($('').addClass('js-something')).toBeMatchedBy('.js-something') + * + * @returns {Boolean} true if DOM contains the element + */ toBeMatchedBy(selector: string): boolean; + + /** + * Only for tags that have disabled attribute + * @example + * // returns true + * expect('').toBeDisabled() + */ toBeDisabled(): boolean; + + /** + * Check if DOM element is focused + * @example + * // returns true + * expect($('').focus()).toBeFocused() + */ toBeFocused(): boolean; - toHandle(event): boolean; + + /** + * Checks if DOM element handles event. + * + * @example + * // returns true + * expect($form).toHandle("submit") + */ + toHandle(eventName: string): boolean; + + /** + * Assigns a callback to an event of the DOM element. + * + * @param eventName Name of the event to assign the callback to. + * @param eventHandler Callback function to be assigned. + * + * @example + * expect($form).toHandleWith("submit", yourSubmitCallback) + */ toHandleWith(eventName: string, eventHandler): boolean; + /** + * Checks if event was triggered. + */ toHaveBeenTriggered(): boolean; + + /** + * Checks if the event has been triggered on selector. + * @param selector Selector that should have triggered the event. + */ toHaveBeenTriggeredOn(selector: string): boolean; + + /** + * Checks if the event has been triggered on selector. + * @param selector Selector that should have triggered the event. + * @param args Extra arguments to be passed to jQuery events functions. + */ toHaveBeenTriggeredOnAndWith(selector: string, ...args: any[]): boolean; + + /** + * Checks if event propagation has been prevented. + */ toHaveBeenPrevented(): boolean; + + /** + * Checks if event propagation has been prevented on element with selector. + * + * @param selector Selector that should have prevented the event. + */ toHaveBeenPreventedOn(selector: string): boolean; + + /** + * Checks if event propagation has been stopped. + * + * @example + * // returns true + * var spyEvent = spyOnEvent('#some_element', 'click') + * $('#some_element').click(function (event){event.stopPropagation();}) + * $('#some_element').click() + * expect(spyEvent).toHaveBeenStopped() + */ toHaveBeenStopped(): boolean; + + /** + * Checks if event propagation has been stopped by an element with the given selector. + * @param selector Selector of the element that should have stopped the event propagation. + * + * @example + * // returns true + * $('#some_element').click(function (event){event.stopPropagation();}) + * $('#some_element').click() + * expect('click').toHaveBeenStoppedOn('#some_element') + */ toHaveBeenStoppedOn(selector: string): boolean; + + /** + * Checks to see if the matched element is attached to the DOM. + * @example + * expect($('#id-name')[0]).toBeInDOM() + */ + toBeInDOM(): boolean; + } interface JQueryEventSpy { From e8ac76dbcf18f24ae50b8ac05aa8375952aabf6f Mon Sep 17 00:00:00 2001 From: Sobit Akhmedov Date: Tue, 2 Jun 2015 19:03:21 +0200 Subject: [PATCH 381/534] add optional() method to Validator interface --- express-validator/express-validator.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index 7fc04f70e..428c90afd 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -150,6 +150,10 @@ declare module ExpressValidator { * Will work against Visa, MasterCard, American Express, Discover, Diners Club, and JCB card numbering formats */ isCreditCard(): Validator; + /** + * Check an input only when the input exists + */ + optional(): Validator; } interface Sanitizer { From bf1d9d8b44bd7d0ad2b2a5e57f188916798c17db Mon Sep 17 00:00:00 2001 From: tomtheisen Date: Tue, 2 Jun 2015 10:35:36 -0700 Subject: [PATCH 382/534] Update select2 events Update select2 events based on documentation at http://select2.github.io/select2/ --- select2/select2.d.ts | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/select2/select2.d.ts b/select2/select2.d.ts index b1f21f664..0b4543596 100644 --- a/select2/select2.d.ts +++ b/select2/select2.d.ts @@ -76,6 +76,10 @@ interface Select2JQueryEventObject extends JQueryEventObject { val: any; added: any; removed: any; + choice: { + id: any; + text: string; + }; } interface JQuery { @@ -84,6 +88,26 @@ interface JQuery { on(events: "change", selector?: string, data?: any, handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; on(events: "change", selector?: string, handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; on(events: "change", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-opening", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-open", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-close", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-highlight", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-selecting", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-removing", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-removed", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-loaded", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-focus", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-blur", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-opening", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-open", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-close", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-highlight", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-selecting", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-removing", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-removed", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-loaded", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-focus", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; + on(events: "select2-blur", handler?: (eventObject: Select2JQueryEventObject) => any): JQuery; select2(): JQuery; select2(it: IdTextPair): JQuery; @@ -141,9 +165,9 @@ interface JQuery { /** * Notifies Select2 that a drag and drop sorting operation has finished */ - select2(method: 'onSortEnd'): JQuery; + select2(method: 'onSortEnd'): JQuery; select2(method: string): any; select2(method: string, value: any, trigger?: boolean): any; select2(options: Select2Options): JQuery; -} +} From a89eb5c302cd3faa50844a0ed677941e510b9623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20H=C3=A4berle?= Date: Tue, 2 Jun 2015 20:12:44 +0200 Subject: [PATCH 383/534] Fixed typing issu --- wolfy87-eventemitter/wolfy87-eventemitter-test.ts | 2 +- wolfy87-eventemitter/wolfy87-eventemitter.d.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wolfy87-eventemitter/wolfy87-eventemitter-test.ts b/wolfy87-eventemitter/wolfy87-eventemitter-test.ts index adef23a39..d2d4e6f0c 100644 --- a/wolfy87-eventemitter/wolfy87-eventemitter-test.ts +++ b/wolfy87-eventemitter/wolfy87-eventemitter-test.ts @@ -1,6 +1,6 @@ /// -//import EventEmitter = require("wolfy87-eventemitter"); +import EventEmitter = require("wolfy87-eventemitter"); var emitter = new EventEmitter(); diff --git a/wolfy87-eventemitter/wolfy87-eventemitter.d.ts b/wolfy87-eventemitter/wolfy87-eventemitter.d.ts index 59c17284a..95cf32ea7 100644 --- a/wolfy87-eventemitter/wolfy87-eventemitter.d.ts +++ b/wolfy87-eventemitter/wolfy87-eventemitter.d.ts @@ -505,8 +505,9 @@ declare module Wolfy87EventEmitter { } declare module "wolfy87-eventemitter" { + class EventEmitter extends Wolfy87EventEmitter.EventEmitter {} export = EventEmitter; } -declare var EventEmitter: typeof Wolfy87EventEmitter.EventEmitter; +//declare var EventEmitter: typeof Wolfy87EventEmitter.EventEmitter; From 5dcc9e204702eaaa40e6f09d99e74c74fb026a56 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Tue, 2 Jun 2015 13:22:40 -0700 Subject: [PATCH 384/534] Add `angular.merge` function This is new API in Angular 1.4: https://docs.angularjs.org/api/ng/function/angular.merge --- angularjs/angular.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 009af202a..0e54c2aea 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -249,6 +249,16 @@ declare module angular { isString(value: any): boolean; isUndefined(value: any): boolean; lowercase(str: string): string; + + /** + * Deeply extends the destination object dst by copying own enumerable properties from the src object(s) to dst. You can specify multiple src objects. If you want to preserve original objects, you can do so by passing an empty object as the target: var object = angular.merge({}, object1, object2). + * + * Unlike extend(), merge() recursively descends into object properties of source objects, performing a deep copy. + * + * @param dst Destination object. + * @param src Source object(s). + */ + merge(dst: any, ...src: any[]): any; /** * The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism. From eb7a5d41278dfee57bb8bb4ddb325b39c0e745d1 Mon Sep 17 00:00:00 2001 From: Horiuchi_H Date: Wed, 3 Jun 2015 10:31:30 +0900 Subject: [PATCH 385/534] add `delete` method --- superagent/superagent-tests.ts | 4 ++++ superagent/superagent.d.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/superagent/superagent-tests.ts b/superagent/superagent-tests.ts index 436874aaf..eaefbf473 100644 --- a/superagent/superagent-tests.ts +++ b/superagent/superagent-tests.ts @@ -52,6 +52,10 @@ request .del('/user/1') .end(callback); +request + .delete('/user/1') + .end(callback); + request('/search') .end(callback); diff --git a/superagent/superagent.d.ts b/superagent/superagent.d.ts index ef477e16a..6944fcceb 100644 --- a/superagent/superagent.d.ts +++ b/superagent/superagent.d.ts @@ -26,6 +26,7 @@ declare module "superagent" { put(url: string, callback?: CallbackHandler): Req; head(url: string, callback?: CallbackHandler): Req; del(url: string, callback?: CallbackHandler): Req; + delete(url: string, callback?: CallbackHandler): Req; options(url: string, callback?: CallbackHandler): Req; trace(url: string, callback?: CallbackHandler): Req; copy(url: string, callback?: CallbackHandler): Req; From 8ab53b38cfdf61e7dc75cf960f427a68bd996664 Mon Sep 17 00:00:00 2001 From: Justin Lan Date: Tue, 2 Jun 2015 21:15:02 -0700 Subject: [PATCH 386/534] Fix some errors in the d3 definitions == Interval.offset() == Should take a number not a Date as the second parameter (https://github.com/mbostock/d3/wiki/Time-Intervals#interval_offset) == svg.line.defined() and svg.area.defined() == In two places setter signature for defined() wasn't listed. == svg.symbol()'s index parameter is optional == https://github.com/mbostock/d3/wiki/SVG-Shapes#_symbol --- d3/d3.d.ts | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 495999bb8..2fa1493b7 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -13,7 +13,7 @@ declare module d3 { * Find the first element that matches the given selector string. */ export function select(selector: string): Selection; - + /** * Create a selection from the given node reference. */ @@ -86,7 +86,7 @@ declare module d3 { attr(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }): Update; /** - * Returns true if the first node in this selection has the given class list. If multiple classes are specified (i.e., "foo bar"), then returns true only if all classes match. + * Returns true if the first node in this selection has the given class list. If multiple classes are specified (i.e., "foo bar"), then returns true only if all classes match. * * @param name The class list to query. */ @@ -476,7 +476,7 @@ declare module d3 { attr(obj: { [key: string]: Primitive | ((datum: Datum, index: number) => Primitive) }): Selection; /** - * Returns true if the first node in this selection has the given class list. If multiple classes are specified (i.e., "foo bar"), then returns true only if all classes match. + * Returns true if the first node in this selection has the given class list. If multiple classes are specified (i.e., "foo bar"), then returns true only if all classes match. * * @param name The class list to query. */ @@ -928,20 +928,20 @@ declare module d3 { */ export function mouse(container: EventTarget): [number, number]; - /** + /** * Given a container element and a touch identifier, determine the x and y coordinates of the touch. * @param container the container element (e.g., an SVG element) * @param identifier the given touch identifier */ export function touch(container: EventTarget, identifer: number): [number, number]; - /** + /** * Given a container element, a list of touches, and a touch identifier, determine the x and y coordinates of the touch. * @param container the container element (e.g., an SVG element) * @param identifier the given touch identifier */ export function touch(container: EventTarget, touches: TouchList, identifer: number): [number, number]; - + /** * Given a container element and an optional list of touches, return the position of every touch relative to the container. * @param container the container element @@ -1024,7 +1024,7 @@ declare module d3 { * Return the min and max simultaneously. */ export function extent(array: number[]): [number, number]; - + /** * Return the min and max simultaneously. */ @@ -1172,7 +1172,7 @@ declare module d3 { * Calls the function for each key and value pair in the map. The 'this' context is the map itself. */ forEach(func: (key: string, value: T) => any): void; - + /** * Is this map empty? */ @@ -1495,6 +1495,8 @@ declare module d3 { clamp(): boolean; clamp(clamp: boolean): Linear; + nice(count?: number): Linear; + ticks(count?: number): number[]; tickFormat(count?: number, format?: string): (n: number) => string; @@ -1637,7 +1639,7 @@ declare module d3 { export function category20b(): Ordinal; export function category20c(): Ordinal; export function category20c(): Ordinal; - + interface Ordinal { (x: Domain): Range; @@ -1728,7 +1730,7 @@ declare module d3 { range(start: Date, stop: Date, step?: number): Date[]; - offset(date: Date, step: Date): Date; + offset(date: Date, step: number): Date; utc: { (d: Date): Date; @@ -1741,7 +1743,7 @@ declare module d3 { range(start: Date, stop: Date, step?: number): Date[]; - offset(date: Date, step: Date): Date; + offset(date: Date, step: number): Date; } } @@ -1768,7 +1770,7 @@ declare module d3 { export function wednesdayOfYear(d: Date): number; export function fridayOfYear(d: Date): number; export function saturdayOfYear(d: Date): number; - + export function format(specifier: string): Format; export module format { @@ -1935,7 +1937,7 @@ declare module d3 { minorStep(): [number, number]; minorStep(step: [number, number]): Graticule; - + precision(): number; precision(precision: number): Graticule; } @@ -2281,7 +2283,7 @@ declare module d3 { tension(tension: number): Area; defined(): (d: T, i: number) => boolean; - defined(): (d: T, i: number) => boolean; + defined(defined: (d: T, i: number) => boolean): Area; } module area { @@ -2332,7 +2334,7 @@ declare module d3 { tension(tension: number): Radial; defined(): (d: T, i: number) => boolean; - defined(): (d: T, i: number) => boolean; + defined(defined: (d: T, i: number) => boolean): Radial; } } @@ -2388,7 +2390,7 @@ declare module d3 { export function symbol(): Symbol; interface Symbol { - (d: T, i: number): string; + (d: T, i?: number): string; type(): (d: T, i: number) => string; type(type: string): Symbol; @@ -2647,7 +2649,7 @@ declare module d3 { parseRows(string: string, accessor: (row: string[], index: number) => T): T[]; format(rows: Object[]): string; - + formatRows(rows: string[][]): string; } @@ -3284,4 +3286,4 @@ interface TouchList { } declare module 'd3' { export = d3; -} \ No newline at end of file +} From fb0ecf0c33fb167532c5351eb97ae6b7268d2311 Mon Sep 17 00:00:00 2001 From: Igor Kriklivets Date: Wed, 3 Jun 2015 11:34:16 +0300 Subject: [PATCH 387/534] Update to 14.2.7 version --- devextreme/dx.devextreme.d.ts | 804 ++++++++++++++++++++-------------- 1 file changed, 473 insertions(+), 331 deletions(-) diff --git a/devextreme/dx.devextreme.d.ts b/devextreme/dx.devextreme.d.ts index 36e3bb615..f2b6a9048 100644 --- a/devextreme/dx.devextreme.d.ts +++ b/devextreme/dx.devextreme.d.ts @@ -1,4 +1,4 @@ -// Type definitions for DevExtreme 14.2+ +// Type definitions for DevExtreme 14.2.7 // Project: http://js.devexpress.com/ // Definitions by: DevExpress Inc. // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -21,6 +21,7 @@ declare module DevExpress { export module validationEngine { export interface IValidator { validate(): ValidatorValidationResult; + reset(): void; } export interface ValidatorValidationResult { isValid: boolean; @@ -38,6 +39,7 @@ declare module DevExpress { group: any; validators: IValidator[]; validate(): ValidationGroupValidationResult; + reset(): void; } /** Provides access to the object that represents the specified validation group. */ export function getGroupConfig(group: any): GroupConfig @@ -47,6 +49,10 @@ declare module DevExpress { export function validateGroup(group: any): ValidationGroupValidationResult; /** Validates rules of the validators that belong to the default validation group. */ export function validateGroup(): ValidationGroupValidationResult; + /** Resets the values and validation result of the editors that belong to the specified validation group. */ + export function resetGroup(group: any): void; + /** Resets the values and validation result of the editors that belong to the default validation group. */ + export function resetGroup(): void; /** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */ export function validateModel(model: Object): ValidationGroupValidationResult; /** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */ @@ -245,6 +251,7 @@ declare module DevExpress { filter?: Object; sort?: Object; select?: Object; + expand?: Object; group?: Object; skip?: number; take?: number; @@ -265,7 +272,7 @@ declare module DevExpress { updating: JQueryCallback; constructor(options?: StoreOptions); /** Returns the data item specified by the key. */ - byKey(key: any, extraOptions?: Object): JQueryPromise; + byKey(key: any): JQueryPromise; /** Adds an item to the data associated with this Store. */ insert(values: Object): JQueryPromise; /** Returns the key expression specified via the key configuration option. */ @@ -340,7 +347,7 @@ declare module DevExpress { byKey?: (key: any) => Promise; /** * User implementation of the byKey(key, extraOptions) method. - * @deprecated Use "byKey" instead + * @deprecated byKey.md */ lookup?: (key: any) => Promise; /** The user implementation of the insert(values) method. */ @@ -379,6 +386,8 @@ declare module DevExpress { searchValue?: Object; /** Specifies the initial select option value. */ select?: Object; + /** An array of the strings that represent the names of the navigation properties to be loaded simultaneously with the OData store's entity. */ + expand?: Object; /** Specifies the initial sort option value. */ sort?: Object; /** Specifies the underlying Store instance used to access data. */ @@ -535,6 +544,8 @@ declare module DevExpress { constructor(options?: ODataStoreOptions); /** Creates the Query object for the OData endpoint. */ createQuery(loadOptions: Object): Object; + /** Returns the data item specified by the key. */ + byKey(key: any, extraOptions?: { expand?: Object }): JQueryPromise; } /** An universal chainable data query interface object. */ export interface Query { @@ -657,7 +668,7 @@ declare module DevExpress { items?: Array; /** * A function performed when a widget item is selected. - * @deprecated Use the 'onSelectionChanged' option instead + * @deprecated onSelectionChanged.md */ itemSelectAction?: Function; /** The template to be used for rendering items. */ @@ -713,11 +724,11 @@ declare module DevExpress { /** The template to be used for rendering items. */ itemTemplate?: any; /** The currently selected value in the widget. */ - value?: any; + value?: Object; } export interface EditorOptions extends WidgetOptions { /** The currently specified value. */ - value?: any; + value?: Object; /** A handler for the valueChanged event. */ onValueChanged?: Function; valueChangeAction?: Function; @@ -729,6 +740,8 @@ declare module DevExpress { isValid?: boolean; /** Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ validationMessageMode?: string; + /** Resets the editor's value to undefined. */ + reset(): void; } /** A base class for editors. */ export class Editor extends Widget { } @@ -817,6 +830,24 @@ declare module DevExpress.framework { /** Formats an object to a URI. */ format(obj: Object): string; } + export interface StateManagerOptions { + /** A storage to which the state manager saves the application state. */ + storage?: Object; + } + /** An object used to store the current application state. */ + export class StateManager { + constructor(options?: StateManagerOptions); + /** Adds an object that implements an interface of a state source to the state manager's collection of state sources. */ + addStateSource(stateSource: Object): void; + /** Removes a specified state source from the state manager's collection of state sources. */ + removeStateSource(stateSource: Object): void; + /** Saves the current application state. */ + saveState(): void; + /** Restores the application state that has been saved by the saveState() method to the state storage. */ + restoreState(): void; + /** Removes the application state that has been saved by the saveState() method to the state storage. */ + clearState(): void; + } export module html { export var layoutSets: Array; export interface HtmlApplicationOptions { @@ -824,7 +855,7 @@ declare module DevExpress.framework { commandMapping?: Object; /** * The name of the default layout used by the application. - * @deprecated Use the "navigationType" option instead. + * @deprecated navigationType.md */ defaultLayout?: string; /** Specifies whether or not view caching is disabled. */ @@ -839,14 +870,18 @@ declare module DevExpress.framework { navigateToRootViewMode?: string; /** An array of dxCommand configuration objects used to define commands available from the application's global navigation. */ navigation?: Array; + /** A state manager to be used in the application. */ + stateManager?: StateManager; + /** Specifies the storage to be used by the application's state manager to store the application state. */ + stateStorage?: Object; /** * Specifies a strategy for choosing layouts for views in your application. - * @deprecated Use the "layoutSet" option instead. + * @deprecated layoutSet.md */ navigationType?: string; /** * Specifies the object that represents the root namespace of the application. - * @deprecated Use the "namespace" option instead. + * @deprecated namespace.md */ ns?: Object; /** Indicates whether on not to use the title of the previously displayed view as text on the Back button. */ @@ -879,13 +914,15 @@ declare module DevExpress.framework { viewCache: ViewCache; /** An array of dxCommand components that are created based on the application's navigation option value. */ navigation: Array; + /** Provides access to the StateManager object. */ + stateManager: StateManager; /** Provides access to the Router object. */ router: Router; /** Navigates to the URI preceding the current one in the navigation history. */ back(): void; /** Returns a Boolean value indicating whether or not backwards navigation is currently possible. */ canBack(): boolean; - /** Removes the application state that has been saved by the saveState() method to the state storage. */ + /** Calls the clearState() method of the application's StateManager object. */ clearState(): void; /** Creates global navigation commands. */ createNavigation(navigationConfig: Array): void; @@ -899,9 +936,9 @@ declare module DevExpress.framework { navigate(uri?: any, options?: Object): void; /** Renders navigation commands to the navigation command containers that are located in the layouts used in the application. */ renderNavigation(): void; - /** Restores the application state that has been saved by the saveState() method to the state storage, and applies it to the application. */ + /** Calls the restoreState() method of the application's StateManager object. */ restoreState(): void; - /** Saves the current application state. */ + /** Calls the saveState method of the application's StateManager object. */ saveState(): void; /** Provides access to the object that defines the current context to be considered when choosing an appropriate template for a view. */ templateContext(): Object; @@ -1039,6 +1076,8 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxValidatorOptions); /** Validates the value of the editor that is controlled by the current dxValidator object against the list of the specified validation rules. */ validate(): validationEngine.ValidatorValidationResult; + /** Resets the value and validation result of the editor associated with the current dxValidator object. */ + reset(): void; } /** The widget that is used in the Knockout and Angular approaches to combine the editors to be validated. */ export class dxValidationGroup extends DOMComponent { @@ -1046,6 +1085,8 @@ declare module DevExpress.ui { constructor(element: Element); /** Validates rules of the validators that belong to the current validation group. */ validate(): validationEngine.ValidationGroupValidationResult; + /** Resets the value and validation result of the editors that are included to the current validation group. */ + reset(): void; } export interface dxValidationSummaryOptions extends CollectionWidgetOptions { /** Specifies the validation group for which summary should be generated. */ @@ -1082,6 +1123,15 @@ declare module DevExpress.ui { searchEnabled?: boolean; /** Specifies whether or not the widget displays items by pages. */ pagingEnabled?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** A handler for the itemClick event. */ + onItemClick?: Function; + onContentReady?: Function; + /** Specifies whether or not the widget supports the focused state and keyboard navigation. */ + focusStateEnabled?: boolean; } /** A base class for drop-down list widgets. */ export class dxDropDownList extends dxDropDownEditor { @@ -1160,12 +1210,19 @@ declare module DevExpress.ui { /** Specifies the current value displayed by the widget. */ value?: any; valueUpdateAction?: Function; - valueChangeAction?: Function; /** Specifies DOM event names that update a widget's value. */ valueChangeEvent?: string; valueUpdateEvent?: string; /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ spellcheck?: boolean; + /** Specifies HTML attributes applied to the inner input element of the widget. */ + attr?: Object; + /** The read-only option that holds the text displayed by the widget input element. */ + text?: string; + /** Specifies whether or not the widget supports the focused state and keyboard navigation. */ + focusStateEnabled?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; } /** A base class for text editing widgets. */ export class dxTextEditor extends Editor { @@ -1197,6 +1254,8 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxTextAreaOptions); } export interface dxTabsOptions extends CollectionWidgetOptions { + /** Specifies whether the widget enables an end-user to select only a single item or multiple items. */ + selectionMode?: string; /** Specifies whether or not an end-user can scroll tabs by swiping. */ scrollByContent?: boolean; /** Specifies whether or not an end-user can scroll tabs. */ @@ -1216,8 +1275,9 @@ declare module DevExpress.ui { onTitleHold?: Function; /** A handler for the titleRendered event. */ onTitleRendered?: Function; - /** A template to be used for rendering the widget title. */ titleTemplate?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; } /** A widget used to display a view and to switch between several views by clicking the appropriate tabs. */ export class dxTabPanel extends dxMultiView { @@ -1230,32 +1290,16 @@ declare module DevExpress.ui { /** The text that is provided as a hint in the select box editor. */ placeholder?: string; /** Specifies whether or not the widget allows an end-user to enter a custom value. */ - editEnabled?: boolean; + fieldEditEnabled?: boolean; } /** A widget that allows you to select an item in a dropdown list. */ export class dxSelectBox extends dxDropDownList { constructor(element: JQuery, options?: dxSelectBoxOptions); constructor(element: Element, options?: dxSelectBoxOptions); - /** Closes the drop-down editor. */ - close(): void; - /** Opens the drop-down editor. */ - open(): void; } export interface dxTagBoxOptions extends dxSelectBoxOptions { /** Holds the list of selected values. */ values?: Array; - /** Holds the last selected value. */ - value?: any; - /** A handler for the valueChanged event. */ - onValueChanged?: (e: { - component: dxTagBox; - element: JQuery; - model: Object; - value: Object; - values: Object; - itemData: Object; - jQueryEvent: JQueryEventObject; - }) => void; } /** A widget that allows you to select multiple items from a dropdown list. */ export class dxTagBox extends dxSelectBox { @@ -1310,6 +1354,12 @@ declare module DevExpress.ui { updateAction?: Function; /** Indicates whether to use native or simulated scrolling. */ useNative?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content swiping it up or down. */ + scrollByContent?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content using the scrollbar. */ + scrollByThumb?: boolean; } /** A widget used to display scrollable content. */ export class dxScrollable extends DOMComponent { @@ -1369,6 +1419,8 @@ declare module DevExpress.ui { width?: any; /** Specifies items displayed on the top or bottom toolbar of the popup window. */ buttons?: Array; + /** Specifies whether or not the widget displays the Close button. */ + showCloseButton?: boolean; /** A handler for the titleRendered event. */ onTitleRendered?: Function; } @@ -1396,6 +1448,8 @@ declare module DevExpress.ui { export class dxPopover extends dxPopup { constructor(element: JQuery, options?: dxPopoverOptions); constructor(element: Element, options?: dxPopoverOptions); + /** Displays the widget for the specified target element. */ + show(target?: any): JQueryPromise; } export interface dxOverlayOptions extends WidgetOptions { /** An object that defines the animation options of the widget. */ @@ -1449,13 +1503,15 @@ declare module DevExpress.ui { show(): JQueryPromise; /** Toggles the visibility of the widget. */ toggle(showing: boolean): JQueryPromise; + /** A static method that specifies the default z-index for all overlay widgets. */ + static baseZIndex(zIndex: number): void; } export interface dxNumberBoxOptions extends dxTextEditorOptions { /** The maximum value accepted by the number box. */ max?: number; /** The minimum value accepted by the number box. */ min?: number; - /** Specifies whether to show spin buttons. */ + /** Specifies whether or not to show spin buttons. */ showSpinButtons?: boolean; useTouchSpinButtons?: boolean; /** Specifies by which value the widget value changes when a spin button is clicked. */ @@ -1468,7 +1524,9 @@ declare module DevExpress.ui { constructor(element: JQuery, options?: dxNumberBoxOptions); constructor(element: Element, options?: dxNumberBoxOptions); } - export interface dxNavBarOptions extends dxTabsOptions { } + export interface dxNavBarOptions extends dxTabsOptions { + scrollingEnabled?: boolean; + } /** A widget that contains items used to navigate through application views. */ export class dxNavBar extends dxTabs { constructor(element: JQuery, options?: dxNavBarOptions); @@ -1526,7 +1584,7 @@ declare module DevExpress.ui { } /** * An object, a string, or an array specifying the location displayed at the center of the widget. - * @deprecated Use the 'center' option instead + * @deprecated center.md */ location?: { lat?: number; @@ -1586,8 +1644,8 @@ declare module DevExpress.ui { clearButtonText?: string; /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlaying window. */ closeOnOutsideClick?: any; - /** The text displayed on the Done button. */ - doneButtonText?: string; + /** The text displayed on the Apply button. */ + applyButtonText?: string; /** A Boolean value specifying whether or not to display the lookup in full-screen mode. */ fullScreen?: boolean; /** A Boolean value specifying whether or not to group widget items. */ @@ -1597,8 +1655,6 @@ declare module DevExpress.ui { groupTemplate?: any; /** The text displayed on the button used to load the next page from the data source. */ nextButtonText?: string; - /** The text or HTML markup displayed by the widget if there are no items satisfying the specified search condition. */ - noDataText?: string; /** A handler for the pageLoading event. */ onPageLoading?: Function; pageLoadingAction?: Function; @@ -1634,8 +1690,6 @@ declare module DevExpress.ui { shading?: boolean; /** Specifies whether to display the Cancel button in the lookup window. */ showCancelButton?: boolean; - /** Specifies whether to display the Done button in the lookup window. */ - showDoneButton?: boolean; /** A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. */ showNextButton?: boolean; /** The title of the lookup window. */ @@ -1649,10 +1703,11 @@ declare module DevExpress.ui { /** A handler for the valueChanged event. */ onValueChanged?: Function; contentReadyAction?: Function; - onContentReady?: Function; titleRender?: any; /** A handler for the titleRendered event. */ onTitleRendered?: Function; + /** Specifies whether or not the widget supports the focused state and keyboard navigation. */ + focusStateEnabled?: boolean; } /** A widget that allows a user to select predefined values from a lookup window. */ export class dxLookup extends dxDropDownList { @@ -1703,7 +1758,7 @@ declare module DevExpress.ui { deleteEnabled?: boolean; /** * A mode specifying how to delete a list item. - * @deprecated Use the "deleteType" option instead. + * @deprecated deleteType.md */ deleteMode?: string; /** Specifies the way a user can delete items from the list. */ @@ -1721,14 +1776,14 @@ declare module DevExpress.ui { selectionEnabled?: boolean; /** * A mode specifying how to select a list item. - * @deprecated Use the "selectionType" option instead. + * @deprecated selectionType.md */ selectionMode?: string; /** A type specifying how to select a list item. */ selectionType?: string; /** Specifies whether the item list represented by this widget is editable. */ editEnabled?: boolean; - /** Specifies whether or not to show the load panel during data loading. */ + /** Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data. */ indicateLoading?: boolean; }; /** A Boolean value specifying whether or not to display a grouped list. */ @@ -1736,6 +1791,7 @@ declare module DevExpress.ui { groupRender?: any; /** The name of the template used to display a group header. */ groupTemplate?: any; + onItemDeleting?: Function; /** A handler for the itemDeleted event. */ onItemDeleted?: Function; itemDeleteAction?: Function; @@ -1774,8 +1830,8 @@ declare module DevExpress.ui { selectionMode?: string; /** A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. */ showNextButton?: boolean; - /** A Boolean value specifying if the widget scrollbar is visible. */ - showScrollbar?: boolean; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; /** Specifies whether or not the widget uses native scrolling. */ useNativeScrolling?: boolean; itemUnselectAction?: Function; @@ -1831,7 +1887,7 @@ declare module DevExpress.ui { unselectItem(itemIndex: any): void; /** * Updates the widget scrollbar according to widget content size. - * @deprecated Use the "updateDimensions" method instead. + * @deprecated updateDimensions.md */ update(): JQueryPromise; /** Updates the widget scrollbar according to widget content size. */ @@ -1844,6 +1900,8 @@ declare module DevExpress.ui { export interface dxGalleryOptions extends CollectionWidgetOptions { /** The time, in milliseconds, spent on slide animation. */ animationDuration?: number; + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; /** A Boolean value specifying whether or not to allow users to switch between items by clicking an indicator. */ indicatorEnabled?: boolean; /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ @@ -1871,16 +1929,25 @@ declare module DevExpress.ui { prevItem(animation: boolean): JQueryPromise; } export interface dxDropDownEditorOptions extends dxTextBoxOptions { + /** Specifies the current value displayed by the widget. */ + value?: Object; /** A handler for the closed event. */ onClosed?: Function; /** A handler for the opened event. */ onOpened?: Function; - /** Specifies whether or not the drop-down window is displayed. */ + /** Specifies whether or not the drop-down editor is displayed. */ opened?: boolean; closeAction?: Function; openAction?: Function; shownAction?: Function; hiddenAction?: Function; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + fieldEditEnabled?: boolean; + editEnabled?: boolean; + /** Specifies the way an end-user applies the selected value. */ + applyValueMode?: string; + /** Specifies whether or not the widget supports the focused state and keyboard navigation. */ + focusStateEnabled?: boolean; } /** A drop-down editor widget. */ export class dxDropDownEditor extends dxTextBox { @@ -1890,12 +1957,10 @@ declare module DevExpress.ui { close(): void; /** Opens the drop-down editor. */ open(): void; + /** Resets the widget's value to null. */ + reset(): void; } export interface dxDateBoxOptions extends dxTextEditorOptions { - /** A dxCalendar configuration object used to initialize the drop-down calendar. */ - calendarOptions?: dxCalendarOptions; - /** Specifies whether or not to close the drop-down calendar when widget value has been changed. */ - closeOnValueChange?: boolean; /** A format used to display date/time information. */ format?: string; /** A Globalize format string specifying the date display format. */ @@ -1906,7 +1971,7 @@ declare module DevExpress.ui { min?: Date; /** The text displayed by the widget when the widget value is not yet specified. This text is also used as a title of the date picker. */ placeholder?: string; - /** Specifies whether or not a user can pick out a date via the drop-down calendar. */ + /** Specifies whether or not a user can pick out a date using the drop-down calendar. */ useCalendar?: boolean; /** A Date object specifying the date and time currently selected using the date box. */ value?: Date; @@ -1916,7 +1981,7 @@ declare module DevExpress.ui { interval?: number; } /** A date box widget. */ - export class dxDateBox extends dxTextEditor { + export class dxDateBox extends dxDropDownEditor { constructor(element: JQuery, options?: dxDateBoxOptions); constructor(element: Element, options?: dxDateBoxOptions); } @@ -1990,12 +2055,14 @@ declare module DevExpress.ui { /** Specifies the screen factor with which all elements are located in a single column. */ singleColumnScreen?: string; } - /** A widget used to build an adaptive markup dependent on screen resolution. */ + /** A widget used to build an adaptive markup that is dependent on screen resolution. */ export class dxResponsiveBox extends CollectionWidget { constructor(element: JQuery, options?: dxBoxOptions); constructor(element: Element, options?: dxBoxOptions); } export interface dxAutocompleteOptions extends dxDropDownListOptions { + /** Specifies the current value displayed by the widget. */ + value?: string; /** The minimum number of characters that must be entered into the text box to begin a search. */ minSearchLength?: number; /** Specifies the maximum count of items displayed by the widget. */ @@ -2041,21 +2108,11 @@ declare module DevExpress.ui { /** Expands the specified item. */ expandItem(index: number): JQueryPromise; } - export interface dxFileUploaderFile { - /** Specifies the selected file name. */ - name?: string; - /** Specifies the selected file size in bytes. */ - size?: number; - /** Specifies the MIME type of the selected file. */ - type?: string; - /** Specifies the date and time of the last selected file modification. */ - lastModifiedDate?: Date; - } export interface dxFileUploaderOptions extends EditorOptions { - /** An object that holds the selected file data. */ - value?: dxFileUploaderFile; - /** Holds data of the files selected in the widget. */ - values?: Array; + /** A read-only option that holds a File instance representing the selected file. */ + value?: File; + /** Holds the File instances representing files selected in the widget. */ + values?: Array; /** Specifies the text displayed on the button opening the file selection dialog. */ buttonText?: string; /** Specifies the text displayed on the area to which an end-user can drop a file. */ @@ -2093,7 +2150,7 @@ declare module DevExpress.ui { /** A handler for the complete event. */ onComplete?: Function; } - /** A widget used to indicate a progress. */ + /** A widget used to indicate progress. */ export class dxProgressBar extends dxTrackBar { constructor(element: JQuery, options?: dxProgressBarOptions); constructor(element: Element, options?: dxProgressBarOptions); @@ -2175,7 +2232,7 @@ declare module DevExpress.ui { constructor(element: JQuery, options?: dxSwitchOptions); constructor(element: Element, options?: dxSwitchOptions); } - export interface dxSlideoutOptions extends CollectionWidgetOptions { + export interface dxSlideOutOptions extends CollectionWidgetOptions { /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ activeStateEnabled?: boolean; /** A Boolean value specifying whether or not to display a grouped menu. */ @@ -2190,11 +2247,13 @@ declare module DevExpress.ui { menuVisible?: boolean; /** Indicates whether the menu can be shown/hidden by swiping the widget's main panel. */ swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; } - /** The dxSlideOut widget allows you to slide-out the current view to reveal an item list. */ + /** The widget that allows you to slide-out the current view to reveal an item list. */ export class dxSlideOut extends CollectionWidget { - constructor(element: JQuery, options?: dxSlideoutOptions); - constructor(element: Element, options?: dxSlideoutOptions); + constructor(element: JQuery, options?: dxSlideOutOptions); + constructor(element: Element, options?: dxSlideOutOptions); /** Hides the widget's slide-out menu. */ hideMenu(): JQueryPromise; /** Displays the widget's slide-out menu. */ @@ -2205,6 +2264,8 @@ declare module DevExpress.ui { export interface dxPivotOptions extends CollectionWidgetOptions { /** The index of the currently active pivot item. */ selectedIndex?: number; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; } /** A widget that is similar to a traditional tab control, but optimized for the phone with simplified end-user interaction. */ export class dxPivot extends CollectionWidget { @@ -2257,12 +2318,20 @@ declare module DevExpress.ui { popupWidth?: any; /** The height of the menu popup in pixels. */ popupHeight?: any; + /** Specifies whether or not the drop-down menu is displayed. */ + opened?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; } /** A drop-down menu widget. */ export class dxDropDownMenu extends Widget { constructor(element: JQuery, options?: dxDropDownEditorOptions); constructor(element: Element, options?: dxDropDownEditorOptions); /** This section lists the data source fields that are used in a default template for drop-down menu items. */ + /** Opens the drop-down menu. */ + open(): void; + /** Closes the drop-down menu. */ + close(): void; } export interface dxActionSheetOptions extends CollectionWidgetOptions { cancelClickAction?: any; @@ -2270,7 +2339,7 @@ declare module DevExpress.ui { onCancelClick?: any; /** The text displayed in the button that closes the action sheet. */ cancelText?: string; - /** Specifies whether to display the Cancel button in action sheet. */ + /** Specifies whether or not to display the Cancel button in action sheet. */ showCancelButton?: boolean; /** A Boolean value specifying whether or not the title of the action sheet is visible. */ showTitle?: boolean; @@ -2297,14 +2366,11 @@ declare module DevExpress.ui { export interface dxColorBoxOptions extends dxDropDownEditorOptions { /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ applyButtonText?: string; - /** Specifies whether the widget value is updated after the Apply button is clicked or immediately after a color is selected in the palette. */ applyValueMode?: string; /** Specifies the text displayed on the button that cancels changes and closes the drop-down editor. */ cancelButtonText?: string; /** Specifies whether or not the widget value includes the alpha channel component. */ editAlphaChannel?: boolean; - /** The color currently selected by the widget. */ - value?: string; } /** A widget used to specify a color value. */ export class dxColorBox extends dxDropDownEditor { @@ -2323,7 +2389,12 @@ declare module DevExpress.ui { export interface dxTreeViewOptions extends CollectionWidgetOptions { /** Specifies whether a nested or plain array is used as a data source. */ dataStructure?: string; - /** An array of currently expanded item objects. */ + /** Specifies whether or not a user can expand all tree view items by the "*" hot key. */ + expandAllEnabled?: boolean; + /** + * An array of currently expanded item objects. + * @deprecated Use item.expanded field instead + */ expandedItems?: Array; /** Specifies whether or not a check box is displayed at each tree view item. */ showCheckBoxes?: boolean; @@ -2345,6 +2416,7 @@ declare module DevExpress.ui { itemsExpr?: any; /** Specifies the name of the data source item field that holds the key of the parent item. */ parentIdExpr?: any; + disabledExpr?: any; /** A string value specifying available scrolling directions. */ scrollDirection?: string; /** A handler for the itemSelected event. */ @@ -2370,6 +2442,10 @@ declare module DevExpress.ui { collapseItem(itemElement: any): void; /** Returns all nodes of the tree view. */ getNodes(): Array; + /** Selects all widget items. */ + selectAll(): void; + /** Unselects all widget items. */ + unselectAll(): void; } export interface dxMenuBaseOptions extends CollectionWidgetOptions { /** An object that defines the animation options of the widget. */ @@ -2386,6 +2462,8 @@ declare module DevExpress.ui { selectionMode?: string; /** Specifies the user interaction by which submenus are shown. */ showSubmenuMode?: string; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; } export class dxMenuBase extends CollectionWidget { constructor(element: JQuery, options?: dxMenuBaseOptions); @@ -2402,8 +2480,6 @@ declare module DevExpress.ui { /** Specifies by which user interaction the first-level submenu is shown. */ showFirstSubmenuMode?: string; showPopupMode?: string; - /** Specifies by which user interaction secondary-level submenus are shown. */ - showSubmenuMode?: string; /** Specifies the direction at which the submenus are displayed. */ submenuDirection?: string; /** A handler for the submenuHidden event. */ @@ -2445,8 +2521,6 @@ declare module DevExpress.ui { positioningAction?: Function; showingAction?: Function; shownAction?: Function; - /** Specifies by which user interaction the context menu is shown. */ - showSubmenuMode?: string; /** Specifies the direction at which submenus are displayed. */ submenuDirection?: string; /** The target element associated with a popover. */ @@ -2458,6 +2532,12 @@ declare module DevExpress.ui { export class dxContextMenu extends dxMenuBase { constructor(element: JQuery, options?: dxContextMenuOptions); constructor(element: Element, options?: dxContextMenuOptions); + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Hides the widget. */ + hide(): JQueryPromise; } export interface dxRemoteOperations { /** Specifies whether or not filtering must be performed on the server side. */ @@ -2973,9 +3053,7 @@ Specifies the message displayed in a group row when the corresponding group cont /** Specifies whether text that does not fit into a column should be wrapped. */ wordWrapEnabled?: boolean; } - /** -A data grid widget. - */ + /** A data grid widget. */ export class dxDataGrid extends Widget { constructor(element: JQuery, options?: dxDataGridOptions); constructor(element: Element, options?: dxDataGridOptions); @@ -3070,6 +3148,7 @@ Searches grid records by a search string. searchByText(text: string): void; /** Selects all grid records. */ selectAll(): void; + deselectAll(): void; /** Selects specific grid records. */ selectRows(keys: Array, preserve: boolean): void; /** Deselects specific grid records. */ @@ -3100,8 +3179,13 @@ declare module DevExpress.viz.charts { type: string; /** Unselects all the selected points of the series. The points are displayed in an initial style. */ clearSelection(): void; - /** Gets a point from the series point collection based on the specified argument. */ + /** + * Gets a point from the series point collection based on the specified argument. + * @deprecated getPointsByArg(pointArg).md + */ getPointByArg(pointArg: any): Object; + /** Gets points from the series point collection based on the specified argument. */ + getPointsByArg(pointArg: any): Array; /** Gets a point from the series point collection based on the specified point position. */ getPointByPos(positionIndex: number): Object; /** Selects the series. The series is displayed in a 'selected' style until another series is selected or the current series is deselected programmatically. */ @@ -3239,8 +3323,6 @@ declare module DevExpress.viz.charts { } /** This section describes the methods that can be used in code to manipulate the Point object. */ export interface PolarPoint extends BasePoint { - /** Gets the parameters of the point's minimum bounding rectangle (MBR). */ - getBoundingRect(): Object; series: PolarSeries; } export interface Strip { @@ -3624,8 +3706,6 @@ declare module DevExpress.viz.charts { tagField?: string; /** Specifies the data source field that provides values for series points. */ valueField?: string; - /** Specifies the required type for series values. */ - valueType?: string; } export interface PieSeriesConfig extends CommonPieSeriesConfig { /** Sets the series type. */ @@ -3648,8 +3728,12 @@ declare module DevExpress.viz.charts { font?: viz.core.Font; /** Specifies the position of the constant line label relative to the chart plot. */ position?: string; + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; } export interface PolarCommonConstantLineLabel { + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; /** Specifies font options for a constant line label. */ font?: viz.core.Font; } @@ -3865,6 +3949,8 @@ declare module DevExpress.viz.charts { minorTickCount?: number; /** Specifies the required type of the value axis. */ type?: string; + /** Specifies the pane on which the current value axis will be displayed. */ + pane?: string; /** Specifies options for value axis strips. */ strips?: Array; } @@ -4285,6 +4371,10 @@ declare module DevExpress.viz.charts { export interface PieLegend extends core.BaseLegend { /** Specifies what chart elements to highlight when a corresponding item in the legend is hovered over. */ hoverMode?: string; + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + /** Specifies a callback function that returns the text to be displayed by a legend item. */ + customizeText?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; } export interface dxPieChartOptions extends BaseChartOptions { /** Specifies adaptive layout options. */ @@ -4375,7 +4465,7 @@ declare module DevExpress.viz.core { /** Specifies a color for the tooltip. */ color?: string; customizeText?: Function; - /** Allows you to change the appearance of particular tooltips. */ + /** Specifies text and appearance of a particular set of tooltips. */ customizeTooltip?: (arg: Object) => { color?: string; text?: string }; /** Specifies whether or not the tooltip is enabled. */ enabled?: boolean; @@ -4575,52 +4665,49 @@ declare module DevExpress.viz.gauges { /** Specifies the start value for the scale of the gauge. */ startValue?: number; } - export interface BaseSubvalueIndicator { - /** Specifies the length of an arrow for the subvalue indicator of the textCloud type in pixels. */ - arrowLength?: number; - /** Specifies the color of a subvalue indicator. */ - color?: string; - /** Specifies the length for a subvalue indicator of the triangleMarker type in pixels. */ - length?: number; - /** Sets the array of colors to be used for coloring the subvalue indicators. */ - palette?: Array; - /** Specifies the appearance of the text displayed in a subvalue indicator of the textCloud type. */ - text?: Object; - /** Specifies a callback function that returns the text to be displayed in a subvalue indicator of the textCloud type. */ - customizeText?: (indicatedSubvalue: { value: number; valueText: string }) => string; - /** Specifies font options for the text displayed by a subvalue indicator of the textCloud type. */ - font?: viz.core.Font; - /** Specifies a format for the text displayed in a subvalue indicator of the textCloud type. */ - format?: string; - /** Specifies a precision for the formatted value displayed in a subvalue indicator of the textCloud type. */ - precision?: number; - /** Overriden by descriptions for specific widgets. */ - type?: string; - /** Specifies the width for a subvalue indicator of the triangleMarker type in pixels. */ - width?: number; - } export interface BaseValueIndicator { - /** Specifies the background color for the value indicator of the rangeBar type. */ + /** Specifies the type of subvalue indicators. */ + type?: string; + /** Specifies the background color for the indicator of the rangeBar type. */ backgroundColor?: string; - /** Specifies the base value for the value indicator of the rangeBar type. */ + /** Specifies the base value for the indicator of the rangeBar type. */ baseValue?: number; - /** Specifies the color of the value indicator. */ + /** Specifies a color of the indicator. */ color?: string; - /** Specifies the range bar size for a value indicator of the rangeBar type. */ + /** Specifies the range bar size for an indicator of the rangeBar type. */ size?: number; - /** Specifies the appearance of the text displayed in a value indicator of the rangeBar type. */ text?: { - /** Specifies a callback function that returns the text to be displayed in a value indicator of the rangeBar type. */ + /** Specifies a callback function that returns the text to be displayed in an indicator. */ customizeText?: (indicatedValue: { value: number; valueText: string }) => string; - /** Specifies font options for the text displayed by a value indicator of the rangeBar type. */ font?: viz.core.Font; - /** Specifies a format for the text displayed in a value indicator of the rangeBar type. */ + /** Specifies a format for the text displayed in an indicator. */ format?: string; /** Specifies the range bar's label indent in pixels. */ indent?: number; - /** Specifies a precision for the formatted value displayed by a value indicator of the rangeBar type. */ + /** Specifies a precision for the formatted value displayed by an indicator. */ precision?: number; }; + offset?: number; + length?: number; + width?: number; + /** Specifies the length of an arrow for the indicator of the textCloud type in pixels. */ + arrowLength?: number; + /** Sets the array of colors to be used for coloring subvalue indicators. */ + palette?: Array; + /** Specifies the distance between the needle and the center of a gauge for the indicator of a needle-like type. */ + indentFromCenter?: number; + /** Specifies the second color for the indicator of the twoColorNeedle type. */ + secondColor?: string; + /** Specifies the length of a twoNeedleColor type indicator tip as a percentage. */ + secondFraction?: number; + /** Specifies the spindle's diameter in pixels for the indicator of a needle-like type. */ + spindleSize?: number; + /** Specifies the inner diameter in pixels, so that the spindle has the shape of a ring. */ + spindleGapSize?: number; + /** Specifies the orientation of the rangeBar indicator on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of the rangeBar indicator on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; } export interface SharedGaugeOptions { /** Specifies animation options. */ @@ -4662,7 +4749,7 @@ declare module DevExpress.viz.gauges { /** Specifies a gauge's scale options. */ scale?: BaseScale; /** Specifies the appearance options of subvalue indicators. */ - subvalueIndicator?: BaseSubvalueIndicator; + subvalueIndicator?: BaseValueIndicator; /** Specifies a set of subvalues to be designated by the subvalue indicators. */ subvalues?: Array; /** Specifies the main value on a gauge. */ @@ -4710,28 +4797,6 @@ declare module DevExpress.viz.gauges { /** Specifies the orientation of scale ticks on a horizontally oriented dxLinearGauge widget. */ verticalOrientation?: string; } - export interface LinearSubvalueIndicator extends BaseSubvalueIndicator { - /** Specifies the orientation of the subvalue indicators on a vertically oriented dxLinearGauge widget. */ - horizontalOrientation?: string; - /** Specifies the distance between a subvalue indicator and an invisible scale line in pixels. */ - offset?: number; - /** Specifies the orientation of the subvalue indicators on a horizontally oriented dxLinearGauge widget. */ - verticalOrientation?: string; - } - export interface LinearValueIndicator extends BaseValueIndicator { - /** Specifies the orientation of the rangeBar value indicator on a vertically oriented dxLinearGauge widget. */ - horizontalOrientation?: string; - /** Specifies the length of a value indicator in pixels. */ - length?: number; - /** Specifies the distance between a value indicator and an invisible scale line. */ - offset?: number; - /** Specifies the type of the value indicator. */ - type?: string; - /** Specifies the orientation of the rangeBar value indicator on a horizontally oriented dxLinearGauge widget. */ - verticalOrientation?: string; - /** Specifies the width of a value indicator in pixels. */ - width?: number; - } export interface dxLinearGaugeOptions extends BaseGaugeOptions { /** Specifies the options required to set the geometry of the dxLinearGauge widget. */ geometry?: { @@ -4741,8 +4806,6 @@ declare module DevExpress.viz.gauges { /** Specifies gauge range container options. */ rangeContainer?: LinearRangeContainer; scale?: LinearScale; - subvalueIndicator?: LinearSubvalueIndicator; - valueIndicator?: LinearValueIndicator; } /** A widget that represents a gauge with a linear scale. */ export class dxLinearGauge extends dxBaseGauge { @@ -4764,28 +4827,6 @@ declare module DevExpress.viz.gauges { /** Specifies the orientation of scale ticks. */ orientation?: string; } - export interface CircularSubvalueIndicator extends BaseSubvalueIndicator { - /** Specifies the distance between a subvalue indicator and an invisible scale line in pixels. */ - offset?: number; - } - export interface CircularValueIndicator extends BaseValueIndicator { - /** Specifies the distance between the needle and the center of a gauge for the value indicator of needle-like types. */ - indentFromCenter?: number; - /** Specifies the distance between the value indicator and the invisible scale line. */ - offset?: number; - /** Specifies the second color for the value indicator of the twoColorNeedle type. */ - secondColor?: string; - /** Specifies the length of a twoNeedleColor type value indicator tip as a percentage. */ - secondFraction?: number; - /** Specifies the inner diameter in pixels, so that the spindle has the shape of a ring. */ - spindleGapSize?: number; - /** Specifies the spindle's diameter in pixels for the value indicator of a needle-like type. */ - spindleSize?: number; - /** Specifies the value indicator type. */ - type?: string; - /** Specifies, in pixels, the width for a value indicator of a needle-like type. */ - width?: number; - } export interface dxCircularGaugeOptions extends BaseGaugeOptions { /** Specifies the options required to set the geometry of the dxCircularGauge widget. */ geometry?: { @@ -4797,8 +4838,6 @@ declare module DevExpress.viz.gauges { /** Specifies gauge range container options. */ rangeContainer?: CircularRangeContainer; scale?: CircularScale; - subvalueIndicator?: CircularSubvalueIndicator; - valueIndicator?: CircularValueIndicator; } /** A widget that represents a gauge with a circular scale. */ export class dxCircularGauge extends dxBaseGauge { @@ -5478,165 +5517,268 @@ declare module DevExpress.viz.sparklines { } } interface JQuery { - dxProgressBar(options?: DevExpress.ui.dxProgressBarOptions): JQuery; - dxProgressBar(methodName: string, ...params: any[]): any; - dxProgressBar(methodName: "instance"): DevExpress.ui.dxProgressBar; - dxSlider(options?: DevExpress.ui.dxSliderOptions): JQuery; - dxSlider(methodName: string, ...params: any[]): any; - dxSlider(methodName: "instance"): DevExpress.ui.dxSlider; - dxRangeSlider(options?: DevExpress.ui.dxRangeSliderOptions): JQuery; - dxRangeSlider(methodName: string, ...params: any[]): any; - dxRangeSlider(methodName: "instance"): DevExpress.ui.dxRangeSlider; - dxFileUploader(options?: DevExpress.ui.dxFileUploaderOptions): JQuery; - dxFileUploader(methodName: string, ...params: any[]): any; - dxFileUploader(methodName: "instance"): DevExpress.ui.dxFileUploader; + dxProgressBar(): JQuery; + dxProgressBar(options: "instance"): DevExpress.ui.dxProgressBar; + dxProgressBar(options: string): any; + dxProgressBar(options: string, ...params: any[]): any; + dxProgressBar(options: DevExpress.ui.dxProgressBarOptions): JQuery; + dxSlider(): JQuery; + dxSlider(options: "instance"): DevExpress.ui.dxSlider; + dxSlider(options: string): any; + dxSlider(options: string, ...params: any[]): any; + dxSlider(options: DevExpress.ui.dxSliderOptions): JQuery; + dxRangeSlider(): JQuery; + dxRangeSlider(options: "instance"): DevExpress.ui.dxRangeSlider; + dxRangeSlider(options: string): any; + dxRangeSlider(options: string, ...params: any[]): any; + dxRangeSlider(options: DevExpress.ui.dxRangeSliderOptions): JQuery; + dxFileUploader(): JQuery; + dxFileUploader(options: "instance"): DevExpress.ui.dxFileUploader; + dxFileUploader(options: string): any; + dxFileUploader(options: string, ...params: any[]): any; + dxFileUploader(options: DevExpress.ui.dxFileUploaderOptions): JQuery; dxValidator(): JQuery; - dxValidator(methodName: string, ...params: any[]): any; - dxValidator(methodName: "instance"): DevExpress.ui.dxValidator; - dxValidatonGroup(): JQuery; - dxValidatonGroup(methodName: string, ...params: any[]): any; - dxValidatonGroup(methodName: "instance"): DevExpress.ui.dxValidationGroup; + dxValidator(options: "instance"): DevExpress.ui.dxValidator; + dxValidator(options: string): any; + dxValidator(options: string, ...params: any[]): any; + dxValidationGroup(): JQuery; + dxValidationGroup(options: "instance"): DevExpress.ui.dxValidationGroup; + dxValidationGroup(options: string): any; + dxValidationGroup(options: string, ...params: any[]): any; dxValidationSummary(): JQuery; - dxValidationSummary(methodName: string, ...params: any[]): any; - dxValidationSummary(methodName: "instance"): DevExpress.ui.dxValidationSummary; - dxTooltip(options?: DevExpress.ui.dxTooltipOptions): JQuery; - dxTooltip(methodName: string, ...params: any[]): any; - dxTooltip(methodName: "instance"): DevExpress.ui.dxTooltip; - dxDropDownList(options?: DevExpress.ui.dxDropDownListOptions): JQuery; - dxDropDownList(methodName: string, ...params: any[]): any; - dxDropDownList(methodName: "instance"): DevExpress.ui.dxDropDownList; - dxToolbar(options?: DevExpress.ui.dxToolbarOptions): JQuery; - dxToolbar(methodName: string, ...params: any[]): any; - dxToolbar(methodName: "instance"): DevExpress.ui.dxToolbar; - dxToast(options?: DevExpress.ui.dxToastOptions): JQuery; - dxToast(methodName: string, ...params: any[]): any; - dxToast(methodName: "instance"): DevExpress.ui.dxToast; - dxTextEditor(options?: DevExpress.ui.dxTextEditorOptions): JQuery; - dxTextEditor(methodName: string, ...params: any[]): any; - dxTextEditor(methodName: "instance"): DevExpress.ui.dxTextEditor; - dxTextBox(options?: DevExpress.ui.dxTextBoxOptions): JQuery; - dxTextBox(methodName: string, ...params: any[]): any; - dxTextBox(methodName: "instance"): DevExpress.ui.dxTextBox; - dxTextArea(options?: DevExpress.ui.dxTextAreaOptions): JQuery; - dxTextArea(methodName: string, ...params: any[]): any; - dxTextArea(methodName: "instance"): DevExpress.ui.dxTextArea; - dxTabs(options?: DevExpress.ui.dxTabsOptions): JQuery; - dxTabs(methodName: string, ...params: any[]): any; - dxTabs(methodName: "instance"): DevExpress.ui.dxTabs; - dxTabPanel(options?: DevExpress.ui.dxTabPanelOptions): JQuery; - dxTabPanel(methodName: string, ...params: any[]): any; - dxTabPanel(methodName: "instance"): DevExpress.ui.dxTabPanel; - dxSelectBox(options?: DevExpress.ui.dxSelectBoxOptions): JQuery; - dxSelectBox(methodName: string, ...params: any[]): any; - dxSelectBox(methodName: "instance"): DevExpress.ui.dxSelectBox; - dxScrollView(options?: DevExpress.ui.dxScrollViewOptions): JQuery; - dxScrollView(methodName: string, ...params: any[]): any; - dxScrollView(methodName: "instance"): DevExpress.ui.dxScrollView; - dxScrollable(options?: DevExpress.ui.dxScrollableOptions): JQuery; - dxScrollable(methodName: string, ...params: any[]): any; - dxScrollable(methodName: "instance"): DevExpress.ui.dxScrollable; - dxRadioGroup(options?: DevExpress.ui.dxRadioGroupOptions): JQuery; - dxRadioGroup(methodName: string, ...params: any[]): any; - dxRadioGroup(methodName: "instance"): DevExpress.ui.dxRadioGroup; - dxPopup(options?: DevExpress.ui.dxPopupOptions): JQuery; - dxPopup(methodName: string, ...params: any[]): any; - dxPopup(methodName: "instance"): DevExpress.ui.dxPopup; - dxPopover(options?: DevExpress.ui.dxPopoverOptions): JQuery; - dxPopover(methodName: string, ...params: any[]): any; - dxPopover(methodName: "instance"): DevExpress.ui.dxPopover; - dxOverlay(options?: DevExpress.ui.dxOverlayOptions): JQuery; - dxOverlay(methodName: string, ...params: any[]): any; - dxOverlay(methodName: "instance"): DevExpress.ui.dxOverlay; - dxNumberBox(options?: DevExpress.ui.dxNumberBoxOptions): JQuery; - dxNumberBox(methodName: string, ...params: any[]): any; - dxNumberBox(methodName: "instance"): DevExpress.ui.dxNumberBox; - dxNavBar(options?: DevExpress.ui.dxNavBarOptions): JQuery; - dxNavBar(methodName: string, ...params: any[]): any; - dxNavBar(methodName: "instance"): DevExpress.ui.dxNavBar; - dxMultiView(options?: DevExpress.ui.dxMultiViewOptions): JQuery; - dxMultiView(methodName: string, ...params: any[]): any; - dxMultiView(methodName: "instance"): DevExpress.ui.dxMultiView; - dxMap(options?: DevExpress.ui.dxMapOptions): JQuery; - dxMap(methodName: string, ...params: any[]): any; - dxMap(methodName: "instance"): DevExpress.ui.dxMap; - dxLookup(options?: DevExpress.ui.dxLookupOptions): JQuery; - dxLookup(methodName: string, ...params: any[]): any; - dxLookup(methodName: "instance"): DevExpress.ui.dxLookup; - dxLoadPanel(options?: DevExpress.ui.dxLoadPanelOptions): JQuery; - dxLoadPanel(methodName: string, ...params: any[]): any; - dxLoadPanel(methodName: "instance"): DevExpress.ui.dxLoadPanel; - dxLoadIndicator(options?: DevExpress.ui.dxLoadIndicatorOptions): JQuery; - dxLoadIndicator(methodName: string, ...params: any[]): any; - dxLoadIndicator(methodName: "instance"): DevExpress.ui.dxLoadIndicator; - dxList(options?: DevExpress.ui.dxListOptions): JQuery; - dxList(methodName: string, ...params: any[]): any; - dxList(methodName: "instance"): DevExpress.ui.dxList; - dxGallery(options?: DevExpress.ui.dxGalleryOptions): JQuery; - dxGallery(methodName: string, ...params: any[]): any; - dxGallery(methodName: "instance"): DevExpress.ui.dxGallery; - dxDropDownEditor(options?: DevExpress.ui.dxDropDownEditorOptions): JQuery; - dxDropDownEditor(methodName: string, ...params: any[]): any; - dxDropDownEditor(methodName: "instance"): DevExpress.ui.dxDropDownEditor; - dxDateBox(options?: DevExpress.ui.dxDateBoxOptions): JQuery; - dxDateBox(methodName: string, ...params: any[]): any; - dxDateBox(methodName: "instance"): DevExpress.ui.dxDateBox; - dxCheckBox(options?: DevExpress.ui.dxCheckBoxOptions): JQuery; - dxCheckBox(methodName: string, ...params: any[]): any; - dxCheckBox(methodName: "instance"): DevExpress.ui.dxCheckBox; - dxBox(options?: DevExpress.ui.dxBoxOptions): JQuery; - dxBox(methodName: string, ...params: any[]): any; - dxBox(methodName: "instance"): DevExpress.ui.dxBox; - dxButton(options?: DevExpress.ui.dxButtonOptions): JQuery; - dxButton(methodName: string, ...params: any[]): any; - dxButton(methodName: "instance"): DevExpress.ui.dxButton; - dxCalendar(options?: DevExpress.ui.dxCalendarOptions): JQuery; - dxCalendar(methodName: string, ...params: any[]): any; - dxCalendar(methodName: "instance"): DevExpress.ui.dxCalendar; - dxAccordion(options?: DevExpress.ui.dxAccordionOptions): JQuery; - dxAccordion(methodName: string, ...params: any[]): any; - dxAccordion(methodName: "instance"): DevExpress.ui.dxAccordion; - dxAutocomplete(options?: DevExpress.ui.dxAutocompleteOptions): JQuery; - dxAutocomplete(methodName: string, ...params: any[]): any; - dxAutocomplete(methodName: "instance"): DevExpress.ui.dxAutocomplete; - dxTileView(options?: DevExpress.ui.dxTileViewOptions): JQuery; - dxTileView(methodName: string, ...params: any[]): any; - dxTileView(methodName: "instance"): DevExpress.ui.dxTileView; - dxSwitch(options?: DevExpress.ui.dxSwitchOptions): JQuery; - dxSwitch(methodName: string, ...params: any[]): any; - dxSwitch(methodName: "instance"): DevExpress.ui.dxSwitch; - dxSlideOut(options?: DevExpress.ui.dxSlideoutOptions): JQuery; - dxSlideOut(methodName: string, ...params: any[]): any; - dxSlideOut(methodName: "instance"): DevExpress.ui.dxSlideOut; - dxPivot(options?: DevExpress.ui.dxPivotOptions): JQuery; - dxPivot(methodName: string, ...params: any[]): any; - dxPivot(methodName: "instance"): DevExpress.ui.dxPivot; - dxPanorama(options?: DevExpress.ui.dxPanoramaOptions): JQuery; - dxPanorama(methodName: string, ...params: any[]): any; - dxPanorama(methodName: "instance"): DevExpress.ui.dxPanorama; - dxActionSheet(options?: DevExpress.ui.dxActionSheetOptions): JQuery; - dxActionSheet(methodName: string, ...params: any[]): any; - dxActionSheet(methodName: "instance"): DevExpress.ui.dxActionSheet; - dxDropDownMenu(options?: DevExpress.ui.dxDropDownMenuOptions): JQuery; - dxDropDownMenu(methodName: string, ...params: any[]): any; - dxDropDownMenu(methodName: "instance"): DevExpress.ui.dxDropDownMenu; - dxTreeView(options?: DevExpress.ui.dxTreeViewOptions): JQuery; - dxTreeView(methodName: string, ...params: any[]): any; - dxTreeView(methodName: "instance"): DevExpress.ui.dxTreeView; - dxMenuBase(options?: DevExpress.ui.dxMenuBaseOptions): JQuery; - dxMenuBase(methodName: string, ...params: any[]): any; - dxMenuBase(methodName: "instance"): DevExpress.ui.dxMenuBase; - dxMenu(options?: DevExpress.ui.dxMenuOptions): JQuery; - dxMenu(methodName: string, ...params: any[]): any; - dxMenu(methodName: "instance"): DevExpress.ui.dxMenu; - dxContextMenu(options?: DevExpress.ui.dxContextMenuOptions): JQuery; - dxContextMenu(methodName: string, ...params: any[]): any; - dxContextMenu(methodName: "instance"): DevExpress.ui.dxContextMenu; - dxColorBox(options?: DevExpress.ui.dxColorBoxOptions): JQuery; - dxColorBox(methodName: string, ...params: any[]): any; - dxColorBox(methodName: "instance"): DevExpress.ui.dxColorBox; - dxDataGrid(options?: DevExpress.ui.dxDataGridOptions): JQuery; - dxDataGrid(methodName: string, ...params: any[]): any; - dxDataGrid(methodName: "instance"): DevExpress.ui.dxDataGrid; + dxValidationSummary(options: "instance"): DevExpress.ui.dxValidationSummary; + dxValidationSummary(options: string): any; + dxValidationSummary(options: string, ...params: any[]): any; + dxTooltip(): JQuery; + dxTooltip(options: "instance"): DevExpress.ui.dxTooltip; + dxTooltip(options: string): any; + dxTooltip(options: string, ...params: any[]): any; + dxTooltip(options: DevExpress.ui.dxTooltipOptions): JQuery; + dxDropDownList(): JQuery; + dxDropDownList(options: "instance"): DevExpress.ui.dxDropDownList; + dxDropDownList(options: string): any; + dxDropDownList(options: string, ...params: any[]): any; + dxDropDownList(options: DevExpress.ui.dxDropDownListOptions): JQuery; + dxToolbar(): JQuery; + dxToolbar(options: "instance"): DevExpress.ui.dxToolbar; + dxToolbar(options: string): any; + dxToolbar(options: string, ...params: any[]): any; + dxToolbar(options: DevExpress.ui.dxToolbarOptions): JQuery; + dxToast(): JQuery; + dxToast(options: "instance"): DevExpress.ui.dxToast; + dxToast(options: string): any; + dxToast(options: string, ...params: any[]): any; + dxToast(options: DevExpress.ui.dxToastOptions): JQuery; + dxTextEditor(): JQuery; + dxTextEditor(options: "instance"): DevExpress.ui.dxTextEditor; + dxTextEditor(options: string): any; + dxTextEditor(options: string, ...params: any[]): any; + dxTextEditor(options: DevExpress.ui.dxTextEditorOptions): JQuery; + dxTextBox(): JQuery; + dxTextBox(options: "instance"): DevExpress.ui.dxTextBox; + dxTextBox(options: string): any; + dxTextBox(options: string, ...params: any[]): any; + dxTextBox(options: DevExpress.ui.dxTextBoxOptions): JQuery; + dxTextArea(): JQuery; + dxTextArea(options: "instance"): DevExpress.ui.dxTextArea; + dxTextArea(options: string): any; + dxTextArea(options: string, ...params: any[]): any; + dxTextArea(options: DevExpress.ui.dxTextAreaOptions): JQuery; + dxTabs(): JQuery; + dxTabs(options: "instance"): DevExpress.ui.dxTabs; + dxTabs(options: string): any; + dxTabs(options: string, ...params: any[]): any; + dxTabs(options: DevExpress.ui.dxTabsOptions): JQuery; + dxTabPanel(): JQuery; + dxTabPanel(options: "instance"): DevExpress.ui.dxTabPanel; + dxTabPanel(options: string): any; + dxTabPanel(options: string, ...params: any[]): any; + dxTabPanel(options: DevExpress.ui.dxTabPanelOptions): JQuery; + dxSelectBox(): JQuery; + dxSelectBox(options: "instance"): DevExpress.ui.dxSelectBox; + dxSelectBox(options: string): any; + dxSelectBox(options: string, ...params: any[]): any; + dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery; + dxScrollView(): JQuery; + dxScrollView(options: "instance"): DevExpress.ui.dxScrollView; + dxScrollView(options: string): any; + dxScrollView(options: string, ...params: any[]): any; + dxScrollView(options: DevExpress.ui.dxScrollViewOptions): JQuery; + dxScrollable(): JQuery; + dxScrollable(options: "instance"): DevExpress.ui.dxScrollable; + dxScrollable(options: string): any; + dxScrollable(options: string, ...params: any[]): any; + dxScrollable(options: DevExpress.ui.dxScrollableOptions): JQuery; + dxRadioGroup(): JQuery; + dxRadioGroup(options: "instance"): DevExpress.ui.dxRadioGroup; + dxRadioGroup(options: string): any; + dxRadioGroup(options: string, ...params: any[]): any; + dxRadioGroup(options: DevExpress.ui.dxRadioGroupOptions): JQuery; + dxPopup(): JQuery; + dxPopup(options: "instance"): DevExpress.ui.dxPopup; + dxPopup(options: string): any; + dxPopup(options: string, ...params: any[]): any; + dxPopup(options: DevExpress.ui.dxPopupOptions): JQuery; + dxPopover(): JQuery; + dxPopover(options: "instance"): DevExpress.ui.dxPopover; + dxPopover(options: string): any; + dxPopover(options: string, ...params: any[]): any; + dxPopover(options: DevExpress.ui.dxPopoverOptions): JQuery; + dxOverlay(): JQuery; + dxOverlay(options: "instance"): DevExpress.ui.dxOverlay; + dxOverlay(options: string): any; + dxOverlay(options: string, ...params: any[]): any; + dxOverlay(options: DevExpress.ui.dxOverlayOptions): JQuery; + dxNumberBox(): JQuery; + dxNumberBox(options: "instance"): DevExpress.ui.dxNumberBox; + dxNumberBox(options: string): any; + dxNumberBox(options: string, ...params: any[]): any; + dxNumberBox(options: DevExpress.ui.dxNumberBoxOptions): JQuery; + dxNavBar(): JQuery; + dxNavBar(options: "instance"): DevExpress.ui.dxNavBar; + dxNavBar(options: string): any; + dxNavBar(options: string, ...params: any[]): any; + dxNavBar(options: DevExpress.ui.dxNavBarOptions): JQuery; + dxMultiView(): JQuery; + dxMultiView(options: "instance"): DevExpress.ui.dxMultiView; + dxMultiView(options: string): any; + dxMultiView(options: string, ...params: any[]): any; + dxMultiView(options: DevExpress.ui.dxMultiViewOptions): JQuery; + dxMap(): JQuery; + dxMap(options: "instance"): DevExpress.ui.dxMap; + dxMap(options: string): any; + dxMap(options: string, ...params: any[]): any; + dxMap(options: DevExpress.ui.dxMapOptions): JQuery; + dxLookup(): JQuery; + dxLookup(options: "instance"): DevExpress.ui.dxLookup; + dxLookup(options: string): any; + dxLookup(options: string, ...params: any[]): any; + dxLookup(options: DevExpress.ui.dxLookupOptions): JQuery; + dxLoadPanel(): JQuery; + dxLoadPanel(options: "instance"): DevExpress.ui.dxLoadPanel; + dxLoadPanel(options: string): any; + dxLoadPanel(options: string, ...params: any[]): any; + dxLoadPanel(options: DevExpress.ui.dxLoadPanelOptions): JQuery; + dxLoadIndicator(): JQuery; + dxLoadIndicator(options: "instance"): DevExpress.ui.dxLoadIndicator; + dxLoadIndicator(options: string): any; + dxLoadIndicator(options: string, ...params: any[]): any; + dxLoadIndicator(options: DevExpress.ui.dxLoadIndicatorOptions): JQuery; + dxList(): JQuery; + dxList(options: "instance"): DevExpress.ui.dxList; + dxList(options: string): any; + dxList(options: string, ...params: any[]): any; + dxList(options: DevExpress.ui.dxListOptions): JQuery; + dxGallery(): JQuery; + dxGallery(options: "instance"): DevExpress.ui.dxGallery; + dxGallery(options: string): any; + dxGallery(options: string, ...params: any[]): any; + dxGallery(options: DevExpress.ui.dxGalleryOptions): JQuery; + dxDropDownEditor(): JQuery; + dxDropDownEditor(options: "instance"): DevExpress.ui.dxDropDownEditor; + dxDropDownEditor(options: string): any; + dxDropDownEditor(options: string, ...params: any[]): any; + dxDropDownEditor(options: DevExpress.ui.dxDropDownEditorOptions): JQuery; + dxDateBox(): JQuery; + dxDateBox(options: "instance"): DevExpress.ui.dxDateBox; + dxDateBox(options: string): any; + dxDateBox(options: string, ...params: any[]): any; + dxDateBox(options: DevExpress.ui.dxDateBoxOptions): JQuery; + dxCheckBox(): JQuery; + dxCheckBox(options: "instance"): DevExpress.ui.dxCheckBox; + dxCheckBox(options: string): any; + dxCheckBox(options: string, ...params: any[]): any; + dxCheckBox(options: DevExpress.ui.dxCheckBoxOptions): JQuery; + dxBox(): JQuery; + dxBox(options: "instance"): DevExpress.ui.dxBox; + dxBox(options: string): any; + dxBox(options: string, ...params: any[]): any; + dxBox(options: DevExpress.ui.dxBoxOptions): JQuery; + dxButton(): JQuery; + dxButton(options: "instance"): DevExpress.ui.dxButton; + dxButton(options: string): any; + dxButton(options: string, ...params: any[]): any; + dxButton(options: DevExpress.ui.dxButtonOptions): JQuery; + dxCalendar(): JQuery; + dxCalendar(options: "instance"): DevExpress.ui.dxCalendar; + dxCalendar(options: string): any; + dxCalendar(options: string, ...params: any[]): any; + dxCalendar(options: DevExpress.ui.dxCalendarOptions): JQuery; + dxAccordion(): JQuery; + dxAccordion(options: "instance"): DevExpress.ui.dxAccordion; + dxAccordion(options: string): any; + dxAccordion(options: string, ...params: any[]): any; + dxAccordion(options: DevExpress.ui.dxAccordionOptions): JQuery; + dxAutocomplete(): JQuery; + dxAutocomplete(options: "instance"): DevExpress.ui.dxAutocomplete; + dxAutocomplete(options: string): any; + dxAutocomplete(options: string, ...params: any[]): any; + dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; + dxTileView(): JQuery; + dxTileView(options: "instance"): DevExpress.ui.dxTileView; + dxTileView(options: string): any; + dxTileView(options: string, ...params: any[]): any; + dxTileView(options: DevExpress.ui.dxTileViewOptions): JQuery; + dxSwitch(): JQuery; + dxSwitch(options: "instance"): DevExpress.ui.dxSwitch; + dxSwitch(options: string): any; + dxSwitch(options: string, ...params: any[]): any; + dxSwitch(options: DevExpress.ui.dxSwitchOptions): JQuery; + dxSlideOut(): JQuery; + dxSlideOut(options: "instance"): DevExpress.ui.dxSlideOut; + dxSlideOut(options: string): any; + dxSlideOut(options: string, ...params: any[]): any; + dxSlideOut(options: DevExpress.ui.dxSlideOutOptions): JQuery; + dxPivot(): JQuery; + dxPivot(options: "instance"): DevExpress.ui.dxPivot; + dxPivot(options: string): any; + dxPivot(options: string, ...params: any[]): any; + dxPivot(options: DevExpress.ui.dxPivotOptions): JQuery; + dxPanorama(): JQuery; + dxPanorama(options: "instance"): DevExpress.ui.dxPanorama; + dxPanorama(options: string): any; + dxPanorama(options: string, ...params: any[]): any; + dxPanorama(options: DevExpress.ui.dxPanoramaOptions): JQuery; + dxActionSheet(): JQuery; + dxActionSheet(options: "instance"): DevExpress.ui.dxActionSheet; + dxActionSheet(options: string): any; + dxActionSheet(options: string, ...params: any[]): any; + dxActionSheet(options: DevExpress.ui.dxActionSheetOptions): JQuery; + dxDropDownMenu(): JQuery; + dxDropDownMenu(options: "instance"): DevExpress.ui.dxDropDownMenu; + dxDropDownMenu(options: string): any; + dxDropDownMenu(options: string, ...params: any[]): any; + dxDropDownMenu(options: DevExpress.ui.dxDropDownMenuOptions): JQuery; + dxTreeView(): JQuery; + dxTreeView(options: "instance"): DevExpress.ui.dxTreeView; + dxTreeView(options: string): any; + dxTreeView(options: string, ...params: any[]): any; + dxTreeView(options: DevExpress.ui.dxTreeViewOptions): JQuery; + dxMenuBase(): JQuery; + dxMenuBase(options: "instance"): DevExpress.ui.dxMenuBase; + dxMenuBase(options: string): any; + dxMenuBase(options: string, ...params: any[]): any; + dxMenuBase(options: DevExpress.ui.dxMenuBaseOptions): JQuery; + dxMenu(): JQuery; + dxMenu(options: "instance"): DevExpress.ui.dxMenu; + dxMenu(options: string): any; + dxMenu(options: string, ...params: any[]): any; + dxMenu(options: DevExpress.ui.dxMenuOptions): JQuery; + dxContextMenu(): JQuery; + dxContextMenu(options: "instance"): DevExpress.ui.dxContextMenu; + dxContextMenu(options: string): any; + dxContextMenu(options: string, ...params: any[]): any; + dxContextMenu(options: DevExpress.ui.dxContextMenuOptions): JQuery; + dxColorBox(): JQuery; + dxColorBox(options: "instance"): DevExpress.ui.dxColorBox; + dxColorBox(options: string): any; + dxColorBox(options: string, ...params: any[]): any; + dxColorBox(options: DevExpress.ui.dxColorBoxOptions): JQuery; + dxDataGrid(): JQuery; + dxDataGrid(options: "instance"): DevExpress.ui.dxDataGrid; + dxDataGrid(options: string): any; + dxDataGrid(options: string, ...params: any[]): any; + dxDataGrid(options: DevExpress.ui.dxDataGridOptions): JQuery; dxChart(options?: DevExpress.viz.charts.dxChartOptions): JQuery; dxChart(methodName: string, ...params: any[]): any; dxChart(methodName: "instance"): DevExpress.viz.charts.dxChart; From 8636f410705b4dc1a68ac9a9526a5256db872f2d Mon Sep 17 00:00:00 2001 From: Igor Kriklivets Date: Wed, 3 Jun 2015 12:19:16 +0300 Subject: [PATCH 388/534] Fix for previous commit --- devextreme/dx.devextreme.d.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/devextreme/dx.devextreme.d.ts b/devextreme/dx.devextreme.d.ts index f2b6a9048..a1d361f54 100644 --- a/devextreme/dx.devextreme.d.ts +++ b/devextreme/dx.devextreme.d.ts @@ -740,11 +740,12 @@ declare module DevExpress { isValid?: boolean; /** Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ validationMessageMode?: string; - /** Resets the editor's value to undefined. */ - reset(): void; } /** A base class for editors. */ - export class Editor extends Widget { } + export class Editor extends Widget { + /** Resets the editor's value to undefined. */ + reset(): void; + } /** An object that serves as a namespace for methods displaying a message in an application/site. */ export var dialog: { /** Creates an alert dialog message containing a single "OK" button. */ From 45c923a5f8426b93b07dfab456004879001a3cf7 Mon Sep 17 00:00:00 2001 From: Eik Date: Wed, 3 Jun 2015 14:11:42 +0200 Subject: [PATCH 389/534] Corrected an issue that didn't allow me to use an extended PageableCollection in a Marionette.compositeView. --- backbone.paginator/backbone.paginator.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backbone.paginator/backbone.paginator.d.ts b/backbone.paginator/backbone.paginator.d.ts index 6eb560cc8..eb0a71962 100644 --- a/backbone.paginator/backbone.paginator.d.ts +++ b/backbone.paginator/backbone.paginator.d.ts @@ -52,7 +52,7 @@ declare module Backbone { type PageableGetPageOptions = CollectionFetchOptions|Silenceable; - class PageableCollection extends Collection{ + class PageableCollection extends Collection{ fullCollection: Collection; mode: string; From 5fdac5f3478e1691eca2f33a8db19454bb7d9f0c Mon Sep 17 00:00:00 2001 From: Josh Petersen Date: Wed, 3 Jun 2015 09:34:42 -0400 Subject: [PATCH 390/534] added definitions and tests for project xlsx https://github.com/SheetJS/js-xlsx --- xlsx/xlsx-tests.ts | 26 +++++++++ xlsx/xlsx.d.ts | 136 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 xlsx/xlsx-tests.ts create mode 100644 xlsx/xlsx.d.ts diff --git a/xlsx/xlsx-tests.ts b/xlsx/xlsx-tests.ts new file mode 100644 index 000000000..7a4054626 --- /dev/null +++ b/xlsx/xlsx-tests.ts @@ -0,0 +1,26 @@ +/// +import xlsx = require('xlsx'); + +var options:xlsx.IParsingOptions = { + cellDates:true +}; + +var workbook = xlsx.readFile('test.xlsx', options); +var otherworkbook = xlsx.readFile('test.xlsx', {type: 'file'}); + +console.log(workbook.Props.Author); + +var firstsheet:string = workbook.SheetNames[0]; + +var firstworksheet = workbook.Sheets[firstsheet]; + +console.log(firstworksheet["A1"]); + +interface tester { + name:string; + age: number; +} + +var jsonvalues:tester[] = xlsx.utils.sheet_to_json(firstworksheet); +var csv = xlsx.utils.sheet_to_csv(firstworksheet); +var formulae = xlsx.utils.sheet_to_formulae(firstworksheet); diff --git a/xlsx/xlsx.d.ts b/xlsx/xlsx.d.ts new file mode 100644 index 000000000..16df800dd --- /dev/null +++ b/xlsx/xlsx.d.ts @@ -0,0 +1,136 @@ +// Type definitions for xlsx +// Project: https://github.com/SheetJS/js-xlsx +// Definitions by: themauveavenger +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'xlsx' { + + export function readFile(filename:string, opts?:IParsingOptions):IWorkBook; + export function read(data:any, opts?:IParsingOptions):IWorkBook; + export var utils:IUtils; + + export interface IProperties { + LastAuthor?:string + Author?:string; + CreatedDate?:Date; + ModifiedDate?:Date + Application?:string; + AppVersion?:string; + Company?:string; + DocSecurity?:string; + Manager?:string; + HyperlinksChanged?: boolean; + SharedDoc?:boolean; + LinksUpToDate?:boolean; + ScaleCrop?:boolean; + Worksheets?:number; + SheetNames?:string[]; + } + + export interface IParsingOptions { + cellFormula?:boolean; + cellHTML?:boolean; + cellNF?:boolean; + cellStyles?:boolean; + cellDates?:boolean; + sheetStubs?:boolean; + sheetRows?:number; + bookDeps?:boolean; + bookFiles?:boolean; + bookProps?:boolean; + bookSheets?:boolean; + bookVBA?:boolean; + password?:string; + + /** + * Possible options: 'binary', 'base64', 'buffer', 'file' + */ + type?:string; + } + + export interface IWorkBook { + /** + * A dictionary of the worksheets in the workbook. + * Use SheetNames to reference these. + */ + Sheets:{[sheet:string]:IWorkSheet}; + + /** + * ordered list of the sheet names in the workbook + */ + SheetNames:string[]; + + /** + * an object storing the standard properties. wb.Custprops stores custom properties. + * Since the XLS standard properties deviate from the XLSX standard, XLS parsing stores core properties in both places. + */ + Props:IProperties; + } + + /** + * object representing the worksheet + */ + export interface IWorkSheet { + [cell:string]:IWorkSheetCell; + } + + export interface IWorkSheetCell { + /** + * The Excel Data Type of the cell. + * b Boolean, n Number, e error, s String, d Date + */ + t: string; + + /** + * The raw value of the cell. + */ + v: string; + + /** + * rich text encoding (if applicable) + */ + r?: string; + + /** + * HTML rendering of the rich text (if applicable) + */ + h?: string; + + /** + * formatted text (if applicable) + */ + w?: string; + + /** + * cell formula (if applicable) + */ + f?: string; + + /** + * comments associated with the cell ** + */ + c?: string; + + /** + * number format string associated with the cell (if requested) + */ + z?: string; + + /** + * cell hyperlink object (.Target holds link, .tooltip is tooltip) + */ + l?: string; + + /** + * the style/theme of the cell (if applicable) + */ + s?: string; + } + + export interface IUtils { + sheet_to_json(worksheet:IWorkSheet|IWorkBook):T[]; + sheet_to_csv(worksheet:IWorkSheet):any; + sheet_to_formulae(worksheet:IWorkSheet):any; + } + +} From c8436fbe1eb00d52f7ed123311a64d5bded7ee87 Mon Sep 17 00:00:00 2001 From: Luzian Zagadinow Date: Wed, 3 Jun 2015 10:29:07 -0400 Subject: [PATCH 391/534] removed extraneous files --- node-calendar/.gitignore | 4 ---- node-calendar/package.json | 14 -------------- 2 files changed, 18 deletions(-) delete mode 100644 node-calendar/.gitignore delete mode 100755 node-calendar/package.json diff --git a/node-calendar/.gitignore b/node-calendar/.gitignore deleted file mode 100644 index 76136c9e9..000000000 --- a/node-calendar/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.js -tsconfig.json -node_modules -.settings \ No newline at end of file diff --git a/node-calendar/package.json b/node-calendar/package.json deleted file mode 100755 index 8cc162a95..000000000 --- a/node-calendar/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "node-calendar.d.ts", - "version": "0.0.1", - "description": "Type definitions for node-calendar v0.1.4", - "main": "node-calendar-tests", - "scripts": { - "test": "node node-calendar-tests" - }, - "author": "Luzian Zagadinow (https://github.com/luzianz)", - "license": "MIT", - "dependencies": { - "node-calendar": "^0.1.4" - } -} \ No newline at end of file From 265b807686458b8a3adeab00ecba82b99927ca53 Mon Sep 17 00:00:00 2001 From: Josh Heyse Date: Wed, 3 Jun 2015 11:56:52 -0500 Subject: [PATCH 392/534] added username to facebook profile --- passport-facebook/passport-facebook.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/passport-facebook/passport-facebook.d.ts b/passport-facebook/passport-facebook.d.ts index 855b033f5..26479cc29 100644 --- a/passport-facebook/passport-facebook.d.ts +++ b/passport-facebook/passport-facebook.d.ts @@ -13,6 +13,7 @@ declare module 'passport-facebook' { interface Profile extends passport.Profile { gender: string; profileUrl: string; + username: string; } interface IStrategyOption { From 4ad9034a401094b53bb01ae1ed113b401f128e43 Mon Sep 17 00:00:00 2001 From: Olivier Foissac Date: Wed, 3 Jun 2015 18:57:03 +0200 Subject: [PATCH 393/534] * Add comments from https://developers.google.com/maps/documentation/javascript/3.19/reference on MarkerOptions, Symbol, SymbolPath, InfoWindow, InfoWindowOptions, LatLng, Point. * Add missing interface google.maps.Icon. --- googlemaps/google.maps-tests.ts | 13 +- googlemaps/google.maps.d.ts | 212 ++++++++++++++++++++++++++++++-- 2 files changed, 214 insertions(+), 11 deletions(-) diff --git a/googlemaps/google.maps-tests.ts b/googlemaps/google.maps-tests.ts index 1079f78b2..23931850d 100644 --- a/googlemaps/google.maps-tests.ts +++ b/googlemaps/google.maps-tests.ts @@ -104,4 +104,15 @@ var removePropertyEvent: google.maps.Data.RemovePropertyEvent = { feature: feature, name: "test", oldValue: {} -}; \ No newline at end of file +}; + + +/***** Overlays *****/ + +var icon: google.maps.Icon = { + anchor: new google.maps.Point(16, 16), + origin: new google.maps.Point(0, 0), + scaledSize: new google.maps.Size(32, 32), + size: new google.maps.Size(32, 32), + url: "dummy" +} \ No newline at end of file diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index fe4e7459c..ecf319c83 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -397,23 +397,86 @@ declare module google.maps { } export interface MarkerOptions { + /** Which animation to play when marker is added to a map. */ animation?: Animation; + /** + * If true, the marker receives mouse and touch events. + * @default true + */ clickable?: boolean; + /** Mouse cursor to show on hover. */ cursor?: string; + /** + * If true, the marker can be dragged. + * @default false + */ draggable?: boolean; flat?: boolean; + /** + * Icon for the foreground. + * If a string is provided, it is treated as though it were an Icon with the string as url. + * @type {(string|Icon|Symbol)} + */ icon?: any; + /** + * Map on which to display Marker. + * @type {(Map|StreetViewPanorama)} + */ map?: any; + /** + * Optimization renders many markers as a single static element. + * Optimized rendering is enabled by default. + * Disable optimized rendering for animated GIFs or PNGs, or when each marker must be rendered + * as a separate DOM element (advanced usage only). + */ optimized?: boolean; + /** + * Marker position. Required. + */ position?: LatLng; raiseOnDrag?: boolean; shadow?: any; + /** Image map region definition used for drag/click. */ shape?: MarkerShape; + /** Rollover text. */ title?: string; + /** If true, the marker is visible. */ visible?: boolean; + /** + * All markers are displayed on the map in order of their zIndex, + * with higher values displaying in front of markers with lower values. + * By default, markers are displayed according to their vertical position on screen, + * with lower markers appearing in front of markers further up the screen. + */ zIndex?: number; } + export interface Icon { + /** + * The position at which to anchor an image in correspondence to the location of the marker on the map. + * By default, the anchor is located along the center point of the bottom of the image. + */ + anchor?: Point; + /** + * The position of the image within a sprite, if any. + * By default, the origin is located at the top left corner of the image (0, 0). + */ + origin?: Point; + /** + * The size of the entire image after scaling, if any. + * Use this property to stretch/ shrink an image or a sprite. + */ + scaledSize?: Size; + /** + * The display size of the sprite or image. + * When using sprites, you must specify the sprite size. + * If the size is not provided, it will be set when the image loads. + */ + size?: Size; + /** The URL of the image or sprite sheet. */ + url?: string; + } + export class MarkerImage { constructor (url: string, size?: Size, origin?: Point, anchor?: Point, scaledSize?: Size); anchor: Point; @@ -429,22 +492,68 @@ declare module google.maps { } export interface Symbol { + /** + * The position of the symbol relative to the marker or polyline. + * The coordinates of the symbol's path are translated left and up by the anchor's x and y coordinates respectively. + * By default, a symbol is anchored at (0, 0). + * The position is expressed in the same coordinate system as the symbol's path. + */ anchor?: Point; + /** + * The symbol's fill color. + * All CSS3 colors are supported except for extended named colors. For symbol markers, this defaults to 'black'. + * For symbols on polylines, this defaults to the stroke color of the corresponding polyline. + */ fillColor?: string; + /** + * The symbol's fill opacity. + * @default 0 + */ fillOpacity?: number; + /** + * The symbol's path, which is a built-in symbol path, or a custom path expressed using SVG path notation. Required. + * @type {(SymbolPath|string)} + */ path?: any; + /** + * The angle by which to rotate the symbol, expressed clockwise in degrees. + * Defaults to 0. + * A symbol in an IconSequence where fixedRotation is false is rotated relative to the angle of the edge on which it lies. + */ rotation?: number; + /** + * The amount by which the symbol is scaled in size. + * For symbol markers, this defaults to 1; after scaling, the symbol may be of any size. + * For symbols on a polyline, this defaults to the stroke weight of the polyline; + * after scaling, the symbol must lie inside a square 22 pixels in size centered at the symbol's anchor. + */ scale?: number; + /** + * The symbol's stroke color. All CSS3 colors are supported except for extended named colors. + * For symbol markers, this defaults to 'black'. + * For symbols on a polyline, this defaults to the stroke color of the polyline. + */ strokeColor?: string; + /** + * The symbol's stroke opacity. For symbol markers, this defaults to 1. + * For symbols on a polyline, this defaults to the stroke opacity of the polyline. + */ strokeOpacity?: number; + /** The symbol's stroke weight. Defaults to the scale of the symbol.v*/ strokeWeight?: number; } + /** Built-in symbol paths. */ export enum SymbolPath { + /** A backward-pointing closed arrow. */ BACKWARD_CLOSED_ARROW, + /** A backward-pointing open arrow. */ BACKWARD_OPEN_ARROW, + /** A circle. */ CIRCLE, + /** A forward-pointing closed arrow. */ FORWARD_CLOSED_ARROW, + /** A forward-pointing open arrow. */ FORWARD_OPEN_ARROW } @@ -453,13 +562,33 @@ declare module google.maps { DROP } + /** + * An overlay that looks like a bubble and is often connected to a marker. + * This class extends MVCObject. + */ export class InfoWindow extends MVCObject { - constructor (opts?: InfoWindowOptions); + /** + * Creates an info window with the given options. + * An InfoWindow can be placed on a map at a particular position or above a marker, + * depending on what is specified in the options. + * Unless auto-pan is disabled, an InfoWindow will pan the map to make itself visible when it is opened. + * After constructing an InfoWindow, you must call open to display it on the map. + * The user can click the close button on the InfoWindow to remove it from the map, or the developer can call close() for the same effect. + */ + constructor(opts?: InfoWindowOptions); + /** Closes this InfoWindow by removing it from the DOM structure. */ close(): void; getContent(): any; // string or Element getPosition(): LatLng; getZIndex(): number; open(map?: Map, anchor?: MVCObject): void; + /** + * Opens this InfoWindow on the given map. Optionally, an InfoWindow can be associated with an anchor. + * In the core API, the only anchor is the Marker class. + * However, an anchor can be any MVCObject that exposes a LatLng position property and optionally + * a Point anchorPoint property for calculating the pixelOffset (see InfoWindowOptions). + * The anchorPoint is the offset from the anchor's position to the tip of the InfoWindow. + */ open(map?: StreetViewPanorama, anchor?: MVCObject): void; setContent(content: Node): void; setContent(content: string): void; @@ -469,11 +598,40 @@ declare module google.maps { } export interface InfoWindowOptions { + /** + * Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. + * The InfoWindow will be sized according to the content. + * To set an explicit size for the content, set content to be a HTML element with that size. + * @type {(string|Node)} + */ content?: any; + /** + * Disable auto-pan on open. By default, the info window will pan the map so that it is fully visible when it opens. + */ disableAutoPan?: boolean; + /** + * Maximum width of the infowindow, regardless of content's width. + * This value is only considered if it is set before a call to open. + * To change the maximum width when changing content, call close, setOptions, and then open. + */ maxWidth?: number; + /** + * The offset, in pixels, of the tip of the info window from the point on the map + * at whose geographical coordinates the info window is anchored. + * If an InfoWindow is opened with an anchor, the pixelOffset will be calculated from the anchor's anchorPoint property. + */ pixelOffset?: Size; + /** + * The LatLng at which to display this InfoWindow. If the InfoWindow is opened with an anchor, the anchor's position will be used instead. + */ position?: LatLng; + /** + * All InfoWindows are displayed on the map in order of their zIndex, + * with higher values displaying in front of InfoWindows with lower values. + * By default, InfoWindows are displayed according to their latitude, + * with InfoWindows of lower latitudes appearing in front of InfoWindows at higher latitudes. + * InfoWindows are always displayed in front of markers. + */ zIndex?: number; } @@ -1356,15 +1514,43 @@ declare module google.maps { latLng: LatLng; } - /***** Base *****/ - export class LatLng { - constructor (lat: number, lng: number, noWrap?: boolean); - equals(other: LatLng): boolean; - lat(): number; - lng(): number; - toString(): string; - toUrlValue(precision?: number): string; + /* **** Base **** */ + /** + * A LatLng is a point in geographical coordinates: latitude and longitude. + * + * * Latitude ranges between -90 and 90 degrees, inclusive. + * Values above or below this range will be clamped to the range [-90, 90]. + * This means that if the value specified is less than -90, it will be set to -90. + * And if the value is greater than 90, it will be set to 90. + * * Longitude ranges between -180 and 180 degrees, inclusive. + * Values above or below this range will be wrapped so that they fall within the range. + * For example, a value of -190 will be converted to 170. A value of 190 will be converted to -170. + * This reflects the fact that longitudes wrap around the globe. + * + * Although the default map projection associates longitude with the x-coordinate of the map, and latitude with the y-coordinate, + * the latitude coordinate is always written first, followed by the longitude. + * Notice that you cannot modify the coordinates of a LatLng. If you want to compute another point, you have to create a new one. + */ + export class LatLng { + /** + * Creates a LatLng object representing a geographic point. + * Note the ordering of latitude and longitude. + * @param lat Latitude is specified in degrees within the range [-90, 90]. + * @param lng Longitude is specified in degrees within the range [-180, 180]. + * @param noWrap Set noWrap to true to enable values outside of this range. + */ + constructor(lat: number, lng: number, noWrap?: boolean); + /** Comparison function. */ + equals(other: LatLng): boolean; + /** Returns the latitude in degrees. */ + lat(): number; + /** Returns the longitude in degrees. */ + lng(): number; + /** Converts to string representation. */ + toString(): string; + /** Returns a string of the form "lat,lng". We round the lat/lng values to 6 decimal places by default. */ + toUrlValue(precision?: number): string; } export class LatLngBounds { @@ -1383,11 +1569,17 @@ declare module google.maps { union(other: LatLngBounds): LatLngBounds; } + export class Point { - constructor (x: number, y: number); + /** A point on a two-dimensional plane. */ + constructor(x: number, y: number); + /** The X coordinate */ x: number; + /** The Y coordinate */ y: number; + /** Compares two Points */ equals(other: Point): boolean; + /** Returns a string representation of this Point. */ toString(): string; } From 3bf10e44d143f27b549986d617f37def4c7530ba Mon Sep 17 00:00:00 2001 From: Josh Heyse Date: Wed, 3 Jun 2015 11:57:24 -0500 Subject: [PATCH 394/534] added passport-google-oauth definitions --- .../passport-google-oauth-tests.ts | 38 ++++++++++++ .../passport-google-oauth.d.ts | 60 +++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 passport-google-oauth/passport-google-oauth-tests.ts create mode 100644 passport-google-oauth/passport-google-oauth.d.ts diff --git a/passport-google-oauth/passport-google-oauth-tests.ts b/passport-google-oauth/passport-google-oauth-tests.ts new file mode 100644 index 000000000..60fad97b4 --- /dev/null +++ b/passport-google-oauth/passport-google-oauth-tests.ts @@ -0,0 +1,38 @@ +/** + * Created by jcabresos on 4/19/2014. + */ +import passport = require('passport'); +import google = require('passport-google-oauth'); + +// just some test model +var User = { + findOrCreate(id:string, provider:string, callback:(err:any, user:any) => void): void { + callback(null, {username:'james'}); + } +} + +passport.use(new google.OAuthStrategy({ + consumerKey: process.env.GOOGLE_CONSUMER_KEY, + consumerSecret: process.env.GOOGLE_CONSUMER_SECRET, + callbackURL: process.env.PASSPORT_GOOGLE_CALLBACK_URL + }, + function(accessToken:string, refreshToken:string, profile:google.Profile, done:(error:any, user?:any) => void) { + User.findOrCreate(profile.id, profile.provider, function(err, user) { + if (err) { return done(err); } + done(null, user); + }); + }) +); + +passport.use(new google.OAuth2Strategy({ + clientID: process.env.GOOGLE_CLIENT_ID, + clientSecret: process.env.GOOGLE_CLIENT_SECRET, + callbackURL: process.env.PASSPORT_GOOGLE_CALLBACK_URL + }, + function(accessToken:string, refreshToken:string, profile:google.Profile, done:(error:any, user?:any) => void) { + User.findOrCreate(profile.id, profile.provider, function(err, user) { + if (err) { return done(err); } + done(null, user); + }); + }) +); diff --git a/passport-google-oauth/passport-google-oauth.d.ts b/passport-google-oauth/passport-google-oauth.d.ts new file mode 100644 index 000000000..ea6c1e91a --- /dev/null +++ b/passport-google-oauth/passport-google-oauth.d.ts @@ -0,0 +1,60 @@ +// Type definitions for passport-facebook 1.0.3 +// Project: https://github.com/jaredhanson/passport-facebook +// Definitions by: James Roland Cabresos +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'passport-google-oauth' { + + import passport = require('passport'); + import express = require('express'); + + interface Profile extends passport.Profile { + gender: string; + } + + interface IOAuthStrategyOption { + consumerKey: string; + consumerSecret: string; + callbackURL: string; + + reguestTokenURL?: string; + accessTokenURL?: string; + userAuthorizationURL?: string; + sessionKey?: string; + } + + class OAuthStrategy implements passport.Strategy { + constructor(options: IOAuthStrategyOption, + verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void); + name: string; + authenticate: (req: express.Request, options?: Object) => void; + } + + interface IOAuth2StrategyOption { + clientID: string; + clientSecret: string; + callbackURL: string; + + authorizationURL?: string; + tokenURL?: string; + + accessType?: string; + approval_prompt?: string; + prompt?: string; + loginHint?: string; + userID?: string; + hostedDomain?: string; + display?: string; + requestVisibleActions?: string; + openIDRealm?: string; + } + + class OAuth2Strategy implements passport.Strategy { + constructor(options: IOAuth2StrategyOption, + verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void); + name: string; + authenticate: (req: express.Request, options?: Object) => void; + } +} From ca327372d6e390c5406cbab28b90934eaf883093 Mon Sep 17 00:00:00 2001 From: Josh Heyse Date: Wed, 3 Jun 2015 11:58:03 -0500 Subject: [PATCH 395/534] added passport-twitter definitions --- passport-twitter/passport-twitter-tests.ts | 25 +++++++++++++++ passport-twitter/passport-twitter.d.ts | 37 ++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 passport-twitter/passport-twitter-tests.ts create mode 100644 passport-twitter/passport-twitter.d.ts diff --git a/passport-twitter/passport-twitter-tests.ts b/passport-twitter/passport-twitter-tests.ts new file mode 100644 index 000000000..3abead1b2 --- /dev/null +++ b/passport-twitter/passport-twitter-tests.ts @@ -0,0 +1,25 @@ +/** + * Created by jcabresos on 4/19/2014. + */ +import passport = require('passport'); +import twitter = require('passport-twitter'); + +// just some test model +var User = { + findOrCreate(id:string, provider:string, callback:(err:any, user:any) => void): void { + callback(null, {username:'james'}); + } +} + +passport.use(new twitter.Strategy({ + clientID: process.env.PASSPORT_FACEBOOK_CLIENT_ID, + clientSecret: process.env.PASSPORT_FACEBOOK_CLIENT_SECRET, + callbackURL: process.env.PASSPORT_FACEBOOK_CALLBACK_URL + }, + function(accessToken:string, refreshToken:string, profile:twitter.Profile, done:(error:any, user?:any) => void) { + User.findOrCreate(profile.id, profile.provider, function(err, user) { + if (err) { return done(err); } + done(null, user); + }); + }) +); diff --git a/passport-twitter/passport-twitter.d.ts b/passport-twitter/passport-twitter.d.ts new file mode 100644 index 000000000..22e292acf --- /dev/null +++ b/passport-twitter/passport-twitter.d.ts @@ -0,0 +1,37 @@ +// Type definitions for passport-facebook 1.0.3 +// Project: https://github.com/jaredhanson/passport-facebook +// Definitions by: James Roland Cabresos +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module 'passport-twitter' { + + import passport = require('passport'); + import express = require('express'); + + interface Profile extends passport.Profile { + gender: string; + } + + interface IStrategyOption { + consumerKey: string; + consumerSecret: string; + callbackURL: string; + + reguestTokenURL?: string; + accessTokenURL?: string; + userAuthorizationURL?: string; + sessionKey?: string; + + userProfileURL?: string; + skipExtendedUserProfile?: boolean; + } + + class Strategy implements passport.Strategy { + constructor(options: IStrategyOption, + verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void); + name: string; + authenticate: (req: express.Request, options?: Object) => void; + } +} From a1915bad2e932a2be44a718818c3b5286793f26c Mon Sep 17 00:00:00 2001 From: Josh Heyse Date: Wed, 3 Jun 2015 12:35:10 -0500 Subject: [PATCH 396/534] fixed twitter tests, added _raw and _json properties --- passport-facebook/passport-facebook.d.ts | 3 +++ passport-google-oauth/passport-google-oauth.d.ts | 3 +++ passport-twitter/passport-twitter-tests.ts | 6 +++--- passport-twitter/passport-twitter.d.ts | 5 +++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/passport-facebook/passport-facebook.d.ts b/passport-facebook/passport-facebook.d.ts index 26479cc29..b3adaf860 100644 --- a/passport-facebook/passport-facebook.d.ts +++ b/passport-facebook/passport-facebook.d.ts @@ -14,6 +14,9 @@ declare module 'passport-facebook' { gender: string; profileUrl: string; username: string; + + _raw: string; + _json: any; } interface IStrategyOption { diff --git a/passport-google-oauth/passport-google-oauth.d.ts b/passport-google-oauth/passport-google-oauth.d.ts index ea6c1e91a..27744021f 100644 --- a/passport-google-oauth/passport-google-oauth.d.ts +++ b/passport-google-oauth/passport-google-oauth.d.ts @@ -12,6 +12,9 @@ declare module 'passport-google-oauth' { interface Profile extends passport.Profile { gender: string; + + _raw: string; + _json: any; } interface IOAuthStrategyOption { diff --git a/passport-twitter/passport-twitter-tests.ts b/passport-twitter/passport-twitter-tests.ts index 3abead1b2..ae644dfa2 100644 --- a/passport-twitter/passport-twitter-tests.ts +++ b/passport-twitter/passport-twitter-tests.ts @@ -12,9 +12,9 @@ var User = { } passport.use(new twitter.Strategy({ - clientID: process.env.PASSPORT_FACEBOOK_CLIENT_ID, - clientSecret: process.env.PASSPORT_FACEBOOK_CLIENT_SECRET, - callbackURL: process.env.PASSPORT_FACEBOOK_CALLBACK_URL + consumerKey: process.env.PASSPORT_TWITTER_CONSUMER_KEY, + consumerSecret: process.env.PASSPORT_TWITTER_CONSUMER_SECRET, + callbackURL: process.env.PASSPORT_TWITTER_CALLBACK_URL }, function(accessToken:string, refreshToken:string, profile:twitter.Profile, done:(error:any, user?:any) => void) { User.findOrCreate(profile.id, profile.provider, function(err, user) { diff --git a/passport-twitter/passport-twitter.d.ts b/passport-twitter/passport-twitter.d.ts index 22e292acf..cb43aad26 100644 --- a/passport-twitter/passport-twitter.d.ts +++ b/passport-twitter/passport-twitter.d.ts @@ -12,6 +12,11 @@ declare module 'passport-twitter' { interface Profile extends passport.Profile { gender: string; + username: string; + + _raw: string; + _json: any; + _accessLevel: string; } interface IStrategyOption { From 923432817762816801e7312f2813529ef9731020 Mon Sep 17 00:00:00 2001 From: Josh Petersen Date: Wed, 3 Jun 2015 14:25:05 -0400 Subject: [PATCH 397/534] minor fix. sheet_to_json only accepts worksheet as a parameter. --- xlsx/xlsx.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xlsx/xlsx.d.ts b/xlsx/xlsx.d.ts index 16df800dd..cdc75349b 100644 --- a/xlsx/xlsx.d.ts +++ b/xlsx/xlsx.d.ts @@ -128,7 +128,7 @@ declare module 'xlsx' { } export interface IUtils { - sheet_to_json(worksheet:IWorkSheet|IWorkBook):T[]; + sheet_to_json(worksheet:IWorkSheet):T[]; sheet_to_csv(worksheet:IWorkSheet):any; sheet_to_formulae(worksheet:IWorkSheet):any; } From bf09efb39f0ec78dec18134bae3546239ff07328 Mon Sep 17 00:00:00 2001 From: Robert Baker Date: Wed, 3 Jun 2015 16:51:31 -0700 Subject: [PATCH 398/534] Added Numbro typedefs (taken from NumeralJS and renamed). Numbro is a maintained fork of the now unmaintained numeraljs. --- numbro/numbro-commonjs-tests.ts | 44 ++++++++++++++++++++++++++++++ numbro/numbro-tests.ts | 43 +++++++++++++++++++++++++++++ numbro/numbro.d.ts | 48 +++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 numbro/numbro-commonjs-tests.ts create mode 100644 numbro/numbro-tests.ts create mode 100644 numbro/numbro.d.ts diff --git a/numbro/numbro-commonjs-tests.ts b/numbro/numbro-commonjs-tests.ts new file mode 100644 index 000000000..c428a475e --- /dev/null +++ b/numbro/numbro-commonjs-tests.ts @@ -0,0 +1,44 @@ +/// +import numbro = require("numbro"); + +var valueFormat: string = numbro(1000).format('0,0'); +// '1,000' + +var valueUnformat: number = numbro().unformat('($10,000.00)'); +// '-10000' + +var value3: Numbro = numbro(1000); +var added: Numbro = value3.add(10); +// 1010 + +var value4: Numbro = numbro(1000); +var formatValue4a: string = value4.format('0,0'); +// '1,000' +var formatValue4b: number = value4.value(); +// 1000 + +var value5: Numbro = numbro(); +value5.set(1000); +var value5Num: number = value5.value(); +// 1000 + +var value6: Numbro = numbro(1000); +var value: number = 100; +var difference = value6.difference(value); +// 900 + +var value7: Numbro = numbro(0); +numbro.zeroFormat('N/A'); +var zeroString: string = value7.format('0.0'); +// 'N/A' + +var a: Numbro = numbro(1000); +var b: Numbro = numbro(a); +var c: Numbro = a.clone(); + +var aVal: number = a.set(2000).value(); +// 2000 +var bVal: number = b.value(); +// 1000 +var cVal: number = c.add(10).value(); +// 1010 diff --git a/numbro/numbro-tests.ts b/numbro/numbro-tests.ts new file mode 100644 index 000000000..0b18e898d --- /dev/null +++ b/numbro/numbro-tests.ts @@ -0,0 +1,43 @@ +/// + +var valueFormat: string = numbro(1000).format('0,0'); +// '1,000' + +var valueUnformat: number = numbro().unformat('($10,000.00)'); +// '-10000' + +var value3: Numbro = numbro(1000); +var added: Numbro = value3.add(10); +// 1010 + +var value4: Numbro = numbro(1000); +var formatValue4a: string = value4.format('0,0'); +// '1,000' +var formatValue4b: number = value4.value(); +// 1000 + +var value5: Numbro = numbro(); +value5.set(1000); +var value5Num: number = value5.value(); +// 1000 + +var value6: Numbro = numbro(1000); +var value: number = 100; +var difference = value6.difference(value); +// 900 + +var value7: Numbro = numbro(0); +numbro.zeroFormat('N/A'); +var zeroString: string = value7.format('0.0'); +// 'N/A' + +var a: Numbro = numbro(1000); +var b: Numbro = numbro(a); +var c: Numbro = a.clone(); + +var aVal: number = a.set(2000).value(); +// 2000 +var bVal: number = b.value(); +// 1000 +var cVal: number = c.add(10).value(); +// 1010 diff --git a/numbro/numbro.d.ts b/numbro/numbro.d.ts new file mode 100644 index 000000000..a2c1f8d7a --- /dev/null +++ b/numbro/numbro.d.ts @@ -0,0 +1,48 @@ +// Type definitions for Numbro.js +// Project: https://github.com/foretagsplatsen/numbro +// Definitions by: Vincent Bortone +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface NumbroLanguage { + delimiters: { + thousands: string; + decimal: string; + }; + abbreviations: { + thousand: string; + million: string; + billion: string; + trillion: string; + }; + ordinal(num: number): string; + currency: { + symbol: string; + }; +} + +interface Numbro { + (value?: any): Numbro; + version: string; + isNumbro: boolean; + language(key: string, values?: NumbroLanguage): Numbro; + zeroFormat(format: string): string; + clone(): Numbro; + format(inputString: string): string; + unformat(inputString: string): number; + value(): number; + valueOf(): number; + set (value: any): Numbro; + add(value: any): Numbro; + subtract(value: any): Numbro; + multiply(value: any): Numbro; + divide(value: any): Numbro; + difference(value: any): number; +} + +declare var numbro: Numbro; + +declare module "numbro" { + + export = numbro; + +} From 5a7baf8191c735673ed3c4db783379ecd98af0be Mon Sep 17 00:00:00 2001 From: Sam Herrmann Date: Wed, 3 Jun 2015 22:06:25 -0400 Subject: [PATCH 399/534] Add missing "parent" property to angular-ui-router state configuration object As documented here: http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$stateProvider --- angular-ui-router/angular-ui-router-tests.ts | 11 ++++++++++- angular-ui-router/angular-ui-router.d.ts | 7 +++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/angular-ui-router/angular-ui-router-tests.ts b/angular-ui-router/angular-ui-router-tests.ts index c31bb1688..a43f9e9bc 100644 --- a/angular-ui-router/angular-ui-router-tests.ts +++ b/angular-ui-router/angular-ui-router-tests.ts @@ -64,7 +64,16 @@ myApp.config(( controller: function ($scope: MyAppScope) { $scope.things = ["A", "Set", "Of", "Things"]; } - }).state('index', { + }) + .state('list', { + parent: 'state3', + url: "/list", + templateUrl: "partials/state3.list.html", + controller: function ($scope: MyAppScope) { + $scope.things = ["A", "Set", "Of", "Things"]; + } + }) + .state('index', { url: "", views: { "viewA": { template: "index.viewA" }, diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts index bfec95156..acc9342d9 100644 --- a/angular-ui-router/angular-ui-router.d.ts +++ b/angular-ui-router/angular-ui-router.d.ts @@ -30,6 +30,13 @@ declare module angular.ui { * Function (injectable), returns the actual controller function or string. */ controllerProvider?: Function; + + /** + * Specifies the parent state of this state + */ + parent?: string | IState + + resolve?: {}; /** * A url with optional parameters. When a state is navigated or transitioned to, the $stateParams service will be populated with any parameters that were passed. From 08fee9265fb493ba6a308f009677696ee063a5d0 Mon Sep 17 00:00:00 2001 From: Luzian Zagadinow Date: Thu, 4 Jun 2015 00:18:28 -0400 Subject: [PATCH 400/534] remove IDayOfWeekMonth in favor of a tuple of [number, number] with refactor --- node-calendar/node-calendar-tests.ts | 3 +-- node-calendar/node-calendar.d.ts | 14 +++----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/node-calendar/node-calendar-tests.ts b/node-calendar/node-calendar-tests.ts index 5a4a40a46..6de5d6cc4 100644 --- a/node-calendar/node-calendar-tests.ts +++ b/node-calendar/node-calendar-tests.ts @@ -1,5 +1,4 @@ /// -/// import node_calendar = require('node-calendar'); @@ -97,7 +96,7 @@ function assertIsNumber(n: number) { assert(typeof n == 'number', 'Should be a number'); } -function assertDayOfWeekMonth(d: IDayOfWeekMonth) { +function assertDayOfWeekMonth(d: [number, number]) { assert(d instanceof Array, 'Day of weak/month should be an array'); assert(d.length == 2, 'Day of weak/month array should contain 2 items'); assert(typeof d[0] == 'number', 'Day of month should be a number'); diff --git a/node-calendar/node-calendar.d.ts b/node-calendar/node-calendar.d.ts index a1c3f0500..3839d6541 100755 --- a/node-calendar/node-calendar.d.ts +++ b/node-calendar/node-calendar.d.ts @@ -3,14 +3,6 @@ // Definitions by: Luzian Zagadinow // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface IDayOfWeekMonth extends Array { - /** dayOfMonth */ - 0: number; - - /** dayOfWeek */ - 1: number; -} - interface IWeekRow extends Array { [dayIndex: number]: T; } @@ -183,7 +175,7 @@ declare module 'node-calendar' { * @param {number} month * Month for which the calendar should be generated. */ - itermonthdays2(year: number, month: number): IDayOfWeekMonth[]; + itermonthdays2(year: number, month: number): [number, number][]; /** * A matrix (array of array) representing a month's calendar. @@ -217,7 +209,7 @@ declare module 'node-calendar' { * @param {number} month * Month for which the calendar should be generated. */ - monthdays2calendar(year: number, month: number): IMonthGrid; + monthdays2calendar(year: number, month: number): IMonthGrid<[number, number]>; /** * The specified year ready for formatting. The return value is an array @@ -254,7 +246,7 @@ declare module 'node-calendar' { * @param {number} width * The number of months to include in each row. Default: 3 */ - yeardays2calendar(year: number, width?: number): IYearGrid; + yeardays2calendar(year: number, width?: number): IYearGrid<[number, number]>; } // Undocumented From 66feb94be0a3c2f60cd2a64744f271c8fb3748a6 Mon Sep 17 00:00:00 2001 From: Luzian Zagadinow Date: Thu, 4 Jun 2015 01:38:15 -0400 Subject: [PATCH 401/534] add missing definitions for module functions add line breaks in documentation to make readable --- node-calendar/node-calendar.d.ts | 169 ++++++++++++++++++++++++++++--- 1 file changed, 154 insertions(+), 15 deletions(-) diff --git a/node-calendar/node-calendar.d.ts b/node-calendar/node-calendar.d.ts index 3839d6541..ae4b16cad 100755 --- a/node-calendar/node-calendar.d.ts +++ b/node-calendar/node-calendar.d.ts @@ -15,7 +15,7 @@ interface IMonthRow extends Array> { [monthColumnIndex: number]: IMonthGrid; } -interface IYearGrid extends Array>{ +interface IYearGrid extends Array> { [monthRowIndex: number]: IMonthRow; } @@ -59,7 +59,7 @@ declare module 'node-calendar' { export var MARCH: number; /** 4 */ - export var APRIL:number; + export var APRIL: number; /** 5 */ export var MAY: number; @@ -150,6 +150,7 @@ declare module 'node-calendar' { * * @param {number} year * Year for which the calendar should be generated. + * * @param {number} month * Month for which the calendar should be generated. */ @@ -161,6 +162,7 @@ declare module 'node-calendar' { * * @param {number} year * Year for which the calendar should be generated. + * * @param {number} month * Month for which the calendar should be generated. */ @@ -172,6 +174,7 @@ declare module 'node-calendar' { * * @param {number} year * Year for which the calendar should be generated. + * * @param {number} month * Month for which the calendar should be generated. */ @@ -183,6 +186,7 @@ declare module 'node-calendar' { * * @param {number} year * Year for which the calendar should be generated. + * * @param {number} month * Month for which the calendar should be generated. */ @@ -194,6 +198,7 @@ declare module 'node-calendar' { * * @param {number} year * Year for which the calendar should be generated. + * * @param {number} month * Month for which the calendar should be generated. */ @@ -206,6 +211,7 @@ declare module 'node-calendar' { * * @param {number} year * Year for which the calendar should be generated. + * * @param {number} month * Month for which the calendar should be generated. */ @@ -219,6 +225,7 @@ declare module 'node-calendar' { * * @param {number} year * Year for which the calendar should be generated. + * * @param {number} width * The number of months to include in each row. Default: 3 */ @@ -230,7 +237,8 @@ declare module 'node-calendar' { * month are zero. * * @param {number} year - * Year for which the calendar should be generated. + * Year for which the calendar should be generated + * * @param {number} width * The number of months to include in each row. Default: 3 */ @@ -242,22 +250,153 @@ declare module 'node-calendar' { * Day numbers outside this month are zero. * * @param {number} year - * Year for which the calendar should be generated. + * Year for which the calendar should be generated + * * @param {number} width * The number of months to include in each row. Default: 3 */ yeardays2calendar(year: number, width?: number): IYearGrid<[number, number]>; } - // Undocumented - //export function isleap(year: number): boolean; - //export function leapdays(beginYear: number, endYear: number): number; - //export function monthrange(year: number, month: number): number[]; - //export function weekday(year: number, month: number, day: number): number; - //export function timegm(dateParams: number[]): number; - //export function IllegalLocaleError(): Error; - //export function IllegalDayError(): Error; - //export function IllegalMonthError(): Error; - //export function IllegalTimeError(): Error; - //export function IllegalWeekdayError(): Error; + /** + * @param {number} year + * Year to test. + * + * @return {boolean} + * true for leap years, false for non-leap years. + */ + export function isleap(year: number): boolean; + + /** + * @param {number} y1 + * Beginning year in the range to test. + * + * @param {number} y2 + * Ending year in the range to test. + * + * @return {number} + * Number of leap years in range (y1...y2). Assumes y1 <= y2. + */ + export function leapdays(y1: number, y2: number): number; + + /** + * @param {number} year + * Year for which the range should be calculated. + * + * @param {number} month + * Month for which the range should be calculated. + * + * @throws {IllegalMonthError} if the provided month is invalid. + * + * @return {number[]} + * starting weekday (0-6 ~ Mon-Sun) and number of days (28-31) for year, month. + */ + export function monthrange(year: number, month: number): number[]; + + /** + * Sets the locale for use in extracting month and weekday names. + * + * @param {string} locale + * Locale to set on the calendar object. Default: en_US + * + * @throws {IllegalLocaleError} if the provided locale is invalid. + */ + export function setlocale(locale?: string); + + /** + * Unrelated but handy function to calculate Unix timestamp from GMT. + * + * @param timegmt {[number, number, number, number, number, number]} + * An array containing the elements from a time structure dataset. + * Format: [tm_year, tm_mon, tm_mday, tm_hour, tm_min, tm_sec] + * + * @throws {IllegalMonthError} if the provided month element is invalid. + * + * @throws {IllegalDayError} if the provided day element is invalid. + * + * @throws {IllegalTimeError} if any of the the provided time elements are invalid. + * + * @return {number} + * Unix timestamp from GMT. + */ + export function timegm(timegmt: [number, number, number, number, number, number]): number; + + /** + * @param {number} year + * Year for which the weekday should be calculated. + * + * @param {number} month + * Month for which the weekday should be calculated. + * + * @param {number} day + * Day for which the weekday should be calculated. + * + * @throws {IllegalMonthError} if the provided month element is invalid. + * + * @throws {IllegalDayError} if the provided day element is invalid. + * + * @return {number} + * weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12), day (1-31). + */ + export function weekday(year: number, month: number, day: number): number; + + /** + * Error indicating a nonexistent or unsupported locale specified. + * + * @param {string} message + * Optional custom error message. + */ + export class IllegalLocaleError implements Error { + public name: string; + public message: string; + constructor(message?: string) + } + + /** + * Error indicating a day index specified outside of the valid range. + * + * @param {string} message + * Optional custom error message. + */ + export class IllegalDayError implements Error { + public name: string; + public message: string; + constructor(message?: string) + } + + /** + * Error indicating a month index specified outside of the expected range (1-12 ~ Jan-Dec). + * + * @param {string} message + * Optional custom error message. + */ + export class IllegalMonthError implements Error { + public name: string; + public message: string; + constructor(message?: string) + } + + /** + * Error indicating a time element is outside of the valid range. + * + * @param {string} message + * Optional custom error message. + */ + export class IllegalTimeError implements Error { + public name: string; + public message: string; + constructor(message?: string) + } + + /** + * Error indicating a weekday index specified outside of the expected range (0-6 ~ Mon-Sun). + * + * @param {string} message + * Optional custom error message. + */ + export class IllegalWeekdayError implements Error { + public name: string; + public message: string; + constructor(message?: string) + } } \ No newline at end of file From cc6e98cc6be9849851c2d8879ec5c9134145b988 Mon Sep 17 00:00:00 2001 From: Luzian Zagadinow Date: Thu, 4 Jun 2015 01:46:31 -0400 Subject: [PATCH 402/534] add tests to reflect new definitions --- node-calendar/node-calendar-tests.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/node-calendar/node-calendar-tests.ts b/node-calendar/node-calendar-tests.ts index 6de5d6cc4..b57cd9f84 100644 --- a/node-calendar/node-calendar-tests.ts +++ b/node-calendar/node-calendar-tests.ts @@ -88,6 +88,25 @@ assertYearGrid(cal.yeardatescalendar(2009, 3), assertIsDate); assertYearGrid(cal.yeardays2calendar(2008, 2), assertDayOfWeekMonth); assertYearGrid(cal.yeardayscalendar(2007, 4), assertIsNumber); +node_calendar.setlocale('en_US'); + +assertIsError(new node_calendar.IllegalDayError()); +assertIsError(new node_calendar.IllegalLocaleError()); +assertIsError(new node_calendar.IllegalMonthError()); +assertIsError(new node_calendar.IllegalTimeError); +assertIsError(new node_calendar.IllegalWeekdayError()); + +assertIsBoolean(node_calendar.isleap(2000)); +assertIsNumber(node_calendar.weekday(2015, node_calendar.JULY, 7)); +assertIsNumber(node_calendar.leapdays(2000, 2010)); + +node_calendar.monthrange(2015, node_calendar.JANUARY).forEach(assertIsNumber); + +var timegmt:[number,number,number,number,number,number] = [2014, node_calendar.JULY, 7, 12, 41, 59]; +assertIsNumber(node_calendar.timegm(timegmt)); + + +// FUNCTIONS ------------------------------------------------------------------ function assertIsDate(d: Date) { assert(d instanceof Date, 'Should be a date'); } @@ -96,6 +115,10 @@ function assertIsNumber(n: number) { assert(typeof n == 'number', 'Should be a number'); } +function assertIsBoolean(b: boolean) { + assert(typeof b == 'boolean', 'Should be a boolean'); +} + function assertDayOfWeekMonth(d: [number, number]) { assert(d instanceof Array, 'Day of weak/month should be an array'); assert(d.length == 2, 'Day of weak/month array should contain 2 items'); @@ -122,4 +145,9 @@ function assertYearGrid(grid: IYearGrid, assertItemType: (item: T) => void function assert(condition: boolean, msg?: string): void { if (condition) return; throw new Error(msg); +} + +function assertIsError(error: Error) { + assert(typeof error.name == 'string', 'Error name should exist and be a string'); + assert(typeof error.message == 'string', 'Error message should exist and be a string'); } \ No newline at end of file From 7c4b699df0acd2108fccf00e7fed3e8933eb2327 Mon Sep 17 00:00:00 2001 From: Luzian Zagadinow Date: Thu, 4 Jun 2015 01:49:16 -0400 Subject: [PATCH 403/534] specify return type of setlocal() --- node-calendar/node-calendar.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-calendar/node-calendar.d.ts b/node-calendar/node-calendar.d.ts index ae4b16cad..6f2b7814b 100755 --- a/node-calendar/node-calendar.d.ts +++ b/node-calendar/node-calendar.d.ts @@ -301,7 +301,7 @@ declare module 'node-calendar' { * * @throws {IllegalLocaleError} if the provided locale is invalid. */ - export function setlocale(locale?: string); + export function setlocale(locale?: string): void; /** * Unrelated but handy function to calculate Unix timestamp from GMT. From 0d8680a11b1d592d10784b94e9a23dd652b5ec65 Mon Sep 17 00:00:00 2001 From: bls Date: Thu, 4 Jun 2015 17:46:55 +1000 Subject: [PATCH 404/534] Add tls.createSecureContext to node.js typing. --- node/node-tests.ts | 11 +++++++++++ node/node.d.ts | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/node/node-tests.ts b/node/node-tests.ts index 8c381bc0e..7c05c3a21 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -7,6 +7,7 @@ import zlib = require("zlib"); import url = require('url'); import util = require("util"); import crypto = require("crypto"); +import tls = require("tls"); import http = require("http"); import net = require("net"); import dgram = require("dgram"); @@ -143,6 +144,16 @@ function crypto_cipher_decipher_buffer_test() { assert.deepEqual(clearText2, clearText); } +//////////////////////////////////////////////////// +/// TLS tests : http://nodejs.org/api/tls.html +//////////////////////////////////////////////////// + +var ctx: tls.SecureContext = tls.createSecureContext({ + key: "NOT REALLY A KEY", + cert: "SOME CERTIFICATE", +}); +var blah = ctx.context; + //////////////////////////////////////////////////// // Make sure .listen() and .close() retuern a Server instance diff --git a/node/node.d.ts b/node/node.d.ts index 2543ccaca..f9b3a68a8 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1236,11 +1236,27 @@ declare module "tls" { cleartext: any; } + export interface SecureContextOptions { + pfx?: any; //string | buffer + key?: any; //string | buffer + passphrase?: string; + cert?: any; // string | buffer + ca?: any; // string | buffer + crl?: any; // string | string[] + ciphers?: string; + honorCipherOrder?: boolean; + } + + export interface SecureContext { + context: any; + } + export function createServer(options: TlsOptions, secureConnectionListener?: (cleartextStream: ClearTextStream) =>void ): Server; export function connect(options: TlsOptions, secureConnectionListener?: () =>void ): ClearTextStream; export function connect(port: number, host?: string, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; export function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () =>void ): ClearTextStream; export function createSecurePair(credentials?: crypto.Credentials, isServer?: boolean, requestCert?: boolean, rejectUnauthorized?: boolean): SecurePair; + export function createSecureContext(details: SecureContextOptions): SecureContext; } declare module "crypto" { From 60d204c382a6a5126f9708b3848cf783cd535717 Mon Sep 17 00:00:00 2001 From: Vadim Macagon Date: Thu, 4 Jun 2015 16:49:28 +0700 Subject: [PATCH 405/534] Extend Mocha typings to allow writing of custom reporters --- mocha/mocha-tests.ts | 34 +++++++ mocha/mocha.d.ts | 230 ++++++++++++++++++++++++++----------------- 2 files changed, 173 insertions(+), 91 deletions(-) diff --git a/mocha/mocha-tests.ts b/mocha/mocha-tests.ts index f90fefaf9..a2e2b0796 100644 --- a/mocha/mocha-tests.ts +++ b/mocha/mocha-tests.ts @@ -249,3 +249,37 @@ function test_run_withOnComplete() { console.log(failures); }); } + +class CustomSpecReporter extends MochaDef.reporters.Spec { + constructor(runner: Mocha.IRunner) { + super(runner); + + runner.on('test', (test: Mocha.ITest) => { + console.log(test.parent.title + '/' + test.title); + }); + } +} + +class MyReporter extends MochaDef.reporters.Base { + passes: number = 0; + failures: number = 0; + + constructor(runner: Mocha.IRunner) { + super(runner); + + runner.on('pass', (test: Mocha.ITest) => { + this.passes++; + console.log('pass: %s', test.fullTitle()); + }); + + runner.on('fail', (test: Mocha.ITest, err: Error) => { + this.failures++; + console.log('fail: %s -- error: %s', test.fullTitle(), err.message); + }); + + runner.on('end', () => { + console.log('end: %d/%d', this.passes, this.passes + this.failures); + process.exit(this.failures); + }); + } +} diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index 63ad66014..fefd91946 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -1,24 +1,9 @@ -// Type definitions for mocha 2.0.1 +// Type definitions for mocha 2.2.5 // Project: http://mochajs.org/ -// Definitions by: Kazi Manzur Rashid , otiai10 , jt000 +// Definitions by: Kazi Manzur Rashid , otiai10 , jt000 , Vadim Macagon // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface Mocha { - // Setup mocha with the given setting options. - setup(options: MochaSetupOptions): Mocha; - - //Run tests and invoke `fn()` when complete. - run(callback?: () => void): void; - - // Set reporter as function - reporter(reporter: () => void): Mocha; - - // Set reporter, defaults to "dot" - reporter(reporter: string): Mocha; - - // Enable growl support. - growl(): Mocha -} +/// interface MochaSetupOptions { //milliseconds to wait before considering a test slow @@ -33,7 +18,7 @@ interface MochaSetupOptions { //array of accepted globals globals?: any[]; - // reporter instance (function or string), defaults to `mocha.reporters.Dot` + // reporter instance (function or string), defaults to `mocha.reporters.Spec` reporter?: any; // bail on the first test failure @@ -45,56 +30,20 @@ interface MochaSetupOptions { // grep string or regexp to filter tests with grep?: any; } - + interface MochaDone { (error?: Error): void; } declare var mocha: Mocha; - -declare var describe: { - (description: string, spec: () => void): void; - only(description: string, spec: () => void): void; - skip(description: string, spec: () => void): void; - timeout(ms: number): void; -} - +declare var describe: Mocha.IContextDefinition; // alias for `describe` -declare var context: { - (contextTitle: string, spec: () => void): void; - only(contextTitle: string, spec: () => void): void; - skip(contextTitle: string, spec: () => void): void; - timeout(ms: number): void; -}; - +declare var context: Mocha.IContextDefinition; // alias for `describe` -declare var suite: { - (suiteTitle: string, spec: () => void): void; - only(suiteTitle: string, spec: () => void): void; - skip(suiteTitle: string, spec: () => void): void; - timeout(ms: number): void; -}; - -declare var it: { - (expectation: string, assertion?: () => void): void; - (expectation: string, assertion?: (done: MochaDone) => void): void; - only(expectation: string, assertion?: () => void): void; - only(expectation: string, assertion?: (done: MochaDone) => void): void; - skip(expectation: string, assertion?: () => void): void; - skip(expectation: string, assertion?: (done: MochaDone) => void): void; - timeout(ms: number): void; -}; - +declare var suite: Mocha.IContextDefinition; +declare var it: Mocha.ITestDefinition; // alias for `it` -declare var test: { - (expectation: string, assertion?: () => void): void; - (expectation: string, assertion?: (done: MochaDone) => void): void; - only(expectation: string, assertion?: () => void): void; - only(expectation: string, assertion?: (done: MochaDone) => void): void; - skip(expectation: string, assertion?: () => void): void; - skip(expectation: string, assertion?: (done: MochaDone) => void): void; - timeout(ms: number): void; -}; +declare var test: Mocha.ITestDefinition; declare function before(action: () => void): void; @@ -128,39 +77,138 @@ declare function suiteTeardown(action: () => void): void; declare function suiteTeardown(action: (done: MochaDone) => void): void; -declare module "mocha" { +declare class Mocha { + constructor(options?: { + grep?: RegExp; + ui?: string; + reporter?: string; + timeout?: number; + bail?: boolean; + }); - class Mocha { - constructor(options?: { - grep?: RegExp; - ui?: string; - reporter?: string; - timeout?: number; - bail?: boolean; - }); + /** Setup mocha with the given options. */ + setup(options: MochaSetupOptions): Mocha; + bail(value?: boolean): Mocha; + addFile(file: string): Mocha; + /** Sets reporter by name, defaults to "spec". */ + reporter(name: string): Mocha; + /** Sets reporter constructor, defaults to mocha.reporters.Spec. */ + reporter(reporter: (runner: Mocha.IRunner, options: any) => any): Mocha; + ui(value: string): Mocha; + grep(value: string): Mocha; + grep(value: RegExp): Mocha; + invert(): Mocha; + ignoreLeaks(value: boolean): Mocha; + checkLeaks(): Mocha; + /** Enables growl support. */ + growl(): Mocha; + globals(value: string): Mocha; + globals(values: string[]): Mocha; + useColors(value: boolean): Mocha; + useInlineDiffs(value: boolean): Mocha; + timeout(value: number): Mocha; + slow(value: number): Mocha; + enableTimeouts(value: boolean): Mocha; + asyncOnly(value: boolean): Mocha; + noHighlighting(value: boolean): Mocha; + /** Runs tests and invokes `onComplete()` when finished. */ + run(onComplete?: (failures: number) => void): Mocha.IRunner; +} - bail(value?: boolean): Mocha; - addFile(file: string): Mocha; - reporter(value: string): Mocha; - ui(value: string): Mocha; - grep(value: string): Mocha; - grep(value: RegExp): Mocha; - invert(): Mocha; - ignoreLeaks(value: boolean): Mocha; - checkLeaks(): Mocha; - growl(): Mocha; - globals(value: string): Mocha; - globals(values: string[]): Mocha; - useColors(value: boolean): Mocha; - useInlineDiffs(value: boolean): Mocha; - timeout(value: number): Mocha; - slow(value: number): Mocha; - enableTimeouts(value: boolean): Mocha; - asyncOnly(value: boolean): Mocha; - noHighlighting(value: boolean): Mocha; - - run(onComplete?: (failures: number) => void): void; +// merge the Mocha class declaration with a module +declare module Mocha { + /** Partial interface for Mocha's `Runnable` class. */ + interface IRunnable extends NodeJS.EventEmitter { + title: string; + fn: Function; + async: boolean; + sync: boolean; + timedOut: boolean; } + /** Partial interface for Mocha's `Suite` class. */ + interface ISuite extends NodeJS.EventEmitter { + parent: ISuite; + title: string; + + fullTitle(): string; + } + + /** Partial interface for Mocha's `Test` class. */ + interface ITest extends IRunnable { + parent: ISuite; + pending: boolean; + + fullTitle(): string; + } + + /** Partial interface for Mocha's `Runner` class. */ + interface IRunner extends NodeJS.EventEmitter {} + + interface IContextDefinition { + (description: string, spec: () => void): ISuite; + only(description: string, spec: () => void): ISuite; + skip(description: string, spec: () => void): void; + timeout(ms: number): void; + } + + interface ITestDefinition { + (expectation: string, assertion?: () => void): ITest; + (expectation: string, assertion?: (done: MochaDone) => void): ITest; + only(expectation: string, assertion?: () => void): ITest; + only(expectation: string, assertion?: (done: MochaDone) => void): ITest; + skip(expectation: string, assertion?: () => void): void; + skip(expectation: string, assertion?: (done: MochaDone) => void): void; + timeout(ms: number): void; + } + + export module reporters { + export class Base { + stats: { + suites: number; + tests: number; + passes: number; + pending: number; + failures: number; + }; + + constructor(runner: IRunner); + } + + export class Doc extends Base {} + export class Dot extends Base {} + export class HTML extends Base {} + export class HTMLCov extends Base {} + export class JSON extends Base {} + export class JSONCov extends Base {} + export class JSONStream extends Base {} + export class Landing extends Base {} + export class List extends Base {} + export class Markdown extends Base {} + export class Min extends Base {} + export class Nyan extends Base {} + export class Progress extends Base { + /** + * @param options.open String used to indicate the start of the progress bar. + * @param options.complete String used to indicate a complete test on the progress bar. + * @param options.incomplete String used to indicate an incomplete test on the progress bar. + * @param options.close String used to indicate the end of the progress bar. + */ + constructor(runner: IRunner, options?: { + open?: string; + complete?: string; + incomplete?: string; + close?: string; + }); + } + export class Spec extends Base {} + export class TAP extends Base {} + export class XUnit extends Base { + constructor(runner: IRunner, options?: any); + } + } +} + +declare module "mocha" { export = Mocha; } From f844c0947a137399b8fb0e7135613b9e68797e16 Mon Sep 17 00:00:00 2001 From: Aurelien Souchet Date: Thu, 4 Jun 2015 16:35:13 +0200 Subject: [PATCH 406/534] added new pickers interface / methods to WinRT --- winrt/winrt.d.ts | 43 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/winrt/winrt.d.ts b/winrt/winrt.d.ts index ed4f33e77..8671e62e0 100644 --- a/winrt/winrt.d.ts +++ b/winrt/winrt.d.ts @@ -44,6 +44,17 @@ declare module Windows { clear(): void; first(): Windows.Foundation.Collections.IIterator>; } + export class ValueSet implements Windows.Foundation.Collections.IPropertySet, Windows.Foundation.Collections.IObservableMap, Windows.Foundation.Collections.IMap, Windows.Foundation.Collections.IIterable> { + size: number; + onmapchanged: any/* TODO */; + lookup(key: string): any; + hasKey(key: string): boolean; + getView(): Windows.Foundation.Collections.IMapView; + insert(key: string, value: any): boolean; + remove(key: string): void; + clear(): void; + first(): Windows.Foundation.Collections.IIterator>; + } export interface IIterable { first(): Windows.Foundation.Collections.IIterator; } @@ -7940,7 +7951,7 @@ declare module Windows { control: Windows.Networking.Sockets.MessageWebSocketControl; information: Windows.Networking.Sockets.MessageWebSocketInformation; onmessagereceived: any/* TODO */; - close(): void; + close(): void; close(code: number, reason: string): void; } export class MessageWebSocketControl implements Windows.Networking.Sockets.IMessageWebSocketControl, Windows.Networking.Sockets.IWebSocketControl { @@ -7980,7 +7991,7 @@ declare module Windows { control: Windows.Networking.Sockets.StreamWebSocketControl; information: Windows.Networking.Sockets.StreamWebSocketInformation; inputStream: Windows.Storage.Streams.IInputStream; - close(): void; + close(): void; close(code: number, reason: string): void; } export class StreamWebSocketControl implements Windows.Networking.Sockets.IStreamWebSocketControl, Windows.Networking.Sockets.IWebSocketControl { @@ -10986,6 +10997,11 @@ declare module Windows { pickSingleFileAsync(): Windows.Foundation.IAsyncOperation; pickMultipleFilesAsync(): Windows.Foundation.IAsyncOperation>; } + export interface IFileOpenPicker2 { + continuationData: Windows.Foundation.Collections.ValueSet; + pickMultipleFilesAndContinue(): void; + pickSingleFileAndContinue(): void; + } export interface IFileSavePicker { commitButtonText: string; defaultFileExtension: string; @@ -10996,6 +11012,10 @@ declare module Windows { suggestedStartLocation: Windows.Storage.Pickers.PickerLocationId; pickSaveFileAsync(): Windows.Foundation.IAsyncOperation; } + export interface IFileSavePicker2 { + continuationData: Windows.Foundation.Collections.ValueSet; + pickSaveFileAndContinue(): void; + } export interface IFolderPicker { commitButtonText: string; fileTypeFilter: Windows.Foundation.Collections.IVector; @@ -11004,16 +11024,23 @@ declare module Windows { viewMode: Windows.Storage.Pickers.PickerViewMode; pickSingleFolderAsync(): Windows.Foundation.IAsyncOperation; } - export class FileOpenPicker implements Windows.Storage.Pickers.IFileOpenPicker { + export interface IFolderPicker2 { + continuationData: Windows.Foundation.Collections.ValueSet; + pickFolderAndContinue(): void; + } + export class FileOpenPicker implements Windows.Storage.Pickers.IFileOpenPicker, Windows.Storage.Pickers.IFileOpenPicker2 { commitButtonText: string; fileTypeFilter: Windows.Foundation.Collections.IVector; settingsIdentifier: string; suggestedStartLocation: Windows.Storage.Pickers.PickerLocationId; viewMode: Windows.Storage.Pickers.PickerViewMode; + continuationData: Windows.Foundation.Collections.ValueSet; + pickSingleFileAndContinue(): void; pickSingleFileAsync(): Windows.Foundation.IAsyncOperation; + pickMultipleFilesAndContinue(): void; pickMultipleFilesAsync(): Windows.Foundation.IAsyncOperation>; } - export class FileSavePicker implements Windows.Storage.Pickers.IFileSavePicker { + export class FileSavePicker implements Windows.Storage.Pickers.IFileSavePicker, Windows.Storage.Pickers.IFileSavePicker2 { commitButtonText: string; defaultFileExtension: string; fileTypeChoices: Windows.Foundation.Collections.IMap>; @@ -11021,14 +11048,18 @@ declare module Windows { suggestedFileName: string; suggestedSaveFile: Windows.Storage.StorageFile; suggestedStartLocation: Windows.Storage.Pickers.PickerLocationId; + continuationData: Windows.Foundation.Collections.ValueSet; + pickSaveFileAndContinue(): void; pickSaveFileAsync(): Windows.Foundation.IAsyncOperation; } - export class FolderPicker implements Windows.Storage.Pickers.IFolderPicker { + export class FolderPicker implements Windows.Storage.Pickers.IFolderPicker, Windows.Storage.Pickers.IFolderPicker2 { commitButtonText: string; fileTypeFilter: Windows.Foundation.Collections.IVector; settingsIdentifier: string; suggestedStartLocation: Windows.Storage.Pickers.PickerLocationId; viewMode: Windows.Storage.Pickers.PickerViewMode; + continuationData: Windows.Foundation.Collections.ValueSet; + pickFolderAndContinue(): void; pickSingleFolderAsync(): Windows.Foundation.IAsyncOperation; } } @@ -14750,4 +14781,4 @@ declare module Windows.Foundation { dispatchEvent?(type: string, details: any): boolean; removeEventListener?(eventType: string, listener: Function, capture?: boolean): void; } -} +} \ No newline at end of file From 034379ca892327cb722466975d5baa71981a61cf Mon Sep 17 00:00:00 2001 From: Luzian Zagadinow Date: Thu, 4 Jun 2015 14:18:34 -0400 Subject: [PATCH 407/534] change return type of monthrange to a tuple --- node-calendar/node-calendar.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node-calendar/node-calendar.d.ts b/node-calendar/node-calendar.d.ts index 6f2b7814b..e37f438fb 100755 --- a/node-calendar/node-calendar.d.ts +++ b/node-calendar/node-calendar.d.ts @@ -288,10 +288,10 @@ declare module 'node-calendar' { * * @throws {IllegalMonthError} if the provided month is invalid. * - * @return {number[]} + * @return {[number, number]} * starting weekday (0-6 ~ Mon-Sun) and number of days (28-31) for year, month. */ - export function monthrange(year: number, month: number): number[]; + export function monthrange(year: number, month: number): [number, number]; /** * Sets the locale for use in extracting month and weekday names. From e118e97028b155ef13e755bcee92afbf9425cc1a Mon Sep 17 00:00:00 2001 From: Luzian Zagadinow Date: Thu, 4 Jun 2015 14:29:53 -0400 Subject: [PATCH 408/534] formatting: correct whitespace inconsistencies --- node-calendar/node-calendar.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/node-calendar/node-calendar.d.ts b/node-calendar/node-calendar.d.ts index e37f438fb..6d5c12eec 100755 --- a/node-calendar/node-calendar.d.ts +++ b/node-calendar/node-calendar.d.ts @@ -348,7 +348,7 @@ declare module 'node-calendar' { */ export class IllegalLocaleError implements Error { public name: string; - public message: string; + public message: string; constructor(message?: string) } @@ -360,7 +360,7 @@ declare module 'node-calendar' { */ export class IllegalDayError implements Error { public name: string; - public message: string; + public message: string; constructor(message?: string) } @@ -372,7 +372,7 @@ declare module 'node-calendar' { */ export class IllegalMonthError implements Error { public name: string; - public message: string; + public message: string; constructor(message?: string) } @@ -384,7 +384,7 @@ declare module 'node-calendar' { */ export class IllegalTimeError implements Error { public name: string; - public message: string; + public message: string; constructor(message?: string) } @@ -396,7 +396,7 @@ declare module 'node-calendar' { */ export class IllegalWeekdayError implements Error { public name: string; - public message: string; + public message: string; constructor(message?: string) } } \ No newline at end of file From 42cb5d2749a91f518edc39cf77464149fb6d055e Mon Sep 17 00:00:00 2001 From: Luzian Zagadinow Date: Thu, 4 Jun 2015 15:07:31 -0400 Subject: [PATCH 409/534] move @param documentation from Error classes at their class level to the constructor where they belong. --- node-calendar/node-calendar.d.ts | 60 ++++++++++++++++---------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/node-calendar/node-calendar.d.ts b/node-calendar/node-calendar.d.ts index 6d5c12eec..204ec6921 100755 --- a/node-calendar/node-calendar.d.ts +++ b/node-calendar/node-calendar.d.ts @@ -340,63 +340,63 @@ declare module 'node-calendar' { */ export function weekday(year: number, month: number, day: number): number; - /** - * Error indicating a nonexistent or unsupported locale specified. - * - * @param {string} message - * Optional custom error message. - */ + /** Error indicating a nonexistent or unsupported locale specified. */ export class IllegalLocaleError implements Error { public name: string; public message: string; + + /** + * @param {string} message + * Optional custom error message. + */ constructor(message?: string) } - /** - * Error indicating a day index specified outside of the valid range. - * - * @param {string} message - * Optional custom error message. - */ + /** Error indicating a day index specified outside of the valid range. */ export class IllegalDayError implements Error { public name: string; public message: string; + + /** + * @param {string} message + * Optional custom error message. + */ constructor(message?: string) } - /** - * Error indicating a month index specified outside of the expected range (1-12 ~ Jan-Dec). - * - * @param {string} message - * Optional custom error message. - */ + /** Error indicating a month index specified outside of the expected range (1-12 ~ Jan-Dec). */ export class IllegalMonthError implements Error { public name: string; public message: string; + + /** + * @param {string} message + * Optional custom error message. + */ constructor(message?: string) } - /** - * Error indicating a time element is outside of the valid range. - * - * @param {string} message - * Optional custom error message. - */ + /** Error indicating a time element is outside of the valid range. */ export class IllegalTimeError implements Error { public name: string; public message: string; + + /** + * @param {string} message + * Optional custom error message. + */ constructor(message?: string) } - /** - * Error indicating a weekday index specified outside of the expected range (0-6 ~ Mon-Sun). - * - * @param {string} message - * Optional custom error message. - */ + /** Error indicating a weekday index specified outside of the expected range (0-6 ~ Mon-Sun). */ export class IllegalWeekdayError implements Error { public name: string; public message: string; + + /** + * @param {string} message + * Optional custom error message. + */ constructor(message?: string) } } \ No newline at end of file From 4e5a848013335eecb13276eaa5c793c02eab3e72 Mon Sep 17 00:00:00 2001 From: Ryan McNamara Date: Thu, 4 Jun 2015 13:42:34 -0700 Subject: [PATCH 410/534] Created type definitions and tests for heap: https://www.npmjs.com/package/heap --- heap/heap-tests.ts | 96 ++++++++++++++++++++++++++++++++++++++++++++++ heap/heap.d.ts | 84 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 heap/heap-tests.ts create mode 100644 heap/heap.d.ts diff --git a/heap/heap-tests.ts b/heap/heap-tests.ts new file mode 100644 index 000000000..605425893 --- /dev/null +++ b/heap/heap-tests.ts @@ -0,0 +1,96 @@ +/// + +var numberComparator = (a: number, b: number) => { return a.toString().length - b.toString().length; }; +var stringComparator = (a: string, b: string) => { return a.length - b.length; }; + +// Test constructor +var numberHeap: Heap = new Heap(); +numberHeap = new Heap(numberComparator); + +var stringHeap: Heap = new Heap(); +stringHeap = new Heap(stringComparator); + +// Test instance methods +numberHeap.push(0); +stringHeap.push("foo"); +numberHeap.insert(0); +stringHeap.insert("foo"); + +var numberIdentifier: number = numberHeap.pop(); +var stringIdentifier: string = stringHeap.pop(); + +numberIdentifier = numberHeap.replace(1); +stringIdentifier = stringHeap.replace("bar"); + +numberIdentifier = numberHeap.pushpop(2); +stringIdentifier = stringHeap.pushpop("bar"); + +numberHeap.heapify(); +stringHeap.heapify(); + +numberHeap.updateItem(2); +stringHeap.updateItem("bar"); + +var booleanIdentifier: boolean = numberHeap.empty(); +booleanIdentifier = stringHeap.empty(); + +numberIdentifier = numberHeap.size(); +numberIdentifier = stringHeap.size(); + +var numberArray: number[] = numberHeap.toArray(); +var stringArray: string[] = stringHeap.toArray(); + +numberHeap = numberHeap.clone(); +numberHeap = numberHeap.copy(); + +stringHeap = stringHeap.clone(); +stringHeap = stringHeap.copy(); + +// Test static methods +Heap.push(numberArray, 3); +Heap.push(numberArray, 3, numberComparator); + +Heap.push(stringArray, "foo"); +Heap.push(stringArray, "foo", stringComparator); + +numberIdentifier = Heap.pop(numberArray); +numberIdentifier = Heap.pop(numberArray, numberComparator); + +stringIdentifier = Heap.pop(stringArray); +stringIdentifier = Heap.pop(stringArray, stringComparator); + +numberIdentifier = Heap.replace(numberArray, 1); +numberIdentifier = Heap.replace(numberArray, 1, numberComparator); + +stringIdentifier = Heap.replace(stringArray, "foo"); +stringIdentifier = Heap.replace(stringArray, "foo", stringComparator); + +numberIdentifier = Heap.pushpop(numberArray, 1); +numberIdentifier = Heap.pushpop(numberArray, 1, numberComparator); + +stringIdentifier = Heap.pushpop(stringArray, "foo"); +stringIdentifier = Heap.pushpop(stringArray, "foo", stringComparator); + +Heap.heapify(numberArray); +Heap.heapify(numberArray, numberComparator); + +Heap.heapify(stringArray); +Heap.heapify(stringArray, stringComparator); + +Heap.updateItem(numberArray, 1); +Heap.updateItem(numberArray, 1, numberComparator); + +Heap.updateItem(stringArray, "foo"); +Heap.updateItem(stringArray, "foo", stringComparator); + +Heap.nlargest(numberArray, 1); +Heap.nlargest(numberArray, 1, numberComparator); + +Heap.nlargest(stringArray, 1); +Heap.nlargest(stringArray, 1, stringComparator); + +Heap.nsmallest(numberArray, 1); +Heap.nsmallest(numberArray, 1, numberComparator); + +Heap.nsmallest(stringArray, 1); +Heap.nsmallest(stringArray, 1, stringComparator); diff --git a/heap/heap.d.ts b/heap/heap.d.ts new file mode 100644 index 000000000..3ec573d1c --- /dev/null +++ b/heap/heap.d.ts @@ -0,0 +1,84 @@ +// Type definitions for heap 0.2.6 +// Project: https://github.com/qiao/heap.js +// Definitions by: Ryan McNamara +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class Heap { + + // Constructor + + constructor(cmp?: (a: T, b: T) => number); + + // Instance Methods + + // Push item onto heap. + push(item: T): void; + insert(item: T): void; + + // Pop the smallest item off the heap and return it. + pop(): T; + + // Return the smallest item of the heap. + peek(): T; + top(): T; + front(): T; + + // Pop and return the current smallest value, and add the new item. + // This is more efficient than pop() followed by push(), and can be more appropriate when using a fixed size heap. + // Note that the value returned may be larger than item! + replace(item: T): T; + + // Fast version of a push followed by a pop. + pushpop(item: T): T; + + // Rebuild the heap. This method may come handy when the priority of the internal data is being modified. + heapify(): void; + + // Update the position of the given item in the heap. This function should be called every time the item is being modified. + updateItem(item: T): void; + + // Determine whether the heap is empty. + empty(): boolean; + + // Get the number of elements stored in the heap. + size(): number; + + // Return the array representation of the heap. (note: the array is a shallow copy of the heap's internal nodes) + toArray(): T[]; + + // Return a clone of the heap. (note: the internal data is a shallow copy of the original one) + clone(): Heap + copy(): Heap + + // Static Methods + + // Push item onto array, maintaining the heap invariant. + static push(array: T[], item: T, cmp?: (a: T, b: T) => number): void; + + // Pop the smallest item off the array, maintaining the heap invariant. + static pop(array: T[], cmp?: (a: T, b: T) => number): T; + + // Pop and return the current smallest value, and add the new item. + // This is more efficient than heappop() followed by heappush(), and can be more appropriate when using a fixed size heap. Note that the value returned may be larger than item! + static replace(array: T[], item: T, cmp?: (a: T, b: T) => number): T; + + // Fast version of a heappush followed by a heappop. + static pushpop(array: T[], item: T, cmp?: (a: T, b: T) => number): T; + + // Build the heap. + static heapify(array: T[], cmp?: (a: T, b: T) => number): Heap; + + // Update the position of the given item in the heap. This function should be called every time the item is being modified. + static updateItem(array: T[], item: T, cmp?: (a: T, b: T) => number): void; + + // Find the n largest elements in a dataset. + static nlargest(array: T[], n: number, cmp?: (a: T, b: T) => number): T[]; + + // Find the n smallest elements in a dataset. + static nsmallest(array: T[], n: number, cmp?: (a: T, b: T) => number): T[]; + +} + +declare module 'heap' { + export = Heap; +} From 18e1d3ad8c7b38e86ec6531c3f7308172a302072 Mon Sep 17 00:00:00 2001 From: Yaron Librach Date: Fri, 5 Jun 2015 01:06:34 -0400 Subject: [PATCH 411/534] Update definitions and tests to 1.0.1 spec. --- oclazyload/oclazyload-tests.ts | 106 +++++++++++++++++++---- oclazyload/oclazyload.d.ts | 153 +++++++++++++++++++++++++++++---- 2 files changed, 223 insertions(+), 36 deletions(-) diff --git a/oclazyload/oclazyload-tests.ts b/oclazyload/oclazyload-tests.ts index 3879a564b..d3d3d6b11 100644 --- a/oclazyload/oclazyload-tests.ts +++ b/oclazyload/oclazyload-tests.ts @@ -1,23 +1,95 @@ /// -var lazyloader:Function = ()=>{}; +angular.module('app', ['oc.lazyLoad']).config(['$ocLazyLoadProvider', function ($ocLazyLoadProvider: oc.ILazyLoadProvider) { + $ocLazyLoadProvider.config({ + debug: true, + events: true, + modules: [{ + name: 'TestModule', + files: ['js/TestModule.js'] + }] + }) +}]); -var config1: oc.ILazyLoadConfig = { - asyncLoader: lazyloader -}; +angular.module('app').controller(['$ocLazyLoadProvider', function ($ocLazyLoad: oc.ILazyLoad) { + $ocLazyLoad.load('testModule.js'); -var config2:oc.ILazyLoadConfig = { - asyncLoader: lazyloader, - loadedModules: ['module1', 'module2'] -}; + $ocLazyLoad.load(['testModule.js', 'testModuleCtrl.js', 'testModuleService.js']); -var moduleConfig:oc.ILazyLoadModuleConfig = { - name:'testmodule', - files:['testmodule'] -} + $ocLazyLoad.load([ + 'testModule.js', + { + type: 'css', + path: 'testModuleCtrl' + }, + { + type: 'html', + path: 'testModuleCtrl.html' + }, + { + type: 'js', + path: 'testModuleCtrl' + }, + 'js!testModuleService', + 'less!testModuleLessFile' + ]); -var config2:oc.ILazyLoadConfig = { - asyncLoader: lazyloader, - loadedModules: ['module1', 'module2'], - modules: [moduleConfig] -}; + $ocLazyLoad.load([ + { + files: [ + 'testModule.js', + 'bower_components/bootstrap/dist/js/bootstrap.js' + ], + cache: false, + kjdf: false + }, + { + files: ['anotherModule.js'], + cache: true + } + ]); + + $ocLazyLoad.load( + [ + 'testModule.js', + 'bower_components/bootstrap/dist/js/bootstrap.js', + 'anotherModule.js' + ], + { + cache: false + }); + + $ocLazyLoad.load( + [ + 'partials/template1.html', + 'partials/template2.html' + ], + { + cache: false, + reconfig: true, + rerun: true, + serie: true, + insertBefore: '#load_css_before', + timeout: 5000 + }); + + $ocLazyLoad.setModuleConfig({ + files: [ + 'testModule.js' + ], + cache: true + }); + + var getConfig: oc.IModuleConfig = $ocLazyLoad.getModuleConfig('testModule'); + + var getModules: string[] = $ocLazyLoad.getModules(); + + var isLoaded: boolean = $ocLazyLoad.isLoaded([ + 'testModule1.js', + 'testModule2.js' + ]); + + $ocLazyLoad.inject('testModule'); + + $ocLazyLoad.toggleWatch(true); +}]); \ No newline at end of file diff --git a/oclazyload/oclazyload.d.ts b/oclazyload/oclazyload.d.ts index 22ac45f9d..1acf7e781 100644 --- a/oclazyload/oclazyload.d.ts +++ b/oclazyload/oclazyload.d.ts @@ -7,28 +7,143 @@ declare module oc { - interface ILazyLoadConfig { - asyncLoader:any; - loadedModules?:string[]; - modules?:ILazyLoadModuleConfig[]; - } - - interface ILazyLoadModuleConfig { - name:string; - files:string[]; - } - interface ILazyLoad { - load(module:any):ng.IPromise; - loadTemplateFile(url:string, config:ILazyLoadModuleConfig):ng.IPromise; - loadTemplateFile(urls:string[], config:ILazyLoadModuleConfig):ng.IPromise; - getModuleName(moduleName:string):string; - getModules():string[]; - getModuleConfig(name:string):ILazyLoadModuleConfig; - setModuleConfig(config:ILazyLoadModuleConfig):void; + /** + * Loads a module or a list of modules into Angular. + * + * @param module The name of a predefined module config object, or a module config object, or an array of either + * @param config Options to be used when loading the modules + */ + load(module: string|ITypedModuleConfig|IModuleConfig|(string|ITypedModuleConfig|IModuleConfig)[], config?: IOptionsConfig): ng.IPromise; + + /** + * Defines a module config object. + * @param config The module config object + * @returns The module config object that was passed in + */ + setModuleConfig(config: IModuleConfig): IModuleConfig; + + /** + * Gets the specified module config object. + * @param name The name of the module config object to get + */ + getModuleConfig(name: string): IModuleConfig; + + /** + * Gets the list of loaded module names. + */ + getModules(): string[]; + + /** + * Checks if a module name, or list of modules names, has been previously loaded into Angular. + */ + isLoaded(moduleName: string|string[]): boolean; + + /** + * Injects a module with the associated name into Angular. Useful for manual injection when loading through RequireJS, SystemJS, etc. Useful in + * conjunction with the toggleWatch() method. + */ + inject(moduleName: string|string[]): boolean; + + /** + * Enables or disables watching Angular for new modules. Useful in conjunction with the inject() method. Make sure to not keep the watch enabled + * indefinitely, or unexpected results may occur. + */ + toggleWatch(watch: boolean): void; + } + + interface ITypedModuleConfig extends IOptionsConfig { + /** + * The file extension, without the period. For example, 'html'. + */ + type: string; + + /** + * The file path, including file name. + */ + path: string; + } + + interface IModuleConfig extends IOptionsConfig { + /** + * The name of the module for easy retrieval later. + */ + name?: string; + + /** + * The list of files to be loaded for this module. + */ + files: string[]; + } + + interface IOptionsConfig extends ng.IRequestShortcutConfig { + /** + * If true, bypasses browser cache by appending a timestamp to URLs. Defaults to true. + */ + cache?: boolean; + + /** + * If true, a module config will be invoked each time the module is reloaded. Use with caution, as re-invoking configs can lead to unexpected results. + * Defaults to false. + */ + reconfig?: boolean; + + /** + * If true, a module run block will be invoked each time the module is reloaded. Use with caution, as re-invoking run blocks can lead to unexpected results. + * Defaults to false. + */ + rerun?: boolean; + + /** + * If true, will load files in a series, instead of in parallel. Defaults to false. + */ + serie?: boolean; + + /** + * If set, will insert files immediately before the provided CSS selector, instead of the default behavior of inserting files immediately before the + * last child of the element. Defaults to undefined. + */ + insertBefore?: string; } interface ILazyLoadProvider { - config(config:ILazyLoadConfig):void; + /** + * Configures the main service provider. + * @param config The configuration settings to use + */ + config(config: IProviderConfig): void; + } + + interface IProviderConfig { + /** + * If true, all errors will be logged to the console, in addition to rejecting a promise. Defaults to false. + */ + debug?: boolean; + + /** + * If true, an event will be broadcast whenever a module, component or file is loaded. Events that can be broadcast are: ocLazyLoad.moduleLoaded, + * ocLazyLoad.moduleReloaded, ocLazyLoad.componentLoaded, ocLazyLoad.fileLoaded. Defaults to false. + */ + events?: boolean; + + /** + * Predefines a set of module configurations for later use. A name must be provided for each module so that it can be retrieved later. + */ + modules?: IModuleConfig[]; + } +} + +declare module angular { + interface IAngularStatic { + /** + * The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism. + * + * When passed two or more arguments, a new module is created. If passed only one argument, an existing module (the name passed as the first argument to module) is retrieved. + * + * @param name The name of the module to create or retrieve. + * @param requires The names of modules this module depends on, and/or ocLazyLoad module configurations. If specified then new module is being created. If unspecified then the module is being retrieved for further configuration. + * @param configFn Optional configuration function for the module. + */ + module(name: string, requires?: (string|oc.IModuleConfig)[], configFn?: Function): IModule; } } \ No newline at end of file From 85d9af51b40179a0e494a04e115afed54b13cc39 Mon Sep 17 00:00:00 2001 From: Igor Kriklivets Date: Fri, 5 Jun 2015 18:54:04 +0300 Subject: [PATCH 412/534] Update to 15.1.3 --- devextreme/14.2/dx.devextreme-14.2.7.d.ts | 5813 +++++++++++++++++++++ devextreme/dx.devextreme.d.ts | 1096 +++- 2 files changed, 6656 insertions(+), 253 deletions(-) create mode 100644 devextreme/14.2/dx.devextreme-14.2.7.d.ts diff --git a/devextreme/14.2/dx.devextreme-14.2.7.d.ts b/devextreme/14.2/dx.devextreme-14.2.7.d.ts new file mode 100644 index 000000000..a1d361f54 --- /dev/null +++ b/devextreme/14.2/dx.devextreme-14.2.7.d.ts @@ -0,0 +1,5813 @@ +// Type definitions for DevExtreme 14.2.7 +// Project: http://js.devexpress.com/ +// Definitions by: DevExpress Inc. +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module DevExpress { + /** A mixin that provides a capability to fire and subscribe to events. */ + export interface EventsMixin { + /** Subscribes to a specified event. */ + on(eventName: string, eventHandler: Function): T; + /** Subscribes to the specified events. */ + on(events: { [eventName: string]: Function; }): T; + /** Detaches all event handlers from the specified event. */ + off(eventName: string): Object; + /** Detaches a particular event handler from the specified event. */ + off(eventName: string, eventHandler: Function): T; + } + /** An object that serves as a namespace for the methods required to perform validation. */ + export module validationEngine { + export interface IValidator { + validate(): ValidatorValidationResult; + reset(): void; + } + export interface ValidatorValidationResult { + isValid: boolean; + name?: string; + value: any; + brokenRule: any; + validationRules: any[]; + } + export interface ValidationGroupValidationResult { + isValid: boolean; + brokenRules: any[]; + validators: IValidator[]; + } + export interface GroupConfig extends EventsMixin { + group: any; + validators: IValidator[]; + validate(): ValidationGroupValidationResult; + reset(): void; + } + /** Provides access to the object that represents the specified validation group. */ + export function getGroupConfig(group: any): GroupConfig + /** Provides access to the object that represents the default validation group. */ + export function getGroupConfig(): GroupConfig + /** Validates rules of the validators that belong to the specified validation group. */ + export function validateGroup(group: any): ValidationGroupValidationResult; + /** Validates rules of the validators that belong to the default validation group. */ + export function validateGroup(): ValidationGroupValidationResult; + /** Resets the values and validation result of the editors that belong to the specified validation group. */ + export function resetGroup(group: any): void; + /** Resets the values and validation result of the editors that belong to the default validation group. */ + export function resetGroup(): void; + /** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */ + export function validateModel(model: Object): ValidationGroupValidationResult; + /** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */ + export function registerModelForValidation(model: Object): void; + } + export var hardwareBackButton: JQueryCallback; + /** Processes the hardware back button click. */ + export function processHardwareBackButton(): void; + /** Specifies whether or not the entire application/site supports right-to-left representation. */ + export var rtlEnabled: boolean; + /** Registers a new component in the DevExpress.ui namespace, and a jQuery plugin and Knockout binding for the required component. */ + export function registerComponent(name: string, componentClass: Object): void; + /** Registers a new component in the specified namespace as a jQuery plugin, Angular directive and Knockout binding. */ + export function registerComponent(name: string, namespace: Object, componentClass: Object): void; + /** Requests that the browser call a specified function to update animation before the next repaint. */ + export function requestAnimationFrame(callback: Function): number; + /** Cancels an animation frame request scheduled with the requestAnimationFrame method. */ + export function cancelAnimationFrame(requestID: number): void; + /** Custom Knockout binding that links an HTML element with a specific action. */ + export class Action { } + /** Used to get URLs that vary in a locally running application and the application running on production. */ + export class EndpointSelector { + constructor(options: { + [key: string]: { + local?: string; + production?: string; + } + }); + /** Returns a local or a productional URL depending on how the application is currently running. */ + urlFor(key: string): string; + } + /** An object that serves as a namespace for the methods that are used to animate UI elements. */ + export module fx { + /** The animation object specifies the widget animation options. */ + export interface AnimationOptions { + /** A function called after animation is completed. */ + complete?: (element: JQuery, config: AnimationOptions) => void; + /** A number specifying wait time before animation execution. */ + delay?: number; + /** A number specifying the time in milliseconds spent on animation. */ + duration?: number; + /** A string specifying the type of an easing function used for animation. */ + easing?: string; + /** Specifies the initial widget animation state. */ + from?: any; + /** A function called before animation is started. */ + start?: (element: JQuery, config: AnimationOptions) => void; + /** Specifies the initial widget animation state. */ + to?: any; + /** A string value specifying the animation type. */ + type?: string; + /** Specifies the animation direction for the "slideIn" and "slideOut" animation types. */ + direction?: string; + } + /** Animates the specified element. */ + export function animate(element: HTMLElement, config: Object): Object; + /** Returns a value indicating whether the specified element is being animated. */ + export function isAnimating(element: HTMLElement): boolean; + /** Stops the animation. */ + export function stop(element: HTMLElement, jumpToEnd: boolean): void; + } + /** An object that serves as a namespace for the methods and events specifying information on the current device. */ + export module devices { + /** The device object defines the device on which the application is running. */ + export interface Device { + /** Indicates whether or not the device platform is Android. */ + android?: boolean; + /** Specifies the type of the device on which the application is running. */ + deviceType?: string; + /** Indicates whether or not the device platform is generic, which means that the application will look and behave according to a generic "light" or "dark" theme. */ + generic?: boolean; + /** Indicates whether or not the device platform is iOS. */ + ios?: boolean; + /** Indicates whether or not the device type is 'phone'. */ + phone?: boolean; + /** Specifies the platform of the device on which the application is running. */ + platform?: string; + /** Indicates whether or not the device type is 'tablet'. */ + tablet?: boolean; + /** Indicates whether or not the device platform is Tizen. */ + tizen?: boolean; + /** Specifies an array with the major and minor versions of the device platform. */ + version?: Array; + /** Indicates whether or not the device platform is Windows8. */ + win8?: boolean; + } + export var orientationChanged: JQueryCallback; + /** Overrides actual device information to force the application to operate as if it was running on the specified device. */ + export function current(deviceName: any): void; + /** Returns information about the current device. */ + export function current(): Device; + /** Returns the current device orientation. */ + export function orientation(): string; + /** Returns real information about the current device regardless of the value passed to the devices.current(deviceName) method. */ + export function real(): Device; + } + /** The position object specifies the widget positioning options. */ + export interface PositionOptions { + /** The target element position that the widget is positioned against. */ + at?: string; + /** The element within which the widget is positioned. */ + boundary?: Element; + /** A string value holding horizontal and vertical offset from the window's boundaries. */ + boundaryOffset?: string; + /** Specifies how to move the widget if it overflows the screen. */ + collision?: any; + /** The position of the widget to align against the target element. */ + my?: string; + /** The target element that the widget is positioned against. */ + of?: HTMLElement; + /** A string value holding horizontal and vertical offset in pixels, separated by a space (e.g., "5 -10"). */ + offset?: string; + } + export interface ComponentOptions { + /** A handler for the optionChanged event. */ + onOptionChanged?: Function; + /** A handler for the disposing event. */ + onDisposing?: Function; + } + /** A base class for all components and widgets. */ + export class Component { + constructor(options?: ComponentOptions) + /** Prevents the component from refreshing until the endUpdate method is called. */ + beginUpdate(): void; + /** Enables the component to refresh after the beginUpdate method call. */ + endUpdate(): void; + /** Returns an instance of this component class. */ + instance(): Component; + /** Sets one or more options of this component. */ + option(options: Object): void; + /** Returns the configuration options of this component. */ + option(): Object; + /** Gets the value of the specified configuration option of this component. */ + option(optionName: string): any; + /** Sets a value to the specified configuration option of this component. */ + option(optionName: string, optionValue: any): void; + } + export interface DOMComponentOptions extends ComponentOptions { + /** Specifies whether or not the current component supports a right-to-left representation. */ + rtlEnabled?: boolean; + } + /** A base class for all components. */ + export class DOMComponent extends Component { + constructor(element: JQuery, options?: DOMComponentOptions); + constructor(element: HTMLElement, options?: DOMComponentOptions); + /** Returns the root HTML element of the widget. */ + element(): JQuery; + /** Specifies the device-dependent default configuration options for this component. */ + static defaultOptions(rule: { + device?: any; + options?: any; + }): void; + } + export module data { + export interface ODataError extends Error { + httpStatus?: number; + errorDetails?: any; + } + export interface StoreOptions { + inserted?: (values: Object, key: any) => void; + inserting?: (values: Object) => void; + loaded?: (result: Array) => void; + loading?: (loadOptions: LoadOptions) => void; + modified?: () => void; + modifying?: () => void; + removed?: (key: any) => void; + removing?: (key: any) => void; + updated?: (key: any, values: Object) => void; + updating?: (key: any, values: Object) => void; + /** A handler for the modified event. */ + onModified?: () => void; + /** A handler for the modifying event. */ + onModifying?: () => void; + /** A handler for the removed event. */ + onRemoved?: (key: any) => void; + /** A handler for the removing event. */ + onRemoving?: (key: any) => void; + /** A handler for the updated event. */ + onUpdated?: (key: any, values: Object) => void; + /** A handler for the updating event. */ + onUpdating?: (key: any, values: Object) => void; + /** A handler for the loaded event. */ + onLoaded?: (result: Array) => void; + /** A handler for the loading event. */ + onLoading?: (loadOptions: LoadOptions) => void; + /** A handler for the inserted event. */ + onInserted?: (values: Object, key: any) => void; + /** A handler for the inserting event. */ + onInserting?: (values: Object) => void; + /** Specifies the function called when the Store causes an error. */ + errorHandler?: (e: Error) => void; + /** Specifies the key properties within the data associated with the Store. */ + key?: any; + } + export interface LoadOptions { + filter?: Object; + sort?: Object; + select?: Object; + expand?: Object; + group?: Object; + skip?: number; + take?: number; + userData?: Object; + requireTotalCount?: boolean; + } + /** The base class for all Stores. */ + export class Store implements EventsMixin { + inserted: JQueryCallback; + inserting: JQueryCallback; + loaded: JQueryCallback; + loading: JQueryCallback; + modified: JQueryCallback; + modifying: JQueryCallback; + removed: JQueryCallback; + removing: JQueryCallback; + updated: JQueryCallback; + updating: JQueryCallback; + constructor(options?: StoreOptions); + /** Returns the data item specified by the key. */ + byKey(key: any): JQueryPromise; + /** Adds an item to the data associated with this Store. */ + insert(values: Object): JQueryPromise; + /** Returns the key expression specified via the key configuration option. */ + key(): any; + /** Returns the key of the Store item that matches the specified object. */ + keyOf(obj: Object): any; + /** Starts loading the data. */ + load(obj?: LoadOptions): JQueryPromise; + /** Removes the data item specified by the key. */ + remove(key: any): JQueryPromise; + /** Obtains the total count of items that will be returned by the load() function. */ + totalCount(obj?: { + filter?: Object; + select?: Object; + group?: Object; + sort?: Object; + }): JQueryPromise; + /** Updates the data item specified by the key. */ + update(key: any, values: Object): JQueryPromise; + on(eventName: "removing", eventHandler: (key: any) => void): Store; + on(eventName: "removed", eventHandler: (key: any) => void): Store; + on(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + on(eventName: "inserting", eventHandler: (values: Object) => void): Store; + on(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + on(eventName: "modifying", eventHandler: () => void): Store; + on(eventName: "modified", eventHandler: () => void): Store; + on(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + on(eventName: "loaded", eventHandler: (result: Array) => void): Store; + on(eventName: string, eventHandler: Function): Store; + on(events: { [eventName: string]: Function; }): Store; + off(eventName: "removing"): Store; + off(eventName: "removed"): Store; + off(eventName: "updating"): Store; + off(eventName: "updated"): Store; + off(eventName: "inserting"): Store; + off(eventName: "inserted"): Store; + off(eventName: "modifying"): Store; + off(eventName: "modified"): Store; + off(eventName: "loading"): Store; + off(eventName: "loaded"): Store; + off(eventName: string): Store; + off(eventName: "removing", eventHandler: (key: any) => void): Store; + off(eventName: "removed", eventHandler: (key: any) => void): Store; + off(eventName: "updating", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "updated", eventHandler: (key: any, values: Object) => void): Store; + off(eventName: "inserting", eventHandler: (values: Object) => void): Store; + off(eventName: "inserted", eventHandler: (values: Object, key: any) => void): Store; + off(eventName: "modifying", eventHandler: () => void): Store; + off(eventName: "modified", eventHandler: () => void): Store; + off(eventName: "loading", eventHandler: (loadOptions: LoadOptions) => void): Store; + off(eventName: "loaded", eventHandler: (result: Array) => void): Store; + off(eventName: string, eventHandler: Function): Store; + } + export interface ArrayStoreOptions extends StoreOptions { + /** Specifies the array associated with this Store. */ + data?: Array; + } + /** A Store accessing an in-memory array. */ + export class ArrayStore extends Store { + constructor(options?: ArrayStoreOptions); + /** Clears all data associated with the current ArrayStore. */ + clear(): void; + /** Creates the Query object for the underlying array. */ + createQuery(): Query; + } + interface Promise { + then(doneFn?: Function, failFn?: Function, progressFn?: Function): Promise; + } + export interface CustomStoreOptions extends StoreOptions { + /** The user implementation of the byKey(key, extraOptions) method. */ + byKey?: (key: any) => Promise; + /** + * User implementation of the byKey(key, extraOptions) method. + * @deprecated byKey.md + */ + lookup?: (key: any) => Promise; + /** The user implementation of the insert(values) method. */ + insert?: (values: Object) => Promise; + /** The user implementation of the load(options) method. */ + load?: (options?: LoadOptions) => Promise; + /** The user implementation of the remove(key) method. */ + remove?: (key: any) => Promise; + /** The user implementation of the totalCount(options) method. */ + totalCount?: () => Promise; + /** The user implementation of the update(key, values) method. */ + update?: (key: any, values: Object) => Promise; + } + /** A Store object that enables you to implement your own data access logic. */ + export class CustomStore extends Store { + constructor(options: CustomStoreOptions); + } + export interface DataSourceOptions { + /** Specifies data filtering conditions. */ + filter?: Object; + /** Specifies data grouping conditions. */ + group?: Object; + /** The item mapping function. */ + map?: (record: any) => any; + /** Specifies the maximum number of items the page can contain. */ + pageSize?: number; + /** Specifies whether a DataSource loads data by pages, or all items at once. */ + paginate?: boolean; + /** The data post processing function. */ + postProcess?: (data: any[]) => any[]; + /** Specifies a value by which the required items are searched. */ + searchExpr?: Object; + /** Specifies the comparison operation used to search for the required items. */ + searchOperation?: string; + /** Specifies the value to which the search expression is compared. */ + searchValue?: Object; + /** Specifies the initial select option value. */ + select?: Object; + /** An array of the strings that represent the names of the navigation properties to be loaded simultaneously with the OData store's entity. */ + expand?: Object; + /** Specifies the initial sort option value. */ + sort?: Object; + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Error) => void; + } + /** An object that provides access to a data web service or local data storage for collection container widgets. */ + export class DataSource implements EventsMixin { + constructor(options?: DataSourceOptions); + changed: JQueryCallback; + loadError: JQueryCallback; + loadingChanged: JQueryCallback; + /** Disposes all resources associated with this DataSource. */ + dispose(): void; + /** Returns the current filter option value. */ + filter(): Object; + /** Sets the filter option value. */ + filter(filterExpr: Object): void; + /** Returns the current group option value. */ + group(): Object; + /** Sets the group option value. */ + group(groupExpr: Object): void; + /** Indicates whether or not the current page contains fewer items than the number of items specified by the pageSize configuration option. */ + isLastPage(): boolean; + /** Indicates whether or not at least one load() method execution has successfully finished. */ + isLoaded(): boolean; + /** Indicates whether or not the DataSource is currently being loaded. */ + isLoading(): boolean; + /** Returns the array of items currently operated by the DataSource. */ + items(): Array; + /** Returns the key expression. */ + key(): any; + /** Starts loading data. */ + load(): JQueryPromise>; + /** Returns an object that would be passed to the load() method of the underlying Store according to the current data shaping option values of the current DataSource instance. */ + loadOptions(): Object; + /** Returns the current pageSize option value. */ + pageSize(): number; + /** Sets the pageSize option value. */ + pageSize(value: number): void; + /** Specifies the index of the currently loaded page. */ + pageIndex(): number; + /** Specifies the index of the page to be loaded during the next load() method execution. */ + pageIndex(newIndex: number): void; + /** Returns the current paginate option value. */ + paginate(): boolean; + /** Sets the paginate option value. */ + paginate(value: boolean): void; + /** Returns the searchExpr option value. */ + searchExpr(): Object; + /** Sets the searchExpr option value. */ + searchExpr(expr: Object): void; + /** Returns the currently specified search operation. */ + searchOperation(): string; + /** Sets the current search operation. */ + searchOperation(op: string): void; + /** Returns the searchValue option value. */ + searchValue(): Object; + /** Sets the searchValue option value. */ + searchValue(value: Object): void; + /** Returns the current select option value. */ + select(): Object; + /** Sets the select option value. */ + select(expr: Object): void; + /** Returns the current sort option value. */ + sort(): Object; + /** Sets the sort option value. */ + sort(sortExpr: Object): void; + /** Returns the underlying Store instance. */ + store(): Store; + /** Returns the number of data items available in an underlying Store after the last load() operation without paging. */ + totalCount(): number; + on(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + on(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + on(eventName: "changed", eventHandler: () => void): DataSource; + on(eventName: string, eventHandler: Function): DataSource; + on(events: { [eventName: string]: Function; }): DataSource; + off(eventName: "loadingChanged"): DataSource; + off(eventName: "loadError"): DataSource; + off(eventName: "changed"): DataSource; + off(eventName: string): DataSource; + off(eventName: "loadingChanged", eventHandler: (isLoading: boolean) => void): DataSource; + off(eventName: "loadError", eventHandler: (e?: Error) => void): DataSource; + off(eventName: "changed", eventHandler: () => void): DataSource; + off(eventName: string, eventHandler: Function): DataSource; + } + /** An object used to work with primitive data types not supported by JavaScript when accessing an OData web service. */ + export class EdmLiteral { + /** Returns a string representation of the value associated with this EdmLiteral object. */ + valueOf(): string; + } + /** An object used to generate and hold the GUID. */ + export class Guid { + /** Creates a new Guid instance that holds the specified GUID. */ + constructor(value: string); + /** Creates a new Guid instance holding the generated GUID. */ + constructor(); + /** Returns a string representation of the Guid instance. */ + toString(): string; + /** Returns a string representation of the Guid instance. */ + valueOf(): string; + } + export interface LocalStoreOptions extends ArrayStoreOptions { + /** Specifies the time (in miliseconds) after the change operation, before the data is flushed. */ + flushInterval?: number; + /** Specifies whether the data is flushed immediatelly after each change operation, or after the delay specified via the flushInterval option. */ + immediate?: boolean; + /** The unique identifier used to distinguish the data within the HTML5 Web Storage. */ + name?: string; + } + /** A Store providing access to the HTML5 Web Storage. */ + export class LocalStore extends ArrayStore { + constructor(options?: LocalStoreOptions); + /** Removes all data associated with this Store. */ + clear(): void; + } + export interface ODataContextOptions extends ODataStoreOptions { + /** Specifies the list of entities to be accessed via the ODataContext. */ + entities?: Object; + /** Specifies the function called if the ODataContext causes an error. */ + errorHandler?: (e: Error) => void; + } + /** Provides access to the entire OData service. */ + export class ODataContext { + constructor(options?: ODataContextOptions); + /** Initiates the specified WebGet service operation that returns a value. For the information on service operations, refer to the OData documentation. */ + get(operationName: string, params: Object): JQueryPromise; + /** Initiates the specified WebGet service operation that returns nothing. For the information on service operations, refer to the OData documentation. */ + invoke(operationName: string, params: Object, httpMethod: Object): JQueryPromise; + /** Return a special proxy object to describe the entity link. */ + objectLink(entityAlias: string, key: any): Object; + } + export interface ODataStoreOptions extends StoreOptions { + /** A function used to customize a web request before it is sent. */ + beforeSend?: (request: Object) => void; + /** Specifies whether the ODataStore uses the JSONP approach to access non-CORS-compatible remote services. */ + jsonp?: boolean; + /** Specifies the type of the ODataStore key property. The following key types are supported out of the box: String, Int32, Int64, and Guid. */ + keyType?: any; + /** Specifies the URL of the data service being accessed via the current ODataContext. */ + url?: string; + /** Specifies the version of the OData protocol used to interact with the data service. */ + version?: number; + /** Specifies the value of the withCredentials field of the underlying jqXHR object. */ + withCredentials?: boolean; + } + /** A Store providing access to a separate OData web service entity. */ + export class ODataStore extends Store { + constructor(options?: ODataStoreOptions); + /** Creates the Query object for the OData endpoint. */ + createQuery(loadOptions: Object): Object; + /** Returns the data item specified by the key. */ + byKey(key: any, extraOptions?: { expand?: Object }): JQueryPromise; + } + /** An universal chainable data query interface object. */ + export interface Query { + /** Calculates a custom summary for the items in the current Query. */ + aggregate(step: (accumulator: any, value: any) => any): JQueryPromise; + /** Calculates a custom summary for the items in the current Query. */ + aggregate(seed: any, step: (accumulator: any, value: any) => any, finalize: (result: any) => any): JQueryPromise; + /** Calculates the average item value for the current Query. */ + avg(getter: Object): JQueryPromise; + /** Finds the item with the maximum getter value. */ + max(getter: Object): JQueryPromise; + /** Finds the item with the maximum value in the Query. */ + max(): JQueryPromise; + /** Finds the item with the minimum value in the Query. */ + min(): JQueryPromise; + /** Finds the item with the minimum getter value. */ + min(getter: Object): JQueryPromise; + /** Calculates the average item value for the current Query, if each Query item has a numeric type. */ + avg(): JQueryPromise; + /** Returns the total count of items in the current Query. */ + count(): JQueryPromise; + /** Executes the Query. */ + enumerate(): JQueryPromise; + /** Filters the current Query data. */ + filter(criteria: Array): Query; + /** Groups the current Query data. */ + groupBy(getter: Object): Query; + /** Applies the specified transformation to each item. */ + select(getter: Object): Query; + /** Limits the data item count. */ + slice(skip: number, take?: number): Query; + /** Sorts current Query data. */ + sortBy(getter: Object, desc: boolean): Query; + /** Sorts current Query data. */ + sortBy(getter: Object): Query; + /** Calculates the sum of item getter values in the current Query. */ + sum(getter: Object): JQueryPromise; + /** Calculates the sum of item values in the current Query. */ + sum(): JQueryPromise; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object): Query; + /** Adds one more sorting condition to the current Query. */ + thenBy(getter: Object, desc: boolean): Query; + /** Returns the array of current Query items. */ + toArray(): Array; + } + /** The global data layer error handler. */ + export var errorHandler: (e: Error) => void; + /** Encodes the specified string or array of bytes to base64 encoding. */ + export function base64_encode(input: any): string; + /** Creates a Query instance. */ + export function query(array: Array): Query; + /** Creates a Query instance for accessing the remote service specified by a URL. */ + export function query(url: string, queryOptions: Object): Query; + /** This section describes the utility objects provided by the DevExtreme data layer. */ + export var utils: { + /** Compiles a getter function from the getter expression. */ + compileGetter(expr: any): Function; + /** Compiles a setter function from the setter expression. */ + compileSetter(expr: any): Function; + odata: { + /** Holds key value converters for OData. */ + keyConverters: { + String(value: any): string; + Int32(value: any): number; + Int64(value: any): EdmLiteral; + Guid(value: any): Guid; + Boolean(value: any): boolean; + Single(value: any): EdmLiteral; + Decimal(value: any): EdmLiteral; + }; + } + } + } + /** An object that serves as a namespace for DevExtreme UI widgets as well as for methods implementing UI logic in DevExtreme sites/applications. */ + export module ui { + /** + * Sets parameters for the viewport meta tag. + * @deprecated Use the "DevExpress.utils.initMobileViewport" option instead. + */ + export function initViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; + export interface WidgetOptions extends DOMComponentOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + /** Specifies whether or not the widget can be focused. */ + focusStateEnabled?: boolean; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** Specifies the width of the widget. */ + width?: any; + /** Specifies the widget tab index. */ + tabIndex?: number; + /** Specifies the text of the hint displayed for the widget. */ + hint?: string; + } + /** The base class for widgets. */ + export class Widget extends DOMComponent { + constructor(options?: WidgetOptions); + /** Redraws the widget. */ + repaint(): void; + /** Sets focus on the widget. */ + focus(): void; + } + export interface CollectionWidgetOptions extends WidgetOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + itemClickAction?: any; + itemHoldAction?: Function; + /** The time period in milliseconds before the onItemHold event is raised. */ + itemHoldTimeout?: number; + itemRender?: any; + itemRenderedAction?: Function; + /** An array of items displayed by the widget. */ + items?: Array; + /** + * A function performed when a widget item is selected. + * @deprecated onSelectionChanged.md + */ + itemSelectAction?: Function; + /** The template to be used for rendering items. */ + itemTemplate?: any; + loopItemFocus?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + onContentReady?: any; + contentReadyAction?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemContextMenu event. */ + onItemContextMenu?: Function; + /** A handler for the itemHold event. */ + onItemHold?: Function; + /** A handler for the itemRendered event. */ + onItemRendered?: Function; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** The index of the currently selected widget item. */ + selectedIndex?: number; + /** The selected item object. */ + selectedItem?: Object; + /** An array of currently selected item objects. */ + selectedItems?: Array; + /** A handler for the itemDeleting event. */ + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + } + /** The base class for widgets containing an item collection. */ + export class CollectionWidget extends Widget { + constructor(element: JQuery, options?: CollectionWidgetOptions); + constructor(element: HTMLElement, options?: CollectionWidgetOptions); + selectItem(itemElement: any): void; + unselectItem(itemElement: any): void; + deleteItem(itemElement: any): JQueryPromise; + isItemSelected(itemElement: any): boolean; + reorderItem(itemElement: any, toItemElement: any): JQueryPromise; + } + export interface DataExpressionMixinOptions { + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of a data source item field whose value is held in the value configuration option. */ + valueExpr?: any; + itemRender?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** The currently selected value in the widget. */ + value?: Object; + } + export interface EditorOptions extends WidgetOptions { + /** The currently specified value. */ + value?: Object; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + valueChangeAction?: Function; + /** A Boolean value specifying whether or not the widget is read-only. */ + readOnly?: boolean; + /** Holds the object that defines the error that occurred during validation. */ + validationError?: Object; + /** Specifies whether the editor's value is valid. */ + isValid?: boolean; + /** Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ + validationMessageMode?: string; + } + /** A base class for editors. */ + export class Editor extends Widget { + /** Resets the editor's value to undefined. */ + reset(): void; + } + /** An object that serves as a namespace for methods displaying a message in an application/site. */ + export var dialog: { + /** Creates an alert dialog message containing a single "OK" button. */ + alert(message: string, title: string): JQueryPromise; + /** Creates a confirm dialog that contains "Yes" and "No" buttons. */ + confirm(message: string, title: string): JQueryPromise; + /** Creates a custom dialog using the options specified by the passed configuration object. */ + custom(options: { title?: string; message?: string; buttons?: Array; }): { + show(): JQueryPromise; + hide(): void; + hide(value: any): void; + }; + }; + /** Creates a toast message. */ + export function notify(message: any, type: string, displayTime: number): void; + /** Creates a toast message. */ + export function notify(options: Object): void; + /** An object that serves as a namespace for the methods that work with DevExtreme CSS Themes. */ + export var themes: { + /** Returns the name of the currently applied theme. */ + current(): string; + /** Changes the current theme to the specified one. */ + current(themeName: string): void; + }; + /** Sets a specified template engine. */ + export function setTemplateEngine(name: string): void; + /** Sets a custom template engine defined via custom compile and render functions. */ + export function setTemplateEngine(options: Object): void; + /** An object that serves as a namespace for utility methods that can be helpful when working with the DevExtreme framework and UI widgets. */ + export var utils: { + /** Sets parameters for the viewport meta tag. */ + initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; + }; + } +} +declare module DevExpress.framework { + /** An object used to store information on the views displayed in an application. */ + export class ViewCache { + viewRemoved: JQueryCallback; + /** Removes all the viewInfo objects from the cache. */ + clear(): void; + /** Obtains a viewInfo object from the cache by the specified key. */ + getView(key: string): Object; + /** Checks whether or not a viewInfo object is contained in the view cache under the specified key. */ + hasView(key: string): boolean; + /** Removes a viewInfo object from the cache by the specified key. */ + removeView(key: string): Object; + /** Adds the specified viewInfo object to the cache under the specified key. */ + setView(key: string, viewInfo: Object): void; + } + export interface dxCommandOptions extends DOMComponentOptions { + action?: any; + /** Specifies an action performed when the execute() method of the command is called. */ + onExecute?: any; + /** Indicates whether or not the widget that displays this command is disabled. */ + disabled?: boolean; + /** Specifies the name of the icon shown inside the widget associated with this command. */ + icon?: string; + /** A URL pointing to the icon shown inside the widget associated with this command. */ + iconSrc?: string; + /** The identifier of the command. */ + id?: string; + /** Specifies the title of the widget associated with this command. */ + title?: string; + /** Specifies the type of the button, if the command is rendered as a dxButton widget. */ + type?: string; + /** A Boolean value specifying whether or not the widget associated with this command is visible. */ + visible?: boolean; + } + /** A markup component used to define markup options for a command. */ + export class dxCommand extends DOMComponent { + constructor(element: JQuery, options: dxCommandOptions); + constructor(options: dxCommandOptions); + /** Executes the action associated with this command. */ + execute(): void; + } + /** An object responsible for routing. */ + export class Router { + /** Adds a routing rule to the list of registered rules. */ + register(pattern: string, defaults?: Object, constraints?: Object): void; + /** Decodes the specified URI to an object using the registered routing rules. */ + parse(uri: string): Object; + /** Formats an object to a URI. */ + format(obj: Object): string; + } + export interface StateManagerOptions { + /** A storage to which the state manager saves the application state. */ + storage?: Object; + } + /** An object used to store the current application state. */ + export class StateManager { + constructor(options?: StateManagerOptions); + /** Adds an object that implements an interface of a state source to the state manager's collection of state sources. */ + addStateSource(stateSource: Object): void; + /** Removes a specified state source from the state manager's collection of state sources. */ + removeStateSource(stateSource: Object): void; + /** Saves the current application state. */ + saveState(): void; + /** Restores the application state that has been saved by the saveState() method to the state storage. */ + restoreState(): void; + /** Removes the application state that has been saved by the saveState() method to the state storage. */ + clearState(): void; + } + export module html { + export var layoutSets: Array; + export interface HtmlApplicationOptions { + /** Specifies where the commands that are defined in the application's views must be displayed. */ + commandMapping?: Object; + /** + * The name of the default layout used by the application. + * @deprecated navigationType.md + */ + defaultLayout?: string; + /** Specifies whether or not view caching is disabled. */ + disableViewCache?: boolean; + /** An array of layout controllers that should be used to show application views in the current navigation context. */ + layoutSet?: any; + /** Specifies whether the current application must behave as a mobile or web application. */ + mode?: string; + /** Specifies the object that represents a root namespace of the application. */ + namespace?: Object; + /** Specifies application behavior when the user navigates to a root view. */ + navigateToRootViewMode?: string; + /** An array of dxCommand configuration objects used to define commands available from the application's global navigation. */ + navigation?: Array; + /** A state manager to be used in the application. */ + stateManager?: StateManager; + /** Specifies the storage to be used by the application's state manager to store the application state. */ + stateStorage?: Object; + /** + * Specifies a strategy for choosing layouts for views in your application. + * @deprecated layoutSet.md + */ + navigationType?: string; + /** + * Specifies the object that represents the root namespace of the application. + * @deprecated namespace.md + */ + ns?: Object; + /** Indicates whether on not to use the title of the previously displayed view as text on the Back button. */ + useViewTitleAsBackText?: boolean; + /** A custom view cache to be used in the application. */ + viewCache?: Object; + /** Specifies a limit for the views that can be cached. */ + viewCacheSize?: number; + /** Specifies options for the viewport meta tag of a mobile browser. */ + viewPort?: JQuery; + /** A custom router to be used in the application. */ + router?: Router; + } + /** An object used to manage views, as well as control the application life cycle. */ + export class HtmlApplication implements EventsMixin { + constructor(options: HtmlApplicationOptions); + afterViewSetup: JQueryCallback; + beforeViewSetup: JQueryCallback; + initialized: JQueryCallback; + navigating: JQueryCallback; + navigatingBack: JQueryCallback; + resolveLayoutController: JQueryCallback; + viewDisposed: JQueryCallback; + viewDisposing: JQueryCallback; + viewHidden: JQueryCallback; + viewRendered: JQueryCallback; + viewShowing: JQueryCallback; + viewShown: JQueryCallback; + /** Provides access to the ViewCache object. */ + viewCache: ViewCache; + /** An array of dxCommand components that are created based on the application's navigation option value. */ + navigation: Array; + /** Provides access to the StateManager object. */ + stateManager: StateManager; + /** Provides access to the Router object. */ + router: Router; + /** Navigates to the URI preceding the current one in the navigation history. */ + back(): void; + /** Returns a Boolean value indicating whether or not backwards navigation is currently possible. */ + canBack(): boolean; + /** Calls the clearState() method of the application's StateManager object. */ + clearState(): void; + /** Creates global navigation commands. */ + createNavigation(navigationConfig: Array): void; + /** Returns an HTML template of the specified view. */ + getViewTemplate(viewName: string): JQuery; + /** Returns a configuration object used to create a dxView component for a specified view. */ + getViewTemplateInfo(viewName: string): Object; + /** Adds a specified HTML template to a collection of view or layout templates. */ + loadTemplates(source: any): JQueryPromise; + /** Navigates to the specified URI. */ + navigate(uri?: any, options?: Object): void; + /** Renders navigation commands to the navigation command containers that are located in the layouts used in the application. */ + renderNavigation(): void; + /** Calls the restoreState() method of the application's StateManager object. */ + restoreState(): void; + /** Calls the saveState method of the application's StateManager object. */ + saveState(): void; + /** Provides access to the object that defines the current context to be considered when choosing an appropriate template for a view. */ + templateContext(): Object; + on(eventName: "initialized", eventHandler: () => void): HtmlApplication; + on(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + on(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + on(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + on(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + on(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + on(eventName: string, eventHandler: Function): HtmlApplication; + on(events: { [eventName: string]: Function; }): HtmlApplication; + off(eventName: "initialized"): HtmlApplication; + off(eventName: "afterViewSetup"): HtmlApplication; + off(eventName: "beforeViewSetup"): HtmlApplication; + off(eventName: "navigating"): HtmlApplication; + off(eventName: "navigatingBack"): HtmlApplication; + off(eventName: "resolveLayoutController"): HtmlApplication; + off(eventName: "viewDisposed"): HtmlApplication; + off(eventName: "viewDisposing"): HtmlApplication; + off(eventName: "viewHidden"): HtmlApplication; + off(eventName: "viewRendered"): HtmlApplication; + off(eventName: "viewShowing"): HtmlApplication; + off(eventName: "viewShown"): HtmlApplication; + off(eventName: string): HtmlApplication; + off(eventName: "initialized", eventHandler: () => void): HtmlApplication; + off(eventName: "afterViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "beforeViewSetup", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "navigating", eventHandler: (e: { + currentUri: string; + uri: string; + cancel: boolean; + options: { + root: boolean; + target: string; + direction: string; + rootInDetailPane: boolean; + modal: boolean; + }; + }) => void): HtmlApplication; + off(eventName: "navigatingBack", eventHandler: (e: { + cancel: boolean; + isHardwareButton: boolean; + }) => void): HtmlApplication; + off(eventName: "resolveLayoutController", eventHandler: (e: { + viewInfo: Object; + layoutController: Object; + availableLayoutControllers: Array; + }) => void): HtmlApplication; + off(eventName: "viewDisposed", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewDisposing", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewHidden", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewRendered", eventHandler: (e: { + viewInfo: Object; + }) => void): HtmlApplication; + off(eventName: "viewShowing", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: "viewShown", eventHandler: (e: { + viewInfo: Object; + direction: string; + }) => void): HtmlApplication; + off(eventName: string, eventHandler: Function): HtmlApplication; + } + } +} +declare module DevExpress.ui { + export interface dxValidatorOptions extends DOMComponentOptions { + /** An array of validation rules to be checked for the editor with which the dxValidator object is associated. */ + validationRules?: Array; + /** Specifies the editor name to be used in the validation default messages. */ + name?: string; + /** An object that specifies what and when to validate and how to apply the validation result. */ + adapter?: Object; + /** Specifies the validation group the editor will be related to. */ + validationGroup?: string; + /** A handler for the validated event. */ + onValidated?: (params: validationEngine.ValidatorValidationResult) => void; + } + /** A widget that is used to validate the associated DevExtreme editors against the defined validation rules. */ + export class dxValidator extends DOMComponent implements validationEngine.IValidator { + constructor(element: JQuery, options?: dxValidatorOptions); + constructor(element: Element, options?: dxValidatorOptions); + /** Validates the value of the editor that is controlled by the current dxValidator object against the list of the specified validation rules. */ + validate(): validationEngine.ValidatorValidationResult; + /** Resets the value and validation result of the editor associated with the current dxValidator object. */ + reset(): void; + } + /** The widget that is used in the Knockout and Angular approaches to combine the editors to be validated. */ + export class dxValidationGroup extends DOMComponent { + constructor(element: JQuery); + constructor(element: Element); + /** Validates rules of the validators that belong to the current validation group. */ + validate(): validationEngine.ValidationGroupValidationResult; + /** Resets the value and validation result of the editors that are included to the current validation group. */ + reset(): void; + } + export interface dxValidationSummaryOptions extends CollectionWidgetOptions { + /** Specifies the validation group for which summary should be generated. */ + validationGroup?: string; + } + /** A widget for displaying the result of checking validation rules for editors. */ + export class dxValidationSummary extends CollectionWidget { + constructor(element: JQuery, options?: dxValidationSummaryOptions); + constructor(element: Element, options?: dxValidationSummaryOptions); + } + export interface dxTooltipOptions extends dxPopoverOptions { + } + /** A tooltip widget. */ + export class dxTooltip extends dxPopover { + constructor(element: JQuery, options?: dxTooltipOptions); + constructor(element: Element, options?: dxTooltipOptions); + } + export interface dxDropDownListOptions extends dxDropDownEditorOptions { + /** Returns the value currently displayed by the widget. */ + displayValue?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies the name of a data source item field or an expression whose value is compared to the search criterion. */ + searchExpr?: Object; + /** Specifies the binary operation used to filter data. */ + searchMode?: string; + /** Specifies the time delay, in milliseconds, after the last character has been typed in, before a search is executed. */ + searchTimeout?: number; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + /** Specifies whether or not the widget supports searching. */ + searchEnabled?: boolean; + /** Specifies whether or not the widget displays items by pages. */ + pagingEnabled?: boolean; + /** The text or HTML markup displayed by the widget if the item collection is empty. */ + noDataText?: string; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: Function; + /** A handler for the itemClick event. */ + onItemClick?: Function; + onContentReady?: Function; + /** Specifies whether or not the widget supports the focused state and keyboard navigation. */ + focusStateEnabled?: boolean; + } + /** A base class for drop-down list widgets. */ + export class dxDropDownList extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDropDownListOptions); + constructor(element: Element, options?: dxDropDownListOptions); + } + export interface dxToolbarOptions extends CollectionWidgetOptions { + menuItemRender?: any; + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** Informs the widget about its location in a view HTML markup. */ + renderAs?: string; + } + /** A toolbar widget. */ + export class dxToolbar extends CollectionWidget { + constructor(element: JQuery, options?: dxToolbarOptions); + constructor(element: Element, options?: dxToolbarOptions); + } + export interface dxToastOptions extends dxOverlayOptions { + animation?: fx.AnimationOptions; + /** The time span in milliseconds during which the dxToast widget is visible. */ + displayTime?: number; + height?: any; + /** The dxToast message text. */ + message?: string; + position?: PositionOptions; + shading?: boolean; + /** Specifies the dxToast widget type. */ + type?: string; + width?: any; + closeOnBackButton?: boolean; + } + /** The toast message widget. */ + export class dxToast extends dxOverlay { + constructor(element: JQuery, options?: dxToastOptions); + constructor(element: Element, options?: dxToastOptions); + } + export interface dxTextEditorOptions extends EditorOptions { + /** A handler for the change event. */ + onChange?: Function; + changeAction?: Function; + /** A handler for the copy event. */ + onCopy?: Function; + copyAction?: Function; + /** A handler for the cut event. */ + onCut?: Function; + cutAction?: Function; + /** A handler for the enterKey event. */ + onEnterKey?: Function; + enterKeyAction?: Function; + /** A handler for the focusIn event. */ + onFocusIn?: Function; + focusInAction?: Function; + /** A handler for the focusOut event. */ + onFocusOut?: Function; + focusOutAction?: Function; + /** A handler for the input event. */ + onInput?: Function; + inputAction?: Function; + /** A handler for the keyDown event. */ + onKeyDown?: Function; + keyDownAction?: Function; + /** A handler for the keyPress event. */ + onKeyPress?: Function; + keyPressAction?: Function; + /** A handler for the keyUp event. */ + onKeyUp?: Function; + keyUpAction?: Function; + /** A handler for the paste event. */ + onPaste?: Function; + pasteAction?: Function; + /** The text displayed by the widget when the widget value is empty. */ + placeholder?: string; + /** Specifies whether to display the Clear button in the widget. */ + showClearButton?: boolean; + /** Specifies the current value displayed by the widget. */ + value?: any; + valueUpdateAction?: Function; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; + valueUpdateEvent?: string; + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + /** Specifies HTML attributes applied to the inner input element of the widget. */ + attr?: Object; + /** The read-only option that holds the text displayed by the widget input element. */ + text?: string; + /** Specifies whether or not the widget supports the focused state and keyboard navigation. */ + focusStateEnabled?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + } + /** A base class for text editing widgets. */ + export class dxTextEditor extends Editor { + constructor(element: JQuery, options?: dxTextEditorOptions); + constructor(element: Element, options?: dxTextEditorOptions); + /** Removes focus from the input element. */ + blur(): void; + /** Sets focus to the input element representing the widget. */ + focus(): void; + } + export interface dxTextBoxOptions extends dxTextEditorOptions { + /** Specifies the maximum number of characters you can enter into the textbox. */ + maxLength?: any; + /** The "mode" attribute value of the actual HTML input element representing the text box. */ + mode?: string; + } + /** A single-line text box widget. */ + export class dxTextBox extends dxTextEditor { + constructor(element: JQuery, options?: dxTextBoxOptions); + constructor(element: Element, options?: dxTextBoxOptions); + } + export interface dxTextAreaOptions extends dxTextBoxOptions { + /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ + spellcheck?: boolean; + } + /** A widget used to display and edit multi-line text. */ + export class dxTextArea extends dxTextBox { + constructor(element: JQuery, options?: dxTextAreaOptions); + constructor(element: Element, options?: dxTextAreaOptions); + } + export interface dxTabsOptions extends CollectionWidgetOptions { + /** Specifies whether the widget enables an end-user to select only a single item or multiple items. */ + selectionMode?: string; + /** Specifies whether or not an end-user can scroll tabs by swiping. */ + scrollByContent?: boolean; + /** Specifies whether or not an end-user can scroll tabs. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; + } + /** A tab strip used to switch between pages. */ + export class dxTabs extends CollectionWidget { + constructor(element: JQuery, options?: dxTabsOptions); + constructor(element: Element, options?: dxTabsOptions); + } + export interface dxTabPanelOptions extends dxMultiViewOptions { + /** A handler for the titleClick event. */ + onTitleClick?: any; + /** A handler for the titleHold event. */ + onTitleHold?: Function; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + titleTemplate?: any; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + } + /** A widget used to display a view and to switch between several views by clicking the appropriate tabs. */ + export class dxTabPanel extends dxMultiView { + constructor(element: JQuery, options?: dxTabPanelOptions); + constructor(element: Element, options?: dxTabPanelOptions); + } + export interface dxSelectBoxOptions extends dxDropDownListOptions { + /** The template to be used for rendering the widget text field. */ + fieldTemplate?: any; + /** The text that is provided as a hint in the select box editor. */ + placeholder?: string; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + fieldEditEnabled?: boolean; + } + /** A widget that allows you to select an item in a dropdown list. */ + export class dxSelectBox extends dxDropDownList { + constructor(element: JQuery, options?: dxSelectBoxOptions); + constructor(element: Element, options?: dxSelectBoxOptions); + } + export interface dxTagBoxOptions extends dxSelectBoxOptions { + /** Holds the list of selected values. */ + values?: Array; + } + /** A widget that allows you to select multiple items from a dropdown list. */ + export class dxTagBox extends dxSelectBox { + constructor(element: JQuery, options?: dxTagBoxOptions); + constructor(element: Element, options?: dxTagBoxOptions); + } + export interface dxScrollViewOptions extends dxScrollableOptions { + /** A handler for the pullDown event. */ + onPullDown?: Function; + pullDownAction?: Function; + /** Specifies the text shown in the pullDown panel when pulling the content down lowers the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while pulling the content down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the reachBottom event. */ + onReachBottom?: Function; + reachBottomAction?: Function; + /** Specifies the text shown in the pullDown panel displayed when content is scrolled to the bottom. */ + reachBottomText?: string; + /** Specifies the text shown in the pullDown panel displayed when the content is being refreshed. */ + refreshingText?: string; + /** Returns a value indicating if the scrollView content is larger then the widget container. */ + isFull(): boolean; + /** Locks the widget until the release(preventScrollBottom) method is called and executes the function passed to the onPullDown option and the handler assigned to the pullDown event. */ + refresh(): void; + /** Notifies the scroll view that data loading is finished. */ + release(preventScrollBottom: boolean): JQueryPromise; + /** Toggles the loading state of the widget. */ + toggleLoading(showOrHide: boolean): void; + } + /** A widget used to display scrollable content. */ + export class dxScrollView extends dxScrollable { + constructor(element: JQuery, options?: dxScrollViewOptions); + constructor(element: Element, options?: dxScrollViewOptions); + } + export interface dxScrollableLocation { + top?: number; + left?: number; + } + export interface dxScrollableOptions extends DOMComponentOptions { + /** A string value specifying the available scrolling directions. */ + direction?: string; + /** A Boolean value specifying whether or not the widget can respond to user interaction. */ + disabled?: boolean; + /** A handler for the scroll event. */ + onScroll?: Function; + scrollAction?: Function; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** A handler for the update event. */ + onUpdated?: Function; + updateAction?: Function; + /** Indicates whether to use native or simulated scrolling. */ + useNative?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content swiping it up or down. */ + scrollByContent?: boolean; + /** A Boolean value specifying whether or not an end-user can scroll the widget content using the scrollbar. */ + scrollByThumb?: boolean; + } + /** A widget used to display scrollable content. */ + export class dxScrollable extends DOMComponent { + constructor(element: JQuery, options?: dxScrollableOptions); + constructor(element: Element, options?: dxScrollableOptions); + /** Returns the height of the scrollable widget in pixels. */ + clientHeight(): number; + /** Returns the width of the scrollable widget in pixels. */ + clientWidth(): number; + /** An HTML element of the widget. */ + content(): JQuery; + /** Scrolls the widget content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Scrolls widget content by the specified number of pixels in horizontal and vertical directions. */ + scrollBy(distanceObject: dxScrollableLocation): void; + /** Returns the height of the scrollable content in pixels. */ + scrollHeight(): number; + /** Returns the current scroll position against the leftmost position. */ + scrollLeft(): number; + /** Returns how far the scrollable content is scrolled from the top and from the left. */ + scrollOffset(): dxScrollableLocation; + /** Scrolls widget content to the specified position. */ + scrollTo(targetLocation: number): void; + /** Scrolls widget content to a specified position. */ + scrollTo(targetLocation: dxScrollableLocation): void; + /** Scrolls widget content to the specified element. */ + scrollToElement(element: Element): void; + /** Returns the current scroll position against the topmost position. */ + scrollTop(): number; + /** Returns the width of the scrollable content in pixels. */ + scrollWidth(): number; + /** Updates the dimensions of the scrollable contents. */ + update(): void; + } + export interface dxRadioGroupOptions extends CollectionWidgetOptions { + /** Specifies the radio group layout. */ + layout?: string; + } + /** A widget that enables a user to select one item within a list of items represented by radio buttons. */ + export class dxRadioGroup extends CollectionWidget { + constructor(element: JQuery, options?: dxRadioGroupOptions); + constructor(element: Element, options?: dxRadioGroupOptions); + } + export interface dxPopupOptions extends dxOverlayOptions { + animation?: fx.AnimationOptions; + /** Specifies whether or not to allow a user to drag the popup window. */ + dragEnabled?: boolean; + /** A Boolean value specifying whether or not to display the widget in full-screen mode. */ + fullScreen?: boolean; + position?: PositionOptions; + /** A Boolean value specifying whether or not to display the title in the overlay window. */ + showTitle?: boolean; + /** The title in the overlay window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + width?: any; + /** Specifies items displayed on the top or bottom toolbar of the popup window. */ + buttons?: Array; + /** Specifies whether or not the widget displays the Close button. */ + showCloseButton?: boolean; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + } + /** A widget that displays required content in a popup window. */ + export class dxPopup extends dxOverlay { + constructor(element: JQuery, options?: dxPopupOptions); + constructor(element: Element, options?: dxPopupOptions); + } + export interface dxPopoverOptions extends dxPopupOptions { + /** An object defining animation options of the widget. */ + animation?: fx.AnimationOptions; + /** Specifies the height of the widget. */ + height?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + shading?: boolean; + /** A Boolean value specifying whether or not to display the title in the overlay window. */ + showTitle?: boolean; + /** The target element associated with a popover. */ + target?: any; + /** Specifies the width of the widget. */ + width?: any; + } + /** A widget that displays the required content in a popup window. */ + export class dxPopover extends dxPopup { + constructor(element: JQuery, options?: dxPopoverOptions); + constructor(element: Element, options?: dxPopoverOptions); + /** Displays the widget for the specified target element. */ + show(target?: any): JQueryPromise; + } + export interface dxOverlayOptions extends WidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: fx.AnimationOptions; + /** A Boolean value specifying whether or not the widget is closed if a user presses the Back hardware button. */ + closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlapping window. */ + closeOnOutsideClick?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + /** Specifies whether or not an end-user can drag the widget. */ + dragEnabled?: boolean; + /** The height of the widget in pixels. */ + height?: any; + /** A handler for the hidden event. */ + onHidden?: Function; + hiddenAction?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + hidingAction?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** A Boolean value specifying whether or not the main screen is inactive while the widget is active. */ + shading?: boolean; + /** Specifies the shading color. */ + shadingColor?: string; + /** A handler for the showing event. */ + onShowing?: Function; + showingAction?: Function; + /** A handler for the shown event. */ + onShown?: Function; + shownAction?: Function; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + /** The widget width in pixels. */ + width?: any; + } + /** A widget displaying the required content in an overlay window. */ + export class dxOverlay extends Widget { + constructor(element: JQuery, options?: dxOverlayOptions); + constructor(element: Element, options?: dxOverlayOptions); + /** An HTML element of the widget. */ + content(): JQuery; + /** Hides the widget. */ + hide(): JQueryPromise; + /** Recalculates the overlay's size and position. */ + repaint(): void; + /** Shows the widget. */ + show(): JQueryPromise; + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** A static method that specifies the default z-index for all overlay widgets. */ + static baseZIndex(zIndex: number): void; + } + export interface dxNumberBoxOptions extends dxTextEditorOptions { + /** The maximum value accepted by the number box. */ + max?: number; + /** The minimum value accepted by the number box. */ + min?: number; + /** Specifies whether or not to show spin buttons. */ + showSpinButtons?: boolean; + useTouchSpinButtons?: boolean; + /** Specifies by which value the widget value changes when a spin button is clicked. */ + step?: number; + /** The current number box value. */ + value?: number; + } + /** A textbox widget that enables a user to enter numeric values. */ + export class dxNumberBox extends dxTextEditor { + constructor(element: JQuery, options?: dxNumberBoxOptions); + constructor(element: Element, options?: dxNumberBoxOptions); + } + export interface dxNavBarOptions extends dxTabsOptions { + scrollingEnabled?: boolean; + } + /** A widget that contains items used to navigate through application views. */ + export class dxNavBar extends dxTabs { + constructor(element: JQuery, options?: dxNavBarOptions); + constructor(element: Element, options?: dxNavBarOptions); + } + export interface dxMultiViewOptions extends CollectionWidgetOptions { + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently displayed item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to change the selected index by swiping. */ + swipeEnabled?: boolean; + } + /** A widget used to display a view and to switch between several views. */ + export class dxMultiView extends CollectionWidget { + constructor(element: JQuery, options?: dxMultiViewOptions); + constructor(element: Element, options?: dxMultiViewOptions); + } + export interface dxMapOptions extends WidgetOptions { + /** Specifies whether or not the widget automatically adjusts center and zoom option values when adding a new marker or route. */ + autoAdjust?: boolean; + bounds?: { + northEast?: { + lat?: number; + lng?: number; + }; + southWest?: { + lat?: number; + lng?: number; + }; + /** An object, a string, or an array specifying the location displayed at the center of the widget. */ + center?: { + /** The latitude location displayed in the center of the widget. */ + lat?: number; + /** The longitude location displayed in the center of the widget. */ + lng?: number; + }; + /** A handler for the click event. */ + onClick?: any; + clickAction?: any; + /** Specifies whether or not map widget controls are available. */ + controls?: boolean; + /** Specifies the height of the widget. */ + height?: number; + /** A key used to authenticate the application within the required map provider. */ + key?: { + /** A key used to authenticate the application within the "Bing" map provider. */ + bing?: string; + /** A key used to authenticate the application within the "Google" map provider. */ + google?: string; + /** A key used to authenticate the application within the "Google Static" map provider. */ + googleStatic?: string; + } + /** + * An object, a string, or an array specifying the location displayed at the center of the widget. + * @deprecated center.md + */ + location?: { + lat?: number; + lng?: number; + }; + /** A handler for the markerAdded event. */ + onMarkerAdded?: Function; + markerAddedAction?: Function; + /** A URL pointing to the custom icon to be used for map markers. */ + markerIconSrc?: string; + /** A handler for the markerRemoved event. */ + onMarkerRemoved?: Function; + markerRemovedAction?: Function; + /** An array of markers displayed on a map. */ + markers?: Array; + /** The name of the current map data provider. */ + provider?: string; + /** A handler for the ready event. */ + onReady?: Function; + readyAction?: Function; + /** A handler for the routeAdded event. */ + onRouteAdded?: Function; + routeAddedAction?: Function; + /** A handler for the routeRemoved event. */ + onRouteRemoved?: Function; + routeRemovedAction?: Function; + /** An array of routes shown on the map. */ + routes?: Array; + /** The type of a map to display. */ + type?: string; + /** Specifies the width of the widget. */ + width?: number; + /** The zoom level of the map. */ + zoom?: number; + /** Adds a marker to the map. */ + addMarker(markerOptions: Object): JQueryPromise; + /** Adds a route to the map. */ + addRoute(options: Object): JQueryPromise; + /** Removes a marker from the map. */ + removeMarker(marker: Object): JQueryPromise; + /** Removes a route from the map. */ + removeRoute(route: any): JQueryPromise; + }; + } + /** An interactive map widget. */ + export class dxMap extends Widget { + constructor(element: JQuery, options?: dxMapOptions); + constructor(element: Element, options?: dxMapOptions); + } + export interface dxLookupOptions extends dxDropDownListOptions { + /** An object defining widget animation options. */ + animation?: fx.AnimationOptions; + autoPagingEnabled?: boolean; + /** The text displayed on the Cancel button. */ + cancelButtonText?: string; + /** The text displayed on the Clear button. */ + clearButtonText?: string; + /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlaying window. */ + closeOnOutsideClick?: any; + /** The text displayed on the Apply button. */ + applyButtonText?: string; + /** A Boolean value specifying whether or not to display the lookup in full-screen mode. */ + fullScreen?: boolean; + /** A Boolean value specifying whether or not to group widget items. */ + grouped?: boolean; + groupRender?: any; + /** The name of the template used to display a group header. */ + groupTemplate?: any; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + pageLoadingAction?: Function; + /** Specifies the text shown in the pullDown panel, which is displayed when the widget is scrolled to the bottom. */ + pageLoadingText?: string; + /** The text displayed by the widget when nothing is selected. */ + placeholder?: string; + /** The height of the widget popup element. */ + popupHeight?: any; + /** The width of the widget popup element. */ + popupWidth?: any; + /** An object defining widget positioning options. */ + position?: PositionOptions; + /** Specifies the text displayed in the pullDown panel when the widget is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + pullRefreshAction?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the widget is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + scrollAction?: Function; + /** A Boolean value specifying whether or not the search bar is visible. */ + searchEnabled?: boolean; + /** The text that is provided as a hint in the lookup's search bar. */ + searchPlaceholder?: string; + /** A Boolean value specifying whether or not the main screen is inactive while the lookup is active. */ + shading?: boolean; + /** Specifies whether to display the Cancel button in the lookup window. */ + showCancelButton?: boolean; + /** A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. */ + showNextButton?: boolean; + /** The title of the lookup window. */ + title?: string; + /** A template to be used for rendering the widget title. */ + titleTemplate?: any; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + /** Specifies whether or not to show lookup contents in a dxPopover widget. */ + usePopover?: boolean; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + contentReadyAction?: Function; + titleRender?: any; + /** A handler for the titleRendered event. */ + onTitleRendered?: Function; + /** Specifies whether or not the widget supports the focused state and keyboard navigation. */ + focusStateEnabled?: boolean; + } + /** A widget that allows a user to select predefined values from a lookup window. */ + export class dxLookup extends dxDropDownList { + constructor(element: JQuery, options?: dxLookupOptions); + constructor(element: Element, options?: dxLookupOptions); + /** This section lists the data source fields that are used in a default template for lookup drop-down items. */ + } + export interface dxLoadPanelOptions extends dxOverlayOptions { + /** An object defining the animation options of the widget. */ + animation?: fx.AnimationOptions; + /** The delay in milliseconds after which the load panel is displayed. */ + delay?: number; + /** The height of the widget. */ + height?: number; + /** A URL pointing to an image to be used as a load indicator. */ + indicatorSrc?: string; + /** The text displayed in the load panel. */ + message?: string; + /** A Boolean value specifying whether or not to show a load indicator. */ + showIndicator?: boolean; + /** A Boolean value specifying whether or not to show the pane behind the load indicator. */ + showPane?: boolean; + /** The width of the widget. */ + width?: number; + } + /** A widget used to indicate whether or not an element is loading. */ + export class dxLoadPanel extends dxOverlay { + constructor(element: JQuery, options?: dxLoadPanelOptions); + constructor(element: Element, options?: dxLoadPanelOptions); + } + export interface dxLoadIndicatorOptions extends WidgetOptions { + /** Specifies the path to an image used as the indicator. */ + indicatorSrc?: string; + } + /** The widget used to indicate the loading process. */ + export class dxLoadIndicator extends Widget { + constructor(element: JQuery, options?: dxLoadIndicatorOptions); + constructor(element: Element, options?: dxLoadIndicatorOptions); + } + export interface dxListOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not to load the next page from the data source when the list is scrolled to the bottom. */ + autoPagingEnabled?: boolean; + /** Specifies whether or not the widget displays items by pages. */ + pagingEnabled?: boolean; + /** An object used to set configuration options for the dxList's edit mode. */ + editConfig?: { + /** Specifies whether the list items can be deleted. */ + deleteEnabled?: boolean; + /** + * A mode specifying how to delete a list item. + * @deprecated deleteType.md + */ + deleteMode?: string; + /** Specifies the way a user can delete items from the list. */ + deleteType?: string; + itemRender?: any; + /** The template used to render list items in edit mode. */ + itemTemplate?: any; + /** Specifies the array of items for a context menu called for a list item. */ + menuItems?: Array; + /** Specifies whether an item context menu is shown when a user swipes or holds an item. */ + menuType?: string; + /** Specifies whether or not a user can reorder items. */ + reorderEnabled?: boolean; + /** Specifies whether the list items can be selected. */ + selectionEnabled?: boolean; + /** + * A mode specifying how to select a list item. + * @deprecated selectionType.md + */ + selectionMode?: string; + /** A type specifying how to select a list item. */ + selectionType?: string; + /** Specifies whether the item list represented by this widget is editable. */ + editEnabled?: boolean; + /** Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data. */ + indicateLoading?: boolean; + }; + /** A Boolean value specifying whether or not to display a grouped list. */ + grouped?: boolean; + groupRender?: any; + /** The name of the template used to display a group header. */ + groupTemplate?: any; + onItemDeleting?: Function; + /** A handler for the itemDeleted event. */ + onItemDeleted?: Function; + itemDeleteAction?: Function; + /** A handler for the itemReordered event. */ + onItemReordered?: Function; + itemReorderAction?: Function; + /** A handler for the itemClick event. */ + onItemClick?: any; + /** A handler for the itemSwipe event. */ + onItemSwipe?: Function; + itemSwipeAction?: Function; + /** The text displayed on the button used to load the next page from the data source. */ + nextButtonText?: string; + /** A handler for the pageLoading event. */ + onPageLoading?: Function; + pageLoadingAction?: Function; + /** Specifies the text shown in the pullDown panel, which is displayed when the list is scrolled to the bottom. */ + pageLoadingText?: string; + /** Specifies the text displayed in the pullDown panel when the list is pulled below the refresh threshold. */ + pulledDownText?: string; + /** Specifies the text shown in the pullDown panel while the list is being pulled down to the refresh threshold. */ + pullingDownText?: string; + /** A handler for the pullRefresh event. */ + onPullRefresh?: Function; + pullRefreshAction?: Function; + /** A Boolean value specifying whether or not the widget supports the "pull down to refresh" gesture. */ + pullRefreshEnabled?: boolean; + /** Specifies the text displayed in the pullDown panel while the list is being refreshed. */ + refreshingText?: string; + /** A handler for the scroll event. */ + onScroll?: Function; + scrollAction?: Function; + /** A Boolean value specifying whether to enable or disable list scrolling. */ + scrollingEnabled?: boolean; + /** Specifies whether the list supports single item selection or multi-selection. */ + selectionMode?: string; + /** A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. */ + showNextButton?: boolean; + /** Specifies when the widget shows the scrollbar. */ + showScrollbar?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNativeScrolling?: boolean; + itemUnselectAction?: Function; + onItemContextMenu?: Function; + onItemHold?: Function; + /** Specifies whether or not an end-user can collapse groups. */ + collapsibleGroups?: boolean; + } + /** A list widget. */ + export class dxList extends CollectionWidget { + constructor(element: JQuery, options?: dxListOptions); + constructor(element: Element, options?: dxListOptions); + /** Returns the height of the widget in pixels. */ + clientHeight(): number; + /** Removes the specified item from the list. */ + deleteItem(itemIndex: any): JQueryPromise; + /** Removes the specified item from the list. */ + deleteItem(itemElement: Element): JQueryPromise; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemIndex: any): boolean; + /** Returns a Boolean value that indicates whether or not the specified item is selected. */ + isItemSelected(itemElement: Element): boolean; + /** + * Reloads list data. + * @deprecated Use the "reload" method instead. + */ + refresh(): void; + /** Reloads list data. */ + reload(): void; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemElement: Element, toItemElement: Element): JQueryPromise; + /** Moves the specified item to the specified position in the list. */ + reorderItem(itemIndex: any, toItemIndex: any): JQueryPromise; + /** Scrolls the list content by the specified number of pixels. */ + scrollBy(distance: number): void; + /** Returns the height of the list content in pixels. */ + scrollHeight(): number; + /** Scrolls list content to the specified position. */ + scrollTo(location: number): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemElement: Element): void; + /** Scrolls the list to the specified item. */ + scrollToItem(itemIndex: any): void; + /** Returns how far the list content is scrolled from the top. */ + scrollTop(): number; + /** Selects the specified item from the list. */ + selectItem(itemElement: Element): void; + /** Selects the specified item from the list. */ + selectItem(itemIndex: any): void; + /** Deselects the specified item from the list. */ + unselectItem(itemElement: Element): void; + /** Unselects the specified item from the list. */ + unselectItem(itemIndex: any): void; + /** + * Updates the widget scrollbar according to widget content size. + * @deprecated updateDimensions.md + */ + update(): JQueryPromise; + /** Updates the widget scrollbar according to widget content size. */ + updateDimensions(): JQueryPromise; + /** Expands the specified group. */ + expandGroup(groupIndex: number): JQueryPromise; + /** Collapses the specified group. */ + collapseGroup(groupIndex: number): JQueryPromise; + } + export interface dxGalleryOptions extends CollectionWidgetOptions { + /** The time, in milliseconds, spent on slide animation. */ + animationDuration?: number; + /** Specifies whether or not to animate the displayed item change. */ + animationEnabled?: boolean; + /** A Boolean value specifying whether or not to allow users to switch between items by clicking an indicator. */ + indicatorEnabled?: boolean; + /** A Boolean value specifying whether or not to scroll back to the first item after the last item is swiped. */ + loop?: boolean; + /** The index of the currently active gallery item. */ + selectedIndex?: number; + /** A Boolean value specifying whether or not to display an indicator that points to the selected gallery item. */ + showIndicator?: boolean; + /** A Boolean value that specifies the availability of the "Forward" and "Back" navigation buttons. */ + showNavButtons?: boolean; + /** The time interval in milliseconds, after which the gallery switches to the next item. */ + slideshowDelay?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; + } + /** An image gallery widget. */ + export class dxGallery extends CollectionWidget { + constructor(element: JQuery, options?: dxGalleryOptions); + constructor(element: Element, options?: dxGalleryOptions); + /** Shows the specified gallery item. */ + goToItem(itemIndex: number, animation: boolean): JQueryPromise; + /** Shows the next gallery item. */ + nextItem(animation: boolean): JQueryPromise; + /** Shows the previous gallery item. */ + prevItem(animation: boolean): JQueryPromise; + } + export interface dxDropDownEditorOptions extends dxTextBoxOptions { + /** Specifies the current value displayed by the widget. */ + value?: Object; + /** A handler for the closed event. */ + onClosed?: Function; + /** A handler for the opened event. */ + onOpened?: Function; + /** Specifies whether or not the drop-down editor is displayed. */ + opened?: boolean; + closeAction?: Function; + openAction?: Function; + shownAction?: Function; + hiddenAction?: Function; + /** Specifies whether or not the widget allows an end-user to enter a custom value. */ + fieldEditEnabled?: boolean; + editEnabled?: boolean; + /** Specifies the way an end-user applies the selected value. */ + applyValueMode?: string; + /** Specifies whether or not the widget supports the focused state and keyboard navigation. */ + focusStateEnabled?: boolean; + } + /** A drop-down editor widget. */ + export class dxDropDownEditor extends dxTextBox { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** Closes the drop-down editor. */ + close(): void; + /** Opens the drop-down editor. */ + open(): void; + /** Resets the widget's value to null. */ + reset(): void; + } + export interface dxDateBoxOptions extends dxTextEditorOptions { + /** A format used to display date/time information. */ + format?: string; + /** A Globalize format string specifying the date display format. */ + formatString?: string; + /** The last date that can be selected within the widget. */ + max?: Date; + /** The minimum date that can be selected within the widget. */ + min?: Date; + /** The text displayed by the widget when the widget value is not yet specified. This text is also used as a title of the date picker. */ + placeholder?: string; + /** Specifies whether or not a user can pick out a date using the drop-down calendar. */ + useCalendar?: boolean; + /** A Date object specifying the date and time currently selected using the date box. */ + value?: Date; + /** Specifies whether or not the widget uses the native HTML input element. */ + useNative?: boolean; + /** Specifies the interval between neighboring values in the popup list in minutes. */ + interval?: number; + } + /** A date box widget. */ + export class dxDateBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDateBoxOptions); + constructor(element: Element, options?: dxDateBoxOptions); + } + export interface dxCheckBoxOptions extends EditorOptions { + checked?: boolean; + /** Specifies the widget state. */ + value?: boolean; + /** Specifies the text displayed by the check box. */ + text?: string; + } + /** A check box widget. */ + export class dxCheckBox extends Editor { + constructor(element: JQuery, options?: dxCheckBoxOptions); + constructor(element: Element, options?: dxCheckBoxOptions); + } + export interface dxCalendarOptions extends EditorOptions { + /** Specifies a date displayed on the current calendar page. */ + currentDate?: Date; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** The latest date the widget allows to select. */ + max?: Date; + /** The earliest date the widget allows to select. */ + min?: Date; + } + /** A calendar widget. */ + export class dxCalendar extends Editor { + constructor(element: JQuery, options?: dxCalendarOptions); + constructor(element: Element, options?: dxCalendarOptions); + } + export interface dxButtonOptions extends WidgetOptions { + /** A handler for the click event. */ + onClick?: any; + clickAction?: any; + /** The name of an icon to be displayed on the button. */ + icon?: string; + /** A URL pointing to the image to be displayed on the button. */ + iconSrc?: string; + /** The text displayed on the button. */ + text?: string; + /** Specifies the button type. */ + type?: string; + /** Specifies the name of the validation group to be accessed in the click event handler. */ + validationGroup?: string; + } + /** A button widget. */ + export class dxButton extends Widget { + constructor(element: JQuery, options?: dxButtonOptions); + constructor(element: Element, options?: dxButtonOptions); + } + export interface dxBoxOptions extends CollectionWidget { + /** Specifies how widget items are aligned along the main direction. */ + align?: string; + /** Specifies the direction of item positioning in the widget. */ + direction?: string; + /** Specifies how widget items are aligned cross-wise. */ + crossAlign?: string; + } + /** A container widget used to arrange inner elements. */ + export class dxBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxResponsiveBoxOptions extends CollectionWidgetOptions { + /** Specifies the collection of rows for the grid used to position layout elements. */ + rows?: Array; + /** Specifies the collection of columns for the grid used to position layout elements. */ + cols?: Array; + /** Specifies the function returning the screen factor depending on the screen width. */ + screenByWidth?: (width: number) => string; + /** Specifies the screen factor with which all elements are located in a single column. */ + singleColumnScreen?: string; + } + /** A widget used to build an adaptive markup that is dependent on screen resolution. */ + export class dxResponsiveBox extends CollectionWidget { + constructor(element: JQuery, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); + } + export interface dxAutocompleteOptions extends dxDropDownListOptions { + /** Specifies the current value displayed by the widget. */ + value?: string; + /** The minimum number of characters that must be entered into the text box to begin a search. */ + minSearchLength?: number; + /** Specifies the maximum count of items displayed by the widget. */ + maxItemCount?: number; + /** Specifies the currently selected item. */ + selectedItem?: Object; + } + /** A textbox widget that supports autocompletion. */ + export class dxAutocomplete extends dxDropDownList { + constructor(element: JQuery, options?: dxAutocompleteOptions); + constructor(element: Element, options?: dxAutocompleteOptions); + /** Opens the drop-down editor. */ + open(): void; + /** Closes the drop-down editor. */ + close(): void; + } + export interface dxAccordionOptions extends CollectionWidgetOptions { + /** A number specifying the time in milliseconds spent on the animation of the expanding or collapsing of a panel. */ + animationDuration?: number; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies whether all items can be collapsed or whether at least one item must always be expanded. */ + collapsible?: boolean; + /** Specifies whether the widget can expand several items or only a single item at once. */ + multiple?: boolean; + /** The template to be used for rendering dxAccordion items. */ + itemTemplate?: any; + /** A handler for the itemTitleClick event. */ + onItemTitleClick?: any; + /** A handler for the itemTitleHold event. */ + onItemTitleHold?: Function; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: any; + /** The index number of the currently selected item. */ + selectedIndex?: number; + } + /** A widget that displays data source items on collapsible panels. */ + export class dxAccordion extends CollectionWidget { + constructor(element: JQuery, options?: dxAccordionOptions); + constructor(element: Element, options?: dxAccordionOptions); + /** Collapses the specified item. */ + collapseItem(index: number): JQueryPromise; + /** Expands the specified item. */ + expandItem(index: number): JQueryPromise; + } + export interface dxFileUploaderOptions extends EditorOptions { + /** A read-only option that holds a File instance representing the selected file. */ + value?: File; + /** Holds the File instances representing files selected in the widget. */ + values?: Array; + /** Specifies the text displayed on the button opening the file selection dialog. */ + buttonText?: string; + /** Specifies the text displayed on the area to which an end-user can drop a file. */ + labelText?: string; + /** Specifies the value passed to the name attribute of the underlying input element. */ + name?: string; + /** Specifies whether the widget enables an end-user to select a single file or multiple files. */ + multiple?: boolean; + /** Specifies a file type or several types accepted by the widget. */ + accept?: string; + } + /** A widget used to select and upload a file or multiple files. */ + export class dxFileUploader extends Editor { + constructor(element: JQuery, options?: dxFileUploaderOptions); + constructor(element: Element, options?: dxFileUploaderOptions); + } + export interface dxTrackBarOptions extends EditorOptions { + /** The minimum value the widget can accept. */ + min?: number; + /** The maximum value the widget can accept. */ + max?: number; + /** The current widget value. */ + value?: number; + } + /** A base class for track bar widgets. */ + export class dxTrackBar extends Editor { + constructor(element: JQuery, options?: dxTrackBarOptions); + constructor(element: Element, options?: dxTrackBarOptions); + } + export interface dxProgressBarOptions extends dxTrackBarOptions { + /** Specifies a format for the progress status. */ + statusFormat?: any; + /** Specifies whether or not the widget displays a progress status. */ + showStatus?: boolean; + /** A handler for the complete event. */ + onComplete?: Function; + } + /** A widget used to indicate progress. */ + export class dxProgressBar extends dxTrackBar { + constructor(element: JQuery, options?: dxProgressBarOptions); + constructor(element: Element, options?: dxProgressBarOptions); + } + export interface dxSliderOptions extends dxTrackBarOptions { + /** The slider step size. */ + step?: number; + /** The current slider value. */ + value?: number; + /** Specifies whether or not to highlight a range selected within the widget. */ + showRange?: boolean; + /** Specifies options for the slider tooltip. */ + tooltip?: { + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies format for the tooltip. */ + format?: any; + /** Specifies whether the tooltip is located over or under the slider. */ + position?: string; + /** Specifies whether the widget always shows a tooltip or only when a pointer is over the slider. */ + showMode?: string; + }; + /** Specifies options for labels displayed at the min and max values. */ + label?: { + /** Specifies whether or not slider labels are visible. */ + visible?: boolean; + /** Specifies whether labels are located over or under the scale. */ + position?: string; + /** Specifies a format for labels. */ + format?: any; + }; + } + /** A widget that allows a user to select a numeric value within a given range. */ + export class dxSlider extends dxTrackBar { + constructor(element: JQuery, options?: dxSliderOptions); + constructor(element: Element, options?: dxSliderOptions); + } + export interface dxRangeSliderOptions extends dxSliderOptions { + /** The left edge of the interval currently selected using the range slider. */ + start?: number; + /** The right edge of the interval currently selected using the range slider. */ + end?: number; + } + /** A widget that enables a user to select a range of numeric values. */ + export class dxRangeSlider extends dxSlider { + constructor(element: JQuery, options?: dxRangeSliderOptions); + constructor(element: Element, options?: dxRangeSliderOptions); + } + export interface dxTileViewOptions extends CollectionWidgetOptions { + /** Specifies the height of the base tile view item. */ + baseItemHeight?: number; + /** Specifies the width of the base tile view item. */ + baseItemWidth?: number; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the distance in pixels between adjacent tiles. */ + itemMargin?: number; + listHeight?: any; + /** A Boolean value specifying whether or not to display a scrollbar. */ + showScrollbar?: boolean; + } + /** A widget displaying several blocks of data as tiles. */ + export class dxTileView extends CollectionWidget { + constructor(element: JQuery, options?: dxTileViewOptions); + constructor(element: Element, options?: dxTileViewOptions); + /** Returns the current scroll position of the widget content. */ + scrollPosition(): number; + } + export interface dxSwitchOptions extends EditorOptions { + /** Text displayed when the widget is in a disabled state. */ + offText?: string; + /** Text displayed when the widget is in an enabled state. */ + onText?: string; + /** A Boolean value specifying whether the current switch state is "On" or "Off". */ + value?: boolean; + } + /** A switch widget. */ + export class dxSwitch extends Editor { + constructor(element: JQuery, options?: dxSwitchOptions); + constructor(element: Element, options?: dxSwitchOptions); + } + export interface dxSlideOutOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** A Boolean value specifying whether or not to display a grouped menu. */ + menuGrouped?: boolean; + menuGroupRender?: any; + /** The name of the template used to display a group header. */ + menuGroupTemplate?: any; + menuItemRender?: any; + /** The template used to render menu items. */ + menuItemTemplate?: any; + /** Specifies whether or not the slide-out menu is displayed. */ + menuVisible?: boolean; + /** Indicates whether the menu can be shown/hidden by swiping the widget's main panel. */ + swipeEnabled?: boolean; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal an item list. */ + export class dxSlideOut extends CollectionWidget { + constructor(element: JQuery, options?: dxSlideOutOptions); + constructor(element: Element, options?: dxSlideOutOptions); + /** Hides the widget's slide-out menu. */ + hideMenu(): JQueryPromise; + /** Displays the widget's slide-out menu. */ + showMenu(): JQueryPromise; + /** Toggles the visibility of the widget's slide-out menu. */ + toggleMenuVisibility(showing: boolean): JQueryPromise; + } + export interface dxPivotOptions extends CollectionWidgetOptions { + /** The index of the currently active pivot item. */ + selectedIndex?: number; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** A widget that is similar to a traditional tab control, but optimized for the phone with simplified end-user interaction. */ + export class dxPivot extends CollectionWidget { + constructor(element: JQuery, options?: dxPivotOptions); + constructor(element: Element, options?: dxPivotOptions); + } + export interface dxPanoramaOptions extends CollectionWidgetOptions { + /** An object exposing options for setting a background image for the panorama. */ + backgroundImage?: { + /** Specifies the height of the panorama's background image. */ + height?: number; + /** Specifies the URL of the image that is used as the panorama's background image. */ + url?: string; + /** Specifies the width of the panorama's background image. */ + width?: number; + }; + /** The index of the currently active panorama item. */ + selectedIndex?: number; + /** Specifies the widget content title. */ + title?: string; + } + /** A widget displaying the required content in a long horizontal canvas that extends beyond the frames of the screen. */ + export class dxPanorama extends CollectionWidget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + } + export interface dxDropDownMenuOptions extends WidgetOptions { + /** A handler for the buttonClick event. */ + onButtonClick?: any; + buttonClickAction?: any; + /** The name of the icon to be displayed by the DropDownMenu button. */ + buttonIcon?: string; + /** A URL pointing to the image to be displayed by the DropDownMenu button. */ + buttonIconSrc?: string; + /** The text displayed in the DropDownMenu button. */ + buttonText?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** A handler for the itemClick event. */ + onItemClick?: any; + itemClickAction?: any; + itemRender?: any; + /** An array of items displayed by the widget. */ + items?: Array; + /** The template to be used for rendering items. */ + itemTemplate?: any; + /** Specifies whether or not to show the drop down menu within a dxPopover widget. */ + usePopover?: boolean; + /** The width of the menu popup in pixels. */ + popupWidth?: any; + /** The height of the menu popup in pixels. */ + popupHeight?: any; + /** Specifies whether or not the drop-down menu is displayed. */ + opened?: boolean; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + } + /** A drop-down menu widget. */ + export class dxDropDownMenu extends Widget { + constructor(element: JQuery, options?: dxDropDownEditorOptions); + constructor(element: Element, options?: dxDropDownEditorOptions); + /** This section lists the data source fields that are used in a default template for drop-down menu items. */ + /** Opens the drop-down menu. */ + open(): void; + /** Closes the drop-down menu. */ + close(): void; + } + export interface dxActionSheetOptions extends CollectionWidgetOptions { + cancelClickAction?: any; + /** A handler for the cancelClick event. */ + onCancelClick?: any; + /** The text displayed in the button that closes the action sheet. */ + cancelText?: string; + /** Specifies whether or not to display the Cancel button in action sheet. */ + showCancelButton?: boolean; + /** A Boolean value specifying whether or not the title of the action sheet is visible. */ + showTitle?: boolean; + /** Specifies the element the action sheet popover points at. */ + target?: any; + /** The title of the action sheet. */ + title?: string; + /** Specifies whether or not to show the action sheet within a dxPopover widget. */ + usePopover?: boolean; + /** A Boolean value specifying whether or not the dxActionSheet widget is visible. */ + visible?: boolean; + } + /** A widget consisting of a set of choices related to a certain task. */ + export class dxActionSheet extends CollectionWidget { + constructor(element: JQuery, options?: dxActionSheetOptions); + constructor(element: Element, options?: dxActionSheetOptions); + /** Hides the widget. */ + hide(): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Shows or hides the widget depending on the Boolean value passed as the parameter. */ + toggle(showing: boolean): JQueryPromise; + } + export interface dxColorBoxOptions extends dxDropDownEditorOptions { + /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ + applyButtonText?: string; + applyValueMode?: string; + /** Specifies the text displayed on the button that cancels changes and closes the drop-down editor. */ + cancelButtonText?: string; + /** Specifies whether or not the widget value includes the alpha channel component. */ + editAlphaChannel?: boolean; + } + /** A widget used to specify a color value. */ + export class dxColorBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxColorBoxOptions); + constructor(element: Element, options?: dxColorBoxOptions); + } + export interface dxColorPickerOptions extends dxColorBoxOptions { } + /** + * A widget used to specify a color value. + * @deprecated Use the dxColorBox widget instead + */ + export class dxColorPicker extends dxColorBox { + constructor(element: JQuery, options?: dxColorPickerOptions); + constructor(element: Element, options?: dxColorPickerOptions); + } + export interface dxTreeViewOptions extends CollectionWidgetOptions { + /** Specifies whether a nested or plain array is used as a data source. */ + dataStructure?: string; + /** Specifies whether or not a user can expand all tree view items by the "*" hot key. */ + expandAllEnabled?: boolean; + /** + * An array of currently expanded item objects. + * @deprecated Use item.expanded field instead + */ + expandedItems?: Array; + /** Specifies whether or not a check box is displayed at each tree view item. */ + showCheckBoxes?: boolean; + /** Specifies whether or not to select nodes recursively. */ + selectNodesRecursive?: boolean; + /** Specifies whether the "Select All" check box is displayed over the tree view. */ + selectAllEnabled?: boolean; + /** Specifies the text displayed at the "Select All" check box. */ + selectAllText?: string; + /** Specifies the name of the data source item field used as a key. */ + keyExpr?: any; + /** Specifies the name of the data source item field whose value is displayed by the widget. */ + displayExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node is selected. */ + selectedExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node is expanded. */ + expandedExpr?: any; + /** Specifies the name of the data source item field that contains an array of nested items. */ + itemsExpr?: any; + /** Specifies the name of the data source item field that holds the key of the parent item. */ + parentIdExpr?: any; + disabledExpr?: any; + /** A string value specifying available scrolling directions. */ + scrollDirection?: string; + /** A handler for the itemSelected event. */ + onItemSelected?: Function; + /** A handler for the itemExpanded event. */ + onItemExpanded?: Function; + /** A handler for the itemCollapsed event. */ + onItemCollapsed?: Function; + } + /** A widget displaying specified data items as a tree. */ + export class dxTreeView extends CollectionWidget { + constructor(element: JQuery, options?: dxTreeViewOptions); + constructor(element: Element, options?: dxTreeViewOptions); + /** Updates the tree view scrollbars according to the current size of the widget content. */ + updateDimensions(): JQueryPromise; + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + /** Expands the specified item. */ + expandItem(itemElement: any): void; + /** Collapses the specified item. */ + collapseItem(itemElement: any): void; + /** Returns all nodes of the tree view. */ + getNodes(): Array; + /** Selects all widget items. */ + selectAll(): void; + /** Unselects all widget items. */ + unselectAll(): void; + } + export interface dxMenuBaseOptions extends CollectionWidgetOptions { + /** An object that defines the animation options of the widget. */ + animation?: fx.AnimationOptions; + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; + /** Specifies the name of the CSS class associated with the menu. */ + cssClass?: string; + /** Holds an array of menu items. */ + items?: Array; + /** Specifies whether or not an item becomes selected if an end-user clicks it. */ + selectionByClick?: boolean; + /** Specifies the selection mode supported by the menu. */ + selectionMode?: string; + /** Specifies the user interaction by which submenus are shown. */ + showSubmenuMode?: string; + /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ + hoverStateEnabled?: boolean; + } + export class dxMenuBase extends CollectionWidget { + constructor(element: JQuery, options?: dxMenuBaseOptions); + constructor(element: Element, options?: dxMenuBaseOptions); + /** Selects the specified item. */ + selectItem(itemElement: any): void; + /** Unselects the specified item. */ + unselectItem(itemElement: any): void; + } + export interface dxMenuOptions extends dxMenuBaseOptions { + firstSubMenuDirection?: string; + /** Specifies whether the menu has horizontal or vertical orientation. */ + orientation?: string; + /** Specifies by which user interaction the first-level submenu is shown. */ + showFirstSubmenuMode?: string; + showPopupMode?: string; + /** Specifies the direction at which the submenus are displayed. */ + submenuDirection?: string; + /** A handler for the submenuHidden event. */ + onSubmenuHidden?: Function; + submenuHiddenAction?: Function; + /** A handler for the submenuHiding event. */ + onSubmenuHiding?: Function; + submenuHidingAction?: Function; + /** A handler for the submenuShowing event. */ + onSubmenuShowing?: Function; + submenuShowingAction?: Function; + /** A handler for the submenuShown event. */ + onSubmenuShown?: Function; + submenuShownAction?: Function; + } + /** A menu widget. */ + export class dxMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxMenuOptions); + constructor(element: Element, options?: dxMenuOptions); + } + export interface dxContextMenuOptions extends dxMenuBaseOptions { + direction?: string; + hiddenAction?: Function; + hidingAction?: Function; + /** Specifies whether the context menu can be called only from code or by user interaction as well. */ + invokeOnlyFromCode?: boolean; + /** A handler for the hidden event. */ + onHidden?: Function; + /** A handler for the hiding event. */ + onHiding?: Function; + /** A handler for the positioning event. */ + onPositioning?: Function; + /** A handler for the showing event. */ + onShowing?: Function; + /** A handler for the shown event. */ + onShown?: Function; + /** An object defining widget positioning options. */ + position?: PositionOptions; + positioningAction?: Function; + showingAction?: Function; + shownAction?: Function; + /** Specifies the direction at which submenus are displayed. */ + submenuDirection?: string; + /** The target element associated with a popover. */ + target?: any; + /** A Boolean value specifying whether or not the widget is visible. */ + visible?: boolean; + } + /** A context menu widget. */ + export class dxContextMenu extends dxMenuBase { + constructor(element: JQuery, options?: dxContextMenuOptions); + constructor(element: Element, options?: dxContextMenuOptions); + /** Toggles the visibility of the widget. */ + toggle(showing: boolean): JQueryPromise; + /** Shows the widget. */ + show(): JQueryPromise; + /** Hides the widget. */ + hide(): JQueryPromise; + } + export interface dxRemoteOperations { + /** Specifies whether or not filtering must be performed on the server side. */ + filtering?: boolean; + /** Specifies whether or not paging must be performed on the server side. */ + paging?: boolean; + /** Specifies whether or not sorting must be performed on the server side. */ + sorting?: boolean; + } + export interface dxDataGridColumn { + /** Specifies the content alignment within column cells. */ + alignment?: string; + /** Specifies whether the values in a column can be edited at runtime. Setting this option makes sense only when editing is enabled for a grid. */ + allowEditing?: boolean; + /** Specifies whether or not a column can be used for filtering grid records. Setting this option makes sense only when the filter row or search panel is visible. */ + allowFiltering?: boolean; + /** Specifies whether a column can be used for grouping grid records at runtime. Setting this option makes sense only when the group panel is visible. */ + allowGrouping?: boolean; + /** Specifies whether or not a column can be hidden by a user. Setting this option makes sense only when the column chooser is visible. */ + allowHiding?: boolean; + /** Specifies whether or not a particular column can be used in column reordering. Setting this option makes sense only when the allowColumnReordering option is set to true. */ + allowReordering?: boolean; + /** Specifies whether or not a particular column can be resized by a user. Setting this option makes sense only when the allowColumnResizing option is true. */ + allowResizing?: boolean; + /** Specifies whether grid records can be sorted by a specific column at runtime. Setting this option makes sense only when the sorting mode differs from none. */ + allowSorting?: boolean; + /** Specifies whether groups appear expanded or not when records are grouped by a specific column. Setting this option makes sense only when grouping is allowed for this column. */ + autoExpandGroup?: boolean; + /** Specifies a callback function that returns a value to be displayed in a column cell. */ + calculateCellValue?: (rowData: Object) => string; + /** Specifies a callback function that defines filters for customary calculated grid cells. */ + calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string) => Array; + /** Specifies a caption for a column. */ + caption?: string; + /** Specifies a custom template for grid column cells. */ + cellTemplate?: any; + /** Specifies a CSS class to be applied to a column. */ + cssClass?: string; + /** Specifies a callback function that determines grouping values. */ + calculateGroupValue?: (rowData: Object) => string; + /** Specifies a callback function that returns the text to be displayed in the cells of a column. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** Specifies the field of a data source that provides data for a column. */ + dataField?: string; + /** Specifies the required type of column values. */ + dataType?: string; + /** Specifies a custom template for the cell of a grid column when it is in an editing state. */ + editCellTemplate?: any; + /** Specifies whether HTML tags are displayed as plain text or applied to the values of the column. */ + encodeHtml?: boolean; + /** In a boolean column, replaces all false items with a specified text. */ + falseText?: string; + /** Specifies the set of available filter operations. */ + filterOperations?: Array; + /** Specifies a filter value for a column. */ + filterValue?: any; + /** Specifies a format for the values displayed in a column. */ + format?: string; + /** Specifies a custom template for the group cell of a grid column. */ + groupCellTemplate?: any; + /** Specifies the index of a column when grid records are grouped by the values of this column. */ + groupIndex?: number; + /** Specifies a custom template for the header of a grid column. */ + headerCellTemplate?: any; + /** Specifies options of a lookup column. */ + lookup?: { + /** Specifies whether or not a user can nullify values of a lookup column. */ + allowClearing?: boolean; + /** +Specifies the data source providing data for a lookup column. + */ + dataSource?: any; + /** Specifies the expression defining the data source field whose values must be displayed. */ + displayExpr?: any; + /** Specifies the expression defining the data source field whose values must be replaced. */ + valueExpr?: string; + }; + /** Specifies a precision for formatted values displayed in a column. */ + precision?: number; + /** Specifies a filter operation applied to a column. */ + selectedFilterOperation?: string; + /** Specifies whether or not the column displays its values by using editors. */ + showEditorAlways?: boolean; + /** Specifies whether or not to display the column when grid records are grouped by it. */ + showWhenGrouped?: boolean; + /** Specifies the index of a column when grid records are sorted by the values of this column. */ + sortIndex?: number; + /** Specifies the initial sort order of column values. */ + sortOrder?: string; + /** In a boolean column, replaces all true items with a specified text. */ + trueText?: string; + /** Specifies whether a column is visible or not. */ + visible?: boolean; + /** Specifies the sequence number of the column in the grid. */ + visibleIndex?: number; + /** Specifies a column width in pixels or percentages. */ + width?: any; + /** Specifies an array of validation rules to be checked when updating column cell values. */ + validationRules?: Array; + /** Specifies whether or not to display the header of a hidden column in the column chooser. */ + showInColumnChooser?: boolean; + /** Specifies the identifier of the column. */ + name?: string; + } + export interface dxDataGridOptions extends WidgetOptions { + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; + /** Indicates whether to show the error row for the grid. */ + errorRowEnabled?: boolean; + /** A handler for the rowValidating event. */ + onRowValidating?: (e: Object) => void; + initNewRow?: (e: { data: Object }) => void; + /** A handler for the initNewRow event. */ + onInitNewRow?: (e: { data: Object }) => void; + rowInserted?: (e: { data: Object; key: any }) => void; + /** A handler for the rowInserted event. */ + onRowInserted?: (e: { data: Object; key: any }) => void; + rowInserting?: (e: { data: Object; cancel: boolean }) => void; + /** A handler for the rowInserting event. */ + onRowInserting?: (e: { data: Object; cancel: boolean }) => void; + rowRemoved?: (e: { data: Object; key: any }) => void; + /** A handler for the rowRemoved event. */ + onRowRemoved?: (e: { data: Object; key: any }) => void; + rowRemoving?: (e: { data: Object; key: any; cancel: boolean }) => void; + /** A handler for the rowRemoving event. */ + onRowRemoving?: (e: { data: Object; key: any; cancel: boolean }) => void; + rowUpdated?: (e: { data: Object; key: any }) => void; + /** A handler for the rowUpdated event. */ + onRowUpdated?: (e: { data: Object; key: any }) => void; + rowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: boolean }) => void; + /** A handler for the rowUpdating event. */ + onRowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: boolean }) => void; + /** Enables a hint that appears when a user hovers the mouse pointer over a cell with truncated content. */ + cellHintEnabled?: boolean; + /** Specifies whether or not grid columns can be reordered by a user. */ + allowColumnReordering?: boolean; + /** Specifies whether or not grid columns can be resized by a user. */ + allowColumnResizing?: boolean; + cellClick?: any; + /** A handler for the cellClick event. */ + onCellClick?: any; + cellHoverChanged?: (e: Object) => void; + /** A handler for the cellHoverChanged event. */ + onCellHoverChanged?: (e: Object) => void; + cellPrepared?: (e: Object) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: Object) => void; + /** Specifies whether or not the width of grid columns depends on column content. */ + columnAutoWidth?: boolean; + /** Specifies the options of a column chooser. */ + columnChooser?: { + /** Specifies text displayed by the column chooser panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether a user can invoke the column chooser or not. */ + enabled?: boolean; + /** Specifies the height of the column chooser panel. */ + height?: number; + /** Specifies text displayed in the title of the column chooser panel. */ + title?: string; + /** Specifies the width of the column chooser panel. */ + width?: number; + }; + /** +An array of grid columns. + */ + columns?: Array; + onContentReady?: Function; + contentReadyAction?: Function; + /** Specifies a function that customizes grid columns after they are created. */ + customizeColumns?: (columns: Array) => void; + dataErrorOccurred?: (errorObject: Error) => void; + /** Specifies a data source for the grid. */ + dataSource?: any; + editingStart?: (e: { + data: Object; + key: any; + cancel: boolean; + column: dxDataGridColumn + }) => void; + /** A handler for the editingStart event. */ + onEditingStart?: (e: { + data: Object; + key: any; + cancel: boolean; + column: dxDataGridColumn + }) => void; + editorPrepared?: (e: Object) => void; + /** A handler for the editorPrepared event. */ + onEditorPrepared?: (e: Object) => void; + editorPreparing?: (e: Object) => void; + /** A handler for the editorPreparing event. */ + onEditorPreparing?: (e: Object) => void; + /** Contains options that specify how grid content can be changed. */ + editing?: { + /** Specifies whether or not grid records can be edited at runtime. */ + editEnabled?: boolean; + /** Specifies how grid values can be edited manually. */ + editMode?: string; + /** Specifies whether or not new records can be inserted into a grid. */ + insertEnabled?: boolean; + /** Specifies whether or not records can be deleted from a grid. */ + removeEnabled?: boolean; + /** Contains options that specify texts for editing-related grid controls. */ + texts?: { + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Save" button. Setting this option makes sense only when the editMode option is set to batch. */ + saveAllChanges?: string; + /** Specifies text for a cancel button displayed when a row is in the editing state. Setting this option makes sense only when the editEnabled option is set to true. */ + cancelRowChanges?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Revert" button. Setting this option makes sense only when the editMode option is set to batch. */ + cancelAllChanges?: string; + /** Specifies a message to be displayed by a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteMessage?: string; + /** Specifies text to be displayed in the title of a confirmation window. Setting this option makes sense only when the edit mode is "row". */ + confirmDeleteTitle?: string; + /** Specifies text for a button that deletes a row from a grid. Setting this option makes sense only when the removeEnabled option is set to true. */ + deleteRow?: string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Add" button. Setting this option makes sense only when the insertEnabled option is true. */ + addRow?: string; + /** Specifies text for a button that turns a row into the editing state. Setting this option makes sense only when the editEnabled option is set to true. */ + editRow?: string; + /** + * Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the removeEnabled option is set to true. + * @deprecated Use the "undeleteRow" option instead. + */ + recoverRow?: string; + /** Specifies text for a save button displayed when a row is in the editing state. Setting this option makes sense only when the editEnabled option is set to true. */ + saveRowChanges?: string; + /** Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the removeEnabled option is set to true. */ + undeleteRow?: string; + }; + }; + /** Specifies filter row options. */ + filterRow?: { + /** Specifies when to apply a filter. */ + applyFilter?: string; + /** Specifies text for the hint that pops up when a user hovers the mouse pointer over the "Apply Filter" button. */ + applyFilterText?: string; + /** Specifies descriptions for filter operations. */ + operationDescriptions?: { + "=": string; + "<>": string; + "<": string; + "<=": string; + ">": string; + ">=": string; + "startswith": string; + "contains": string; + "notcontains": string; + "endswith": string; + }; + /** Specifies text for the reset operation in a filter list. */ + resetOperationText?: string; + /** Specifies text for the operation of clearing the applied filter when a select box is used. */ + showAllText?: string; + /** Specifies whether or not an icon that allows the user to choose a filter operation is visible. */ + showOperationChooser?: boolean; + /** Specifies whether the filter row is visible or not. */ + visible?: boolean; + }; + /** Specifies the behavior of grouped grid records. */ + grouping?: { + /** Specifies whether the user can collapse grouped records in a grid or not. */ + allowCollapsing?: boolean; + /** Specifies whether groups appear expanded or not. */ + autoExpandAll?: boolean; + /** Specifies the message displayed in a group row when the corresponding group is continued from the previous page. */ + groupContinuedMessage?: string; + /** +Specifies the message displayed in a group row when the corresponding group continues on the next page. + */ + groupContinuesMessage?: string; + }; + /** Specifies options that configure the group panel. */ + groupPanel?: { + /** Specifies whether columns can be dragged onto or from the group panel. */ + allowColumnDragging?: boolean; + /** Specifies text displayed by the group panel when it does not contain any columns. */ + emptyPanelText?: string; + /** Specifies whether the group panel is visible or not. */ + visible?: boolean; + }; + /** Specifies options configuring the load panel. */ + loadPanel?: { + /** Specifies whether to show the load panel or not. */ + enabled?: boolean; + /** Specifies the height of the load panel in pixels. */ + height?: number; + /** Specifies a URL pointing to an image to be used as a loading indicator. */ + indicatorSrc?: string; + /** Specifies whether or not a loading indicator must be displayed on the load panel. */ + showIndicator?: boolean; + /** Specifies whether or not the pane of the load panel must be displayed. */ + showPane?: boolean; + /** Specifies text displayed by the load panel. */ + text?: string; + /** Specifies the width of the load panel in pixels. */ + width?: number; + }; + /** Specifies text displayed when a grid does not contain any records. */ + noDataText?: string; + /** Specifies the options of a grid pager. */ + pager?: { + /** Specifies the page sizes that can be selected at runtime. */ + allowedPageSizes?: any; + /** Specifies whether to show the page size selector or not. */ + showPageSizeSelector?: boolean; + /** Specifies whether to show the pager or not. */ + visible?: any; + /** Specifies the text accompanying the page navigator. */ + infoText?: string; + /** Specifies whether or not to display the text accompanying the page navigator. This text is specified by the infoText option. */ + showInfo?: boolean; + /** Specifies whether or not to display buttons that switch the grid to the previous or next page. */ + showNavigationButtons?: boolean; + }; + /** Specifies paging options. */ + paging?: { + /** Specifies whether dxDataGrid loads data page by page or all at once. */ + enabled?: boolean; + /** Specifies the grid page that should be displayed by default. */ + pageIndex?: number; + /** Specifies the size of grid pages. */ + pageSize?: number; + }; + /** Specifies whether or not grid rows must be shaded in a different way. */ + rowAlternationEnabled?: boolean; + rowClick?: any; + /** A handler for the rowClick event. */ + onRowClick?: any; + rowPrepared?: (e: Object) => void; + /** A handler for the rowPrepared event. */ + onRowPrepared?: (e: Object) => void; + /** Specifies a custom template for grid rows. */ + rowTemplate?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not a grid must preload pages adjacent to the current page when using virtual scrolling. */ + preloadEnabled?: boolean; + }; + /** Specifies options of the search panel. */ + searchPanel?: { + /** Specifies whether or not search strings in the located grid records should be highlighted. */ + highlightSearchText?: boolean; + /** Specifies text displayed by the search panel when no search string was typed. */ + placeholder?: string; + /** Specifies whether the search panel is visible or not. */ + visible?: boolean; + /** Specifies the width of the search panel in pixels. */ + width?: number; + /** Sets a search string for the search panel. */ + text?: string; + }; + /** Specifies the operations that must be performed on the server side. */ + remoteOperations?: any; + /** Allows you to sort groups according to the values of group summary items. */ + sortByGroupSummaryInfo?: Array<{ + /** Specifies the group summary item whose values must be used to sort groups. */ + summaryItem?: string; + /** Specifies the identifier of the column that must be used in grouping so that sorting by group summary item values be applied. */ + groupColumn?: string; + /** Specifies the sort order of group summary item values. */ + sortOrder?: string; + }>; + /** Allows you to build a master-detail interface in the grid. */ + masterDetail?: { + /** Enables an end-user to expand/collapse detail sections. */ + enabled?: boolean; + /** Specifies whether detail sections appear expanded or collapsed. */ + autoExpandAll?: boolean; + /** Specifies the template for detail sections. */ + template?: any; + }; + /** Specifies the keys of the records that must appear selected initially. */ + selectedRowKeys?: Array; + /** Specifies options of runtime selection. */ + selection?: { + /** Specifies whether the user can select all grid records at once. */ + allowSelectAll?: boolean; + /** Specifies the selection mode. */ + mode?: string; + }; + selectionChanged?: (e: { + currentSelectedRowKeys: Array; + currentDeselectedRowKeys: Array; + selectedRowKeys: Array; + selectedRowsData: Array; + }) => void; + /** A handler for the dataErrorOccured event. */ + onDataErrorOccurred?: (e: { error: Error }) => void; + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + currentSelectedRowKeys: Array; + currentDeselectedRowKeys: Array; + selectedRowKeys: Array; + selectedRowsData: Array; + }) => void; + /** Specifies whether column headers are visible or not. */ + showColumnHeaders?: boolean; + /** Specifies whether or not vertical lines separating one grid column from another are visible. */ + showColumnLines?: boolean; + /** Specifies whether or not horizontal lines separating one grid row from another are visible. */ + showRowLines?: boolean; + /** Specifies options of runtime sorting. */ + sorting?: { + /** Specifies text for the context menu item that sets an ascending sort order in a column. */ + ascendingText?: string; + /** Specifies text for the context menu item that resets sorting settings for a column. */ + clearText?: string; + /** Specifies text for the context menu item that sets a descending sort order in a column. */ + descendingText?: string; + /** Specifies the runtime sorting mode. */ + mode?: string; + }; + /** Specifies options of state storing. */ + stateStoring?: { + /** Specifies a callback function that performs specific actions on state loading. */ + customLoad?: () => JQueryPromise; + /** Specifies a callback function that performs specific actions on state saving. */ + customSave?: (gridState: Object) => void; + /** Specifies whether or not a grid saves its state. */ + enabled?: boolean; + /** Specifies the delay between the last change of a grid state and the operation of saving this state in milliseconds. */ + savingTimeout?: number; + /** Specifies a unique key to be used for storing the grid state. */ + storageKey?: string; + /** Specifies the type of storage to be used for state storing. */ + type?: string; + }; + /** Specifies the options of the grid summary. */ + summary?: { + /** Contains options that specify text patterns for summary items. */ + texts?: { + /** Specifies a pattern for the 'sum' summary items when they are displayed in the parent column. */ + sum?: string; + /** Specifies a pattern for the 'sum' summary items displayed in a group row or in any other column rather than the parent one. */ + sumOtherColumn?: string; + /** Specifies a pattern for the 'min' summary items when they are displayed in the parent column. */ + min?: string; + /** Specifies a pattern for the 'min' summary items displayed in a group row or in any other column rather than the parent one. */ + minOtherColumn?: string; + /** Specifies a pattern for the 'max' summary items when they are displayed in the parent column. */ + max?: string; + /** Specifies a pattern for the 'max' summary items displayed in a group row or in any other column rather than the parent one. */ + maxOtherColumn?: string; + /** Specifies a pattern for the 'avg' summary items when they are displayed in the parent column. */ + avg?: string; + /** Specifies a pattern for the 'avg' summary items displayed in a group row or in any other column rather than the parent one. */ + avgOtherColumn?: string; + /** Specifies a pattern for the 'count' summary items. */ + count?: string; + }; + /** Specifies items of the group summary. */ + groupItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the column that provides data for a group summary item. */ + column?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** Specifies a precision for the summary item value of a numeric format. */ + precision?: number; + /** Specifies whether or not a summary item must be displayed in the group footer. */ + showInGroupFooter?: boolean; + /** Specifies the column that must hold the summary item when this item is displayed in the group footer. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: string; + }>; + /** Specifies items of the total summary. */ + totalItems?: Array<{ + /** Specifies the identifier of a summary item. */ + name?: string; + /** Specifies the alignment of a summary item. */ + alignment?: string; + /** Specifies the column that provides data for a summary item. */ + column?: string; + /** Specifies a CSS class to be applied to a summary item. */ + cssClass?: string; + /** Customizes the text to be displayed in the summary item. */ + customizeText?: (itemInfo: { + value: any; + valueText: string; + }) => string; + /** Specifies a pattern for the summary item text. */ + displayFormat?: string; + /** Specifies a precision for the summary item value of a numeric format. */ + precision?: number; + /** Specifies the column that must hold the summary item. */ + showInColumn?: string; + /** Specifies how to aggregate data for a summary item. */ + summaryType?: string; + /** Specifies a format for the summary item value. */ + valueFormat?: string; + }>; + /** Allows you to use a custom aggregate function to calculate the value of a summary item. */ + calculateCustomSummary?: (options: { + component: dxDataGrid; + name?: string; + value: any; + totalValue: any; + summaryProcess: string + }) => void; + }; + /** Specifies whether text that does not fit into a column should be wrapped. */ + wordWrapEnabled?: boolean; + } + /** A data grid widget. */ + export class dxDataGrid extends Widget { + constructor(element: JQuery, options?: dxDataGridOptions); + constructor(element: Element, options?: dxDataGridOptions); + /** Ungroups grid records. */ + clearGrouping(): void; + /** Clears sorting settings of all grid columns at once. */ + clearSorting(): void; + /** Allows you to obtain a cell by its row index and the data field of its column. */ + getCellElement(rowIndex: number, dataField: string): any; + /** Allows you to obtain a cell by its row index and the visible index of its column. */ + getCellElement(rowIndex: number, visibleColumnIndex: number): any; + /** Returns the current state of the grid. */ + state(): Object; + /** Sets the grid state. */ + state(state: Object): void; + /** Allows you to obtain the row index by a data key. */ + getRowIndexByKey(key: any): number; + /** Allows you to obtain the data key by a row index. */ + getKeyByRowIndex(rowIndex: number): any; + /** Adds a new column to a grid. */ + addColumn(columnOptions: dxDataGridColumn): void; + /** Displays the load panel. */ + beginCustomLoading(messageText: string): void; + /** Discards changes made in a grid. */ + cancelEditData(): void; + /** Clears the filter applied to grid records from code. */ + clearFilter(): void; + /** Deselects all grid records. */ + clearSelection(): void; + /** Draws the cell being edited from the editing state. Use this method when the edit mode is batch. */ + closeEditCell(): void; + /** Collapses groups or master rows in a grid. */ + collapseAll(groupIndex?: number): void; + /** Returns the number of data columns in a grid. */ + columnCount(): number; + /** Returns the value of a specific column option. */ + columnOption(id: number, optionName: string): any; + /** Sets an option of a specific column. */ + columnOption(id: number, optionName: string, optionValue: any): void; + /** Returns the options of a column by an identifier. */ + columnOption(id: any): Object; + /** Sets several options of a column at once. */ + columnOption(id: any, options: Object): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, columnIndex: number): void; + /** Sets a specific row into the editing state. */ + editRow(rowIndex: number): void; + /** Hides the load panel. */ + endCustomLoading(): void; + /** Expands groups or master rows in a grid. */ + expandAll(groupIndex: number): void; + /** Allows you to find out whether a specific group or master row is expanded or collapsed. */ + isRowExpanded(key: any): boolean; + /** Allows you to expand a specific group or master row by its key. */ + expandRow(key: any): void; + /** Allows you to collapse a specific group or master row by its key. */ + collapseRow(key: any): void; + /** Applies a filter to grid records. */ + filter(filterExpr: Array): void; + /** Gets the keys of currently selected grid records. */ + getSelectedRowKeys(): Array; + /** Gets the data objects of currently selected grid records. */ + getSelectedRowsData(): Array; + /** Hides the column chooser panel. */ + hideColumnChooser(): void; + /** Adds a new data row to a grid. */ + insertRow(): void; + /** Returns the key corresponding to the passed data object. */ + keyOf(obj: Object): any; + /** Switches a grid to a specified page. */ + pageIndex(newIndex: number): void; + /** Gets the index of the current page. */ + pageIndex(): number; + /** Sets the page size. */ + pageSize(value: number): void; + /** Gets the current page size. */ + pageSize(): number; + /** + * Recovers a row deleted in the batch edit mode. + * @deprecated Use the "undeleteRow" method instead. + */ + recoverRow(rowIndex: number): void; + /** Refreshes grid data. */ + refresh(): void; + /** Removes a specific row from a grid. */ + removeRow(rowIndex: number): void; + /** Saves changes made in a grid. */ + saveEditData(): void; + /** +Searches grid records by a search string. + */ + searchByText(text: string): void; + /** Selects all grid records. */ + selectAll(): void; + deselectAll(): void; + /** Selects specific grid records. */ + selectRows(keys: Array, preserve: boolean): void; + /** Deselects specific grid records. */ + deselectRows(keys: Array): void; + /** Selects grid rows by indexes. */ + selectRowsByIndexes(indexes: Array): void; + /** Allows you to find out whether a row is selected or not. */ + isRowSelected(key: any): boolean; + /** Invokes the column chooser panel. */ + showColumnChooser(): void; + startSelectionWithCheckboxes(): boolean; + /** Returns the number of records currently held by a grid. */ + totalCount(): number; + /** Recovers a row deleted in the batch edit mode. */ + undeleteRow(rowIndex: number): void; + /** Allows you to obtain a data object by its key. */ + byKey(key: any): JQueryPromise; + /** Gets the value of a total summary item. */ + getTotalSummaryValue(summaryItemName: string): any; + } +} +declare module DevExpress.viz.charts { + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface BaseSeries { + /** Provides information about the state of the series object. */ + fullState: number; + /** Returns the type of the series. */ + type: string; + /** Unselects all the selected points of the series. The points are displayed in an initial style. */ + clearSelection(): void; + /** + * Gets a point from the series point collection based on the specified argument. + * @deprecated getPointsByArg(pointArg).md + */ + getPointByArg(pointArg: any): Object; + /** Gets points from the series point collection based on the specified argument. */ + getPointsByArg(pointArg: any): Array; + /** Gets a point from the series point collection based on the specified point position. */ + getPointByPos(positionIndex: number): Object; + /** Selects the series. The series is displayed in a 'selected' style until another series is selected or the current series is deselected programmatically. */ + select(): void; + /** Selects the specified point. The point is displayed in a 'selected' style. */ + selectPoint(point: BasePoint): void; + /** Deselects the specified point. The point is displayed in an initial style. */ + deselectPoint(point: BasePoint): void; + /** Returns an array of all points in the series. */ + getAllPoints(): Array; + /** Returns visible series points. */ + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface BasePoint { + /** Provides information about the state of the point object. */ + fullState: number; + /** Returns the point's argument value that was set in the data source. */ + originalArgument: any; + /** Returns the point's value that was set in the data source. */ + originalValue: any; + /** Returns the tag of the point. */ + tag: string; + /** Deselects the point. */ + clearSelection(): void; + /** Gets the color of a particular point. */ + getColor(): string; + /** Hides the tooltip of the point. */ + hideTooltip(): void; + /** Provides information about the hover state of a point. */ + isHovered(): any; + /** Provides information about the selection state of a point. */ + isSelected(): any; + /** Selects the point. The point is displayed in a 'selected' style until another point is selected or the current point is deselected programmatically. */ + select(): void; + /** Shows the tooltip of the point. */ + showTooltip(): void; + /** Allows you to obtain the label of a series point. */ + getLabel(): any; + /** Returns the series object to which the point belongs. */ + series: BaseSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface ChartSeries extends BaseSeries { + /** Returns the name of the series pane. */ + pane: string; + /** Returns the name of the value axis of the series. */ + axis: string; + /** Returns the name of the series. */ + name: string; + /** Returns the tag of the series. */ + tag: string; + /** Hides a particular series. */ + hide(): void; + /** Provides information about the hover state of a series. */ + isHovered(): any; + /** Provides information about the selection state of a series. */ + isSelected(): any; + /** Provides information about the visibility state of a series. */ + isVisible(): boolean; + /** Makes a particular series visible. */ + show(): void; + selectPoint(point: ChartPoint): void; + deselectPoint(point: ChartPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface ChartPoint extends BasePoint { + /** Contains the close value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalCloseValue: any; + /** Contains the high value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalHighValue: any; + /** Contains the low value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalLowValue: any; + /** Contains the first value of the point. This field is useful for points belonging to a series of the range area or range bar type only. */ + originalMinValue: any; + /** Contains the open value of the point. This field is useful for points belonging to a series of the candle stick or stock type only. */ + originalOpenValue: any; + /** Contains the size of the bubble as it was set in the data source. This field is useful for points belonging to a series of the bubble type only. */ + size: any; + /** Gets the parameters of the point's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + series: ChartSeries; + } + /** This section describes the methods that can be used in code to manipulate the Label object. */ + export interface Label { + /** Gets the parameters of the label's minimum bounding rectangle (MBR). */ + getBoundingRect(): { x: number; y: number; width: number; height: number; }; + /** Hides the point label. */ + hide(): void; + /** Shows the point label. */ + show(): void; + } + export interface PieSeries extends BaseSeries { + selectPoint(point: PiePoint): void; + deselectPoint(point: PiePoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PiePoint extends BasePoint { + /** Gets the percentage value of the specific point. */ + percent: any; + /** Provides information about the visibility state of a point. */ + isVisible(): boolean; + /** Makes a specific point visible. */ + show(): void; + /** Hides a specific point. */ + hide(): void; + series: PieSeries; + } + /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ + export interface PolarSeries extends BaseSeries { + /** Returns the name of the value axis of the series. */ + axis: string; + /** Returns the name of the series. */ + name: string; + /** Returns the tag of the series. */ + tag: string; + /** Hides a particular series. */ + hide(): void; + /** Provides information about the hover state of a series. */ + isHovered(): any; + /** Provides information about the selection state of a series. */ + isSelected(): any; + /** Provides information about the visibility state of a series. */ + isVisible(): boolean; + /** Makes a particular series visible. */ + show(): void; + selectPoint(point: PolarPoint): void; + deselectPoint(point: PolarPoint): void; + getAllPoints(): Array; + getVisiblePoints(): Array; + } + /** This section describes the methods that can be used in code to manipulate the Point object. */ + export interface PolarPoint extends BasePoint { + series: PolarSeries; + } + export interface Strip { + /** Specifies a color for a strip. */ + color?: string; + /** An object that defines the label configuration options of a strip. */ + label?: { + /** Specifies the text displayed in a strip. */ + text?: string; + }; + /** Specifies a start value for a strip. */ + startValue?: any; + /** Specifies an end value for a strip. */ + endValue?: any; + } + export interface BaseSeriesConfigLabel { + /** Specifies a format for arguments displayed by point labels. */ + argumentFormat?: string; + /** Specifies a precision for formatted point arguments displayed in point labels. */ + argumentPrecision?: number; + /** Specifies a background color for point labels. */ + backgroundColor?: string; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies connector options for series point labels. */ + connector?: { + /** Specifies the color of label connectors. */ + color?: string; + /** Indicates whether or not label connectors are visible. */ + visible?: boolean; + /** Specifies the width of label connectors. */ + width?: number; + }; + /** Specifies a callback function that returns the text to be displayed by point labels. */ + customizeText?: (pointInfo: Object) => string; + /** Specifies font options for the text displayed in point labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed by point labels. */ + format?: string; + position?: string; + /** Specifies a precision for formatted point values displayed in point labels. */ + precision?: number; + /** Specifies the angle used to rotate point labels from their initial position. */ + rotationAngle?: number; + /** Specifies the visibility of point labels. */ + visible?: boolean; + } + export interface SeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies whether or not to show a label when the point has a zero value. */ + showForZeroValues?: boolean; + } + export interface ChartSeriesConfigLabel extends SeriesConfigLabel { + /** Specifies how to align point labels relative to the corresponding data points that they represent. */ + alignment?: string; + /** Specifies how to shift point labels horizontally from their initial positions. */ + horizontalOffset?: number; + /** Specifies how to shift point labels vertically from their initial positions. */ + verticalOffset?: number; + /** Specifies a precision for the percentage values displayed in the labels of a full-stacked-like series. */ + percentPrecision?: number; + } + export interface BaseCommonSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + axis?: string; + /** An object defining the label configuration options for a series in the dxChart widget. */ + label?: ChartSeriesConfigLabel; + /** Specifies border options for point labels. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the dash style of the series' line. */ + dashStyle?: string; + hoverMode?: string; + /** An object defining configuration options for a hovered series. */ + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /**

                Sets a color for a series when it is hovered over.

                */ + color?: string; + /** Specifies the dash style for the line in a hovered series. */ + dashStyle?: string; + /** Specifies the hatching options to be applied when a series is hovered over. */ + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a hovered series. */ + width?: number; + }; + /** Specifies whether a chart ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies the minimal length of a displayed bar in pixels. */ + minBarSize?: number; + /** Specifies opacity for a series. */ + opacity?: number; + /** Specifies the series elements to highlight when the series is selected. */ + selectionMode?: string; + /** An object defining configuration options for a selected series. */ + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the dash style for the line in a selected series. */ + dashStyle?: string; + /** Specifies the hatching options to be applied when a series is selected. */ + hatching?: viz.core.Hatching; + /** Specifies the width of a line in a selected series. */ + width?: number; + }; + /** Specifies whether or not to show the series in the chart's legend. */ + showInLegend?: boolean; + /** Specifies the name of the stack where the values of the _stackedBar_ series must be located. */ + stack?: string; + /** Specifies the name of the data source field that provides data about a point. */ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + /** Specifies the visibility of a series. */ + visible?: boolean; + /** Specifies a line width. */ + width?: number; + /** Configures error bars. */ + valueErrorBar?: { + /** Specifies whether error bars must be displayed in full or partially. */ + displayMode?: string; + /** Specifies the data field that provides data for low error values. */ + lowValueField?: string; + /** Specifies the data field that provides data for high error values. */ + highValueField?: string; + /** Specifies how error bar values must be calculated. */ + type?: string; + /** Specifies the value to be used for generating error bars. */ + value?: number; + /** Specifies the color of error bars. */ + color?: string; + /** Specifies the opacity of error bars. */ + opacity?: number; + /** Specifies the length of the lines that indicate the error bar edges. */ + edgeLength?: number; + /** Specifies the width of the error bar line. */ + lineWidth?: number; + }; + } + export interface CommonPointOptions { + /** Specifies border options for points in the line and area series. */ + border?: viz.core.Border; + /** Specifies the points color. */ + color?: string; + /** Specifies what series points to highlight when a point is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered point. */ + hoverStyle?: { + /** An object defining the border options for a hovered point. */ + border?: viz.core.Border; + /** Sets a color for a point when it is hovered over. */ + color?: string; + /** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies what series points to highlight when a point is selected. */ + selectionMode?: string; + /** An object defining configuration options for a selected point. */ + selectionStyle?: { + /** An object defining the border options for a selected point. */ + border?: viz.core.Border; + /**

                Sets a color for a point when it is selected.

                */ + color?: string; + /** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */ + size?: number; + /** Specifies a symbol for presenting points of the line and area series. */ + symbol?: string; + visible?: boolean; + } + export interface ChartCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: any; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: any; + /** Specifies the width of an image that is used as a point marker. */ + width?: any; + }; + } + export interface PolarCommonPointOptions extends CommonPointOptions { + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: number; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: string; + /** Specifies the width of an image that is used as a point marker. */ + width?: number; + }; + } + /** An object that defines configuration options for chart series. */ + export interface CommonSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies the data source field that provides a 'close' value for a _candleStick_ or _stock_ series. */ + closeValueField?: string; + /** Specifies a radius for bar corners. */ + cornerRadius?: number; + /** Specifies the data source field that provides a 'high' value for a _candleStick_ or _stock_ series. */ + highValueField?: string; + /** Specifies the color for the body (rectangle) of a _candleStick_ series. */ + innerColor?: string; + /** Specifies the data source field that provides a 'low' value for a _candleStick_ or _stock_ series. */ + lowValueField?: string; + /** Specifies the data source field that provides an 'open' value for a _candleStick_ or _stock_ series. */ + openValueField?: string; + /** Specifies the pane that will be used to display a series. */ + pane?: string; + /** An object defining configuration options for points in line-, scatter- and area-like series. */ + point?: ChartCommonPointOptions; + /** Specifies the data source field that provides values for one end of a range series. To set the data source field for the other end of the range series, use the rangeValue2Field property. */ + rangeValue1Field?: string; + /** Specifies the data source field that provides values for the second end of a range series. To set the data source field for the other end of the range series, use the rangeValue1Field property. */ + rangeValue2Field?: string; + /** Specifies reduction options for the stock or candleStick series. */ + reduction?: { + /** Specifies a color for the points whose reduction level price is lower in comparison to the value in the previous point. */ + color?: string; + /** Specifies for which price level (open, high, low or close) to enable reduction options in the series. */ + level?: string; + }; + /** Specifies the data source field that defines the size of bubbles. */ + sizeField?: string; + } + export interface CommonSeriesSettings extends CommonSeriesConfig { + /**

                An object that specifies configuration options for all series of the area type in the chart.

                */ + area?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the bubble type in the chart. */ + bubble?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _candleStick_ type in the chart. */ + candlestick?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedArea_ type in the chart. */ + fullstackedarea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Full-Stacked Spline Area type in the chart. */ + fullstackedsplinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedBar_ type in the chart. */ + fullstackedbar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _fullStackedLine_ type in the chart. */ + fullstackedline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Full-Stacked Spline type in the chart. */ + fullstackedspline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _rangeArea_ type in the chart. */ + rangearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _rangeBar_ type in the chart. */ + rangebar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _spline_ type in the chart. */ + spline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _splineArea_ type in the chart. */ + splinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedArea_ type in the chart. */ + stackedarea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Stacked Spline Area type in the chart. */ + stackedsplinearea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedLine_ type in the chart. */ + stackedline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the Stacked Spline type in the chart. */ + stackedspline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stepArea_ type in the chart. */ + steparea?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stepLine_ type in the chart. */ + stepline?: CommonSeriesConfig; + /** An object that specifies configuration options for all series of the _stock_ type in the chart. */ + stock?: CommonSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface SeriesConfig extends CommonSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + /** An object that defines configuration options for polar chart series. */ + export interface CommonPolarSeriesConfig extends BaseCommonSeriesConfig { + /** Specifies whether or not to close the chart by joining the end point with the first point. */ + closed?: boolean; + label?: SeriesConfigLabel; + point?: PolarCommonPointOptions; + } + export interface CommonPolarSeriesSettings extends CommonPolarSeriesConfig { + /** An object that specifies configuration options for all series of the area type in the chart. */ + area?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _bar_ type in the chart. */ + bar?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _line_ type in the chart. */ + line?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _scatter_ type in the chart. */ + scatter?: CommonPolarSeriesConfig; + /** An object that specifies configuration options for all series of the _stackedBar_ type in the chart. */ + stackedbar?: CommonPolarSeriesConfig; + /** Sets a series type. */ + type?: string; + } + export interface PolarSeriesConfig extends CommonPolarSeriesConfig { + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + /** Sets the series type. */ + type?: string; + } + export interface PieSeriesConfigLabel extends BaseSeriesConfigLabel { + /** Specifies how to shift labels from their initial position in a radial direction in pixels. */ + radialOffset?: number; + /** Specifies a precision for the percentage values displayed in labels. */ + percentPrecision?: number; + } + /** An object that defines configuration options for chart series. */ + export interface CommonPieSeriesConfig { + /** Specifies the data source field that provides arguments for series points. */ + argumentField?: string; + /** Specifies the required type for series arguments. */ + argumentType?: string; + /** An object defining the series border configuration options. */ + border?: viz.core.DashedBorder; + /** Specifies a series color. */ + color?: string; + /** Specifies the chart elements to highlight when a series is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered series. */ + hoverStyle?: { + /** An object defining the border options for a hovered series. */ + border?: viz.core.DashedBorder; + /** Sets a color for the series when it is hovered over. */ + color?: string; + /** Specifies the hatching options to be applied when a point is hovered over. */ + hatching?: viz.core.Hatching; + }; + /** Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. */ + innerRadius?: number; + /** An object defining the label configuration options. */ + label?: PieSeriesConfigLabel; + /** Specifies how many points are acceptable to be in a series to display all labels for these points. Otherwise, the labels will not be displayed. */ + maxLabelCount?: number; + /** Specifies a minimal size of a displayed pie segment. */ + minSegmentSize?: number; + /** Specifies the direction in which the dxPieChart's series points are located. */ + segmentsDirection?: string; + /**

                Specifies the chart elements to highlight when the series is selected.

                */ + selectionMode?: string; + /** An object defining configuration options for the series when it is selected. */ + selectionStyle?: { + /** An object defining the border options for a selected series. */ + border?: viz.core.DashedBorder; + /** Sets a color for a series when it is selected. */ + color?: string; + /** Specifies the hatching options to be applied when a point is selected. */ + hatching?: viz.core.Hatching; + }; + /** Specifies chart segment grouping options. */ + smallValuesGrouping?: { + /** Specifies the name of the grouped chart segment. This name represents the segment in the chart legend. */ + groupName?: string; + /** Specifies the segment grouping mode. */ + mode?: string; + /** Specifies a threshold for segment values. */ + threshold?: number; + /** Specifies how many segments must not be grouped. */ + topCount?: number; + }; + /** Specifies a start angle for a pie chart in arc degrees. */ + startAngle?: number; + /**

                Specifies the name of the data source field that provides data about a point.

                */ + tagField?: string; + /** Specifies the data source field that provides values for series points. */ + valueField?: string; + } + export interface PieSeriesConfig extends CommonPieSeriesConfig { + /** Sets the series type. */ + type?: string; + } + export interface SeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => SeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface PolarSeriesTemplate { + /** Specifies a callback function that returns a series object with individual series settings. */ + customizeSeries?: (seriesName: string) => PolarSeriesConfig; + /** Specifies a data source field that represents the series name. */ + nameField?: string; + } + export interface ChartCommonConstantLineLabel { + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + /** Specifies the position of the constant line label relative to the chart plot. */ + position?: string; + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + } + export interface PolarCommonConstantLineLabel { + /** Indicates whether or not to display labels for the axis constant lines. */ + visible?: boolean; + /** Specifies font options for a constant line label. */ + font?: viz.core.Font; + } + export interface ConstantLineStyle { + /** Specifies a color for a constant line. */ + color?: string; + /** Specifies a dash style for a constant line. */ + dashStyle?: string; + /** Specifies a constant line width in pixels. */ + width?: number; + } + export interface ChartCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartCommonConstantLineLabel; + /** Specifies the space between the constant line label and the left/right side of the constant line. */ + paddingLeftRight?: number; + /** Specifies the space between the constant line label and the top/bottom side of the constant line. */ + paddingTopBottom?: number; + } + export interface PolarCommonConstantLineStyle extends ConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarCommonConstantLineLabel; + } + export interface CommonAxisLabel { + /** Specifies font options for axis labels. */ + font?: viz.core.Font; + /** Specifies the spacing between an axis and its labels in pixels. */ + indentFromAxis?: number; + /** Indicates whether or not axis labels are visible. */ + visible?: boolean; + } + export interface ChartCommonAxisLabel extends CommonAxisLabel { + /** Specifies the label's position relative to the tick (grid line). */ + alignment?: string; + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: { + /** Specifies how to arrange axis labels. */ + mode?: string; + /** Specifies the angle used to rotate axis labels. */ + rotationAngle?: number; + /** Specifies the spacing that must be set between staggered rows when the 'stagger' algorithm is applied. */ + staggeringSpacing?: number; + }; + } + export interface PolarCommonAxisLabel extends CommonAxisLabel { + /** Specifies the overlap resolving algorithm to be applied to axis labels. */ + overlappingBehavior?: string; + } + export interface CommonAxisTitle { + /** Specifies font options for an axis title. */ + font?: viz.core.Font; + /** Specifies a margin for an axis title in pixels. */ + margin?: number; + } + export interface BaseCommonAxisSettings { + /** Specifies the color of the line that represents an axis. */ + color?: string; + /** Specifies whether ticks/grid lines of a discrete axis are located between labels or cross the labels. */ + discreteAxisDivisionMode?: string; + /** An object defining the configuration options for the grid lines of an axis in the dxPolarChart widget. */ + grid?: { + /** Specifies a color for grid lines. */ + color?: string; + /** Specifies an opacity for grid lines. */ + opacity?: number; + /** Indicates whether or not the grid lines of an axis are visible. */ + visible?: boolean; + /** Specifies the width of grid lines. */ + width?: number; + }; + /** Specifies the options of the minor grid. */ + minorGrid?: { + /** Specifies a color for the lines of the minor grid. */ + color?: string; + /** Specifies an opacity for the lines of the minor grid. */ + opacity?: number; + /** Indicates whether the minor grid is visible or not. */ + visible?: boolean; + /** Specifies a width for the lines of the minor grid. */ + width?: number; + }; + /** Indicates whether or not an axis is inverted. */ + inverted?: boolean; + /** Specifies the opacity of the line that represents an axis. */ + opacity?: number; + /** Indicates whether or not to set ticks/grid lines of a continuous axis of the 'date-time' type at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** An object defining the configuration options for axis ticks. */ + tick?: { + /** Specifies ticks color. */ + color?: string; + /** Specifies tick opacity. */ + opacity?: number; + /** Indicates whether or not ticks are visible on an axis. */ + visible?: boolean; + }; + /** Specifies the options of the minor ticks. */ + minorTick?: { + /** Specifies a color for the minor ticks. */ + color?: string; + /** Specifies an opacity for the minor ticks. */ + opacity?: number; + /** Indicates whether or not the minor ticks are displayed on an axis. */ + visible?: boolean; + }; + /** Indicates whether or not the line that represents an axis in a chart is visible. */ + visible?: boolean; + /** Specifies the width of the line that represents an axis in the chart. */ + width?: number; + } + export interface ChartCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxChart widget. */ + label?: ChartCommonAxisLabel; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + /** Specifies, in pixels, the space reserved for an axis. */ + placeholderSize?: number; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + /** Specifies the label's position on a strip. */ + horizontalAlignment?: string; + /** Specifies a label's position on a strip. */ + verticalAlignment?: string; + }; + /** Specifies the spacing, in pixels, between the left/right strip border and the strip label. */ + paddingLeftRight?: number; + /** Specifies the spacing, in pixels, between the top/bottom strip borders and the strip label. */ + paddingTopBottom?: number; + }; + /** An object defining the title configuration options that are common for all axes in the dxChart widget. */ + title?: CommonAxisTitle; + /** Indicates whether or not to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + } + export interface PolarCommonAxisSettings extends BaseCommonAxisSettings { + /** Specifies the appearance of all the widget's constant lines. */ + constantLineStyle?: PolarCommonConstantLineStyle; + /** An object defining the label configuration options that are common for all axes in the dxPolarChart widget. */ + label?: PolarCommonAxisLabel; + /** An object defining configuration options for strip style. */ + stripStyle?: { + /** An object defining the configuration options for a strip label style. */ + label?: { + /** Specifies font options for a strip label. */ + font?: viz.core.Font; + }; + }; + } + export interface ChartConstantLineLabel extends ChartCommonConstantLineLabel { + /** Specifies the horizontal alignment of a constant line label. */ + horizontalAlignment?: string; + /** Specifies the vertical alignment of a constant line label. */ + verticalAlignment?: string; + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface PolarConstantLineLabel extends PolarCommonConstantLineLabel { + /** Specifies the text to be displayed in a constant line label. */ + text?: string; + } + export interface AxisLabel { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */ + customizeHint?: (argument: { value: any; valueText: string }) => string; + /** Specifies a callback function that returns the text to be displayed in value axis labels. */ + customizeText?: (argument: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed by axis labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the axis labels. */ + precision?: number; + } + export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { } + export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel { } + export interface AxisTitle extends CommonAxisTitle { + /** Specifies the text for the value axis title. */ + text?: string; + } + export interface ChartConstantLineStyle extends ChartCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartConstantLineLabel; + } + export interface ChartConstantLine extends ChartConstantLineStyle { + /** An object defining constant line label options. */ + label?: ChartConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface PolarConstantLine extends PolarCommonConstantLineStyle { + /** An object defining constant line label options. */ + label?: PolarConstantLineLabel; + /** Specifies a value to be displayed by a constant line. */ + value?: any; + } + export interface Axis { + /** Specifies a coefficient for dividing the value axis. */ + axisDivisionFactor?: number; + /** Specifies the order in which discrete values are arranged on the value axis. */ + categories?: Array; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic axis. */ + logarithmBase?: number; + /** Specifies an interval between axis ticks/grid lines. */ + tickInterval?: any; + /** Specifies the interval between minor ticks. */ + minorTickInterval?: any; + /** Specifies the number of minor ticks between two neighboring major ticks. */ + minorTickCount?: number; + /** Specifies the required type of the value axis. */ + type?: string; + /** Specifies the pane on which the current value axis will be displayed. */ + pane?: string; + /** Specifies options for value axis strips. */ + strips?: Array; + } + export interface ChartAxis extends ChartCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies the appearance options for the constant lines of the value axis. */ + constantLineStyle?: ChartCommonConstantLineStyle; + /** Specifies options for value axis labels. */ + label?: ChartAxisLabel; + /** Specifies the maximum value on the value axis. */ + max?: any; + /** Specifies the minimum value on the value axis. */ + min?: any; + /** Specifies the position of the value axis on a chart. */ + position?: string; + /** Specifies the title for a value axis. */ + title?: AxisTitle; + } + export interface PolarAxis extends PolarCommonAxisSettings, Axis { + /** Defines an array of the value axis constant lines. */ + constantLines?: Array; + /** Specifies options for value axis labels. */ + label?: PolarAxisLabel; + } + export interface ArgumentAxis { + /** Specifies the desired type of axis values. */ + argumentType?: string; + /** Specifies the elements that will be highlighted when the argument axis is hovered over. */ + hoverMode?: string; + } + export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis { } + export interface PolarArgumentAxis extends PolarAxis, ArgumentAxis { + /** Specifies a start angle for the argument axis in degrees. */ + startAngle?: number; + /** Specifies whether or not to display the first point at the angle specified by the startAngle option. */ + firstPointOnStartAngle?: boolean; + /** Specifies the period of the argument values in the data source. */ + period?: number; + } + export interface ValueAxis { + /** Specifies the name of the value axis. */ + name?: string; + /** Specifies whether or not to indicate a zero value on the value axis. */ + showZero?: boolean; + /** Specifies the desired type of axis values. */ + valueType?: string; + } + export interface ChartValueAxis extends ChartAxis, ValueAxis { + /** Specifies the spacing, in pixels, between multiple value axes in a chart. */ + multipleAxesSpacing?: number; + /** Specifies the value by which the chart's value axes are synchronized. */ + synchronizedValue?: number; + } + export interface PolarValueAxis extends PolarAxis, ValueAxis { + /** Indicates whether to display series with indents from axis boundaries. */ + valueMarginsEnabled?: boolean; + /** Specifies a coefficient that determines the spacing between the maximum series point and the axis. */ + maxValueMargin?: number; + /** Specifies a coefficient that determines the spacing between the minimum series point and the axis. */ + minValueMargin?: number; + tick?: { + visible?: boolean; + } + } + export interface CommonPane { + /** Specifies a background color in a pane. */ + backgroundColor?: string; + /** Specifies the border options of a chart's pane. */ + border?: PaneBorder; + } + export interface Pane extends CommonPane { + /** Specifies the name of a pane. */ + name?: string; + } + export interface PaneBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies the bottom border's visibility state in a pane. */ + bottom?: boolean; + /** Specifies the left border's visibility state in a pane. */ + left?: boolean; + /** Specifies the right border's visibility state in a pane. */ + right?: boolean; + /** Specifies the top border's visibility state in a pane. */ + top?: boolean; + } + export interface ChartAnimation extends viz.core.Animation { + /** Specifies the maximum series point count in the chart that the animation supports. */ + maxPointCountSupported?: number; + } + export interface BaseChartTooltip extends viz.core.Tooltip { + /** Specifies a format for arguments of the chart's series points. */ + argumentFormat?: string; + /** Specifies a precision for formatted arguments displayed in tooltips. */ + argumentPrecision?: number; + /** Specifies a precision for a percent value displayed in tooltips for stacked series and dxPieChart series. */ + percentPrecision?: number; + } + export interface BaseChartOptions extends viz.core.BaseWidgetOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies the width of the widget container that is small enough for the layout to begin adapting. */ + width?: number; + /** Specifies the height of the widget container that is small enough for the layout to begin adapting. */ + height?: number; + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies animation options. */ + animation?: ChartAnimation; + /** Specifies a callback function that returns an object with options for a specific point label. */ + customizeLabel?: (labelInfo: Object) => Object; + /** Specifies a callback function that returns an object with options for a specific point. */ + customizePoint?: (pointInfo: Object) => Object; + /** Specifies a data source for the chart. */ + dataSource?: any; + done?: Function; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies options of a dxChart's (dxPieChart's) legend. */ + legend?: core.BaseLegend; + /** Specifies the blank space between the chart's extreme elements and the boundaries of the area provided for the widget (see size) in pixels. */ + margin?: viz.core.Margins; + /** Sets the name of the palette to be used in the chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: any; + /** A handler for the done event. */ + onDone?: (e: { + component: BaseChart; + element: Element; + }) => void; + /** A handler for the pointClick event. */ + onPointClick?: any; + pointClick?: any; + /** A handler for the pointHoverChanged event. */ + onPointHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + pointHoverChanged?: (point: TPoint) => void; + /** A handler for the pointSelectionChanged event. */ + onPointSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TPoint; + }) => void; + pointSelectionChanged?: (point: TPoint) => void; + /** Specifies whether a single point or multiple points can be selected in the chart. */ + pointSelectionMode?: string; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies options for the dxChart and dxPieChart widget series. */ + series?: any; + /** Specifies the size of the widget in pixels. */ + size?: viz.core.Size; + /** Sets the name of the theme to be used in the chart. */ + theme?: string; + /** Specifies a title for the chart. */ + title?: { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** Specifies the title's horizontal position in the chart. */ + horizontalAlignment?: string; + /** Specifies a title's position on the chart in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the distance between the title and surrounding chart elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies a text for the chart's title. */ + text?: string; + }; + /** Specifies tooltip options. */ + tooltip?: BaseChartTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseChart; + element: Element; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseChart; + element: Element; + }) => void; + tooltipHidden?: (point: TPoint) => void; + tooltipShown?: (point: TPoint) => void; + } + /** A base class for all chart widgets included in the ChartJS library. */ + export class BaseChart extends viz.core.BaseWidget { + /** Deselects the chart's selected series. The series is displayed in an initial style. */ + clearSelection(): void; + /** Gets the current size of the widget. */ + getSize(): { width: number; height: number }; + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Hides all widget tooltips. */ + hideTooltip(): void; + /** Redraws a widget. */ + render(renderOptions?: { + force?: boolean; + animate?: boolean; + asyncSeriesRendering?: boolean; + }): void; + } + export interface AdvancedLegend extends core.BaseLegend { + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /**

                Specifies a callback function that returns the text to be displayed by legend items.

                */ + customizeText?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; + /** Specifies what series elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + } + export interface AdvancedOptions extends BaseChartOptions { + /** A handler for the argumentAxisClick event. */ + onArgumentAxisClick?: any; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate the values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort the series points. */ + sortingMethod?: any; + }; + /** A handler for the legendClick event. */ + onLegendClick?: any; + /** A handler for the seriesClick event. */ + onSeriesClick?: any; + /** A handler for the seriesHoverChanged event. */ + onSeriesHoverChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** A handler for the seriesSelectionChanged event. */ + onSeriesSelectionChanged?: (e: { + component: BaseChart; + element: Element; + target: TSeries; + }) => void; + /** Specifies whether a single series or multiple series can be selected in the chart. */ + seriesSelectionMode?: string; + /** Specifies how the chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + } + export interface Legend extends AdvancedLegend { + /** Specifies whether the legend is located outside or inside the chart's plot. */ + position?: string; + } + export interface ChartTooltip extends BaseChartTooltip { + /** Specifies whether the tooltip must be located in the center of a bar or on its edge. Applies only to the Bar series. */ + location?: string; + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxChartOptions extends AdvancedOptions { + /** Specifies a value indicating whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ + equalBarWidth?: any; + adaptiveLayout?: { + keepLabels?: boolean; + }; + /** Indicates whether or not to synchronize value axes when they are displayed on a single pane. */ + synchronizeMultiAxes?: boolean; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Indicates whether or not to adjust a value axis to the current minimum and maximum values of a zoomed chart. */ + adjustOnZoom?: boolean; + /** Specifies argument axis options for the dxChart widget. */ + argumentAxis?: ChartArgumentAxis; + argumentAxisClick?: any; + /** An object defining the configuration options that are common for all axes of the dxChart widget. */ + commonAxisSettings?: ChartCommonAxisSettings; + /** An object defining the configuration options that are common for all panes in the dxChart widget. */ + commonPaneSettings?: CommonPane; + /** An object defining the configuration options that are common for all series of the dxChart widget. */ + commonSeriesSettings?: CommonSeriesSettings; + /** An object that specifies the appearance options of the chart crosshair. */ + crosshair?: { + /** Specifies a color for the crosshair lines. */ + color?: string; + /** Specifies a dash style for the crosshair lines. */ + dashStyle?: string; + /** Specifies whether to enable the crosshair or not. */ + enabled?: boolean; + /** Specifies the opacity of the crosshair lines. */ + opacity?: number; + /** Specifies the width of the crosshair lines. */ + width?: number; + /** Specifies the appearance of the horizontal crosshair line. */ + horizontalLine?: CrosshaierWithLabel; + /** Specifies the appearance of the vertical crosshair line. */ + verticalLine?: CrosshaierWithLabel; + /** Specifies the options of the crosshair labels. */ + label?: { + /** Specifies a color for the background of the crosshair labels. */ + backgroundColor?: string; + /** Specifies whether the crosshair labels are visible or not. */ + visible?: boolean; + /** Specifies font options for the text of the crosshair labels. */ + font?: viz.core.Font; + } + }; + /** Specifies a default pane for the chart's series. */ + defaultPane?: string; + /** Specifies a coefficient determining the diameter of the largest bubble. */ + maxBubbleSize?: number; + /** Specifies the diameter of the smallest bubble measured in pixels. */ + minBubbleSize?: number; + /** Defines the dxChart widget's pane(s). */ + panes?: Array; + /** Swaps the axes round so that the value axis becomes horizontal and the argument axes becomes vertical. */ + rotated?: boolean; + /** Specifies the options of a chart's legend. */ + legend?: Legend; + /** Specifies options for dxChart widget series. */ + series?: Array; + legendClick?: any; + seriesClick?: any; + seriesHoverChanged?: (series: ChartSeries) => void; + seriesSelectionChanged?: (series: ChartSeries) => void; + /** Defines options for the series template. */ + seriesTemplate?: SeriesTemplate; + /** Specifies tooltip options. */ + tooltip?: ChartTooltip; + /** Specifies value axis options for the dxChart widget. */ + valueAxis?: Array; + /** Enables scrolling in your chart. */ + scrollingMode?: string; + /** Enables zooming in your chart. */ + zoomingMode?: string; + /** Specifies the settings of the scroll bar. */ + scrollBar?: { + /** Specifies whether the scroll bar is visible or not. */ + visible?: boolean; + /** Specifies the spacing between the scroll bar and the chart's plot in pixels. */ + offset?: number; + /** Specifies the color of the scroll bar. */ + color?: string; + /** Specifies the width of the scroll bar in pixels. */ + width?: number; + /** Specifies the opacity of the scroll bar. */ + opacity?: number; + /** Specifies the position of the scroll bar in the chart. */ + position?: string; + }; + } + /** A widget used to embed charts into HTML JS applications. */ + export class dxChart extends BaseChart { + constructor(element: JQuery, options?: dxChartOptions); + constructor(element: Element, options?: dxChartOptions); + /** Returns an array of all series in the chart. */ + getAllSeries(): Array; + /** Gets a series within the chart's series collection by the specified name (see the name option). */ + getSeriesByName(seriesName: string): ChartSeries; + /** Gets a series within the chart's series collection by its position number. */ + getSeriesByPos(seriesIndex: number): ChartSeries; + /** Sets the specified start and end values for the chart's argument axis. */ + zoomArgument(startValue: any, endValue: any): void; + } + interface CrosshaierWithLabel extends viz.core.DashedBorderWithOpacity { + /** Configures the label that belongs to the horizontal crosshair line. */ + label?: { + /** Specifies a color for the background of the label that belongs to the horizontal crosshair line. */ + backgroundColor?: string; + /** Specifies whether the label of the horizontal crosshair line is visible or not. */ + visible?: boolean; + /** Specifies font options for the text of the label that belongs to the horizontal crosshair line. */ + font?: viz.core.Font; + } + } + export interface PolarChartTooltip extends BaseChartTooltip { + /** Specifies the kind of information to display in a tooltip. */ + shared?: boolean; + } + export interface dxPolarChartOptions extends AdvancedOptions { + /** Specifies a value indicating whether all bars in a series must have the same angle, or may have different angles if any points in other series are missing. */ + equalBarWidth?: boolean; + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + width?: number; + height?: number; + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Indicates whether or not to display a "spider web". */ + useSpiderWeb?: boolean; + /** Specifies argument axis options for the dxPolarChart widget. */ + argumentAxis?: PolarArgumentAxis; + /** An object defining the configuration options that are common for all axes of the dxPolarChart widget. */ + commonAxisSettings?: PolarCommonAxisSettings; + /** An object defining the configuration options that are common for all series of the dxPolarChart widget. */ + commonSeriesSettings?: CommonPolarSeriesSettings; + /** Specifies the options of a chart's legend. */ + legend?: AdvancedLegend; + /** Specifies options for dxPolarChart widget series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: PolarSeriesTemplate; + /** Specifies tooltip options. */ + tooltip?: PolarChartTooltip; + /** Specifies value axis options for the dxPolarChart widget. */ + valueAxis?: PolarValueAxis; + } + /** A chart widget displaying data in a polar coordinate system. */ + export class dxPolarChart extends BaseChart { + constructor(element: JQuery, options?: dxPolarChartOptions); + constructor(element: Element, options?: dxPolarChartOptions); + /** Returns an array of all series in the chart. */ + getAllSeries(): Array; + /** Gets a series within the chart's series collection by the specified name (see the name option). */ + getSeriesByName(seriesName: string): PolarSeries; + /** Gets a series within the chart's series collection by its position number. */ + getSeriesByPos(seriesIndex: number): PolarSeries; + } + export interface PieLegend extends core.BaseLegend { + /** Specifies what chart elements to highlight when a corresponding item in the legend is hovered over. */ + hoverMode?: string; + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ + customizeHint?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + /** Specifies a callback function that returns the text to be displayed by a legend item. */ + customizeText?: (pointInfo: { pointName: string; pointIndex: number; pointColor: string; }) => string; + } + export interface dxPieChartOptions extends BaseChartOptions { + /** Specifies adaptive layout options. */ + adaptiveLayout?: { + /** Specifies whether or not point labels can be hidden when the layout is adapting. */ + keepLabels?: boolean; + }; + /** Specifies dxPieChart legend options. */ + legend?: PieLegend; + /** Specifies options for the series of the dxPieChart widget. */ + series?: Array; + /** Specifies the diameter of the pie. */ + diameter?: number; + /** A handler for the legendClick event. */ + onLegendClick?: any; + legendClick?: any; + /** Specifies how the chart must behave when series point labels overlap. */ + resolveLabelOverlapping?: string; + } + /** A circular chart widget for HTML JS applications. */ + export class dxPieChart extends BaseChart { + constructor(element: JQuery, options?: dxPieChartOptions); + constructor(element: Element, options?: dxPieChartOptions); + /** Provides access to the dxPieChart series. */ + getSeries(): PieSeries; + } +} +declare module DevExpress.viz.core { + export interface Border { + /** Sets a border color for a selected series. */ + color?: string; + /** Sets border visibility for a selected series. */ + visible?: boolean; + /** Sets a border width for a selected series. */ + width?: number; + } + export interface DashedBorder extends Border { + /** Specifies a dash style for the border of a selected series point. */ + dashStyle?: string; + } + export interface DashedBorderWithOpacity extends DashedBorder { + /** Specifies the opacity of the tooltip's border. */ + opacity?: number; + } + export interface Font { + /** Specifies the font color for a strip label. */ + color?: string; + /** Specifies the font family for a strip label. */ + family?: string; + /** Specifies the font opacity for a strip label. */ + opacity?: number; + /** Specifies the font size for a strip label. */ + size?: any; + /** Specifies the font weight for the text displayed in strips. */ + weight?: number; + } + export interface Hatching { + /** Specifies how to apply hatching to highlight a selected series. */ + direction?: string; + /** Specifies the opacity of hatching lines. */ + opacity?: number; + /** Specifies the distance between hatching lines in pixels. */ + step?: number; + /** Specifies the width of hatching lines in pixels. */ + width?: number; + } + export interface Margins { + /** Specifies the legend's bottom margin in pixels. */ + bottom?: number; + /** Specifies the legend's left margin in pixels. */ + left?: number; + /** Specifies the legend's right margin in pixels. */ + right?: number; + /** Specifies the legend's bottom margin in pixels. */ + top?: number; + } + export interface Size { + /** Specifies the width of the widget. */ + width?: number; + /** Specifies the height of the widget. */ + height?: number; + } + export interface Tooltip { + /** Specifies the length of the tooltip's arrow in pixels. */ + arrowLength?: number; + /** Specifies the appearance of the tooltip's border. */ + border?: viz.core.DashedBorderWithOpacity; + /** Specifies a color for the tooltip. */ + color?: string; + customizeText?: Function; + /** Specifies text and appearance of a particular set of tooltips. */ + customizeTooltip?: (arg: Object) => { color?: string; text?: string }; + /** Specifies whether or not the tooltip is enabled. */ + enabled?: boolean; + /** Specifies font options for the text displayed by the tooltip. */ + font?: Font; + /** Specifies a format for the text displayed by the tooltip. */ + format?: string; + /** Specifies the opacity of a tooltip. */ + opacity?: number; + /** Specifies a distance from the tooltip's left/right boundaries to the inner text in pixels. */ + paddingLeftRight?: number; + /** Specifies a distance from the tooltip's top/bottom boundaries to the inner text in pixels. */ + paddingTopBottom?: number; + /** Specifies a precision for formatted values displayed by the tooltip. */ + precision?: number; + /** Specifies options of the tooltip's shadow. */ + shadow?: { + /** Specifies the blur distance of the tooltip's shadow. */ + blur?: number; + /** Specifies the color of the tooltip's shadow. */ + color?: string; + /** Specifies the horizontal offset of the tooltip's shadow relative to the tooltip in pixels. */ + offsetX?: number; + /** Specifies the vertical offset of the tooltip's shadow relative to the tooltip in pixels. */ + offsetY?: number; + /** Specifies the opacity of the tooltip's shadow. */ + opacity?: number; + }; + } + export interface Animation { + /** Determines how long animation runs. */ + duration?: number; + /** Specifies the animation easing mode. */ + easing?: string; + /** Indicates whether or not animation is enabled. */ + enabled?: boolean; + } + export interface LoadingIndicator { + /** Specifies a color for the loading indicator background. */ + backgroundColor?: string; + /** Specifies font options for the loading indicator text. */ + font?: viz.core.Font; + /** Specifies whether to show the loading indicator or not. */ + show?: boolean; + /** Specifies a text to be displayed by the loading indicator. */ + text?: string; + } + export interface LegendBorder extends viz.core.DashedBorderWithOpacity { + /** Specifies a radius for the corners of the legend border. */ + cornerRadius?: number; + } + export interface BaseLegend { + /** Specifies the color of the legend's background. */ + backgroundColor?: string; + /** Specifies legend border settings. */ + border?: viz.core.LegendBorder; + /** Specifies how many columns must be taken to arrange legend items. */ + columnCount?: number; + /** Specifies the spacing between a pair of neighboring legend columns in pixels. */ + columnItemSpacing?: number; + /** Specifies whether or not item columns in the legend have an equal width. */ + equalColumnWidth?: boolean; + /** Specifies font options for legend items. */ + font?: viz.core.Font; + /** Specifies the legend's position on the map. */ + horizontalAlignment?: string; + /** Specifies the alignment of legend items. */ + itemsAlignment?: string; + /** Specifies the position of text relative to the item marker. */ + itemTextPosition?: string; + /** Specifies the distance between the legend and the container borders in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of item markers in the legend in pixels. */ + markerSize?: number; + /** Specifies whether to arrange legend items horizontally or vertically. */ + orientation?: string; + /** Specifies the spacing between the legend left/right border and legend items in pixels. */ + paddingLeftRight?: number; + /** Specifies the spacing between the legend top/bottom border and legend items in pixels. */ + paddingTopBottom?: number; + /** Specifies how many rows must be taken to arrange legend items. */ + rowCount?: number; + /** Specifies the spacing between a pair of neighboring legend rows in pixels. */ + rowItemSpacing?: number; + /** Specifies the legend's position on the map. */ + verticalAlignment?: string; + /** Specifies whether or not the legend is visible on the map. */ + visible?: boolean; + } + export interface BaseWidgetOptions { + drawn?: (widget: Object) => void; + /** A handler for the drawn event. */ + onDrawn?: (e: { + component: BaseWidget; + element: Element; + }) => void; + incidentOccured?: (incidentInfo: { + id: string; + type: string; + args: any; + text: string; + widget: string; + version: string; + }) => void; + /** A handler for the incidentOccurred event. */ + onIncidentOccurred?: ( + component: BaseWidget, + element: Element, + target: { + id: string; + type: string; + args: any; + text: string; + widget: string; + version: string; + } + ) => void; + /** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */ + pathModified?: boolean; + /** Specifies whether or not the widget supports right-to-left representation. */ + rtlEnabled?: boolean; + } + /** This section describes options and methods that are common to all widgets. */ + export class BaseWidget extends DOMComponent { + /** Returns the widget's SVG markup. */ + svg(): string; + } +} +declare module DevExpress.viz.gauges { + export interface BaseRangeContainer { + /** Specifies a range container's background color. */ + backgroundColor?: string; + /** Specifies the offset of the range container from an invisible scale line in pixels. */ + offset?: number; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: any; + /** An array of objects representing ranges contained in the range container. */ + ranges?: Array<{ startValue: number; endValue: number; color: string }>; + /** Specifies a color of a range. */ + color?: string; + /** Specifies an end value of a range. */ + endValue?: number; + /** Specifies a start value of a range. */ + startValue?: number; + } + export interface ScaleTick { + /** Specifies the color of the scale's minor ticks. */ + color?: string; + /** Specifies an array of custom minor ticks. */ + customTickValues?: Array; + /** Specifies the length of the scale's minor ticks. */ + length?: number; + /** Indicates whether automatically calculated minor ticks are visible or not. */ + showCalculatedTicks?: boolean; + /** Specifies an interval between minor ticks. */ + tickInterval?: number; + /** Indicates whether scale minor ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's minor ticks. */ + width?: number; + } + export interface ScaleMajorTick extends ScaleTick { + /** Specifies whether or not to expand the current major tick interval if labels overlap each other. */ + useTicksAutoArrangement?: boolean; + } + export interface BaseScaleLabel { + /** Specifies whether or not scale labels should be colored similarly to their corresponding ranges in the range container. */ + useRangeColors?: boolean; + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: number; valueText: string }) => string; + /** Specifies font options for the text displayed in the scale labels of the gauge. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the scale labels. */ + precision?: number; + /** Specifies whether or not scale labels are visible on the gauge. */ + visible?: boolean; + } + export interface BaseScale { + /** Specifies the end value for the scale of the gauge. */ + endValue?: number; + /** Specifies whether or not to hide the first scale label. */ + hideFirstLabel?: boolean; + /** Specifies whether or not to hide the first major tick on the scale. */ + hideFirstTick?: boolean; + /** Specifies whether or not to hide the last scale label. */ + hideLastLabel?: boolean; + /** Specifies whether or not to hide the last major tick on the scale. */ + hideLastTick?: boolean; + /** Specifies common options for scale labels. */ + label?: BaseScaleLabel; + /** Specifies options of the gauge's major ticks. */ + majorTick?: ScaleMajorTick; + /** Specifies options of the gauge's minor ticks. */ + minorTick?: ScaleTick; + /** Specifies the start value for the scale of the gauge. */ + startValue?: number; + } + export interface BaseValueIndicator { + /** Specifies the type of subvalue indicators. */ + type?: string; + /** Specifies the background color for the indicator of the rangeBar type. */ + backgroundColor?: string; + /** Specifies the base value for the indicator of the rangeBar type. */ + baseValue?: number; + /** Specifies a color of the indicator. */ + color?: string; + /** Specifies the range bar size for an indicator of the rangeBar type. */ + size?: number; + text?: { + /** Specifies a callback function that returns the text to be displayed in an indicator. */ + customizeText?: (indicatedValue: { value: number; valueText: string }) => string; + font?: viz.core.Font; + /** Specifies a format for the text displayed in an indicator. */ + format?: string; + /** Specifies the range bar's label indent in pixels. */ + indent?: number; + /** Specifies a precision for the formatted value displayed by an indicator. */ + precision?: number; + }; + offset?: number; + length?: number; + width?: number; + /** Specifies the length of an arrow for the indicator of the textCloud type in pixels. */ + arrowLength?: number; + /** Sets the array of colors to be used for coloring subvalue indicators. */ + palette?: Array; + /** Specifies the distance between the needle and the center of a gauge for the indicator of a needle-like type. */ + indentFromCenter?: number; + /** Specifies the second color for the indicator of the twoColorNeedle type. */ + secondColor?: string; + /** Specifies the length of a twoNeedleColor type indicator tip as a percentage. */ + secondFraction?: number; + /** Specifies the spindle's diameter in pixels for the indicator of a needle-like type. */ + spindleSize?: number; + /** Specifies the inner diameter in pixels, so that the spindle has the shape of a ring. */ + spindleGapSize?: number; + /** Specifies the orientation of the rangeBar indicator on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of the rangeBar indicator on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface SharedGaugeOptions { + /** Specifies animation options. */ + animation?: viz.core.Animation; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies the size of the widget in pixels. */ + size?: viz.core.Size; + /** Specifies a subtitle for a gauge. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies a text for the subtitle. */ + text?: string; + }; + /** Specifies the name of the theme to be applied. */ + theme?: string; + /** Specifies a title for a gauge. */ + title?: { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** Specifies a title's position on the gauge. */ + position?: string; + /** Specifies a text for the title. */ + text?: string; + }; + /** Specifies options for gauge tooltips. */ + tooltip?: viz.core.Tooltip; + } + export interface BaseGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies the blank space in pixels between the widget's extreme elements and the boundaries of the area provided for the widget (see the size option). */ + margin?: viz.core.Margins; + /** Specifies options of the gauge's range container. */ + rangeContainer?: BaseRangeContainer; + /** Specifies a gauge's scale options. */ + scale?: BaseScale; + /** Specifies the appearance options of subvalue indicators. */ + subvalueIndicator?: BaseValueIndicator; + /** Specifies a set of subvalues to be designated by the subvalue indicators. */ + subvalues?: Array; + /** Specifies the main value on a gauge. */ + value?: number; + /** Specifies the appearance options of the value indicator. */ + valueIndicator?: BaseValueIndicator; + } + /** A gauge widget. */ + export class dxBaseGauge extends viz.core.BaseWidget { + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(): void; + /** Returns the main gauge value. */ + value(): number; + /** Updates a gauge value. */ + value(value: number): void; + /** Returns an array of gauge subvalues. */ + subvalues(): Array; + /** Updates gauge subvalues. */ + subvalues(subvalues: Array): void; + } + export interface LinearRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + /** Specifies the orientation of a range container on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + /** Specifies the width of the range container's start and end boundaries in the dxLinearGauge widget. */ + width?: any; + /** Specifies an end width of a range container. */ + end?: number; + /** Specifies a start width of a range container. */ + start?: number; + } + export interface LinearScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface LinearScale extends BaseScale { + /** Specifies the orientation of scale ticks on a vertically oriented dxLinearGauge widget. */ + horizontalOrientation?: string; + label?: LinearScaleLabel; + /** Specifies the orientation of scale ticks on a horizontally oriented dxLinearGauge widget. */ + verticalOrientation?: string; + } + export interface dxLinearGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxLinearGauge widget. */ + geometry?: { + /** Indicates whether to display the dxLinearGauge widget vertically or horizontally. */ + orientation?: string; + }; + /** Specifies gauge range container options. */ + rangeContainer?: LinearRangeContainer; + scale?: LinearScale; + } + /** A widget that represents a gauge with a linear scale. */ + export class dxLinearGauge extends dxBaseGauge { + constructor(element: JQuery, options?: dxLinearGaugeOptions); + constructor(element: Element, options?: dxLinearGaugeOptions); + } + export interface CircularRangeContainer extends BaseRangeContainer { + /** Specifies the orientation of the range container in the dxCircularGauge widget. */ + orientation?: string; + /** Specifies the range container's width in pixels. */ + width?: number; + } + export interface CircularScaleLabel extends BaseScaleLabel { + /** Specifies the spacing between scale labels and ticks. */ + indentFromTick?: number; + } + export interface CircularScale extends BaseScale { + label?: CircularScaleLabel; + /** Specifies the orientation of scale ticks. */ + orientation?: string; + } + export interface dxCircularGaugeOptions extends BaseGaugeOptions { + /** Specifies the options required to set the geometry of the dxCircularGauge widget. */ + geometry?: { + /** Specifies the end angle of the circular gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the circular gauge's arc. */ + startAngle?: number; + }; + /** Specifies gauge range container options. */ + rangeContainer?: CircularRangeContainer; + scale?: CircularScale; + } + /** A widget that represents a gauge with a circular scale. */ + export class dxCircularGauge extends dxBaseGauge { + constructor(element: JQuery, options?: dxCircularGaugeOptions); + constructor(element: Element, options?: dxCircularGaugeOptions); + } + export interface dxBarGaugeOptions extends viz.core.BaseWidgetOptions, SharedGaugeOptions { + /** Specifies a color for the remaining segment of the bar's track. */ + backgroundColor?: string; + /** Specifies a distance between bars in pixels. */ + barSpacing?: number; + /** Specifies a base value for bars. */ + baseValue?: number; + /** Specifies an end value for the gauge's invisible scale. */ + endValue?: number; + /** Defines the shape of the gauge's arc. */ + geometry?: { + /** Specifies the end angle of the bar gauge's arc. */ + endAngle?: number; + /** Specifies the start angle of the bar gauge's arc. */ + startAngle?: number; + }; + /** Specifies the options of the labels that accompany gauge bars. */ + label?: { + /** Specifies a color for the label connector text. */ + connectorColor?: string; + /** Specifies the width of the label connector in pixels. */ + connectorWidth?: number; + /** Specifies a callback function that returns a text for labels. */ + customizeText?: (barValue: { value: number; valueText: string }) => string; + /** Specifies font options for bar labels. */ + font?: viz.core.Font; + /** Specifies a format for bar labels. */ + format?: string; + /** Specifies the distance between the upper bar and bar labels in pixels. */ + indent?: number; + /** Specifies a precision for the formatted value displayed by labels. */ + precision?: number; + /** Specifies whether bar labels appear on a gauge or not. */ + visible?: boolean; + }; + /** Sets the name of the palette or an array of colors to be used for coloring the gauge range container. */ + palette?: string; + /** Defines the radius of the bar that is closest to the center relatively to the radius of the topmost bar. */ + relativeInnerRadius?: number; + /** Specifies a start value for the gauge's invisible scale. */ + startValue?: number; + /** Specifies the array of values to be indicated on a bar gauge. */ + values?: Array; + } + /** A circular bar widget. */ + export class dxBarGauge extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxBarGaugeOptions); + constructor(element: Element, options?: dxBarGaugeOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws the widget. */ + render(): void; + /** Returns an array of gauge values. */ + values(): Array; + /** Updates the values displayed by a gauge. */ + values(values: Array): void; + } +} +declare module DevExpress.viz.map { + /** This section describes the fields and methods that can be used in code to manipulate the Area object. */ + export interface Area { + /** Contains the element type. */ + type: string; + /** Return the value of an attribute. */ + attribute(name: string): any; + /** Provides information about the selection state of an area. */ + selected(): boolean; + /** Sets a new selection state for an area. */ + selected(state: boolean): void; + } + /** This section describes the fields and methods that can be used in code to manipulate the Markers object. */ + export interface Marker { + /** Contains the descriptive text accompanying the map marker. */ + text: string; + /** Contains the type of the element. */ + type: string; + /** Contains the URL of an image map marker. */ + url: string; + /** Contains the value of a bubble map marker. */ + value: number; + /** Contains the values of a pie map marker. */ + values: Array; + /** Returns the value of an attribute. */ + attribute(name: string): any; + /** Returns the coordinates of a specific marker. */ + coordinates(): Array; + /** Provides information about the selection state of a marker. */ + selected(): boolean; + /** Sets a new selection state for a marker. */ + selected(state: boolean): void; + } + export interface AreaSettings { + /** Specifies the width of the area border in pixels. */ + borderWidth?: number; + /** Specifies a color for the area border. */ + borderColor?: string; + click?: any; + /** Specifies a color for an area. */ + color?: string; + /** Specifies the function that customizes each area individually. */ + customize?: (areaInfo: Area) => AreaSettings; + /** Specifies a color for the area border when the area is hovered over. */ + hoveredBorderColor?: string; + /** Specifies the pixel-measured width of the area border when the area is hovered over. */ + hoveredBorderWidth?: number; + /** Specifies a color for an area when this area is hovered over. */ + hoveredColor?: string; + /** Specifies whether or not to change the appearance of an area when it is hovered over. */ + hoverEnabled?: boolean; + /** Configures area labels. */ + label?: { + /** Specifies the data field that provides data for area labels. */ + dataField?: string; + /** Enables area labels. */ + enabled?: boolean; + /** Specifies font options for area labels. */ + font?: viz.core.Font; + }; + /** Specifies the name of the palette or a custom range of colors to be used for coloring a map. */ + palette?: any; + /** Specifies the number of colors in a palette. */ + paletteSize?: number; + /** Allows you to paint areas with similar attributes in the same color. */ + colorGroups?: Array; + /** Specifies the field that provides data to be used for coloring areas. */ + colorGroupingField?: string; + /** Specifies a color for the area border when the area is selected. */ + selectedBorderColor?: string; + /** Specifies a color for an area when this area is selected. */ + selectedColor?: string; + /** Specifies the pixel-measured width of the area border when the area is selected. */ + selectedBorderWidth?: number; + selectionChanged?: (area: Area) => void; + /** Specifies whether single or multiple areas can be selected on a vector map. */ + selectionMode?: string; + } + export interface MarkerSettings { + /** Specifies a color for the marker border. */ + borderColor?: string; + /** Specifies the width of the marker border in pixels. */ + borderWidth?: number; + click?: any; + /** Specifies a color for a marker of the dot or bubble type. */ + color?: string; + /** Specifies the function that customizes each marker individually. */ + customize?: (markerInfo: Marker) => MarkerSettings; + font?: Object; + /** Specifies the pixel-measured width of the marker border when the marker is hovered over. */ + hoveredBorderWidth?: number; + /** Specifies a color for the marker border when the marker is hovered over. */ + hoveredBorderColor?: string; + /** Specifies a color for a marker of the dot or bubble type when this marker is hovered over. */ + hoveredColor?: string; + /** Specifies whether or not to change the appearance of a marker when it is hovered over. */ + hoverEnabled?: boolean; + /** Specifies marker label options. */ + label?: { + /** Enables marker labels. */ + enabled?: boolean; + /** Specifies font options for marker labels. */ + font?: viz.core.Font; + }; + /** Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if you use markers of the bubble type. */ + maxSize?: number; + /** Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if you use markers of the bubble type. */ + minSize?: number; + /** Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. */ + opacity?: number; + /** Specifies the pixel-measured width of the marker border when the marker is selected. */ + selectedBorderWidth?: number; + /** Specifies a color for the marker border when the marker is selected. */ + selectedBorderColor?: string; + /** Specifies a color for a marker of the dot or bubble type when this marker is selected. */ + selectedColor?: string; + selectionChanged?: (marker: Marker) => void; + /** Specifies whether a single or multiple markers can be selected on a vector map. */ + selectionMode?: string; + /** Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. */ + size?: number; + /** Specifies the type of markers to be used on the map. */ + type?: string; + /** Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. */ + palette?: any; + /** Allows you to paint markers with similar attributes in the same color. */ + colorGroups?: Array; + /** Specifies the field that provides data to be used for coloring markers. */ + colorGroupingField?: string; + /** Allows you to display bubbles with similar attributes in the same size. */ + sizeGroups?: Array; + /** Specifies the field that provides data to be used for sizing bubble markers. */ + sizeGroupingField?: string; + } + export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions { + /** An object specifying options for the map areas. */ + areaSettings?: AreaSettings; + /** Specifies the options for the map background. */ + background?: { + /** Specifies a color for the background border. */ + borderColor?: string; + /** Specifies a color for the background. */ + color?: string; + }; + /** Specifies the positioning of a map in geographical coordinates. */ + bounds?: Array; + /** Specifies the options of the control bar. */ + controlBar?: { + /** Specifies a color for the outline of the control bar elements. */ + borderColor?: string; + /** Specifies a color for the inner area of the control bar elements. */ + color?: string; + /** Specifies whether or not to display the control bar. */ + enabled?: boolean; + /** Specifies the margin of the control bar in pixels. */ + margin?: number; + /** Specifies the position of the control bar. */ + horizontalAlignment?: string; + /** Specifies the position of the control bar. */ + verticalAlignment?: string; + }; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies a data source for the map area. */ + mapData?: any; + /** Specifies a data source for the map markers. */ + markers?: any; + /** An object specifying options for the map markers. */ + markerSettings?: MarkerSettings; + /** Specifies the size of the dxVectorMap widget. */ + size?: viz.core.Size; + /** Specifies the name of the theme to be applied. */ + theme?: Object; + /** Specifies tooltip options. */ + tooltip?: viz.core.Tooltip; + /** Configures map legends. */ + legends?: Array; + /** Specifies whether or not the map should respond when a user rolls the mouse wheel. */ + wheelEnabled?: boolean; + /** Specifies whether the map should respond to touch gestures. */ + touchEnabled?: boolean; + /** Disables the zooming capability. */ + zoomingEnabled?: boolean; + /** Specifies the geographical coordinates of the center for a map. */ + center?: Array; + centerChanged?: (center: Array) => void; + /** A handler for the centerChanged event. */ + onCenterChanged?: (e: { + center: Array; + component: dxVectorMap; + element: Element; + }) => void; + /** Specifies a number that is used to zoom a map initially. */ + zoomFactor?: number; + zoomFactorChanged?: (zoomFactor: number) => void; + /** A handler for the zoomFactorChanged event. */ + onZoomFactorChanged?: (e: { + zoomFactor: number; + component: dxVectorMap; + element: Element; + }) => void; + click?: any; + /** A handler for the click event. */ + onClick?: any; + /** A handler for the areaClick event. */ + onAreaClick?: any; + /** A handler for the areaSelectionChanged event. */ + onAreaSelectionChanged?: (e: { + target: Area; + component: dxVectorMap; + element: Element; + }) => void; + /** A handler for the markerClick event. */ + onMarkerClick?: any; + /** A handler for the markerSelectionChanged event. */ + onMarkerSelectionChanged?: (e: { + target: Marker; + component: dxVectorMap; + element: Element; + }) => void; + /** Disables the panning capability. */ + panningEnabled?: boolean; + } + export interface Legend extends viz.core.BaseLegend { + /** Specifies text for legend items. */ + customizeText?: (itemInfo: { start: number; end: number; index: number; color: string; size: number; }) => string; + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the text of a legend item. */ + customizeHint?: (itemInfo: { start: number; end: number; index: number; color: string; size: number }) => string; + /** Specifies the source of data for the legend. */ + source?: string; + } + /** A vector map widget. */ + export class dxVectorMap extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxVectorMapOptions); + constructor(element: Element, options?: dxVectorMapOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(): void; + /** Gets the current coordinates of the map center. */ + center(): Array; + /** Sets the coordinates of the map center. */ + center(centerCoordinates: Array): void; + /** Deselects all the selected areas on a map. The areas are displayed in their initial style after. */ + clearAreaSelection(): void; + /** Deselects all the selected markers on a map. The markers are displayed in their initial style after. */ + clearMarkerSelection(): void; + /** Deselects all the selected area and markers on a map at once. The areas and markers are displayed in their initial style after. */ + clearSelection(): void; + /** Converts client area coordinates into map coordinates. */ + convertCoordinates(x: number, y: number): Array; + /** Returns an array with all the map areas. */ + getAreas(): Array; + /** Returns an array with all the map markers. */ + getMarkers(): Array; + /** Gets the current coordinates of the map viewport. */ + viewport(): Array; + /** Sets the coordinates of the map viewport. */ + viewport(viewportCoordinates: Array): void; + /** Gets the current value of the map zoom factor. */ + zoomFactor(): number; + /** Sets the value of the map zoom factor. */ + zoomFactor(zoomFactor: number): void; + } +} +declare module DevExpress.viz.rangeSelector { + export interface dxRangeSelectorOptions extends viz.core.BaseWidgetOptions { + /** Specifies the options for the range selector's background. */ + background?: { + /** Specifies the background color for the dxRangeSelector. */ + color?: string; + /** Specifies image options. */ + image?: { + /** Specifies a location for the image in the background of a range selector. */ + location?: string; + /** Specifies the image's URL. */ + url?: string; + }; + /** Indicates whether or not the background (background color and/or image) is visible. */ + visible?: boolean; + }; + /** Specifies the dxRangeSelector's behavior options. */ + behavior?: { + /** Indicates whether or not you can swap sliders. */ + allowSlidersSwap?: boolean; + /** +Indicates whether or not animation is enabled. + */ + animationEnabled?: boolean; + /** Specifies when to call the onSelectedRangeChanged function. */ + callSelectedRangeChanged?: string; + /** Indicates whether or not an end user can specify the range using a mouse, without the use of sliders. */ + manualRangeSelectionEnabled?: boolean; + /** Indicates whether or not an end user can shift the selected range to the required location on a scale by clicking. */ + moveSelectedRangeByClick?: boolean; + /** Indicates whether to snap a slider to ticks. */ + snapToTicks?: boolean; + }; + /** Specifies the options required to display a chart as the range selector's background. */ + chart?: { + /** Specifies a coefficient for determining an indent from the bottom background boundary to the lowest chart point. */ + bottomIndent?: number; + /** An object defining the common configuration options for the chart’s series. */ + commonSeriesSettings?: viz.charts.CommonSeriesSettings; + /** An object providing options for managing data from a data source. */ + dataPrepareSettings?: { + /** Specifies whether or not to validate values from a data source. */ + checkTypeForAllData?: boolean; + /** Specifies whether or not to convert the values from a data source into the data type of an axis. */ + convertToAxisDataType?: boolean; + /** Specifies how to sort series points. */ + sortingMethod?: any; + }; + /** Specifies a value indicating whether all bars in a series must have the same width, or may have different widths if any points in other series are missing. */ + equalBarWidth?: any; + /** An object defining the chart’s series. */ + series?: Array; + /** Defines options for the series template. */ + seriesTemplate?: viz.charts.SeriesTemplate; + /** Specifies a coefficient for determining an indent from the background's top boundary to the topmost chart point. */ + topIndent?: number; + /** Specifies whether or not to filter the series points depending on their quantity. */ + useAggregation?: boolean; + /** Specifies options for the chart's value axis. */ + valueAxis?: { + /** Indicates whether or not the chart's value axis must be inverted. */ + inverted?: boolean; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic value axis. */ + logarithmBase?: number; + /** Specifies the maximum value of the chart's value axis. */ + max?: number; + /** Specifies the minimum value of the chart's value axis. */ + min?: number; + /** Specifies the type of the value axis. */ + type?: string; + /** Specifies the desired type of axis values. */ + valueType?: string; + }; + }; + /** Specifies the color of the parent page element. */ + containerBackgroundColor?: string; + /** Specifies a data source for the scale values and for the chart at the background. */ + dataSource?: any; + /** Specifies the data source field that provides data for the scale. */ + dataSourceField?: string; + /** Specifies the appearance of the loading indicator. */ + loadingIndicator?: viz.core.LoadingIndicator; + /** Specifies the blank space in pixels between the dxRangeSelector widget's extreme elements and the boundaries of the area provided for the widget (see size). */ + margin?: viz.core.Margins; + /** Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. */ + redrawOnResize?: boolean; + /** Specifies options of the range selector's scale. */ + scale?: { + /** Specifies the scale's end value. */ + endValue?: any; + /** Specifies common options for scale labels. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale labels. */ + customizeText?: (scaleValue: { value: any; valueText: string; }) => string; + /** Specifies font options for the text displayed in the range selector's scale labels. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in scale labels. */ + format?: string; + /** Specifies a precision for the formatted value displayed in the scale labels. */ + precision?: number; + /** Specifies a spacing between scale labels and the background bottom edge. */ + topIndent?: number; + /** Specifies whether or not the scale's labels are visible. */ + visible?: boolean; + }; + /** Specifies the value to be raised to a power when generating ticks for a logarithmic scale. */ + logarithmBase?: number; + /** Specifies an interval between major ticks. */ + majorTickInterval?: any; + /** Specifies options for the date-time scale's markers. */ + marker?: { + /** Defines the options that can be set for the text that is displayed by the scale markers. */ + label?: { + /** Specifies a callback function that returns the text to be displayed in scale markers. */ + customizeText?: (markerValue: { value: any; valueText: string }) => string; + /** Specifies a format for the text displayed in scale markers. */ + format?: string; + }; + /** Specifies the height of the marker's separator. */ + separatorHeight?: number; + /** Specifies the space between the marker label and the marker separator. */ + textLeftIndent?: number; + /** Specifies the space between the marker's label and the top edge of the marker's separator. */ + textTopIndent?: number; + /** Specified the indent between the marker and the scale lables. */ + topIndent?: number; + /** Indicates whether scale markers are visible. */ + visible?: boolean; + }; + /** Specifies the maximum range that can be selected. */ + maxRange?: any; + /** Specifies the number of minor ticks between neighboring major ticks. */ + minorTickCount?: number; + /** +Specifies an interval between minor ticks. + */ + minorTickInterval?: any; + /** Specifies the minimum range that can be selected. */ + minRange?: any; + /** Specifies the height of the space reserved for the scale in pixels. */ + placeholderHeight?: number; + /** Indicates whether or not to set ticks of a date-time scale at the beginning of each date-time interval. */ + setTicksAtUnitBeginning?: boolean; + /** Specifies whether or not to show ticks for the boundary scale values, when neither major ticks nor minor ticks are created for these values. */ + showCustomBoundaryTicks?: boolean; + /** Indicates whether or not to show minor ticks on the scale. */ + showMinorTicks?: boolean; + /** Specifies the scale's start value. */ + startValue?: any; + /** Specifies options defining the appearance of scale ticks. */ + tick?: { + /** Specifies the color of scale ticks (both major and minor ticks). */ + color?: string; + /** Specifies the opacity of scale ticks (both major and minor ticks). */ + opacity?: number; + /** Specifies the width of the scale's ticks (both major and minor ticks). */ + width?: number; + }; + /** Specifies the type of the scale. */ + type?: string; + /** Specifies whether or not to expand the current tick interval if labels overlap each other. */ + useTicksAutoArrangement?: boolean; + /** Specifies the type of values on the scale. */ + valueType?: string; + /** Specifies the order of arguments on a discrete scale. */ + categories?: Array; + }; + /** Specifies the range to be selected when displaying the dxRangeSelector. */ + selectedRange?: { + /** Specifies the start value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + startValue?: any; + /** Specifies the end value of the range to be selected when displaying the dxRangeSelector widget on a page. */ + endValue?: any; + }; + selectedRangeChanged?: (selectedRange: { startValue: any; endValue: any; }) => void; + /** A handler for the selectedRangeChanged event. */ + onSelectedRangeChanged?: (e: { + startValue: any; + endValue: any; + component: dxRangeSelector; + element: Element; + }) => void; + /** Specifies the options of the range selector's shutters. */ + shutter?: { + /** Specifies shutter color. */ + color?: string; + /** Specifies the opacity of the color of shutters. */ + opacity?: number; + }; + /** Specifies in pixels the size of the dxRangeSelector widget. */ + size?: viz.core.Size; + /** Specifies the appearance of the range selector's slider handles. */ + sliderHandle?: { + /** Specifies the color of the slider handles. */ + color?: string; + /** Specifies the opacity of the slider handles. */ + opacity?: number; + /** Specifies the width of the slider handles. */ + width?: number; + }; + /** Defines the options of the range selector slider markers. */ + sliderMarker?: { + /** Specifies the color of the slider markers. */ + color?: string; + /** Specifies a callback function that returns the text to be displayed by slider markers. */ + customizeText?: (scaleValue: { value: any; valueText: any; }) => string; + /** Specifies font options for the text displayed by the range selector slider markers. */ + font?: viz.core.Font; + /** Specifies a format for the text displayed in slider markers. */ + format?: string; + /** Specifies the color used for the slider marker text when the currently selected range does not match the minRange and maxRange values. */ + invalidRangeColor?: string; + /** Specifies the empty space between the marker's border and the marker’s text. */ + padding?: number; + /** Specifies in pixels the height and width of the space reserved for the range selector slider markers. */ + placeholderSize?: { + /** Specifies the height of the placeholder for the left and right slider markers. */ + height?: number; + /** Specifies the width of the placeholder for the left and right slider markers. */ + width?: { + /** Specifies the width of the left slider marker's placeholder. */ + left?: number; + /** Specifies the width of the right slider marker's placeholder. */ + right?: number; + }; + }; + /** Specifies a precision for the formatted value displayed in slider markers. */ + precision?: number; + /** Indicates whether or not the slider markers are visible. */ + visible?: boolean; + }; + /** Sets the name of the theme to be used by the range selector. */ + theme?: string; + } + /** A widget that allows end users to select a range of values on a scale. */ + export class dxRangeSelector extends viz.core.BaseWidget { + constructor(element: JQuery, options?: dxRangeSelectorOptions); + constructor(element: Element, options?: dxRangeSelectorOptions); + /** Displays the loading indicator. */ + showLoadingIndicator(): void; + /** Conceals the loading indicator. */ + hideLoadingIndicator(): void; + /** Redraws a widget. */ + render(skipChartAnimation?: boolean): void; + /** Returns the currently selected range. */ + getSelectedRange(): { startValue: any; endValue: any; }; + /** Sets a specified range. */ + setSelectedRange(selectedRange: { startValue: any; endValue: any; }): void; + } +} +declare module DevExpress.viz.sparklines { + export interface SparklineTooltip extends viz.core.Tooltip { + /** Specifies how a tooltip is horizontally aligned relative to the graph. */ + horizontalAlignment?: string; + /** Specifies how a tooltip is vertically aligned relative to the graph. */ + verticalAlignment?: string; + } + export interface BaseSparklineOptions extends viz.core.BaseWidgetOptions { + /** Specifies the blank space between the widget's extreme elements and the boundaries of the area provided for the widget in pixels. */ + margin?: viz.core.Margins; + /** Specifies the size of the widget. */ + size?: viz.core.Size; + /** Specifies the name of the theme to be applied. */ + theme?: string; + /** Specifies tooltip options. */ + tooltip?: SparklineTooltip; + } + /** Overridden by descriptions for particular widgets. */ + export class BaseSparkline extends viz.core.BaseWidget { + /** Redraws a widget. */ + render(): void; + } + export interface dxBulletOptions extends BaseSparkline { + /** Specifies a color for the bullet bar. */ + color?: string; + /** Specifies an end value for the invisible scale. */ + endScaleValue?: number; + /** Specifies whether or not to show the target line. */ + showTarget?: boolean; + /** Specifies whether or not to show the line indicating zero on the invisible scale. */ + showZeroLevel?: boolean; + /** Specifies a start value for the invisible scale. */ + startScaleValue?: number; + /** Specifies the value indicated by the target line. */ + target?: number; + /** Specifies a color for both the target and zero level lines. */ + targetColor?: string; + /** Specifies the width of the target line. */ + targetWidth?: number; + /** Specifies the primary value indicated by the bullet bar. */ + value?: number; + } + /** A bullet graph widget. */ + export class dxBullet extends BaseSparkline { + constructor(element: JQuery, options?: dxBulletOptions); + constructor(element: Element, options?: dxBulletOptions); + } + export interface dxSparklineOptions extends BaseSparklineOptions { + /** Specifies the data source field that provides arguments for a sparkline. */ + argumentField?: string; + /** Sets a color for the bars indicating negative values. Available for a sparkline of the bar type only. */ + barNegativeColor?: string; + /** Sets a color for the bars indicating positive values. Available for a sparkline of the bar type only. */ + barPositiveColor?: string; + /** Specifies a data source for the sparkline. */ + dataSource?: Array; + /** Sets a color for the boundary of both the first and last points on a sparkline. */ + firstLastColor?: string; + /** Specifies whether a sparkline ignores null data points or not. */ + ignoreEmptyPoints?: boolean; + /** Sets a color for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineColor?: string; + /** Specifies a width for a line on a sparkline. Available for the sparklines of the line- and area-like types. */ + lineWidth?: number; + /** Sets a color for the bars indicating the values that are less than the winloss threshold. Available for a sparkline of the winloss type only. */ + lossColor?: string; + /** Sets a color for the boundary of the maximum point on a sparkline. */ + maxColor?: string; + /** Sets a color for the boundary of the minimum point on a sparkline. */ + minColor?: string; + /** Sets a color for points on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointColor?: string; + /** Specifies the diameter of sparkline points in pixels. Available for the sparklines of line- and area-like types. */ + pointSize?: number; + /** Specifies a symbol to use as a point marker on a sparkline. Available for the sparklines of the line- and area-like types. */ + pointSymbol?: string; + /** Specifies whether or not to indicate both the first and last values on a sparkline. */ + showFirstLast?: boolean; + /** Specifies whether or not to indicate both the minimum and maximum values on a sparkline. */ + showMinMax?: boolean; + /** Determines the type of a sparkline. */ + type?: string; + /** Specifies the data source field that provides values for a sparkline. */ + valueField?: string; + /** Sets a color for the bars indicating the values greater than a winloss threshold. Available for a sparkline of the winloss type only. */ + winColor?: string; + /** Specifies a value that serves as a threshold for the sparkline of the winloss type. */ + winlossThreshold?: number; + } + /** A sparkline widget. */ + export class dxSparkline extends BaseSparkline { + constructor(element: JQuery, options?: dxSparklineOptions); + constructor(element: Element, options?: dxSparklineOptions); + } +} +interface JQuery { + dxProgressBar(): JQuery; + dxProgressBar(options: "instance"): DevExpress.ui.dxProgressBar; + dxProgressBar(options: string): any; + dxProgressBar(options: string, ...params: any[]): any; + dxProgressBar(options: DevExpress.ui.dxProgressBarOptions): JQuery; + dxSlider(): JQuery; + dxSlider(options: "instance"): DevExpress.ui.dxSlider; + dxSlider(options: string): any; + dxSlider(options: string, ...params: any[]): any; + dxSlider(options: DevExpress.ui.dxSliderOptions): JQuery; + dxRangeSlider(): JQuery; + dxRangeSlider(options: "instance"): DevExpress.ui.dxRangeSlider; + dxRangeSlider(options: string): any; + dxRangeSlider(options: string, ...params: any[]): any; + dxRangeSlider(options: DevExpress.ui.dxRangeSliderOptions): JQuery; + dxFileUploader(): JQuery; + dxFileUploader(options: "instance"): DevExpress.ui.dxFileUploader; + dxFileUploader(options: string): any; + dxFileUploader(options: string, ...params: any[]): any; + dxFileUploader(options: DevExpress.ui.dxFileUploaderOptions): JQuery; + dxValidator(): JQuery; + dxValidator(options: "instance"): DevExpress.ui.dxValidator; + dxValidator(options: string): any; + dxValidator(options: string, ...params: any[]): any; + dxValidationGroup(): JQuery; + dxValidationGroup(options: "instance"): DevExpress.ui.dxValidationGroup; + dxValidationGroup(options: string): any; + dxValidationGroup(options: string, ...params: any[]): any; + dxValidationSummary(): JQuery; + dxValidationSummary(options: "instance"): DevExpress.ui.dxValidationSummary; + dxValidationSummary(options: string): any; + dxValidationSummary(options: string, ...params: any[]): any; + dxTooltip(): JQuery; + dxTooltip(options: "instance"): DevExpress.ui.dxTooltip; + dxTooltip(options: string): any; + dxTooltip(options: string, ...params: any[]): any; + dxTooltip(options: DevExpress.ui.dxTooltipOptions): JQuery; + dxDropDownList(): JQuery; + dxDropDownList(options: "instance"): DevExpress.ui.dxDropDownList; + dxDropDownList(options: string): any; + dxDropDownList(options: string, ...params: any[]): any; + dxDropDownList(options: DevExpress.ui.dxDropDownListOptions): JQuery; + dxToolbar(): JQuery; + dxToolbar(options: "instance"): DevExpress.ui.dxToolbar; + dxToolbar(options: string): any; + dxToolbar(options: string, ...params: any[]): any; + dxToolbar(options: DevExpress.ui.dxToolbarOptions): JQuery; + dxToast(): JQuery; + dxToast(options: "instance"): DevExpress.ui.dxToast; + dxToast(options: string): any; + dxToast(options: string, ...params: any[]): any; + dxToast(options: DevExpress.ui.dxToastOptions): JQuery; + dxTextEditor(): JQuery; + dxTextEditor(options: "instance"): DevExpress.ui.dxTextEditor; + dxTextEditor(options: string): any; + dxTextEditor(options: string, ...params: any[]): any; + dxTextEditor(options: DevExpress.ui.dxTextEditorOptions): JQuery; + dxTextBox(): JQuery; + dxTextBox(options: "instance"): DevExpress.ui.dxTextBox; + dxTextBox(options: string): any; + dxTextBox(options: string, ...params: any[]): any; + dxTextBox(options: DevExpress.ui.dxTextBoxOptions): JQuery; + dxTextArea(): JQuery; + dxTextArea(options: "instance"): DevExpress.ui.dxTextArea; + dxTextArea(options: string): any; + dxTextArea(options: string, ...params: any[]): any; + dxTextArea(options: DevExpress.ui.dxTextAreaOptions): JQuery; + dxTabs(): JQuery; + dxTabs(options: "instance"): DevExpress.ui.dxTabs; + dxTabs(options: string): any; + dxTabs(options: string, ...params: any[]): any; + dxTabs(options: DevExpress.ui.dxTabsOptions): JQuery; + dxTabPanel(): JQuery; + dxTabPanel(options: "instance"): DevExpress.ui.dxTabPanel; + dxTabPanel(options: string): any; + dxTabPanel(options: string, ...params: any[]): any; + dxTabPanel(options: DevExpress.ui.dxTabPanelOptions): JQuery; + dxSelectBox(): JQuery; + dxSelectBox(options: "instance"): DevExpress.ui.dxSelectBox; + dxSelectBox(options: string): any; + dxSelectBox(options: string, ...params: any[]): any; + dxSelectBox(options: DevExpress.ui.dxSelectBoxOptions): JQuery; + dxScrollView(): JQuery; + dxScrollView(options: "instance"): DevExpress.ui.dxScrollView; + dxScrollView(options: string): any; + dxScrollView(options: string, ...params: any[]): any; + dxScrollView(options: DevExpress.ui.dxScrollViewOptions): JQuery; + dxScrollable(): JQuery; + dxScrollable(options: "instance"): DevExpress.ui.dxScrollable; + dxScrollable(options: string): any; + dxScrollable(options: string, ...params: any[]): any; + dxScrollable(options: DevExpress.ui.dxScrollableOptions): JQuery; + dxRadioGroup(): JQuery; + dxRadioGroup(options: "instance"): DevExpress.ui.dxRadioGroup; + dxRadioGroup(options: string): any; + dxRadioGroup(options: string, ...params: any[]): any; + dxRadioGroup(options: DevExpress.ui.dxRadioGroupOptions): JQuery; + dxPopup(): JQuery; + dxPopup(options: "instance"): DevExpress.ui.dxPopup; + dxPopup(options: string): any; + dxPopup(options: string, ...params: any[]): any; + dxPopup(options: DevExpress.ui.dxPopupOptions): JQuery; + dxPopover(): JQuery; + dxPopover(options: "instance"): DevExpress.ui.dxPopover; + dxPopover(options: string): any; + dxPopover(options: string, ...params: any[]): any; + dxPopover(options: DevExpress.ui.dxPopoverOptions): JQuery; + dxOverlay(): JQuery; + dxOverlay(options: "instance"): DevExpress.ui.dxOverlay; + dxOverlay(options: string): any; + dxOverlay(options: string, ...params: any[]): any; + dxOverlay(options: DevExpress.ui.dxOverlayOptions): JQuery; + dxNumberBox(): JQuery; + dxNumberBox(options: "instance"): DevExpress.ui.dxNumberBox; + dxNumberBox(options: string): any; + dxNumberBox(options: string, ...params: any[]): any; + dxNumberBox(options: DevExpress.ui.dxNumberBoxOptions): JQuery; + dxNavBar(): JQuery; + dxNavBar(options: "instance"): DevExpress.ui.dxNavBar; + dxNavBar(options: string): any; + dxNavBar(options: string, ...params: any[]): any; + dxNavBar(options: DevExpress.ui.dxNavBarOptions): JQuery; + dxMultiView(): JQuery; + dxMultiView(options: "instance"): DevExpress.ui.dxMultiView; + dxMultiView(options: string): any; + dxMultiView(options: string, ...params: any[]): any; + dxMultiView(options: DevExpress.ui.dxMultiViewOptions): JQuery; + dxMap(): JQuery; + dxMap(options: "instance"): DevExpress.ui.dxMap; + dxMap(options: string): any; + dxMap(options: string, ...params: any[]): any; + dxMap(options: DevExpress.ui.dxMapOptions): JQuery; + dxLookup(): JQuery; + dxLookup(options: "instance"): DevExpress.ui.dxLookup; + dxLookup(options: string): any; + dxLookup(options: string, ...params: any[]): any; + dxLookup(options: DevExpress.ui.dxLookupOptions): JQuery; + dxLoadPanel(): JQuery; + dxLoadPanel(options: "instance"): DevExpress.ui.dxLoadPanel; + dxLoadPanel(options: string): any; + dxLoadPanel(options: string, ...params: any[]): any; + dxLoadPanel(options: DevExpress.ui.dxLoadPanelOptions): JQuery; + dxLoadIndicator(): JQuery; + dxLoadIndicator(options: "instance"): DevExpress.ui.dxLoadIndicator; + dxLoadIndicator(options: string): any; + dxLoadIndicator(options: string, ...params: any[]): any; + dxLoadIndicator(options: DevExpress.ui.dxLoadIndicatorOptions): JQuery; + dxList(): JQuery; + dxList(options: "instance"): DevExpress.ui.dxList; + dxList(options: string): any; + dxList(options: string, ...params: any[]): any; + dxList(options: DevExpress.ui.dxListOptions): JQuery; + dxGallery(): JQuery; + dxGallery(options: "instance"): DevExpress.ui.dxGallery; + dxGallery(options: string): any; + dxGallery(options: string, ...params: any[]): any; + dxGallery(options: DevExpress.ui.dxGalleryOptions): JQuery; + dxDropDownEditor(): JQuery; + dxDropDownEditor(options: "instance"): DevExpress.ui.dxDropDownEditor; + dxDropDownEditor(options: string): any; + dxDropDownEditor(options: string, ...params: any[]): any; + dxDropDownEditor(options: DevExpress.ui.dxDropDownEditorOptions): JQuery; + dxDateBox(): JQuery; + dxDateBox(options: "instance"): DevExpress.ui.dxDateBox; + dxDateBox(options: string): any; + dxDateBox(options: string, ...params: any[]): any; + dxDateBox(options: DevExpress.ui.dxDateBoxOptions): JQuery; + dxCheckBox(): JQuery; + dxCheckBox(options: "instance"): DevExpress.ui.dxCheckBox; + dxCheckBox(options: string): any; + dxCheckBox(options: string, ...params: any[]): any; + dxCheckBox(options: DevExpress.ui.dxCheckBoxOptions): JQuery; + dxBox(): JQuery; + dxBox(options: "instance"): DevExpress.ui.dxBox; + dxBox(options: string): any; + dxBox(options: string, ...params: any[]): any; + dxBox(options: DevExpress.ui.dxBoxOptions): JQuery; + dxButton(): JQuery; + dxButton(options: "instance"): DevExpress.ui.dxButton; + dxButton(options: string): any; + dxButton(options: string, ...params: any[]): any; + dxButton(options: DevExpress.ui.dxButtonOptions): JQuery; + dxCalendar(): JQuery; + dxCalendar(options: "instance"): DevExpress.ui.dxCalendar; + dxCalendar(options: string): any; + dxCalendar(options: string, ...params: any[]): any; + dxCalendar(options: DevExpress.ui.dxCalendarOptions): JQuery; + dxAccordion(): JQuery; + dxAccordion(options: "instance"): DevExpress.ui.dxAccordion; + dxAccordion(options: string): any; + dxAccordion(options: string, ...params: any[]): any; + dxAccordion(options: DevExpress.ui.dxAccordionOptions): JQuery; + dxAutocomplete(): JQuery; + dxAutocomplete(options: "instance"): DevExpress.ui.dxAutocomplete; + dxAutocomplete(options: string): any; + dxAutocomplete(options: string, ...params: any[]): any; + dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; + dxTileView(): JQuery; + dxTileView(options: "instance"): DevExpress.ui.dxTileView; + dxTileView(options: string): any; + dxTileView(options: string, ...params: any[]): any; + dxTileView(options: DevExpress.ui.dxTileViewOptions): JQuery; + dxSwitch(): JQuery; + dxSwitch(options: "instance"): DevExpress.ui.dxSwitch; + dxSwitch(options: string): any; + dxSwitch(options: string, ...params: any[]): any; + dxSwitch(options: DevExpress.ui.dxSwitchOptions): JQuery; + dxSlideOut(): JQuery; + dxSlideOut(options: "instance"): DevExpress.ui.dxSlideOut; + dxSlideOut(options: string): any; + dxSlideOut(options: string, ...params: any[]): any; + dxSlideOut(options: DevExpress.ui.dxSlideOutOptions): JQuery; + dxPivot(): JQuery; + dxPivot(options: "instance"): DevExpress.ui.dxPivot; + dxPivot(options: string): any; + dxPivot(options: string, ...params: any[]): any; + dxPivot(options: DevExpress.ui.dxPivotOptions): JQuery; + dxPanorama(): JQuery; + dxPanorama(options: "instance"): DevExpress.ui.dxPanorama; + dxPanorama(options: string): any; + dxPanorama(options: string, ...params: any[]): any; + dxPanorama(options: DevExpress.ui.dxPanoramaOptions): JQuery; + dxActionSheet(): JQuery; + dxActionSheet(options: "instance"): DevExpress.ui.dxActionSheet; + dxActionSheet(options: string): any; + dxActionSheet(options: string, ...params: any[]): any; + dxActionSheet(options: DevExpress.ui.dxActionSheetOptions): JQuery; + dxDropDownMenu(): JQuery; + dxDropDownMenu(options: "instance"): DevExpress.ui.dxDropDownMenu; + dxDropDownMenu(options: string): any; + dxDropDownMenu(options: string, ...params: any[]): any; + dxDropDownMenu(options: DevExpress.ui.dxDropDownMenuOptions): JQuery; + dxTreeView(): JQuery; + dxTreeView(options: "instance"): DevExpress.ui.dxTreeView; + dxTreeView(options: string): any; + dxTreeView(options: string, ...params: any[]): any; + dxTreeView(options: DevExpress.ui.dxTreeViewOptions): JQuery; + dxMenuBase(): JQuery; + dxMenuBase(options: "instance"): DevExpress.ui.dxMenuBase; + dxMenuBase(options: string): any; + dxMenuBase(options: string, ...params: any[]): any; + dxMenuBase(options: DevExpress.ui.dxMenuBaseOptions): JQuery; + dxMenu(): JQuery; + dxMenu(options: "instance"): DevExpress.ui.dxMenu; + dxMenu(options: string): any; + dxMenu(options: string, ...params: any[]): any; + dxMenu(options: DevExpress.ui.dxMenuOptions): JQuery; + dxContextMenu(): JQuery; + dxContextMenu(options: "instance"): DevExpress.ui.dxContextMenu; + dxContextMenu(options: string): any; + dxContextMenu(options: string, ...params: any[]): any; + dxContextMenu(options: DevExpress.ui.dxContextMenuOptions): JQuery; + dxColorBox(): JQuery; + dxColorBox(options: "instance"): DevExpress.ui.dxColorBox; + dxColorBox(options: string): any; + dxColorBox(options: string, ...params: any[]): any; + dxColorBox(options: DevExpress.ui.dxColorBoxOptions): JQuery; + dxDataGrid(): JQuery; + dxDataGrid(options: "instance"): DevExpress.ui.dxDataGrid; + dxDataGrid(options: string): any; + dxDataGrid(options: string, ...params: any[]): any; + dxDataGrid(options: DevExpress.ui.dxDataGridOptions): JQuery; + dxChart(options?: DevExpress.viz.charts.dxChartOptions): JQuery; + dxChart(methodName: string, ...params: any[]): any; + dxChart(methodName: "instance"): DevExpress.viz.charts.dxChart; + dxPieChart(options?: DevExpress.viz.charts.dxPieChartOptions): JQuery; + dxPieChart(methodName: string, ...params: any[]): any; + dxPieChart(methodName: "instance"): DevExpress.viz.charts.dxPieChart; + dxPolarChart(options?: DevExpress.viz.charts.dxPolarChartOptions): JQuery; + dxPolarChart(methodName: string, ...params: any[]): any; + dxPolarChart(methodName: "instance"): DevExpress.viz.charts.dxPolarChart; + dxLinearGauge(options?: DevExpress.viz.gauges.dxLinearGaugeOptions): JQuery; + dxLinearGauge(methodName: string, ...params: any[]): any; + dxLinearGauge(methodName: "instance"): DevExpress.viz.gauges.dxLinearGauge; + dxCircularGauge(options?: DevExpress.viz.gauges.dxCircularGaugeOptions): JQuery; + dxCircularGauge(methodName: string, ...params: any[]): any; + dxCircularGauge(methodName: "instance"): DevExpress.viz.gauges.dxCircularGauge; + dxBarGauge(options?: DevExpress.viz.gauges.dxBarGaugeOptions): JQuery; + dxBarGauge(methodName: string, ...params: any[]): any; + dxBarGauge(methodName: "instance"): DevExpress.viz.gauges.dxBarGauge; + dxRangeSelector(options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions): JQuery; + dxRangeSelector(methodName: string, ...params: any[]): any; + dxRangeSelector(methodName: "instance"): DevExpress.viz.rangeSelector.dxRangeSelector; + dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; + dxVectorMap(methodName: string, ...params: any[]): any; + dxVectorMap(methodName: "instance"): DevExpress.viz.map.dxVectorMap; + dxBullet(options?: DevExpress.viz.sparklines.dxBulletOptions): JQuery; + dxBullet(methodName: string, ...params: any[]): any; + dxBullet(methodName: "instance"): DevExpress.viz.sparklines.dxBullet; + dxSparkline(options?: DevExpress.viz.sparklines.dxSparklineOptions): JQuery; + dxSparkline(methodName: string, ...params: any[]): any; + dxSparkline(methodName: "instance"): DevExpress.viz.sparklines.dxSparkline; +} \ No newline at end of file diff --git a/devextreme/dx.devextreme.d.ts b/devextreme/dx.devextreme.d.ts index a1d361f54..4825e80b2 100644 --- a/devextreme/dx.devextreme.d.ts +++ b/devextreme/dx.devextreme.d.ts @@ -1,11 +1,11 @@ -// Type definitions for DevExtreme 14.2.7 +// Type definitions for DevExtreme 15.1.3 // Project: http://js.devexpress.com/ // Definitions by: DevExpress Inc. // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// -declare module DevExpress { +declare module DevExpress { /** A mixin that provides a capability to fire and subscribe to events. */ export interface EventsMixin { /** Subscribes to a specified event. */ @@ -35,7 +35,7 @@ declare module DevExpress { brokenRules: any[]; validators: IValidator[]; } - export interface GroupConfig extends EventsMixin { + export interface GroupConfig extends EventsMixin { group: any; validators: IValidator[]; validate(): ValidationGroupValidationResult; @@ -56,7 +56,7 @@ declare module DevExpress { /** Validates the rules that are defined within the dxValidator objects that are registered for the specified ViewModel. */ export function validateModel(model: Object): ValidationGroupValidationResult; /** Registers all the dxValidator objects by which the fields of the specified ViewModel are extended. */ - export function registerModelForValidation(model: Object): void; + export function registerModelForValidation(model: Object) : void; } export var hardwareBackButton: JQueryCallback; /** Processes the hardware back button click. */ @@ -86,21 +86,23 @@ declare module DevExpress { } /** An object that serves as a namespace for the methods that are used to animate UI elements. */ export module fx { - /** The animation object specifies the widget animation options. */ + /** Defines animation options. */ export interface AnimationOptions { /** A function called after animation is completed. */ complete?: (element: JQuery, config: AnimationOptions) => void; /** A number specifying wait time before animation execution. */ delay?: number; + /** A number specifying the time period to wait before the animation of the next stagger item starts. */ + staggerDelay?: number; /** A number specifying the time in milliseconds spent on animation. */ duration?: number; /** A string specifying the type of an easing function used for animation. */ easing?: string; - /** Specifies the initial widget animation state. */ + /** Specifies the initial animation state. */ from?: any; /** A function called before animation is started. */ start?: (element: JQuery, config: AnimationOptions) => void; - /** Specifies the initial widget animation state. */ + /** Specifies a final animation state. */ to?: any; /** A string value specifying the animation type. */ type?: string; @@ -108,12 +110,39 @@ declare module DevExpress { direction?: string; } /** Animates the specified element. */ - export function animate(element: HTMLElement, config: Object): Object; + export function animate(element: HTMLElement, config: AnimationOptions): Object; /** Returns a value indicating whether the specified element is being animated. */ export function isAnimating(element: HTMLElement): boolean; /** Stops the animation. */ export function stop(element: HTMLElement, jumpToEnd: boolean): void; } + /** The manager that performs several specified animations at a time. */ + export class TransitionExecutor { + /** Deletes all the animations registered in the Transition Executor by using the enter(elements, animation) and leave(elements, animation) methods. */ + reset(): void; + /** Registers a set of elements that should be animated as "entering" using the specified animation configuration. */ + enter(elements: JQuery, animation: any): void; + /** Registers a set of elements that should be animated as "leaving" using the specified animation configuration. */ + leave(elements: JQuery, animation: any): void; + /** Starts all the animations registered using the enter(elements, animation) and leave(elements, animation) methods beforehand. */ + start(config: Object): JQueryPromise; + } + export class AnimationPresetCollection { + /** Resets all the changes made in the animation repository. */ + resetToDefaults(): void; + /** Deletes the specified animation or clears all the animation repository, if an animation name is not passed. */ + clear(name: string): void; + /** Adds the specified animation preset to the animation repository by the specified name. */ + registerPreset(name: string, config: any): void; + /** Applies the changes made in the animation repository. */ + applyChanges(): void; + /** Returns the configuration of the animation found in the animation repository by the specified name for the current device. */ + getPreset(name: string): void; + /** Registers predefined animations in the animation repository. */ + registerDefaultPresets(): void; + } + /** A repository of animations. */ + export var animationPresets: AnimationPresetCollection; /** An object that serves as a namespace for the methods and events specifying information on the current device. */ export module devices { /** The device object defines the device on which the application is running. */ @@ -132,12 +161,12 @@ declare module DevExpress { platform?: string; /** Indicates whether or not the device type is 'tablet'. */ tablet?: boolean; - /** Indicates whether or not the device platform is Tizen. */ - tizen?: boolean; /** Specifies an array with the major and minor versions of the device platform. */ version?: Array; /** Indicates whether or not the device platform is Windows8. */ win8?: boolean; + /** Specifies a performance grade of the current device. */ + grade?: string; } export var orientationChanged: JQueryCallback; /** Overrides actual device information to force the application to operate as if it was running on the specified device. */ @@ -167,6 +196,8 @@ declare module DevExpress { offset?: string; } export interface ComponentOptions { + /** A handler for the initialized event. */ + onInitialized?: Function; /** A handler for the optionChanged event. */ onOptionChanged?: Function; /** A handler for the disposing event. */ @@ -193,6 +224,10 @@ declare module DevExpress { export interface DOMComponentOptions extends ComponentOptions { /** Specifies whether or not the current component supports a right-to-left representation. */ rtlEnabled?: boolean; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the width of the widget. */ + width?: any; } /** A base class for all components. */ export class DOMComponent extends Component { @@ -339,17 +374,12 @@ declare module DevExpress { /** Creates the Query object for the underlying array. */ createQuery(): Query; } - interface Promise { + interface Promise { then(doneFn?: Function, failFn?: Function, progressFn?: Function): Promise; } export interface CustomStoreOptions extends StoreOptions { /** The user implementation of the byKey(key, extraOptions) method. */ byKey?: (key: any) => Promise; - /** - * User implementation of the byKey(key, extraOptions) method. - * @deprecated byKey.md - */ - lookup?: (key: any) => Promise; /** The user implementation of the insert(values) method. */ insert?: (values: Object) => Promise; /** The user implementation of the load(options) method. */ @@ -622,26 +652,19 @@ declare module DevExpress { } /** An object that serves as a namespace for DevExtreme UI widgets as well as for methods implementing UI logic in DevExtreme sites/applications. */ export module ui { - /** - * Sets parameters for the viewport meta tag. - * @deprecated Use the "DevExpress.utils.initMobileViewport" option instead. - */ - export function initViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; export interface WidgetOptions extends DOMComponentOptions { /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ activeStateEnabled?: boolean; /** A Boolean value specifying whether or not the widget can respond to user interaction. */ disabled?: boolean; - /** Specifies the height of the widget. */ - height?: any; /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ hoverStateEnabled?: boolean; /** Specifies whether or not the widget can be focused. */ focusStateEnabled?: boolean; + /** Specifies a shortcut key that sets focus on the widget element. */ + accessKey?: string; /** A Boolean value specifying whether or not the widget is visible. */ visible?: boolean; - /** Specifies the width of the widget. */ - width?: any; /** Specifies the widget tab index. */ tabIndex?: number; /** Specifies the text of the hint displayed for the widget. */ @@ -654,6 +677,8 @@ declare module DevExpress { repaint(): void; /** Sets focus on the widget. */ focus(): void; + /** Registers a handler for pressing of the specified key. */ + registerKeyHandler(key: string, handler: Function): void; } export interface CollectionWidgetOptions extends WidgetOptions { /** A data source used to fetch data to be displayed by the widget. */ @@ -741,10 +766,10 @@ declare module DevExpress { /** Specifies how the message about the validation rules that are not satisfied by this editor's value is displayed. */ validationMessageMode?: string; } - /** A base class for editors. */ - export class Editor extends Widget { - /** Resets the editor's value to undefined. */ - reset(): void; + /** @docid Editor */ + export class Editor extends Widget { + /** @docid EditorMethods_reset */ + reset(): void; } /** An object that serves as a namespace for methods displaying a message in an application/site. */ export var dialog: { @@ -781,7 +806,138 @@ declare module DevExpress { }; } } -declare module DevExpress.framework { +declare module DevExpress.data { + export interface XmlaStoreOptions { + /** The HTTP address to an XMLA OLAP server. */ + url?: string; + /** The name of the database associated with the Store. */ + catalog?: string; + /** The cube name. */ + cube?: string; + } + /** A Store that provides access to an OLAP cube using the XMLA standard. */ + export class XmlaStore { + constructor(options: XmlaStoreOptions); + } + export interface PivotGridField { + index?: number; + /** A boolean value specifying whether or not the field is visible in the pivot grid and the Field Chooser. */ + visible?: boolean; + /** Name of the data source field containing data for the pivot grid field. */ + dataField?: string; + /** A caption that will be displayed in the pivot grid's field chooser to identify the field. */ + caption?: string; + /** Specifies a type of field values. */ + dataType?: string; + /** Specifies how the values of the current field are combined into groups. Cannot be used for the XmlaStore store type. */ + groupInterval?: any; + /** Specifies how to aggregate field data. Cannot be used for th XmlaStore store type. */ + summaryType?: string; + /** Allows you to use a custom aggregate function to calculate the summary values. Cannot be used for the XmlaStore store type. */ + calculateCustomSummary?: (options: { + summaryProcess?: string; + value?: any; + totalValue?: any; + }) => void; + /** Specifies the function that determines how to split data from the data source into ranges for header items. Cannot be used for the XmlaStore store type. */ + selector?: (data: Object) => any; + /** Type of the area where the field is located. */ + area?: string; + /** Index among the other fields displayed within the same area. */ + areaIndex?: number; + /** The name of the folder in which the field is located. */ + displayFolder?: string; + /** The name of the group to which the field belongs. */ + groupName?: string; + /** The index of the field within a group. */ + groupIndex?: number; + /** Specifies the initial sort order of field values. */ + sortOrder?: string; + /** Specifies how field data should be sorted. Can be used for the XmlaStore store type only. */ + sortBy?: string; + /** Specifies the data field against which the header items of this field should be sorted. */ + sortBySummaryField?: string; + /** The array of field names that specify a path to column/row whose summary field is used for sorting of this field's header items. */ + sortBySummaryPath?: Array; + /** The filter values for the current field. */ + filterValues?: Array; + /** The filter type for the current field. */ + filterType?: string; + /** Indicates whether all header items of the field's header level are expanded. */ + expanded?: boolean; + /** Specifies whether the field should be treated as a Data Field. */ + isMeasure?: boolean; + /** Specifies a display format for field values. */ + format?: string; + /** Specifies a callback function that returns the text to be displayed in the cells of a field. */ + customizeText?: (cellInfo: { value: any; valueText: string }) => string; + /** Specifies a precision for formatted field values. */ + precision?: number; + /** Specifies how to sort the header items. */ + sortingMethod?: (a: Object, b: Object) => number; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies the absolute width of the field in the pivot grid. */ + width?: number; + } + export interface PivotGridDataSourceOptions { + /** Specifies the underlying Store instance used to access data. */ + store?: any; + /** Indicates whether or not the automatic field generation from data in the Store is enabled. */ + retrieveFields?: boolean; + /** Specifies data filtering conditions. */ + filter?: Object; + /** An array of pivot grid fields. */ + fields?: Array; + /** Indicates whether or not the local sorting of the XMLA data should be performed. */ + localSorting?: boolean; + /** A handler for the changed event. */ + onChanged?: () => void; + /** A handler for the loadingChanged event. */ + onLoadingChanged?: (isLoading: boolean) => void; + /** A handler for the loadError event. */ + onLoadError?: (e?: Object) => void; + /** A handler for the fieldsPrepared event. */ + onFieldsPrepared?: (e?: Array) => void; + } + /** An object that provides access to data for the dxPivotGrid widget. */ + export class PivotGridDataSource implements EventsMixin { + constructor(options?: PivotGridDataSource); + /** Starts loading data. */ + load(): JQueryPromise; + /** Indicates whether or not the PivotGridDataSource is currently being loaded. */ + isLoading(): boolean; + /** Gets data displayed in a PivotGrid. */ + getData(): Object; + /** Gets all fields within a specified area. */ + getAreaFields(area: string, collectGroups: boolean): Array; + /** Gets all fields from the data source. */ + fields(): Array; + /** Sets the fields option. */ + fields(fields: Array): void; + /** Gets current options of a specified field. */ + field(id: number): PivotGridField; + /** Sets one or more options of a specified field. */ + field(id: number, field: PivotGridField): void; + /** Collapses a specified header item. */ + collapseHeaderItem(area: string, path: Array): void; + /** Expands a specified header item. */ + expandHeaderItem(area: string, path: Array): void; + /** Disposes of all resources associated with this PivotGridDataSource. */ + dispose(): void; + on(eventName: string, eventHandler: Function): PivotGridDataSource; + on(events: { [eventName: string]: Function; }): PivotGridDataSource; + off(eventName: string): PivotGridDataSource; + off(eventName: string, eventHandler: Function): PivotGridDataSource; + } +} +declare module DevExpress.framework { /** An object used to store information on the views displayed in an application. */ export class ViewCache { viewRemoved: JQueryCallback; @@ -804,7 +960,6 @@ declare module DevExpress.framework { disabled?: boolean; /** Specifies the name of the icon shown inside the widget associated with this command. */ icon?: string; - /** A URL pointing to the icon shown inside the widget associated with this command. */ iconSrc?: string; /** The identifier of the command. */ id?: string; @@ -851,18 +1006,19 @@ declare module DevExpress.framework { } export module html { export var layoutSets: Array; + export var animationSets: { [animationSetName: string]: AnimationSet }; + export interface AnimationSet { + [animationName: string]: any + } export interface HtmlApplicationOptions { /** Specifies where the commands that are defined in the application's views must be displayed. */ commandMapping?: Object; - /** - * The name of the default layout used by the application. - * @deprecated navigationType.md - */ - defaultLayout?: string; /** Specifies whether or not view caching is disabled. */ disableViewCache?: boolean; /** An array of layout controllers that should be used to show application views in the current navigation context. */ layoutSet?: any; + /** Specifies the animation presets that are used to animate different UI elements in the current application. */ + animationSet?: AnimationSet; /** Specifies whether the current application must behave as a mobile or web application. */ mode?: string; /** Specifies the object that represents a root namespace of the application. */ @@ -875,16 +1031,6 @@ declare module DevExpress.framework { stateManager?: StateManager; /** Specifies the storage to be used by the application's state manager to store the application state. */ stateStorage?: Object; - /** - * Specifies a strategy for choosing layouts for views in your application. - * @deprecated layoutSet.md - */ - navigationType?: string; - /** - * Specifies the object that represents the root namespace of the application. - * @deprecated namespace.md - */ - ns?: Object; /** Indicates whether on not to use the title of the previously displayed view as text on the Back button. */ useViewTitleAsBackText?: boolean; /** A custom view cache to be used in the application. */ @@ -1058,7 +1204,7 @@ declare module DevExpress.framework { } } } -declare module DevExpress.ui { +declare module DevExpress.ui { export interface dxValidatorOptions extends DOMComponentOptions { /** An array of validation rules to be checked for the editor with which the dxValidator object is associated. */ validationRules?: Array; @@ -1098,6 +1244,25 @@ declare module DevExpress.ui { constructor(element: JQuery, options?: dxValidationSummaryOptions); constructor(element: Element, options?: dxValidationSummaryOptions); } + /** A widget that displays required content in a resizable element. */ + export interface dxResizableOptions extends DOMComponentOptions { + /** Specifies which borders of the widget element are used as a handle. */ + handles?: string; + /** Specifies the lower width boundary for resizing. */ + minWidth?: number; + /** Specifies the upper width boundary for resizing. */ + maxWidth?: number; + /** Specifies the lower height boundary for resizing. */ + minHeight?: number; + /** Specifies the upper height boundary for resizing. */ + maxHeight?: number; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: Function; + } export interface dxTooltipOptions extends dxPopoverOptions { } /** A tooltip widget. */ @@ -1122,7 +1287,10 @@ declare module DevExpress.ui { valueChangeEvent?: string; /** Specifies whether or not the widget supports searching. */ searchEnabled?: boolean; - /** Specifies whether or not the widget displays items by pages. */ + /** + * Specifies whether or not the widget displays items by pages. + * @deprecated dataSource.paginate.md + */ pagingEnabled?: boolean; /** The text or HTML markup displayed by the widget if the item collection is empty. */ noDataText?: string; @@ -1210,10 +1378,8 @@ declare module DevExpress.ui { showClearButton?: boolean; /** Specifies the current value displayed by the widget. */ value?: any; - valueUpdateAction?: Function; /** Specifies DOM event names that update a widget's value. */ valueChangeEvent?: string; - valueUpdateEvent?: string; /** Specifies whether or not the widget checks the inner text for spelling mistakes. */ spellcheck?: boolean; /** Specifies HTML attributes applied to the inner input element of the widget. */ @@ -1224,6 +1390,14 @@ declare module DevExpress.ui { focusStateEnabled?: boolean; /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ hoverStateEnabled?: boolean; + /** The editor mask, which specifies the format of the entered string. */ + mask?: string; + /** Specifies a mask placeholder character. */ + maskChar?: string; + /** Specifies custom mask rules. */ + maskRules?: Object; + /** A message displayed when the entered text does not match the specified pattern. */ + maskInvalidMessage?: string; } /** A base class for text editing widgets. */ export class dxTextEditor extends Editor { @@ -1370,7 +1544,7 @@ declare module DevExpress.ui { clientHeight(): number; /** Returns the width of the scrollable widget in pixels. */ clientWidth(): number; - /** An HTML element of the widget. */ + /** Returns an HTML element of the widget. */ content(): JQuery; /** Scrolls the widget content by the specified number of pixels. */ scrollBy(distance: number): void; @@ -1411,7 +1585,7 @@ declare module DevExpress.ui { /** A Boolean value specifying whether or not to display the widget in full-screen mode. */ fullScreen?: boolean; position?: PositionOptions; - /** A Boolean value specifying whether or not to display the title in the overlay window. */ + /** A Boolean value specifying whether or not to display the title in the popup window. */ showTitle?: boolean; /** The title in the overlay window. */ title?: string; @@ -1465,6 +1639,8 @@ declare module DevExpress.ui { deferRendering?: boolean; /** Specifies whether or not an end-user can drag the widget. */ dragEnabled?: boolean; + /** Specifies whether or not an end user can resize the widget. */ + resizeEnabled?: boolean; /** The height of the widget in pixels. */ height?: any; /** A handler for the hidden event. */ @@ -1583,14 +1759,6 @@ declare module DevExpress.ui { /** A key used to authenticate the application within the "Google Static" map provider. */ googleStatic?: string; } - /** - * An object, a string, or an array specifying the location displayed at the center of the widget. - * @deprecated center.md - */ - location?: { - lat?: number; - lng?: number; - }; /** A handler for the markerAdded event. */ onMarkerAdded?: Function; markerAddedAction?: Function; @@ -1638,11 +1806,12 @@ declare module DevExpress.ui { export interface dxLookupOptions extends dxDropDownListOptions { /** An object defining widget animation options. */ animation?: fx.AnimationOptions; - autoPagingEnabled?: boolean; /** The text displayed on the Cancel button. */ cancelButtonText?: string; /** The text displayed on the Clear button. */ clearButtonText?: string; + /** Specifies whether or not the widget cleans the search box when the popup window is displayed. */ + cleanSearchOnOpening?: boolean; /** A Boolean value specifying whether or not the widget is closed if a user clicks outside of the overlaying window. */ closeOnOutsideClick?: any; /** The text displayed on the Apply button. */ @@ -1658,6 +1827,8 @@ declare module DevExpress.ui { nextButtonText?: string; /** A handler for the pageLoading event. */ onPageLoading?: Function; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; pageLoadingAction?: Function; /** Specifies the text shown in the pullDown panel, which is displayed when the widget is scrolled to the bottom. */ pageLoadingText?: string; @@ -1691,7 +1862,10 @@ declare module DevExpress.ui { shading?: boolean; /** Specifies whether to display the Cancel button in the lookup window. */ showCancelButton?: boolean; - /** A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. */ + /** + * A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. + * @deprecated pageLoadMode.md + */ showNextButton?: boolean; /** The title of the lookup window. */ title?: string; @@ -1709,6 +1883,8 @@ declare module DevExpress.ui { onTitleRendered?: Function; /** Specifies whether or not the widget supports the focused state and keyboard navigation. */ focusStateEnabled?: boolean; + /** A Boolean value specifying whether or not to display the title in the popup window. */ + showPopupTitle?: boolean; } /** A widget that allows a user to select predefined values from a lookup window. */ export class dxLookup extends dxDropDownList { @@ -1749,52 +1925,16 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxLoadIndicatorOptions); } export interface dxListOptions extends CollectionWidgetOptions { - /** A Boolean value specifying whether or not to load the next page from the data source when the list is scrolled to the bottom. */ - autoPagingEnabled?: boolean; - /** Specifies whether or not the widget displays items by pages. */ - pagingEnabled?: boolean; - /** An object used to set configuration options for the dxList's edit mode. */ - editConfig?: { - /** Specifies whether the list items can be deleted. */ - deleteEnabled?: boolean; - /** - * A mode specifying how to delete a list item. - * @deprecated deleteType.md - */ - deleteMode?: string; - /** Specifies the way a user can delete items from the list. */ - deleteType?: string; - itemRender?: any; - /** The template used to render list items in edit mode. */ - itemTemplate?: any; - /** Specifies the array of items for a context menu called for a list item. */ - menuItems?: Array; - /** Specifies whether an item context menu is shown when a user swipes or holds an item. */ - menuType?: string; - /** Specifies whether or not a user can reorder items. */ - reorderEnabled?: boolean; - /** Specifies whether the list items can be selected. */ - selectionEnabled?: boolean; - /** - * A mode specifying how to select a list item. - * @deprecated selectionType.md - */ - selectionMode?: string; - /** A type specifying how to select a list item. */ - selectionType?: string; - /** Specifies whether the item list represented by this widget is editable. */ - editEnabled?: boolean; - /** Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data. */ - indicateLoading?: boolean; - }; /** A Boolean value specifying whether or not to display a grouped list. */ grouped?: boolean; groupRender?: any; - /** The name of the template used to display a group header. */ + /** The template to be used for rendering item groups. */ groupTemplate?: any; onItemDeleting?: Function; /** A handler for the itemDeleted event. */ onItemDeleted?: Function; + /** A handler for the groupRendered event. */ + onGroupRendered?: Function; itemDeleteAction?: Function; /** A handler for the itemReordered event. */ onItemReordered?: Function; @@ -1827,19 +1967,40 @@ declare module DevExpress.ui { scrollAction?: Function; /** A Boolean value specifying whether to enable or disable list scrolling. */ scrollingEnabled?: boolean; - /** Specifies whether the list supports single item selection or multi-selection. */ - selectionMode?: string; - /** A Boolean value specifying whether the widget loads the next page automatically when you reach the bottom of the list or when a button is clicked. */ - showNextButton?: boolean; /** Specifies when the widget shows the scrollbar. */ showScrollbar?: string; /** Specifies whether or not the widget uses native scrolling. */ useNativeScrolling?: boolean; + /** A Boolean value specifying whether to enable or disable the bounce-back effect. */ + bounceEnabled?: boolean; + /** A Boolean value specifying if the list is scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean value specifying if the list is scrolled using the scrollbar. */ + scrollByThumb?: boolean; itemUnselectAction?: Function; onItemContextMenu?: Function; onItemHold?: Function; /** Specifies whether or not an end-user can collapse groups. */ collapsibleGroups?: boolean; + /** Specifies whether the next page is loaded when a user scrolls the widget to the bottom or when the "next" button is clicked. */ + pageLoadMode?: string; + /** Specifies whether or not to display controls used to select list items. */ + showSelectionControls?: boolean; + /** Specifies whether the list supports single item selection or multi-selection. */ + selectionMode?: string; + selectAllText?: string; + /** Specifies the array of items for a context menu called for a list item. */ + menuItems?: Array; + /** Specifies whether an item context menu is shown when a user holds or swipes an item. */ + menuMode?: string; + /** Specifies whether or not an end user can delete list items. */ + allowItemDeleting?: boolean; + /** Specifies the way a user can delete items from the list. */ + itemDeleteMode?: string; + /** Specifies whether or not an end user can reorder list items. */ + allowItemReordering?: boolean; + /** Specifies whether or not to show the loading panel when the DataSource bound to the widget is loading data. */ + indicateLoading?: boolean; } /** A list widget. */ export class dxList extends CollectionWidget { @@ -1855,11 +2016,6 @@ declare module DevExpress.ui { isItemSelected(itemIndex: any): boolean; /** Returns a Boolean value that indicates whether or not the specified item is selected. */ isItemSelected(itemElement: Element): boolean; - /** - * Reloads list data. - * @deprecated Use the "reload" method instead. - */ - refresh(): void; /** Reloads list data. */ reload(): void; /** Moves the specified item to the specified position in the list. */ @@ -1886,11 +2042,6 @@ declare module DevExpress.ui { unselectItem(itemElement: Element): void; /** Unselects the specified item from the list. */ unselectItem(itemIndex: any): void; - /** - * Updates the widget scrollbar according to widget content size. - * @deprecated updateDimensions.md - */ - update(): JQueryPromise; /** Updates the widget scrollbar according to widget content size. */ updateDimensions(): JQueryPromise; /** Expands the specified group. */ @@ -1917,6 +2068,12 @@ declare module DevExpress.ui { slideshowDelay?: number; /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ swipeEnabled?: boolean; + /** Specifies whether or not to display parts of previous and next images along the sides of the current image. */ + wrapAround?: boolean; + /** Specifies if the widget stretches images to fit the total gallery width. */ + stretchImages?: boolean; + /** Specifies the width of an area used to display a single image. */ + initialItemWidth?: number; } /** An image gallery widget. */ export class dxGallery extends CollectionWidget { @@ -1960,6 +2117,10 @@ declare module DevExpress.ui { open(): void; /** Resets the widget's value to null. */ reset(): void; + /** Returns an <input> element of the widget. */ + field(): JQuery; + /** Returns an HTML element of the popup window content. */ + content(): JQuery; } export interface dxDateBoxOptions extends dxTextEditorOptions { /** A format used to display date/time information. */ @@ -1972,14 +2133,24 @@ declare module DevExpress.ui { min?: Date; /** The text displayed by the widget when the widget value is not yet specified. This text is also used as a title of the date picker. */ placeholder?: string; - /** Specifies whether or not a user can pick out a date using the drop-down calendar. */ + /** + * Specifies whether or not a user can pick out a date using the drop-down calendar. + * @deprecated Use 'pickerType' option instead. + */ useCalendar?: boolean; /** A Date object specifying the date and time currently selected using the date box. */ value?: Date; - /** Specifies whether or not the widget uses the native HTML input element. */ + /** + * Specifies whether or not the widget uses the native HTML input element. + * @deprecated Use 'pickerType' option instead. + */ useNative?: boolean; /** Specifies the interval between neighboring values in the popup list in minutes. */ interval?: number; + /** Specifies the maximum zoom level of a calendar, which is used to pick the date. */ + maxZoomLevel?: string; + /** Specifies the type of date/time picker. */ + pickerType?: string; } /** A date box widget. */ export class dxDateBox extends dxDropDownEditor { @@ -1987,7 +2158,6 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxDateBoxOptions); } export interface dxCheckBoxOptions extends EditorOptions { - checked?: boolean; /** Specifies the widget state. */ value?: boolean; /** Specifies the text displayed by the check box. */ @@ -2007,6 +2177,16 @@ declare module DevExpress.ui { max?: Date; /** The earliest date the widget allows to select. */ min?: Date; + /** Specifies whether or not the widget displays a button that selects the current date. */ + showTodayButton?: boolean; + /** Specifies the current calendar zoom level. */ + zoomLevel?: string; + /** Specifies the maximum zoom level of the calendar. */ + maxZoomLevel?: string; + /** Specifies the minimum zoom level of the calendar. */ + minZoomLevel?: string; + /** The template to be used for rendering calendar cells. */ + cellTemplate?: any; } /** A calendar widget. */ export class dxCalendar extends Editor { @@ -2014,12 +2194,13 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxCalendarOptions); } export interface dxButtonOptions extends WidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; /** A handler for the click event. */ onClick?: any; clickAction?: any; /** The name of an icon to be displayed on the button. */ icon?: string; - /** A URL pointing to the image to be displayed on the button. */ iconSrc?: string; /** The text displayed on the button. */ text?: string; @@ -2044,7 +2225,7 @@ declare module DevExpress.ui { /** A container widget used to arrange inner elements. */ export class dxBox extends CollectionWidget { constructor(element: JQuery, options?: dxBoxOptions); - constructor(element: Element, options?: dxBoxOptions); + constructor(element: Element, options?: dxBoxOptions); } export interface dxResponsiveBoxOptions extends CollectionWidgetOptions { /** Specifies the collection of rows for the grid used to position layout elements. */ @@ -2114,8 +2295,11 @@ declare module DevExpress.ui { value?: File; /** Holds the File instances representing files selected in the widget. */ values?: Array; - /** Specifies the text displayed on the button opening the file selection dialog. */ buttonText?: string; + /** The text displayed on the button that opens the file browser. */ + selectButtonText?: string; + /** The text displayed on the button that starts uploading. */ + uploadButtonText?: string; /** Specifies the text displayed on the area to which an end-user can drop a file. */ labelText?: string; /** Specifies the value passed to the name attribute of the underlying input element. */ @@ -2124,6 +2308,22 @@ declare module DevExpress.ui { multiple?: boolean; /** Specifies a file type or several types accepted by the widget. */ accept?: string; + /** Specifies a target Url for the upload request. */ + uploadUrl?: string; + /** Specifies if an end user can remove a just uploaded file. */ + allowCanceling?: boolean; + /** Specifies whether or not the widget displays the list of selected files. */ + showFileList?: boolean; + /** Gets the current progress in percentages. */ + progress?: number; + /** The message displayed by the widget when it is ready to upload the specified files. */ + readyToUploadMessage?: string; + /** The message displayed by the widget when uploading is finished. */ + uploadedMessage?: string; + /** The message displayed by the widget on uploading failure. */ + uploadFailedMessage?: string; + /** Specifies how the widget uploads files. */ + uploadMode?: string; } /** A widget used to select and upload a file or multiple files. */ export class dxFileUploader extends Editor { @@ -2163,6 +2363,8 @@ declare module DevExpress.ui { value?: number; /** Specifies whether or not to highlight a range selected within the widget. */ showRange?: boolean; + /** Specifies the size of a step by which a slider handle is moved when a user uses the Page up or Page down keyboard shortcuts. */ + keyStep?: number; /** Specifies options for the slider tooltip. */ tooltip?: { /** Specifies whether or not the tooltip is enabled. */ @@ -2201,6 +2403,8 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxRangeSliderOptions); } export interface dxTileViewOptions extends CollectionWidgetOptions { + /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ + activeStateEnabled?: boolean; /** Specifies the height of the base tile view item. */ baseItemHeight?: number; /** Specifies the width of the base tile view item. */ @@ -2209,7 +2413,6 @@ declare module DevExpress.ui { height?: any; /** Specifies the distance in pixels between adjacent tiles. */ itemMargin?: number; - listHeight?: any; /** A Boolean value specifying whether or not to display a scrollbar. */ showScrollbar?: boolean; } @@ -2233,6 +2436,31 @@ declare module DevExpress.ui { constructor(element: JQuery, options?: dxSwitchOptions); constructor(element: Element, options?: dxSwitchOptions); } + export interface dxSlideOutViewOptions extends WidgetOptions { + /** Specifies whether or not the menu panel is visible. */ + menuVisible?: boolean; + /** Specifies whether or not the menu is shown when a user swipes the widget content. */ + swipeEnabled?: boolean; + /** A template to be used for rendering menu panel content. */ + menuTemplate?: any; + /** A template to be used for rendering widget content. */ + contentTemplate?: any; + } + /** The widget that allows you to slide-out the current view to reveal a custom menu. */ + export class dxSlideOutView extends Widget { + constructor(element: JQuery, options?: dxSlideOutViewOptions); + constructor(element: Element, options?: dxSlideOutViewOptions); + /** Returns an HTML element of the widget menu block. */ + menuContent(): JQuery; + /** Returns an HTML element of the widget content block. */ + content(): JQuery; + /** Displays the widget's menu block. */ + showMenu(): JQueryPromise; + /** Hides the widget's menu block. */ + hideMenu(): JQueryPromise; + /** Toggles the visibility of the widget's menu block. */ + toggleMenuVisibility(): JQueryPromise; + } export interface dxSlideOutOptions extends CollectionWidgetOptions { /** A Boolean value specifying whether or not the widget changes its state when interacting with a user. */ activeStateEnabled?: boolean; @@ -2244,6 +2472,10 @@ declare module DevExpress.ui { menuItemRender?: any; /** The template used to render menu items. */ menuItemTemplate?: any; + /** A handler for the menuGroupRendered event. */ + onMenuGroupRendered?: Function; + /** A handler for the menuItemRendered event. */ + onMenuItemRendered?: Function; /** Specifies whether or not the slide-out menu is displayed. */ menuVisible?: boolean; /** Indicates whether the menu can be shown/hidden by swiping the widget's main panel. */ @@ -2265,6 +2497,8 @@ declare module DevExpress.ui { export interface dxPivotOptions extends CollectionWidgetOptions { /** The index of the currently active pivot item. */ selectedIndex?: number; + /** A Boolean value specifying whether or not to allow users to switch between items by swiping. */ + swipeEnabled?: boolean; /** A template to be used for rendering widget content. */ contentTemplate?: any; } @@ -2299,7 +2533,6 @@ declare module DevExpress.ui { buttonClickAction?: any; /** The name of the icon to be displayed by the DropDownMenu button. */ buttonIcon?: string; - /** A URL pointing to the image to be displayed by the DropDownMenu button. */ buttonIconSrc?: string; /** The text displayed in the DropDownMenu button. */ buttonText?: string; @@ -2364,6 +2597,68 @@ declare module DevExpress.ui { /** Shows or hides the widget depending on the Boolean value passed as the parameter. */ toggle(showing: boolean): JQueryPromise; } + export interface dxSchedulerOptions extends WidgetOptions { + /** Specifies a date displayed on the current scheduler view by default. */ + currentDate?: Date; + /** Specifies the view used in the scheduler by default. */ + currentView?: string; + /** A data source used to fetch data to be displayed by the widget. */ + dataSource?: any; + /** Specifies the first day of a week. */ + firstDayOfWeek?: number; + /** The template to be used for rendering appointments. */ + appointmentTemplate?: any; + /** Lists the views to be available within the scheduler's View Selector. */ + views?: Array; + /** Specifies the resource kinds by which the scheduler's appointments are grouped in a timetable. */ + groups?: Array; + /** Specifies a start hour in the scheduler view's time interval. */ + startDayHour?: number; + /** Specifies an end hour in the scheduler view's time interval. */ + endDayHour?: number; + /** Specifies an array of resources available in the scheduler. */ + resources?: Array<{ + /** Indicates whether or not several resources of this kind can be assigned to an appointment. */ + allowMultiple?: boolean; + /** Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. */ + mainColor?: boolean; + /** A data source used to fetch resources to be available in the scheduler. */ + dataSource?: any; + /** Specifies the resource object field whose value is displayed by the Resource editor in the Appointment popup window. */ + displayExpr?: any; + /** Specifies the resource object field that is used as a value of the Resource editor in the Appointment popup window. */ + valueExpr?: any; + /** The name of the appointment object field that specifies a resource of this kind. */ + field?: string; + /** Specifies the label of the Appointment popup window field that allows end users to assign a resource of this kind. */ + label?: string; + }>; + /** A handler for the AppoinmentAdding event. */ + onAppointmentAdding?: Function; + /** A handler for the appointmentAdded event. */ + onAppointmentAdded?: Function; + /** A handler for the AppoinmentUpdating event. */ + onAppointmentUpdating?: Function; + /** A handler for the appointmentUpdated event. */ + onAppointmentUpdated?: Function; + /** A handler for the AppoinmentDeleting event. */ + onAppointmentDeleting?: Function; + /** A handler for the appointmentDeleted event. */ + onAppointmentDeleted?: Function; + /** A handler for the appointmentRendered event. */ + onAppointmentRendered?: Function; + } + /** A widget that displays scheduled data using different views and provides the capability to load, add and edit appointments. */ + export class dxScheduler extends Widget { + constructor(element: JQuery, options?: dxSchedulerOptions); + constructor(element: Element, options?: dxSchedulerOptions); + /** Add the appointment defined by the object passed as a parameter to the data associated with the widget. */ + addAppointment(appointment: Object): void; + /** Updates the appointment specified by the first method parameter by the appointment object specified by the second method parameter in the the data associated with the widget. */ + updateAppointment(target: Object, appointment: Object): void; + /** Deletes the appointment defined by the parameter from the the data associated with the widget. */ + deleteAppointment(appointment: Object): void; + } export interface dxColorBoxOptions extends dxDropDownEditorOptions { /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ applyButtonText?: string; @@ -2372,6 +2667,8 @@ declare module DevExpress.ui { cancelButtonText?: string; /** Specifies whether or not the widget value includes the alpha channel component. */ editAlphaChannel?: boolean; + /** Specifies the size of a step by which a handle is moved using a keyboard shortcut. */ + keyStep?: number; } /** A widget used to specify a color value. */ export class dxColorBox extends dxDropDownEditor { @@ -2388,6 +2685,8 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxColorPickerOptions); } export interface dxTreeViewOptions extends CollectionWidgetOptions { + /** Specifies whether or not to animate item collapsing and expanding. */ + animationEnabled?: boolean; /** Specifies whether a nested or plain array is used as a data source. */ dataStructure?: string; /** Specifies whether or not a user can expand all tree view items by the "*" hot key. */ @@ -2417,7 +2716,14 @@ declare module DevExpress.ui { itemsExpr?: any; /** Specifies the name of the data source item field that holds the key of the parent item. */ parentIdExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node is disabled. */ disabledExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding node includes child nodes. */ + hasItemsExpr?: any; + /** Specifies if the virtual mode is enabled. */ + virtualModeEnabled?: boolean; + /** Specifies the parent ID value of the root item. */ + rootValue?: any; /** A string value specifying available scrolling directions. */ scrollDirection?: string; /** A handler for the itemSelected event. */ @@ -2461,8 +2767,18 @@ declare module DevExpress.ui { selectionByClick?: boolean; /** Specifies the selection mode supported by the menu. */ selectionMode?: string; - /** Specifies the user interaction by which submenus are shown. */ - showSubmenuMode?: string; + /** Specifies options of submenu showing and hiding. */ + showSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay of submenu show and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; /** A Boolean value specifying whether or not the widget changes its state when being hovered by an end user. */ hoverStateEnabled?: boolean; } @@ -2475,12 +2791,22 @@ declare module DevExpress.ui { unselectItem(itemElement: any): void; } export interface dxMenuOptions extends dxMenuBaseOptions { - firstSubMenuDirection?: string; + /** Specifies whether or not the submenu is hidden when the mouse pointer leaves it. */ + hideSubmenuOnMouseLeave?: boolean; /** Specifies whether the menu has horizontal or vertical orientation. */ orientation?: string; - /** Specifies by which user interaction the first-level submenu is shown. */ - showFirstSubmenuMode?: string; - showPopupMode?: string; + /** Specifies options for showing and hiding the first level submenu. */ + showFirstSubmenuMode?: { + /** Specifies the mode name. */ + name?: string; + /** Specifies the delay of submenu showing and hiding. */ + delay?: { + /** The time span after which the submenu is shown. */ + show?: number; + /** The time span after which the submenu is hidden. */ + hide?: number; + }; + }; /** Specifies the direction at which the submenus are displayed. */ submenuDirection?: string; /** A handler for the submenuHidden event. */ @@ -2502,11 +2828,13 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxMenuOptions); } export interface dxContextMenuOptions extends dxMenuBaseOptions { - direction?: string; - hiddenAction?: Function; - hidingAction?: Function; - /** Specifies whether the context menu can be called only from code or by user interaction as well. */ - invokeOnlyFromCode?: boolean; + /** Holds an object that specifies options of alternative menu invocation. */ + alternativeInvocationMode?: { + /** Specifies whether or not the standard context menu invocation (on a right mouse click or on a long tap) is disabled. */ + enabled?: Boolean; + /** Specifies the element used to invoke the context menu. */ + invokingElement?: any; + }; /** A handler for the hidden event. */ onHidden?: Function; /** A handler for the hiding event. */ @@ -2519,9 +2847,6 @@ declare module DevExpress.ui { onShown?: Function; /** An object defining widget positioning options. */ position?: PositionOptions; - positioningAction?: Function; - showingAction?: Function; - shownAction?: Function; /** Specifies the direction at which submenus are displayed. */ submenuDirection?: string; /** The target element associated with a popover. */ @@ -2553,8 +2878,12 @@ declare module DevExpress.ui { alignment?: string; /** Specifies whether the values in a column can be edited at runtime. Setting this option makes sense only when editing is enabled for a grid. */ allowEditing?: boolean; - /** Specifies whether or not a column can be used for filtering grid records. Setting this option makes sense only when the filter row or search panel is visible. */ + /** Specifies whether or not a column can be used for filtering grid records. Setting this option makes sense only when the filter row and column header filtering are visible. */ allowFiltering?: boolean; + /** Specifies whether or not the column can be anchored to a grid edge by end users. Setting this option makes sense only when the columnFixing | enabled option is set to true. */ + allowFixing?: boolean; + /** Specifies if a column can be used for searching grid records. Setting this option makes sense only when the search panel is visible. */ + allowSearch?: boolean; /** Specifies whether a column can be used for grouping grid records at runtime. Setting this option makes sense only when the group panel is visible. */ allowGrouping?: boolean; /** Specifies whether or not a column can be hidden by a user. Setting this option makes sense only when the column chooser is visible. */ @@ -2577,8 +2906,10 @@ declare module DevExpress.ui { cellTemplate?: any; /** Specifies a CSS class to be applied to a column. */ cssClass?: string; - /** Specifies a callback function that determines grouping values. */ - calculateGroupValue?: (rowData: Object) => string; + /** Specifies a callback function that determines values for column cells to be used for grouping. */ + calculateGroupValue?: any; + /** Specifies a callback function that returns a value or the name of the field to be used for sorting column cells. */ + calculateSortValue?: any; /** Specifies a callback function that returns the text to be displayed in the cells of a column. */ customizeText?: (cellInfo: { value: any; valueText: string }) => string; /** Specifies the field of a data source that provides data for a column. */ @@ -2595,6 +2926,14 @@ declare module DevExpress.ui { filterOperations?: Array; /** Specifies a filter value for a column. */ filterValue?: any; + /** Specifies initial filter values for the column's header filter. */ + filterValues?: Array; + /** Specifies whether to include or exclude the records with the values selected in the column's header filter. */ + filterType?: string; + /** Indicates whether the column takes part in horizontal grid scrolling or is anchored to a grid edge. */ + fixed?: boolean; + /** Specifies the grid edge to which the column is anchored. */ + fixedPosition?: string; /** Specifies a format for the values displayed in a column. */ format?: string; /** Specifies a custom template for the group cell of a grid column. */ @@ -2650,6 +2989,8 @@ Specifies the data source providing data for a lookup column. errorRowEnabled?: boolean; /** A handler for the rowValidating event. */ onRowValidating?: (e: Object) => void; + /** A handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => void; initNewRow?: (e: { data: Object }) => void; /** A handler for the initNewRow event. */ onInitNewRow?: (e: { data: Object }) => void; @@ -2701,6 +3042,40 @@ Specifies the data source providing data for a lookup column. /** Specifies the width of the column chooser panel. */ width?: number; }; + /** Specifies options for column fixing. */ + columnFixing?: { + /** Indicates if column fixing is enabled. */ + enabled?: boolean; + /** Contains options that specify texts for column-fixing related commands in the column header's context menu. */ + texts?: { + /** Specifies text for a context menu item that fixes the column for which the context menu is invoked. */ + fix?: string; + /** Specifies text for a context menu item that unfixes the column for which the context menu is invoked. */ + unfix?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the left grid edge. */ + leftPosition?: string; + /** Specifies text for a context menu subitem that fixes a column, for which the context menu is invoked, to the right grid edge. */ + rightPosition?: string; + }; + }; + /** Specifies options for filtering using a column header filter. */ + headerFilter?: { + /** Indicates whether or not the column header filter button is visible. */ + visible?: boolean; + /** Specifies the height of the dropdown menu invoked when using a column header filter. */ + height?: number; + /** Specifies the width of the dropdown menu invoked when using a column header filter. */ + width?: number; + /** Contains options that specify texts for the dropdown menu invoked when you use a column header filter. */ + texts?: { + /** Specifies text for the item specifying an empty value in the column header filter's dropdown menu. */ + emptyValue?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu and applies specified filtering. */ + ok?: string; + /** Specifies text for a button that closes the column header filter's dropdown menu without applying performed selection. */ + cancel?: string; + } + }; /** An array of grid columns. */ @@ -2759,11 +3134,6 @@ An array of grid columns. addRow?: string; /** Specifies text for a button that turns a row into the editing state. Setting this option makes sense only when the editEnabled option is set to true. */ editRow?: string; - /** - * Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the removeEnabled option is set to true. - * @deprecated Use the "undeleteRow" option instead. - */ - recoverRow?: string; /** Specifies text for a save button displayed when a row is in the editing state. Setting this option makes sense only when the editEnabled option is set to true. */ saveRowChanges?: string; /** Specifies text for a button that recovers a deleted row. Setting this option makes sense only if the grid uses the batch edit mode and the removeEnabled option is set to true. */ @@ -2913,6 +3283,32 @@ Specifies the message displayed in a group row when the corresponding group cont /** Specifies the template for detail sections. */ template?: any; }; + /** Specifies options for exporting grid data. */ + export?: { + /** Indicates if the export feature is enabled in the grid. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** Specifies whether to enable Excel filtering for the exported data in the resulting XLSX file. */ + excelFilterEnabled?: boolean; + /** Specifies whether to enable word wrapping for the exported data in the resulting XLSX file. */ + excelWrapTextEnabled?: boolean; + /** Specifies the URL of the server-side proxy that streams the resulting file to the end user to enable export in IE8, IE9 and Safari browsers. */ + proxyUrl?: string; + /** Indicates whether to allow end users to export not only the data displayed in the grid, but the selected rows only. */ + allowExportSelectedData?: boolean; + /** Contains options that specify texts for the export-related commands and hints. */ + texts?: { + /** Specifies text for the Export button when this button invokes a dropdown menu so you can choose the required export format. */ + exportTo?: string; + /** Specifies text for the Export button when this button exports to the XSLX format. */ + exportToExcel?: string; + /** Specifies text for the item in the Export dropdown menu that exports grid data to Excel. */ + excelFormat?: string; + /** Specifies text for the option in the Export dropdown menu that allows you to choose whether to export all the grid data or the selected rows only. */ + selectedRows?: string; + } + }; /** Specifies the keys of the records that must appear selected initially. */ selectedRowKeys?: Array; /** Specifies options of runtime selection. */ @@ -2937,6 +3333,22 @@ Specifies the message displayed in a group row when the corresponding group cont selectedRowKeys: Array; selectedRowsData: Array; }) => void; + /** A handler for the exporting event. */ + onExporting?: (e: { + fileName: string; + format: string; + cancel: boolean; + }) => void; + /** A handler for the exported event. */ + onExported?: (e: Object) => void; + /** A handler for the rowExpanding event. */ + onRowExpanding?: (e: Object) => void; + /** A handler for the rowExpanded event. */ + onRowExpanded?: (e: Object) => void; + /** A handler for the rowCollapsing event. */ + onRowCollapsing?: (e: Object) => void; + /** A handler for the rowCollapsed event. */ + onRowCollapsed?: (e: Object) => void; /** Specifies whether column headers are visible or not. */ showColumnHeaders?: boolean; /** Specifies whether or not vertical lines separating one grid column from another are visible. */ @@ -3009,7 +3421,9 @@ Specifies the message displayed in a group row when the corresponding group cont precision?: number; /** Specifies whether or not a summary item must be displayed in the group footer. */ showInGroupFooter?: boolean; - /** Specifies the column that must hold the summary item when this item is displayed in the group footer. */ + /** Indicates whether to display group summary items in brackets of the group row header or to align them by the corresponding columns within the group row. */ + alignByColumn?: boolean; + /** Specifies the column that must hold the summary item when this item is displayed in the group footer or aligned by a column in the group row. */ showInColumn?: string; /** Specifies how to aggregate data for a summary item. */ summaryType?: string; @@ -3080,7 +3494,7 @@ Specifies the message displayed in a group row when the corresponding group cont beginCustomLoading(messageText: string): void; /** Discards changes made in a grid. */ cancelEditData(): void; - /** Clears the filter applied to grid records from code. */ + /** Clears all the filters applied to grid records. */ clearFilter(): void; /** Deselects all grid records. */ clearSelection(): void; @@ -3112,8 +3526,12 @@ Specifies the message displayed in a group row when the corresponding group cont expandRow(key: any): void; /** Allows you to collapse a specific group or master row by its key. */ collapseRow(key: any): void; - /** Applies a filter to grid records. */ - filter(filterExpr: Array): void; + /** Applies a filter to the grid's data source. */ + filter(filterExpr?: any): void; + /** Returns a filter expression applied to the grid's data source using the filter(filterExpr) method. */ + filter(): any; + /** Returns a filter expression applied to the grid using all possible scenarious. */ + getCombinedFilter(): any; /** Gets the keys of currently selected grid records. */ getSelectedRowKeys(): Array; /** Gets the data objects of currently selected grid records. */ @@ -3132,11 +3550,6 @@ Specifies the message displayed in a group row when the corresponding group cont pageSize(value: number): void; /** Gets the current page size. */ pageSize(): number; - /** - * Recovers a row deleted in the batch edit mode. - * @deprecated Use the "undeleteRow" method instead. - */ - recoverRow(rowIndex: number): void; /** Refreshes grid data. */ refresh(): void; /** Removes a specific row from a grid. */ @@ -3149,6 +3562,7 @@ Searches grid records by a search string. searchByText(text: string): void; /** Selects all grid records. */ selectAll(): void; + /** Deselects the rows that are currently selected within the applied filter. */ deselectAll(): void; /** Selects specific grid records. */ selectRows(keys: Array, preserve: boolean): void; @@ -3169,9 +3583,140 @@ Searches grid records by a search string. byKey(key: any): JQueryPromise; /** Gets the value of a total summary item. */ getTotalSummaryValue(summaryItemName: string): any; + /** Exports grid data to Excel. */ + exportToExcel(selectionOnly: boolean): void; + /** Updates the grid to the size of its content. */ + updateDimensions(): void; + /** Focuses the specified cell element in the grid. */ + focus(element?: JQuery): void; + } + export interface dxPivotGridOptions extends WidgetOptions { + /** Specifies a data source for the pivot grid. */ + dataSource?: any; + useNativeScrolling?: any; + /** Allows an end-user to change sorting options. */ + allowSorting?: boolean; + /** Allows an end-user to sort columns by summary values. */ + allowSortingBySummary?: boolean; + /** Allows an end-user to change filtering options. */ + allowFiltering?: boolean; + /** Allows an end-user to expand/collapse all header items within a header level. */ + allowExpandAll?: boolean; + /** Specifies whether to display the Total rows. */ + showRowTotals?: boolean; + /** Specifies whether to display the Grand Total row. */ + showRowGrandTotals?: boolean; + /** Specifies whether to display the Total columns. */ + showColumnTotals?: boolean; + /** Specifies whether to display the Grand Total column. */ + showColumnGrandTotals?: boolean; + /** The Field Chooser configuration options. */ + fieldChooser?: { + /** Enables or disables the field chooser. */ + enabled?: boolean; + /** Specifies the field chooser layout. */ + layout?: number; + /** Specifies the text to display as a title of the field chooser popup window. */ + title?: string; + /** Specifies the field chooser width. */ + width?: number; + /** Specifies the field chooser height. */ + height?: number; + /** Strings that can be changed or localized in the pivot grid's integrated Field Chooser. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** Strings that can be changed or localized in the dxPivotGrid widget. */ + texts?: { + /** The string to display as a header of the Grand Total row and column. */ + grandTotal?: string; + /** The string to display as a header of the Total row and column. */ + total?: string; + /** Specifies the text displayed when a pivot grid does not contain any fields. */ + noData?: string; + /** The string to display as a Show Field Chooser context menu item. */ + showFieldChooser?: string; + /** The string to display as an Expand All context menu item. */ + expandAll?: string; + /** The string to display as a Collapse All context menu item. */ + collapseAll?: string; + /** The string to display as a Sort Column by Summary Value context menu item. */ + sortColumnBySummary?: string; + /** The string to display as a Sort Row by Summary Value context menu item. */ + sortRowBySummary?: string; + /** The string to display as a Remove All Sorting context menu item. */ + removeAllSorting?: string; + }; + /** The Load panel configuration options. */ + loadPanel?: { + /** Enables or disables the load panel. */ + enabled?: boolean; + /** Specifies the height of the load panel. */ + height?: number; + /** Specifies the URL pointing to an image that will be used as a load indicator. */ + indicatorSrc?: string; + /** Specifies whether or not to show a load indicator. */ + showIndicator?: boolean; + /** Specifies whether or not to show load panel background. */ + showPane?: boolean; + /** Specifies the text to display inside a load panel. */ + text?: string; + /** Specifies the width of the load panel. */ + width?: number; + }; + /** A handler for the cellClick event. */ + onCellClick?: (e: any) => void; + /** A handler for the cellPrepared event. */ + onCellPrepared?: (e: any) => void; + } + /** A data summarization widget for multi-dimensional data analysis and data mining. */ + export class dxPivotGrid extends Widget { + constructor(element: JQuery, options?: dxPivotGridOptions); + constructor(element: Element, options?: dxPivotGridOptions); + /** Gets the PivotGridDataSource instance. */ + getDataSource(): DevExpress.data.PivotGridDataSource; + /** Updates the widget to the size of its content. */ + updateDimensions(): void; + } + export interface dxPivotGridFieldChooserOptions extends WidgetOptions { + /** Specifies the field chooser layout. */ + layout?: number; + /** The data source of a dxPivotGrid widget. */ + dataSource?: DevExpress.data.PivotGridDataSource; + onContentReady?: Function; + /** Strings that can be changed or localized in the dxPivotGridFieldChooser widget. */ + texts?: { + /** The string to display instead of Row Fields. */ + rowFields?: string; + /** The string to display instead of Column Fields. */ + columnFields?: string; + /** The string to display instead of Data Fields. */ + dataFields?: string; + /** The string to display instead of Filter Fields. */ + filterFields?: string; + /** The string to display instead of All Fields. */ + allFields?: string; + }; + } + /** A complementary widget for dxPivotGrid that allows you to manage data displayed in the dxPivotGrid. */ + export class dxPivotGridFieldChooser extends Widget { + constructor(element: JQuery, options?: dxPivotGridFieldChooserOptions); + constructor(element: Element, options?: dxPivotGridFieldChooserOptions); + /** Updates the widget to the size of its content. */ + updateDimensions(): void; } } -declare module DevExpress.viz.charts { +declare module DevExpress.viz.charts { /** This section describes the fields and methods that can be used in code to manipulate the Series object. */ export interface BaseSeries { /** Provides information about the state of the series object. */ @@ -3180,7 +3725,9 @@ declare module DevExpress.viz.charts { type: string; /** Unselects all the selected points of the series. The points are displayed in an initial style. */ clearSelection(): void; - /** + /** Gets the color of a particular series. */ + getColor(): string; + /** * Gets a point from the series point collection based on the specified argument. * @deprecated getPointsByArg(pointArg).md */ @@ -3239,7 +3786,7 @@ declare module DevExpress.viz.charts { name: string; /** Returns the tag of the series. */ tag: string; - /** Hides a particular series. */ + /** Hides a series. */ hide(): void; /** Provides information about the hover state of a series. */ isHovered(): any; @@ -3307,7 +3854,7 @@ declare module DevExpress.viz.charts { name: string; /** Returns the tag of the series. */ tag: string; - /** Hides a particular series. */ + /** Hides a series. */ hide(): void; /** Provides information about the hover state of a series. */ isHovered(): any; @@ -3469,59 +4016,59 @@ declare module DevExpress.viz.charts { }; } export interface CommonPointOptions { - /** Specifies border options for points in the line and area series. */ - border?: viz.core.Border; - /** Specifies the points color. */ - color?: string; - /** Specifies what series points to highlight when a point is hovered over. */ - hoverMode?: string; - /** An object defining configuration options for a hovered point. */ - hoverStyle?: { - /** An object defining the border options for a hovered point. */ + /** Specifies border options for points in the line and area series. */ border?: viz.core.Border; - /** Sets a color for a point when it is hovered over. */ + /** Specifies the points color. */ color?: string; - /** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */ + /** Specifies what series points to highlight when a point is hovered over. */ + hoverMode?: string; + /** An object defining configuration options for a hovered point. */ + hoverStyle?: { + /** An object defining the border options for a hovered point. */ + border?: viz.core.Border; + /** Sets a color for a point when it is hovered over. */ + color?: string; + /** Specifies the diameter of a hovered point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies what series points to highlight when a point is selected. */ + selectionMode?: string; + /** An object defining configuration options for a selected point. */ + selectionStyle?: { + /** An object defining the border options for a selected point. */ + border?: viz.core.Border; + /**

                Sets a color for a point when it is selected.

                */ + color?: string; + /** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */ + size?: number; + }; + /** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */ size?: number; - }; - /** Specifies what series points to highlight when a point is selected. */ - selectionMode?: string; - /** An object defining configuration options for a selected point. */ - selectionStyle?: { - /** An object defining the border options for a selected point. */ - border?: viz.core.Border; - /**

                Sets a color for a point when it is selected.

                */ - color?: string; - /** Specifies the diameter of a selected point in the series that represents data points as symbols (not as bars for instance). */ - size?: number; - }; - /** Specifies the point diameter in pixels for those series that represent data points as symbols (not as bars for instance). */ - size?: number; - /** Specifies a symbol for presenting points of the line and area series. */ - symbol?: string; - visible?: boolean; + /** Specifies a symbol for presenting points of the line and area series. */ + symbol?: string; + visible?: boolean; } export interface ChartCommonPointOptions extends CommonPointOptions { - /** An object specifying the parameters of an image that is used as a point marker. */ - image?: { - /** Specifies the height of an image that is used as a point marker. */ - height?: any; - /** Specifies a URL leading to the image to be used as a point marker. */ - url?: any; - /** Specifies the width of an image that is used as a point marker. */ - width?: any; - }; + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: any; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: any; + /** Specifies the width of an image that is used as a point marker. */ + width?: any; + }; } export interface PolarCommonPointOptions extends CommonPointOptions { - /** An object specifying the parameters of an image that is used as a point marker. */ - image?: { - /** Specifies the height of an image that is used as a point marker. */ - height?: number; - /** Specifies a URL leading to the image to be used as a point marker. */ - url?: string; - /** Specifies the width of an image that is used as a point marker. */ - width?: number; - }; + /** An object specifying the parameters of an image that is used as a point marker. */ + image?: { + /** Specifies the height of an image that is used as a point marker. */ + height?: number; + /** Specifies a URL leading to the image to be used as a point marker. */ + url?: string; + /** Specifies the width of an image that is used as a point marker. */ + width?: number; + }; } /** An object that defines configuration options for chart series. */ export interface CommonSeriesConfig extends BaseCommonSeriesConfig { @@ -3904,17 +4451,17 @@ declare module DevExpress.viz.charts { text?: string; } export interface AxisLabel { - /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */ + /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a label on the value axis. */ customizeHint?: (argument: { value: any; valueText: string }) => string; - /** Specifies a callback function that returns the text to be displayed in value axis labels. */ + /** Specifies a callback function that returns the text to be displayed in value axis labels. */ customizeText?: (argument: { value: any; valueText: string }) => string; - /** Specifies a format for the text displayed by axis labels. */ + /** Specifies a format for the text displayed by axis labels. */ format?: string; - /** Specifies a precision for the formatted value displayed in the axis labels. */ + /** Specifies a precision for the formatted value displayed in the axis labels. */ precision?: number; } - export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel { } - export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel { } + export interface ChartAxisLabel extends ChartCommonAxisLabel, AxisLabel {} + export interface PolarAxisLabel extends PolarCommonAxisLabel, AxisLabel {} export interface AxisTitle extends CommonAxisTitle { /** Specifies the text for the value axis title. */ text?: string; @@ -3930,7 +4477,7 @@ declare module DevExpress.viz.charts { value?: any; } export interface PolarConstantLine extends PolarCommonConstantLineStyle { - /** An object defining constant line label options. */ + /** An object defining constant line label options. */ label?: PolarConstantLineLabel; /** Specifies a value to be displayed by a constant line. */ value?: any; @@ -3983,7 +4530,7 @@ declare module DevExpress.viz.charts { /** Specifies the elements that will be highlighted when the argument axis is hovered over. */ hoverMode?: string; } - export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis { } + export interface ChartArgumentAxis extends ChartAxis, ArgumentAxis {} export interface PolarArgumentAxis extends PolarAxis, ArgumentAxis { /** Specifies a start angle for the argument axis in degrees. */ startAngle?: number; @@ -3999,7 +4546,7 @@ declare module DevExpress.viz.charts { showZero?: boolean; /** Specifies the desired type of axis values. */ valueType?: string; - } + } export interface ChartValueAxis extends ChartAxis, ValueAxis { /** Specifies the spacing, in pixels, between multiple value axes in a chart. */ multipleAxesSpacing?: number; @@ -4106,8 +4653,6 @@ declare module DevExpress.viz.charts { series?: any; /** Specifies the size of the widget in pixels. */ size?: viz.core.Size; - /** Sets the name of the theme to be used in the chart. */ - theme?: string; /** Specifies a title for the chart. */ title?: { /** Specifies font options for the title. */ @@ -4157,7 +4702,7 @@ declare module DevExpress.viz.charts { asyncSeriesRendering?: boolean; }): void; } - export interface AdvancedLegend extends core.BaseLegend { + export interface AdvancedLegend extends core.BaseLegend { /** Specifies the text for a hint that appears when a user hovers the mouse pointer over a legend item. */ customizeHint?: (seriesInfo: { seriesName: string; seriesIndex: number; seriesColor: string; }) => string; /**

                Specifies a callback function that returns the text to be displayed by legend items.

                */ @@ -4198,7 +4743,7 @@ declare module DevExpress.viz.charts { /** Specifies whether a single series or multiple series can be selected in the chart. */ seriesSelectionMode?: string; /** Specifies how the chart must behave when series point labels overlap. */ - resolveLabelOverlapping?: string; + resolveLabelOverlapping?: string; } export interface Legend extends AdvancedLegend { /** Specifies whether the legend is located outside or inside the chart's plot. */ @@ -4263,7 +4808,7 @@ declare module DevExpress.viz.charts { maxBubbleSize?: number; /** Specifies the diameter of the smallest bubble measured in pixels. */ minBubbleSize?: number; - /** Defines the dxChart widget's pane(s). */ + /** Defines the dxChart widget's pane(s). */ panes?: Array; /** Swaps the axes round so that the value axis becomes horizontal and the argument axes becomes vertical. */ rotated?: boolean; @@ -4393,7 +4938,7 @@ declare module DevExpress.viz.charts { onLegendClick?: any; legendClick?: any; /** Specifies how the chart must behave when series point labels overlap. */ - resolveLabelOverlapping?: string; + resolveLabelOverlapping?: string; } /** A circular chart widget for HTML JS applications. */ export class dxPieChart extends BaseChart { @@ -4403,7 +4948,7 @@ declare module DevExpress.viz.charts { getSeries(): PieSeries; } } -declare module DevExpress.viz.core { +declare module DevExpress.viz.core { export interface Border { /** Sets a border color for a selected series. */ color?: string; @@ -4465,8 +5010,7 @@ declare module DevExpress.viz.core { border?: viz.core.DashedBorderWithOpacity; /** Specifies a color for the tooltip. */ color?: string; - customizeText?: Function; - /** Specifies text and appearance of a particular set of tooltips. */ + /** Specifies text and appearance of a set of tooltips. */ customizeTooltip?: (arg: Object) => { color?: string; text?: string }; /** Specifies whether or not the tooltip is enabled. */ enabled?: boolean; @@ -4527,8 +5071,6 @@ declare module DevExpress.viz.core { columnCount?: number; /** Specifies the spacing between a pair of neighboring legend columns in pixels. */ columnItemSpacing?: number; - /** Specifies whether or not item columns in the legend have an equal width. */ - equalColumnWidth?: boolean; /** Specifies font options for legend items. */ font?: viz.core.Font; /** Specifies the legend's position on the map. */ @@ -4573,21 +5115,23 @@ declare module DevExpress.viz.core { }) => void; /** A handler for the incidentOccurred event. */ onIncidentOccurred?: ( - component: BaseWidget, - element: Element, - target: { - id: string; - type: string; - args: any; - text: string; - widget: string; - version: string; - } + component: BaseWidget, + element: Element, + target: { + id: string; + type: string; + args: any; + text: string; + widget: string; + version: string; + } ) => void; /** Notifies a widget that it is embedded into an HTML page that uses a path modifier. */ pathModified?: boolean; /** Specifies whether or not the widget supports right-to-left representation. */ rtlEnabled?: boolean; + /** Sets the name of the theme to be used in the widget. */ + theme?: string; } /** This section describes options and methods that are common to all widgets. */ export class BaseWidget extends DOMComponent { @@ -4595,7 +5139,7 @@ declare module DevExpress.viz.core { svg(): string; } } -declare module DevExpress.viz.gauges { +declare module DevExpress.viz.gauges { export interface BaseRangeContainer { /** Specifies a range container's background color. */ backgroundColor?: string; @@ -4726,8 +5270,6 @@ declare module DevExpress.viz.gauges { /** Specifies a text for the subtitle. */ text?: string; }; - /** Specifies the name of the theme to be applied. */ - theme?: string; /** Specifies a title for a gauge. */ title?: { /** Specifies font options for the title. */ @@ -4905,7 +5447,7 @@ declare module DevExpress.viz.gauges { values(values: Array): void; } } -declare module DevExpress.viz.map { +declare module DevExpress.viz.map { /** This section describes the fields and methods that can be used in code to manipulate the Area object. */ export interface Area { /** Contains the element type. */ @@ -4916,6 +5458,8 @@ declare module DevExpress.viz.map { selected(): boolean; /** Sets a new selection state for an area. */ selected(state: boolean): void; + /** Applies the area settings specified as a parameter and updates the area appearance. */ + applySettings(settings: any): void; } /** This section describes the fields and methods that can be used in code to manipulate the Markers object. */ export interface Marker { @@ -4937,6 +5481,8 @@ declare module DevExpress.viz.map { selected(): boolean; /** Sets a new selection state for a marker. */ selected(state: boolean): void; + /** Applies the marker settings specified as a parameter and updates the marker appearance. */ + applySettings(settings: any): void; } export interface AreaSettings { /** Specifies the width of the area border in pixels. */ @@ -5065,6 +5611,8 @@ declare module DevExpress.viz.map { horizontalAlignment?: string; /** Specifies the position of the control bar. */ verticalAlignment?: string; + /** Specifies the opacity of the Control_Bar. */ + opacity?: number; }; /** Specifies the appearance of the loading indicator. */ loadingIndicator?: viz.core.LoadingIndicator; @@ -5076,8 +5624,6 @@ declare module DevExpress.viz.map { markerSettings?: MarkerSettings; /** Specifies the size of the dxVectorMap widget. */ size?: viz.core.Size; - /** Specifies the name of the theme to be applied. */ - theme?: Object; /** Specifies tooltip options. */ tooltip?: viz.core.Tooltip; /** Configures map legends. */ @@ -5099,6 +5645,8 @@ declare module DevExpress.viz.map { }) => void; /** Specifies a number that is used to zoom a map initially. */ zoomFactor?: number; + /** Specifies a map's maximum zoom factor. */ + maxZoomFactor?: number; zoomFactorChanged?: (zoomFactor: number) => void; /** A handler for the zoomFactorChanged event. */ onZoomFactorChanged?: (e: { @@ -5172,7 +5720,7 @@ declare module DevExpress.viz.map { zoomFactor(zoomFactor: number): void; } } -declare module DevExpress.viz.rangeSelector { +declare module DevExpress.viz.rangeSelector { export interface dxRangeSelectorOptions extends viz.core.BaseWidgetOptions { /** Specifies the options for the range selector's background. */ background?: { @@ -5346,6 +5894,15 @@ Specifies an interval between minor ticks. /** Specifies the end value of the range to be selected when displaying the dxRangeSelector widget on a page. */ endValue?: any; }; + /** Specifies the color of the selected range. */ + selectedRangeColor?: string; + /** Range selector's indent options. */ + indent?: { + /** Specifies range selector's left indent. */ + left?: number; + /** Specifies range selector's right indent. */ + right?: number; + }; selectedRangeChanged?: (selectedRange: { startValue: any; endValue: any; }) => void; /** A handler for the selectedRangeChanged event. */ onSelectedRangeChanged?: (e: { @@ -5354,7 +5911,7 @@ Specifies an interval between minor ticks. component: dxRangeSelector; element: Element; }) => void; - /** Specifies the options of the range selector's shutters. */ + /** Specifies range selector shutter options. */ shutter?: { /** Specifies shutter color. */ color?: string; @@ -5384,9 +5941,21 @@ Specifies an interval between minor ticks. format?: string; /** Specifies the color used for the slider marker text when the currently selected range does not match the minRange and maxRange values. */ invalidRangeColor?: string; - /** Specifies the empty space between the marker's border and the marker’s text. */ + /** + * Specifies the empty space between the marker's border and the marker’s text. + * @deprecated Use the 'paddingTopBottom' and 'paddingLeftRight' options instead + */ padding?: number; - /** Specifies in pixels the height and width of the space reserved for the range selector slider markers. */ + /** Specifies the empty space between the marker's top and bottom borders and the marker's text. */ + paddingTopBottom?: number; + /** Specifies the empty space between the marker's left and right borders and the marker's text. */ + paddingLeftRight?: number; + /** Specifies the placeholder height of the slider marker. */ + placeholderHeight?: number; + /** + * Specifies in pixels the height and width of the space reserved for the range selector slider markers. + * @deprecated Use the 'placeholderHeight' and 'indent' options instead + */ placeholderSize?: { /** Specifies the height of the placeholder for the left and right slider markers. */ height?: number; @@ -5403,8 +5972,6 @@ Specifies an interval between minor ticks. /** Indicates whether or not the slider markers are visible. */ visible?: boolean; }; - /** Sets the name of the theme to be used by the range selector. */ - theme?: string; } /** A widget that allows end users to select a range of values on a scale. */ export class dxRangeSelector extends viz.core.BaseWidget { @@ -5422,11 +5989,17 @@ Specifies an interval between minor ticks. setSelectedRange(selectedRange: { startValue: any; endValue: any; }): void; } } -declare module DevExpress.viz.sparklines { +declare module DevExpress.viz.sparklines { export interface SparklineTooltip extends viz.core.Tooltip { - /** Specifies how a tooltip is horizontally aligned relative to the graph. */ + /** + * Specifies how a tooltip is horizontally aligned relative to the graph. + * @deprecated Tooltip alignment is no more available. + */ horizontalAlignment?: string; - /** Specifies how a tooltip is vertically aligned relative to the graph. */ + /** + * Specifies how a tooltip is vertically aligned relative to the graph. + * @deprecated Tooltip alignment is no more available. + */ verticalAlignment?: string; } export interface BaseSparklineOptions extends viz.core.BaseWidgetOptions { @@ -5434,8 +6007,6 @@ declare module DevExpress.viz.sparklines { margin?: viz.core.Margins; /** Specifies the size of the widget. */ size?: viz.core.Size; - /** Specifies the name of the theme to be applied. */ - theme?: string; /** Specifies tooltip options. */ tooltip?: SparklineTooltip; } @@ -5510,6 +6081,10 @@ declare module DevExpress.viz.sparklines { winColor?: string; /** Specifies a value that serves as a threshold for the sparkline of the winloss type. */ winlossThreshold?: number; + /** Specifies the minimum value of the sparkline value axis. */ + minValue?: number; + /** Specifies the maximum value of the sparkline's value axis. */ + maxValue?: number; } /** A sparkline widget. */ export class dxSparkline extends BaseSparkline { @@ -5517,7 +6092,7 @@ declare module DevExpress.viz.sparklines { constructor(element: Element, options?: dxSparklineOptions); } } -interface JQuery { +interface JQuery { dxProgressBar(): JQuery; dxProgressBar(options: "instance"): DevExpress.ui.dxProgressBar; dxProgressBar(options: string): any; @@ -5780,6 +6355,21 @@ interface JQuery { dxDataGrid(options: string): any; dxDataGrid(options: string, ...params: any[]): any; dxDataGrid(options: DevExpress.ui.dxDataGridOptions): JQuery; + dxPivotGrid(): JQuery; + dxPivotGrid(options: "instance"): DevExpress.ui.dxPivotGrid; + dxPivotGrid(options: string): any; + dxPivotGrid(options: string, ...params: any[]): any; + dxPivotGrid(options: DevExpress.ui.dxPivotGridOptions): JQuery; + dxPivotGridFieldChooser(): JQuery; + dxPivotGridFieldChooser(options: "instance"): DevExpress.ui.dxPivotGridFieldChooser; + dxPivotGridFieldChooser(options: string): any; + dxPivotGridFieldChooser(options: string, ...params: any[]): any; + dxPivotGridFieldChooser(options: DevExpress.ui.dxPivotGridFieldChooserOptions): JQuery; + dxScheduler(): JQuery; + dxScheduler(options: "instance"): DevExpress.ui.dxScheduler; + dxScheduler(options: string): any; + dxScheduler(options: string, ...params: any[]): any; + dxScheduler(options: DevExpress.ui.dxSchedulerOptions): JQuery; dxChart(options?: DevExpress.viz.charts.dxChartOptions): JQuery; dxChart(methodName: string, ...params: any[]): any; dxChart(methodName: "instance"): DevExpress.viz.charts.dxChart; From 48df6f8dd4ebd0a09bb980a5bcd2acbc41217c31 Mon Sep 17 00:00:00 2001 From: Igor Kriklivets Date: Fri, 5 Jun 2015 18:57:28 +0300 Subject: [PATCH 413/534] Path to jQuery.d.ts changed --- devextreme/14.2/dx.devextreme-14.2.7.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devextreme/14.2/dx.devextreme-14.2.7.d.ts b/devextreme/14.2/dx.devextreme-14.2.7.d.ts index a1d361f54..c8827de9c 100644 --- a/devextreme/14.2/dx.devextreme-14.2.7.d.ts +++ b/devextreme/14.2/dx.devextreme-14.2.7.d.ts @@ -1,9 +1,9 @@ -// Type definitions for DevExtreme 14.2.7 +// Type definitions for DevExtreme 14.2.7 // Project: http://js.devexpress.com/ // Definitions by: DevExpress Inc. // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module DevExpress { /** A mixin that provides a capability to fire and subscribe to events. */ From 279425d25fbe4e7a3a3ae5ff429c0c0124c23473 Mon Sep 17 00:00:00 2001 From: Lucy He Date: Fri, 5 Jun 2015 18:04:26 -0400 Subject: [PATCH 414/534] Add typing for addResources. Export i18next-client module. --- i18next/i18next-tests.ts | 18 ++++++++++++++++++ i18next/i18next.d.ts | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/i18next/i18next-tests.ts b/i18next/i18next-tests.ts index b1732de11..741f12982 100644 --- a/i18next/i18next-tests.ts +++ b/i18next/i18next-tests.ts @@ -665,6 +665,24 @@ describe('i18next', function () { }); + describe('adding resources after initialisation', function () { + + var frResource = { 'simple_fr': 'ok_from_fr' }; + var enResource = { 'simple_en': 'ok_from_en' }; + + beforeEach(function (done) { + i18n.init({ resStore: {} }, + function (t) { done(); }); + }); + + it('it should use resources for translation added after initialisation', function () { + i18n.addResources('fr', 'translation', frResource); + i18n.addResources('en', 'translation', enResource); + expect(i18n.t('simple_fr', { lng: 'fr' })).to.be('ok_from_fr'); + expect(i18n.t('simple_en', { lng: 'en' })).to.be('ok_from_en'); + }); + + }); }); describe('translation functionality', function () { diff --git a/i18next/i18next.d.ts b/i18next/i18next.d.ts index 3463f2426..4d7d5945b 100644 --- a/i18next/i18next.d.ts +++ b/i18next/i18next.d.ts @@ -66,6 +66,7 @@ interface I18nextOptions { interface I18nextStatic { + addResources(language: string, namespace: string, resources: IResourceStoreKey): void; addPostProcessor(name: string, fn: (value: any, key: string, options: any) => string): void; detectLanguage(): string; functions: { @@ -130,4 +131,8 @@ declare var i18n: I18nextStatic; declare module 'i18next' { export = i18n; +} + +declare module 'i18next-client' { + export = i18n; } \ No newline at end of file From f3797dc8504128fba6810be381c2983e7cfc05e8 Mon Sep 17 00:00:00 2001 From: Lucy He Date: Fri, 5 Jun 2015 18:10:15 -0400 Subject: [PATCH 415/534] Move function so typings are alphabetical. --- i18next/i18next.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18next/i18next.d.ts b/i18next/i18next.d.ts index 4d7d5945b..f39095459 100644 --- a/i18next/i18next.d.ts +++ b/i18next/i18next.d.ts @@ -66,8 +66,8 @@ interface I18nextOptions { interface I18nextStatic { - addResources(language: string, namespace: string, resources: IResourceStoreKey): void; addPostProcessor(name: string, fn: (value: any, key: string, options: any) => string): void; + addResources(language: string, namespace: string, resources: IResourceStoreKey): void; detectLanguage(): string; functions: { extend(target: any, ...objs: any[]): Object; From ed5be30e622dbfd9a302a310e5322dbee759cfc9 Mon Sep 17 00:00:00 2001 From: Kenneth Kolstad Date: Fri, 5 Jun 2015 15:48:45 -0700 Subject: [PATCH 416/534] lodash: add generic _.remove --- lodash/lodash-tests.ts | 1 + lodash/lodash.d.ts | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2017252ff..f45f2fb04 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -270,6 +270,7 @@ result = _.range(0); result = _.remove([1, 2, 3, 4, 5, 6], function (num: number) { return num % 2 == 0; }); result = _.remove(foodsOrganic, 'organic'); result = _.remove(foodsType, { 'type': 'vegetable' }); +var typedResult: IFoodType[] = _.remove([ { name: 'apple' }, { name: 'orange' }], { name: 'orange' }); result = _.sortedIndex([20, 30, 50], 40); result = _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index dfa5e2e6a..a3523fe9f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1296,6 +1296,14 @@ declare module _ { remove( array: List, wherealue?: Dictionary): any[]; + + /** + * @see _.remove + * @param item The item to remove + **/ + remove( + array:Array, + item:T): T[]; } //_.rest From 40b0c2661875cf6fcb3765f9a4325395b903b105 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Fri, 5 Jun 2015 15:58:51 -0700 Subject: [PATCH 417/534] Update angular2.d.ts for alpha.26 --- angular2/angular2-tests.ts | 5 +- angular2/angular2.d.ts | 5556 +++++++++++++++++++++++++++++++++--- 2 files changed, 5144 insertions(+), 417 deletions(-) diff --git a/angular2/angular2-tests.ts b/angular2/angular2-tests.ts index bdd2628e5..80c7e3cd9 100644 --- a/angular2/angular2-tests.ts +++ b/angular2/angular2-tests.ts @@ -2,7 +2,6 @@ // Use Typescript 1.4 style imports import ng = require("angular2/angular2"); -import di = require("angular2/di"); class Service { @@ -17,11 +16,11 @@ class Cmp { Cmp.annotations = [ ng.Component({ selector: 'cmp', - injectables: [Service, di.bind(Service2).toValue(null)] + injectables: [Service, ng.bind(Service2).toValue(null)] }), ng.View({ template: '{{greeting}} world!', - directives: [ng.For, ng.If] + directives: [ng.NgFor, ng.NgIf] }) ]; diff --git a/angular2/angular2.d.ts b/angular2/angular2.d.ts index fa3cc7788..b70c4577d 100644 --- a/angular2/angular2.d.ts +++ b/angular2/angular2.d.ts @@ -1,299 +1,1839 @@ -// Type definitions for Angular v2.0.0-alpha.22 +// Type definitions for Angular v2.0.0-alpha.26 // Project: http://angular.io/ // Definitions by: angular team // Definitions: https://github.com/borisyankov/DefinitelyTyped -/****************** - * This is a minimal type definition for the Angular2 quickstart. - * We plan to publish a complete definition soon. - ******************/ +// *********************************************************** +// This file is generated by the Angular build process. +// Please do not create manual edits or send pull requests +// modifying this file. +// *********************************************************** + +// Angular depends transitively on these libraries. +// If you don't have them installed you can run +// $ tsd query es6-promise rx rx-lite --action install --save +/// +/// interface List extends Array {} +interface Map {} +interface StringMap extends Map {} interface Type {} -interface _ComponentArg { - /** - * The CSS selector that triggers the instantiation of a directive. - * - * Angular only allows directives to trigger on CSS selectors that do not cross element boundaries. - * - * `selector` may be declared as one of the following: - * - * - `element-name`: select by element name. - * - `.class`: select by class name. - * - `[attribute]`: select by attribute name. - * - `[attribute=value]`: select by attribute name and value. - * - `:not(sub_selector)`: select only if the element does not match the `sub_selector`. - * - `selector1, selector2`: select if either `selector1` or `selector2` matches. - * - * - * ## Example - * - * Suppose we have a directive with an `input[type=text]` selector. - * - * And the following HTML: - * - * ```html - * - * - * - * - * ``` - * - * The directive would only be instantiated on the `` element. - * - */ - selector: string; +declare module "angular2/angular2" { + type SetterFn = typeof Function; + type int = number; + + // See https://github.com/Microsoft/TypeScript/issues/1168 + class BaseException /* extends Error */ { + message: any; + stack: any; + toString(): string; + } +} + + +declare module "angular2/angular2" { + class AbstractChangeDetector extends ChangeDetector { + addChild(cd: ChangeDetector): any; + addShadowDomChild(cd: ChangeDetector): any; + callOnAllChangesDone(): any; + checkNoChanges(): any; + detectChanges(): any; + detectChangesInRecords(throwOnChange: boolean): any; + lightDomChildren: List; + markAsCheckOnce(): any; + markPathToRootAsCheckOnce(): any; + mode: string; + parent: ChangeDetector; + ref: ChangeDetectorRef; + remove(): any; + removeChild(cd: ChangeDetector): any; + removeShadowDomChild(cd: ChangeDetector): any; + shadowDomChildren: List; + } + class ProtoRecord { + args: List; + bindingRecord: BindingRecord; + contextIndex: number; + directiveIndex: DirectiveIndex; + expressionAsString: string; + fixedArgs: List; + funcOrValue: any; + isLifeCycleRecord(): boolean; + isPipeRecord(): boolean; + isPureFunction(): boolean; + lastInBinding: boolean; + lastInDirective: boolean; + mode: number; + name: string; + selfIndex: number; + } + + /** - * Enumerates the set of properties that accept data binding for a directive. - * - * The `properties` property defines a set of `directiveProperty` to `bindingProperty` - * key-value pairs: - * - * - `directiveProperty` specifies the component property where the value is written. - * - `bindingProperty` specifies the DOM property where the value is read from. - * - * You can include a {@link Pipe} when specifying a `bindingProperty` to allow for data transformation and structural - * change detection of the value. These pipes will be evaluated in the context of this component. - * - * - * ## Syntax - * + * Directives allow you to attach behavior to elements in the DOM. + * + * Directives with an embedded view are called Components. + * + * A directive consists of a single directive annotation and a controller class. When the + * directive's `selector` matches + * elements in the DOM, the following steps occur: + * + * 1. For each directive, the `ElementInjector` attempts to resolve the directive's constructor + * arguments. + * 2. Angular instantiates directives for each matched element using `ElementInjector` in a + * depth-first order, + * as declared in the HTML. + * + * ## Understanding How Injection Works + * + * There are three stages of injection resolution. + * - *Pre-existing Injectors*: + * - The terminal Injector cannot resolve dependencies. It either throws an error or, if + * the dependency was + * specified as `@Optional`, returns `null`. + * - The platform injector resolves browser singleton resources, such as: cookies, title, + * location, and others. + * - *Component Injectors*: Each component instance has its own Injector, and they follow + * the same parent-child hierarchy + * as the component instances in the DOM. + * - *Element Injectors*: Each component instance has a Shadow DOM. Within the Shadow DOM each + * element has an `ElementInjector` + * which follow the same parent-child hierarchy as the DOM elements themselves. + * + * When a template is instantiated, it also must instantiate the corresponding directives in a + * depth-first order. The + * current `ElementInjector` resolves the constructor dependencies for each directive. + * + * Angular then resolves dependencies as follows, according to the order in which they appear in the + * View: + * + * 1. Dependencies on the current element + * 2. Dependencies on element injectors and their parents until it encounters a Shadow DOM boundary + * 3. Dependencies on component injectors and their parents until it encounters the root component + * 4. Dependencies on pre-existing injectors + * + * + * The `ElementInjector` can inject other directives, element-specific special objects, or it can + * delegate to the parent + * injector. + * + * To inject other directives, declare the constructor parameter as: + * - `directive:DirectiveType`: a directive on the current element only + * - `@Ancestor() directive:DirectiveType`: any directive that matches the type between the current + * element and the + * Shadow DOM root. Current element is not included in the resolution, therefore even if it could + * resolve it, it will + * be ignored. + * - `@Parent() directive:DirectiveType`: any directive that matches the type on a direct parent + * element only. + * - `@Query(DirectiveType) query:QueryList`: A live collection of direct child + * directives. + * - `@QueryDescendants(DirectiveType) query:QueryList`: A live collection of any + * child directives. + * + * To inject element-specific special objects, declare the constructor parameter as: + * - `element: ElementRef` to obtain a reference to logical element in the view. + * - `viewContainer: ViewContainerRef` to control child template instantiation, for + * Directive directives only + * - `bindingPropagation: BindingPropagation` to control change detection in a more granular way. + * + * ## Example + * + * The following example demonstrates how dependency injection resolves constructor arguments in + * practice. + * + * + * Assume this HTML template: + * * ``` + *
                + *
                + *
                + *
                + *
                + *
                + *
                + *
                + *
                + *
                + * ``` + * + * With the following `dependency` decorator and `SomeService` injectable class. + * + * ``` + * @Injectable() + * class SomeService { + * } + * * @Directive({ - * properties: { - * 'directiveProperty1': 'bindingProperty1', - * 'directiveProperty2': 'bindingProperty2 | pipe1 | ...', - * ... + * selector: '[dependency]', + * properties: [ + * 'id: dependency' + * ] + * }) + * class Dependency { + * id:string; + * } + * ``` + * + * Let's step through the different ways in which `MyDirective` could be declared... + * + * + * ### No injection + * + * Here the constructor is declared with no arguments, therefore nothing is injected into + * `MyDirective`. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor() { * } * } * ``` - * - * - * ## Basic Property Binding - * - * We can easily build a simple `Tooltip` directive that exposes a `tooltip` property, which can be used in templates - * with standard Angular syntax. For example: - * + * + * This directive would be instantiated with no dependencies. + * + * + * ### Component-level injection + * + * Directives can inject any injectable instance from the closest component injector or any of its + * parents. + * + * Here, the constructor declares a parameter, `someService`, and injects the `SomeService` type + * from the parent + * component's injector. + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(someService: SomeService) { + * } + * } + * ``` + * + * This directive would be instantiated with a dependency on `SomeService`. + * + * + * ### Injecting a directive from the current element + * + * Directives can inject other directives declared on the current element. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(dependency: Dependency) { + * expect(dependency.id).toEqual(3); + * } + * } + * ``` + * This directive would be instantiated with `Dependency` declared at the same element, in this case + * `dependency="3"`. + * + * + * ### Injecting a directive from a direct parent element + * + * Directives can inject other directives declared on a direct parent element. By definition, a + * directive with a + * `@Parent` annotation does not attempt to resolve dependencies for the current element, even if + * this would satisfy + * the dependency. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Parent() dependency: Dependency) { + * expect(dependency.id).toEqual(2); + * } + * } + * ``` + * This directive would be instantiated with `Dependency` declared at the parent element, in this + * case `dependency="2"`. + * + * + * ### Injecting a directive from any ancestor elements + * + * Directives can inject other directives declared on any ancestor element (in the current Shadow + * DOM), i.e. on the + * parent element and its parents. By definition, a directive with an `@Ancestor` annotation does + * not attempt to + * resolve dependencies for the current element, even if this would satisfy the dependency. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Ancestor() dependency: Dependency) { + * expect(dependency.id).toEqual(2); + * } + * } + * ``` + * + * Unlike the `@Parent` which only checks the parent, `@Ancestor` checks the parent, as well as its + * parents recursively. If `dependency="2"` didn't exist on the direct parent, this injection would + * have returned + * `dependency="1"`. + * + * + * ### Injecting a live collection of direct child directives + * + * + * A directive can also query for other child directives. Since parent directives are instantiated + * before child directives, a directive can't simply inject the list of child directives. Instead, + * the directive injects a QueryList, which updates its contents as children are added, + * removed, or moved by a directive that uses a ViewContainerRef such as a `ng-for`, an + * `ng-if`, or an `ng-switch`. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Query(Dependency) dependencies:QueryList) { + * } + * } + * ``` + * + * This directive would be instantiated with a QueryList which contains `Dependency` 4 and + * 6. Here, `Dependency` 5 would not be included, because it is not a direct child. + * + * ### Injecting a live collection of descendant directives + * + * Note: This is will be implemented in later release. () + * + * Similar to `@Query` above, but also includes the children of the child elements. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@QueryDescendents(Dependency) dependencies:QueryList) { + * } + * } + * ``` + * + * This directive would be instantiated with a Query which would contain `Dependency` 4, 5 and 6. + * + * ### Optional injection + * + * The normal behavior of directives is to return an error when a specified dependency cannot be + * resolved. If you + * would like to inject `null` on unresolved dependency instead, you can annotate that dependency + * with `@Optional()`. + * This explicitly permits the author of a template to treat some of the surrounding directives as + * optional. + * + * ``` + * @Directive({ selector: '[my-directive]' }) + * class MyDirective { + * constructor(@Optional() dependency:Dependency) { + * } + * } + * ``` + * + * This directive would be instantiated with a `Dependency` directive found on the current element. + * If none can be + * found, the injector supplies `null` instead of throwing an error. + * + * ## Example + * + * Here we use a decorator directive to simply define basic tool-tip behavior. + * * ``` * @Directive({ * selector: '[tooltip]', - * properties: { - * 'text': 'tooltip' - * } - * }) - * class Tooltip { - * set text(text) { - * // This will get called every time the 'tooltip' binding changes with the new value. - * } - * } - * ``` - * - * We can then bind to the `tooltip' property as either an expression (`someExpression`) or as a string literal, as - * shown in the HTML template below: - * - * ```html - *
                ...
                - *
                ...
                - * ``` - * - * Whenever the `someExpression` expression changes, the `properties` declaration instructs - * Angular to update the `Tooltip`'s `text` property. - * - * - * - * ## Bindings With Pipes - * - * You can also use pipes when writing binding definitions for a directive. - * - * For example, we could write a binding that updates the directive on structural changes, rather than on reference - * changes, as normally occurs in change detection. - * - * See {@link Pipe} and {@link keyValDiff} documentation for more details. - * - * ``` - * @Directive({ - * selector: '[class-set]', - * properties: { - * 'classChanges': 'classSet | keyValDiff' - * } - * }) - * class ClassSet { - * set classChanges(changes:KeyValueChanges) { - * // This will get called every time the `class-set` expressions changes its structure. - * } - * } - * ``` - * - * The template that this directive is used in may also contain its own pipes. For example: - * - * ```html - *
                - * ``` - * - * In this case, the two pipes compose as if they were inlined: `someExpression | somePipe | keyValDiff`. - * - */ - properties?: Object; - - /** - * Specifies which DOM hostListeners a directive listens to. - * - * The `hostListeners` property defines a set of `event` to `method` key-value pairs: - * - * - `event1`: the DOM event that the directive listens to. - * - `statement`: the statement to execute when the event occurs. - * If the evalutation of the statement returns `false`, then `preventDefault`is applied on the DOM event. - * - * To listen to global events, a target must be added to the event name. - * The target can be `window`, `document` or `body`. - * - * When writing a directive event binding, you can also refer to the following local variables: - * - `$event`: Current event object which triggered the event. - * - `$target`: The source of the event. This will be either a DOM element or an Angular directive. - * (will be implemented in later release) - * - * - * ## Syntax - * - * ``` - * @Directive({ + * properties: [ + * 'text: tooltip' + * ], * hostListeners: { - * 'event1': 'onMethod1(arguments)', - * 'target:event2': 'onMethod2(arguments)', - * ... - * } - * } - * ``` - * - * ## Basic Event Binding: - * - * Suppose you want to write a directive that triggers on `change` events in the DOM and on `resize` events in window. - * You would define the event binding as follows: - * - * ``` - * @Directive({ - * selector: 'input', - * hostListeners: { - * 'change': 'onChange($event)', - * 'window:resize': 'onResize($event)' + * 'onmouseenter': 'onMouseEnter()', + * 'onmouseleave': 'onMouseLeave()' * } * }) - * class InputDirective { - * onChange(event:Event) { + * class Tooltip{ + * text:string; + * overlay:Overlay; // NOT YET IMPLEMENTED + * overlayManager:OverlayManager; // NOT YET IMPLEMENTED + * + * constructor(overlayManager:OverlayManager) { + * this.overlay = overlay; * } - * onResize(event:Event) { + * + * onMouseEnter() { + * // exact signature to be determined + * this.overlay = this.overlayManager.open(text, ...); + * } + * + * onMouseLeave() { + * this.overlay.close(); + * this.overlay = null; * } * } * ``` - * - * Here the `onChange` method of `InputDirective` is invoked whenever the DOM element fires the 'change' event. - * + * In our HTML template, we can then add this behavior to a `
                ` or any other element with the + * `tooltip` selector, + * like so: + * + * ``` + *
                + * ``` + * + * Directives can also control the instantiation, destruction, and positioning of inline template + * elements: + * + * A directive uses a ViewContainerRef to instantiate, insert, move, and destroy views at + * runtime. + * The ViewContainerRef is created as a result of `