From 88b29b7995a27a11dfc241cb236c926e151b0a3e Mon Sep 17 00:00:00 2001 From: Alexey Gorshkov Date: Mon, 11 May 2015 01:51:24 +0300 Subject: [PATCH 001/474] Added jsurl --- jsurl/jsurl-tests.ts | 67 ++++++++++++++++++++++++++++++++++++++++++++ jsurl/jsurl.d.ts | 18 ++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 jsurl/jsurl-tests.ts create mode 100644 jsurl/jsurl.d.ts diff --git a/jsurl/jsurl-tests.ts b/jsurl/jsurl-tests.ts new file mode 100644 index 0000000000..f573feb49e --- /dev/null +++ b/jsurl/jsurl-tests.ts @@ -0,0 +1,67 @@ +/// + +var u = new Url; // curent document URL will be used +// or we can instantiate as +var u2 = new Url("http://example.com/some/path?a=b&c=d#someAnchor"); +// it should support relative URLs also +var u3 = new Url("/my/site/doc/path?foo=bar#baz"); + +// get the value of some query string parameter +alert(u2.query.a); +// or +alert(u3.query["foo"]); + +// Manupulating query string parameters +u.query.a = [1, 2, 3]; // adds/replaces in query string params a=1&a=2&a=3 +u.query.b = 'woohoo'; // adds/replaces in query string param b=woohoo + +if (u.query.a instanceof Array) { // the way to add a parameter + u.query.a.push(4); // now it's "a=1&a=2&a=3&a=4&b=woohoo" +} + +else { // if not an array but scalar value here is a way how to convert to array + u.query.a = [u.query.a]; + u.query.a.push(8) +} + + +// The way to remove the parameter: +delete u.query.a +// or: +delete u.query["a"] + +// If you need to remove all query string params: +u.query.clear(); +alert(u); + +// Lookup URL parts: +alert( + 'protocol = ' + u.protocol + '\n' + + 'user = ' + u.user + '\n' + + 'pass = ' + u.pass + '\n' + + 'host = ' + u.host + '\n' + + 'port = ' + u.port + '\n' + + 'path = ' + u.path + '\n' + + 'query = ' + u.query + '\n' + + 'hash = ' + u.hash + ); + +// Manipulating URL parts +u.path = '/some/new/path'; // the way to change URL path +u.protocol = 'https' // the way to force https protocol on the source URL + +// inject into string +var str = 'My Cool Link'; + +// or use in DOM context +var a = document.createElement('a'); +a.href = u; +a.innerHTML = 'test'; +document.body.appendChild(a); + +// Stringify +u += ''; +String(u); +u.toString(); +// NOTE, that usually it will be done automatically, so only in special +// cases direct stringify is required \ No newline at end of file diff --git a/jsurl/jsurl.d.ts b/jsurl/jsurl.d.ts new file mode 100644 index 0000000000..a5f7902578 --- /dev/null +++ b/jsurl/jsurl.d.ts @@ -0,0 +1,18 @@ +// Type definitions for jsurl 1.2.2 +// Project: https://github.com/Mikhus/jsurl +// Definitions by: Alexey Gorshkov +// Definitions: https://github.com/agorshkov23/DefinitelyTyped + +declare class Url { + constructor(url?: string); + query: any; + protocol: string; + user: string; + pass: string; + host: string; + port: string; + path: string; + hash: string; + href: string; + toString(): string; +} \ No newline at end of file From e4ff04e164e36ee9a9de52268be208f4a162c36e Mon Sep 17 00:00:00 2001 From: lgrignon Date: Mon, 14 Sep 2015 10:56:09 +0200 Subject: [PATCH 002/474] added polymer ts definition --- polymer-ts/polymer-ts.d.ts | 127 +++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 polymer-ts/polymer-ts.d.ts diff --git a/polymer-ts/polymer-ts.d.ts b/polymer-ts/polymer-ts.d.ts new file mode 100644 index 0000000000..4f44de6d28 --- /dev/null +++ b/polymer-ts/polymer-ts.d.ts @@ -0,0 +1,127 @@ +declare module polymer { + class PolymerBase extends HTMLElement { + $: any; + $$: any; + root: HTMLElement; + shadyRoot: HTMLElement; + style: CSSStyleDeclaration; + customStyle: { + [property: string]: string; + }; + arrayDelete(path: string, item: string | any): any; + async(callback: Function, waitTime?: number): any; + attachedCallback(): void; + attributeFollows(name: string, toElement: HTMLElement, fromElement: HTMLElement): void; + cancelAsync(handle: number): void; + cancelDebouncer(jobName: string): void; + classFollows(name: string, toElement: HTMLElement, fromElement: HTMLElement): void; + create(tag: string, props: Object): any; + debounce(jobName: string, callback: Function, wait?: number): void; + deserialize(value: string, type: any): any; + distributeContent(): void; + domHost(): void; + elementMatches(selector: string, node: Element): any; + fire(type: string, detail?: Object, options?: FireOptions): any; + flushDebouncer(jobName: string): void; + get(path: string | Array): any; + getContentChildNodes(slctr: string): any; + getContentChildren(slctr: string): any; + getNativePrototype(tag: string): any; + getPropertyInfo(property: string): any; + importHref(href: string, onload?: Function, onerror?: Function): any; + instanceTemplate(template: any): any; + isDebouncerActive(jobName: string): any; + linkPaths(to: string, from: string): void; + listen(node: Element, eventName: string, methodName: string): void; + mixin(target: Object, source: Object): void; + notifyPath(path: string, value: any, fromAbove?: any): void; + pop(path: string): any; + push(path: string, value: any): any; + reflectPropertyToAttribute(name: string): void; + resolveUrl(url: string): any; + scopeSubtree(container: Element, shouldObserve: boolean): void; + serialize(value: string): any; + serializeValueToAttribute(value: any, attribute: string, node: Element): void; + set(path: string, value: any, root?: Object): any; + setScrollDirection(direction: string, node: HTMLElement): void; + shift(path: string, value: any): any; + splice(path: string, start: number, deleteCount: number): any; + toggleAttribute(name: string, bool: boolean, node?: HTMLElement): void; + toggleClass(name: string, bool: boolean, node?: HTMLElement): void; + transform(transform: string, node?: HTMLElement): void; + translate3d(x: any, y: any, z: any, node?: HTMLElement): void; + unlinkPaths(path: string): void; + unshift(path: string, value: any): any; + updateStyles(): void; + } + interface dom { + (node: HTMLElement): HTMLElement; + (node: polymer.Base): HTMLElement; + flush(): any; + } + interface FireOptions { + node?: HTMLElement | polymer.Base; + bubbles?: boolean; + cancelable?: boolean; + } + interface Element { + properties?: Object; + listeners?: Object; + behaviors?: Object[]; + observers?: String[]; + factoryImpl?(...args: any[]): void; + ready?(): void; + created?(): void; + attached?(): void; + detached?(): void; + attributeChanged?(attrName: string, oldVal: any, newVal: any): void; + prototype?: Object; + } + interface PolymerTSElement { + $custom_cons?: FunctionConstructor; + $custom_cons_args?: any[]; + template?: string; + style?: string; + } + interface Property { + name?: string; + type?: any; + value?: any; + reflectToAttribute?: boolean; + readonly?: boolean; + notify?: boolean; + computed?: string; + observer?: string; + } + class Base extends polymer.PolymerBase implements polymer.Element { + static create(...args: any[]): T; + static register(): void; + is: string; + } + function createEs6PolymerBase(): void; + function prepareForRegistration(elementClass: Function): polymer.Element; + function createDomModule(definition: polymer.Element): void; + function createElement(element: new (...args: any[]) => T): new (...args: any[]) => T; + function createClass(element: new (...args: any[]) => T): new (...args: any[]) => T; + function isRegistered(element: polymer.Element): boolean; +} +declare var Polymer: { + (prototype: polymer.Element): FunctionConstructor; + Class(prototype: polymer.Element): Function; + dom: polymer.dom; + appendChild(node: HTMLElement): HTMLElement; + insertBefore(node: HTMLElement, beforeNode: HTMLElement): HTMLElement; + removeChild(node: HTMLElement): HTMLElement; + updateStyles(): void; + Base: any; +}; +declare function component(tagname: string, extendsTag?: string): (target: Function) => void; +declare function extend(tagname: string): (target: Function) => void; +declare function template(templateString: string): (target: Function) => void; +declare function style(styleString: string): (target: Function) => void; +declare function hostAttributes(attributes: Object): (target: Function) => void; +declare function property(ob?: polymer.Property): (target: polymer.Element, propertyKey: string) => void; +declare function computed(ob?: polymer.Property): (target: polymer.Element, computedFuncName: string) => void; +declare function listen(eventName: string): (target: polymer.Element, propertyKey: string) => void; +declare function behavior(behaviorObject: any): any; +declare function observe(observedProps: string): (target: polymer.Element, observerFuncName: string) => void; From da0bddb559bd1dc599237a0fbc808d45bb71ad87 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 18 Sep 2015 16:33:30 +0200 Subject: [PATCH 003/474] added backbone local storage def --- .../backbone.localStorage.d.ts | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 backbone.localStorage/backbone.localStorage.d.ts diff --git a/backbone.localStorage/backbone.localStorage.d.ts b/backbone.localStorage/backbone.localStorage.d.ts new file mode 100644 index 0000000000..b0a554828e --- /dev/null +++ b/backbone.localStorage/backbone.localStorage.d.ts @@ -0,0 +1,46 @@ + + +declare module Backbone { + interface Serializer { + serialize(item: any): any; + deserialize(data: any): any; + } + + declare class LocalStorage { + name: string; + serializer: Serializer; + records: string[]; + + constructor(name: string, serializer?: Serializer); + + save(); + + // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already + // have an id of it's own. + create(model: any): any; + + // Update a model by replacing its copy in `this.data`. + update(model: any): any; + + // Retrieve a model from `this.data` by id. + find(model: any): any; + + // Return the array of all models currently in storage. + findAll(): any; + + // Delete a model from `this.data`, returning it. + destroy(model: T): T; + + localStorage(): any; + + // Clear localStorage for specific collection. + _clear(): void; + + _storageSize(): number; + + _itemName(id): string; + }; +} + +export Store = Backbone.LocalStorage; + From ea76cec95c4f1698cda13ae5f0393eb30dcbc178 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 18 Sep 2015 16:40:41 +0200 Subject: [PATCH 004/474] wrong version committed --- backbone.localStorage/backbone.localStorage.d.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backbone.localStorage/backbone.localStorage.d.ts b/backbone.localStorage/backbone.localStorage.d.ts index b0a554828e..e0af97e1d2 100644 --- a/backbone.localStorage/backbone.localStorage.d.ts +++ b/backbone.localStorage/backbone.localStorage.d.ts @@ -1,12 +1,11 @@ - declare module Backbone { interface Serializer { serialize(item: any): any; deserialize(data: any): any; } - declare class LocalStorage { + class LocalStorage { name: string; serializer: Serializer; records: string[]; @@ -39,8 +38,8 @@ declare module Backbone { _storageSize(): number; _itemName(id): string; - }; + } } -export Store = Backbone.LocalStorage; +import Store = Backbone.LocalStorage; From 581d094508cb40e4b571e2027142d5dd6134722e Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 18 Sep 2015 16:44:37 +0200 Subject: [PATCH 005/474] added def typed header comments --- backbone.localStorage/backbone.localStorage.d.ts | 6 ++++++ polymer-ts/polymer-ts.d.ts | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/backbone.localStorage/backbone.localStorage.d.ts b/backbone.localStorage/backbone.localStorage.d.ts index e0af97e1d2..5696fa3d9f 100644 --- a/backbone.localStorage/backbone.localStorage.d.ts +++ b/backbone.localStorage/backbone.localStorage.d.ts @@ -1,3 +1,9 @@ +// Type definitions for backbone.localStorage 1.0.0 +// Project: https://github.com/jeromegn/Backbone.localStorage +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// declare module Backbone { interface Serializer { diff --git a/polymer-ts/polymer-ts.d.ts b/polymer-ts/polymer-ts.d.ts index 4f44de6d28..cd96dfe21a 100644 --- a/polymer-ts/polymer-ts.d.ts +++ b/polymer-ts/polymer-ts.d.ts @@ -1,3 +1,8 @@ +// Type definitions for PolymerTS 0.1.17 +// Project: https://github.com/nippur72/PolymerTS +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module polymer { class PolymerBase extends HTMLElement { $: any; From 99a76bb80179d43f48d5e942257135e41ddc4781 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 18 Sep 2015 16:46:49 +0200 Subject: [PATCH 006/474] fixed implicit any --- backbone.localStorage/backbone.localStorage.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backbone.localStorage/backbone.localStorage.d.ts b/backbone.localStorage/backbone.localStorage.d.ts index 5696fa3d9f..122c475876 100644 --- a/backbone.localStorage/backbone.localStorage.d.ts +++ b/backbone.localStorage/backbone.localStorage.d.ts @@ -18,7 +18,7 @@ declare module Backbone { constructor(name: string, serializer?: Serializer); - save(); + save(): void; // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already // have an id of it's own. @@ -43,7 +43,7 @@ declare module Backbone { _storageSize(): number; - _itemName(id): string; + _itemName(id: any): string; } } From 8088f834010654f82033838c8baabc1b35c285e9 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Sun, 20 Sep 2015 10:17:47 +0200 Subject: [PATCH 007/474] deleted for rename --- .../backbone.localStorage.d.ts | 51 ------------------- 1 file changed, 51 deletions(-) delete mode 100644 backbone.localStorage/backbone.localStorage.d.ts diff --git a/backbone.localStorage/backbone.localStorage.d.ts b/backbone.localStorage/backbone.localStorage.d.ts deleted file mode 100644 index 122c475876..0000000000 --- a/backbone.localStorage/backbone.localStorage.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Type definitions for backbone.localStorage 1.0.0 -// Project: https://github.com/jeromegn/Backbone.localStorage -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module Backbone { - interface Serializer { - serialize(item: any): any; - deserialize(data: any): any; - } - - class LocalStorage { - name: string; - serializer: Serializer; - records: string[]; - - constructor(name: string, serializer?: Serializer); - - save(): void; - - // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already - // have an id of it's own. - create(model: any): any; - - // Update a model by replacing its copy in `this.data`. - update(model: any): any; - - // Retrieve a model from `this.data` by id. - find(model: any): any; - - // Return the array of all models currently in storage. - findAll(): any; - - // Delete a model from `this.data`, returning it. - destroy(model: T): T; - - localStorage(): any; - - // Clear localStorage for specific collection. - _clear(): void; - - _storageSize(): number; - - _itemName(id: any): string; - } -} - -import Store = Backbone.LocalStorage; - From 7f6349d245f67a5b56cf6c339a51bd80a293a359 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Sun, 20 Sep 2015 10:20:47 +0200 Subject: [PATCH 008/474] renamed backbone.localStorage to backbone.localstorage --- .../backbone.localstorage.d.ts | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 backbone.localstorage/backbone.localstorage.d.ts diff --git a/backbone.localstorage/backbone.localstorage.d.ts b/backbone.localstorage/backbone.localstorage.d.ts new file mode 100644 index 0000000000..122c475876 --- /dev/null +++ b/backbone.localstorage/backbone.localstorage.d.ts @@ -0,0 +1,51 @@ +// Type definitions for backbone.localStorage 1.0.0 +// Project: https://github.com/jeromegn/Backbone.localStorage +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Backbone { + interface Serializer { + serialize(item: any): any; + deserialize(data: any): any; + } + + class LocalStorage { + name: string; + serializer: Serializer; + records: string[]; + + constructor(name: string, serializer?: Serializer); + + save(): void; + + // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already + // have an id of it's own. + create(model: any): any; + + // Update a model by replacing its copy in `this.data`. + update(model: any): any; + + // Retrieve a model from `this.data` by id. + find(model: any): any; + + // Return the array of all models currently in storage. + findAll(): any; + + // Delete a model from `this.data`, returning it. + destroy(model: T): T; + + localStorage(): any; + + // Clear localStorage for specific collection. + _clear(): void; + + _storageSize(): number; + + _itemName(id: any): string; + } +} + +import Store = Backbone.LocalStorage; + From 1c1d000362c240f6a6f9318e6325de9fbfce052c Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Sun, 4 Oct 2015 15:20:31 +0200 Subject: [PATCH 009/474] Added typings for jquery cropbox plugin --- jquery.cropbox/jquery.cropbox.d.ts | 115 +++++++++++++++++++++++++ jquery.cropbox/jquery.cropbox.tests.ts | 39 +++++++++ 2 files changed, 154 insertions(+) create mode 100644 jquery.cropbox/jquery.cropbox.d.ts create mode 100644 jquery.cropbox/jquery.cropbox.tests.ts diff --git a/jquery.cropbox/jquery.cropbox.d.ts b/jquery.cropbox/jquery.cropbox.d.ts new file mode 100644 index 0000000000..70e09a46ae --- /dev/null +++ b/jquery.cropbox/jquery.cropbox.d.ts @@ -0,0 +1,115 @@ +// Type definitions for jQuery cropbox +// Project: https://github.com/acornejo/jquery-cropbox +// Definitions by: Per Kastman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module jQueryCropBox { + + enum ShowControls { + never, + always, + hover, + auto + } + + interface CropboxArea { + cropX: number; + cropY: number; + cropW: number; + cropH: number; + } + + interface CropboxOptions { + /** + * Width in pixels of the cropping window + */ + width?: number; + /** + * Height in pixels of the cropping window + */ + height?: number; + /** + * Number of incremental zoom steps. With the default of 10, you have to click the zoom-in button 9 times to reach 100%. + */ + zoom?: number; + /** + * Maximum zoom value. With the default of 1.0 users can't zoom beyond the maximum image resolution. + */ + maxZoom?: number; + /** + * If not null, this is the entire html block that should appear on hover over the image for instructions and/or buttons (could include the zoom in/out buttons for example). If null, the default html block is used which has the text "Click to drag" and the zoom in/out buttons. Use false to disable controls. + */ + controls?: any; + /** + * Set the initial cropping area + */ + result?: CropboxArea; + /** + * This flag is used to determine when to display the controls. Never, always and hover do exactly what you would expect (never show them, always show them, show them on hover). The auto flag is the same as the hover flag, except that on mobile devices it always shows the controls (since there is no hover event). + */ + showControls?: ShowControls + } + + interface CropboxDragOptions { + startX: number, + startY: number, + dx: number, + dy: number + } + + interface CropboxSetCropOptions { + cropX: number, + cropY: number, + cropW: number, + cropH: number + } + + interface Cropbox { + /** + * Increase image zoom level by one step + */ + zoomIn(): void; + /** + * Decrease image zoom level by one step + */ + zoomOut(): void; + /** + * Set zoom leevl to a value between 0 and 1. Need to call update to reflect the changes. + */ + zoom(percent: number): void; + /** + * Simulate image dragging, starting from (startX,startY) and moving a delta of (dx,dy). Need to call update to reflect the changes. + */ + drag(options: CropboxDragOptions): void; + /** + * Set crop window. + */ + setCrop(options: CropboxSetCropOptions): void; + /** + * Update the cropped result (must call after zoom and drag). + */ + update(): void; + /** + * Generate a URL for the cropped image on the client (requires HTML5 compliant browser). + */ + getDataURL(): string; + /** + * Generate a Blob with the cropped image (requires HTML5 compliant browser). + */ + getBlob(): any; + /** + * Remove the cropbox functionality from the image. + */ + remove(): void; + } + +} +interface JQuery { + cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox +} + +interface JQueryStatic { + cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox +} diff --git a/jquery.cropbox/jquery.cropbox.tests.ts b/jquery.cropbox/jquery.cropbox.tests.ts new file mode 100644 index 0000000000..cb8f0be5ac --- /dev/null +++ b/jquery.cropbox/jquery.cropbox.tests.ts @@ -0,0 +1,39 @@ +/// +/// + +var cropboxWithDefaultSettings = $("#element").cropbox(); + +var cropboxOptions: jQueryCropBox.CropboxOptions = { + height: 500, + zoom: 5, + width: 0.5, +}; + +var cropboxWithOptions = $("#element").cropbox(cropboxOptions); + +cropboxWithOptions.zoomIn(); +cropboxWithOptions.zoomOut(); +cropboxWithOptions.zoom(50); + +var cropDragOption: jQueryCropBox.CropboxDragOptions = { + startX: 10, + startY: 0, + dx: 100, + dy: 100 +}; + +cropboxWithOptions.drag(cropDragOption); + +var cropboxSetCropOption: jQueryCropBox.CropboxSetCropOptions = { + cropX: 10, + cropY: 10, + cropW: 50, + cropH: 50 +}; + +cropboxWithOptions.setCrop(cropboxSetCropOption); + +cropboxWithOptions.update(); +cropboxWithOptions.getDataURL(); +cropboxWithOptions.getBlob(); +cropboxWithOptions.remove(); From 10c7ec397f4617dfb0fc7274fa9a8c054ff362b2 Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Sun, 4 Oct 2015 15:25:44 +0200 Subject: [PATCH 010/474] Cleanup --- jquery.cropbox/jquery.cropbox.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.cropbox/jquery.cropbox.d.ts b/jquery.cropbox/jquery.cropbox.d.ts index 70e09a46ae..82b550bf30 100644 --- a/jquery.cropbox/jquery.cropbox.d.ts +++ b/jquery.cropbox/jquery.cropbox.d.ts @@ -104,8 +104,8 @@ declare module jQueryCropBox { */ remove(): void; } - } + interface JQuery { cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox } From b9a7194092297ca857f96d971e290612bc2618d7 Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Tue, 6 Oct 2015 18:56:29 +0200 Subject: [PATCH 011/474] Renamed according to naming convention --- .../jquery.cropbox.d.ts => jquery-cropbox/jquery-cropbox.d.ts | 4 ++-- .../jquery-cropbox.tests.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename jquery.cropbox/jquery.cropbox.d.ts => jquery-cropbox/jquery-cropbox.d.ts (96%) rename jquery.cropbox/jquery.cropbox.tests.ts => jquery-cropbox/jquery-cropbox.tests.ts (94%) diff --git a/jquery.cropbox/jquery.cropbox.d.ts b/jquery-cropbox/jquery-cropbox.d.ts similarity index 96% rename from jquery.cropbox/jquery.cropbox.d.ts rename to jquery-cropbox/jquery-cropbox.d.ts index 82b550bf30..fba9846bba 100644 --- a/jquery.cropbox/jquery.cropbox.d.ts +++ b/jquery-cropbox/jquery-cropbox.d.ts @@ -107,9 +107,9 @@ declare module jQueryCropBox { } interface JQuery { - cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox + cropbox(params?: jQueryCropBox.CropboxOptions): JQuery } interface JQueryStatic { - cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox + cropbox(params?: jQueryCropBox.CropboxOptions): JQueryStatic } diff --git a/jquery.cropbox/jquery.cropbox.tests.ts b/jquery-cropbox/jquery-cropbox.tests.ts similarity index 94% rename from jquery.cropbox/jquery.cropbox.tests.ts rename to jquery-cropbox/jquery-cropbox.tests.ts index cb8f0be5ac..e8db3847c6 100644 --- a/jquery.cropbox/jquery.cropbox.tests.ts +++ b/jquery-cropbox/jquery-cropbox.tests.ts @@ -1,5 +1,5 @@ /// -/// +/// var cropboxWithDefaultSettings = $("#element").cropbox(); From 68d3c81d8d635bd03136a19fd2d40d3dc500c7b9 Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Tue, 6 Oct 2015 19:16:44 +0200 Subject: [PATCH 012/474] Fixed incorrect return type --- jquery-cropbox/jquery-cropbox.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery-cropbox/jquery-cropbox.d.ts b/jquery-cropbox/jquery-cropbox.d.ts index fba9846bba..82b550bf30 100644 --- a/jquery-cropbox/jquery-cropbox.d.ts +++ b/jquery-cropbox/jquery-cropbox.d.ts @@ -107,9 +107,9 @@ declare module jQueryCropBox { } interface JQuery { - cropbox(params?: jQueryCropBox.CropboxOptions): JQuery + cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox } interface JQueryStatic { - cropbox(params?: jQueryCropBox.CropboxOptions): JQueryStatic + cropbox(params?: jQueryCropBox.CropboxOptions): jQueryCropBox.Cropbox } From 1e9273d62eb6e2c2de01116c6446f006b47916b7 Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Tue, 6 Oct 2015 19:29:47 +0200 Subject: [PATCH 013/474] Updated according to naming convention --- .../{jquery-cropbox.tests.ts => jquery-cropbox-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jquery-cropbox/{jquery-cropbox.tests.ts => jquery-cropbox-tests.ts} (100%) diff --git a/jquery-cropbox/jquery-cropbox.tests.ts b/jquery-cropbox/jquery-cropbox-tests.ts similarity index 100% rename from jquery-cropbox/jquery-cropbox.tests.ts rename to jquery-cropbox/jquery-cropbox-tests.ts From 392f2699d0aee7ef7da3227614e641600c1e1af1 Mon Sep 17 00:00:00 2001 From: Maxime LUCE Date: Sun, 25 Oct 2015 01:01:01 +0200 Subject: [PATCH 014/474] Update opn typings for version 3.0.2 --- opn/opn-tests.ts | 18 ++++++++--- opn/opn.d.ts | 84 ++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 91 insertions(+), 11 deletions(-) diff --git a/opn/opn-tests.ts b/opn/opn-tests.ts index 361725970d..2b39f1950c 100644 --- a/opn/opn-tests.ts +++ b/opn/opn-tests.ts @@ -1,10 +1,18 @@ /// -import opn = require('opn'); +import * as opn from "opn"; var errorCallback: (err: Error) => void; -opn('foo'); -opn('foo', 'bar'); -opn('foo', errorCallback); -opn('foo', 'bar', errorCallback); +opn("foo"); +opn("foo", errorCallback); + +opn("foo", { app: "bar" }); +opn("foo", { app: ["bar", "--arg"] }); +opn("foo", { app: "bar", wait: false }); +opn("foo", { app: ["bar", "--arg"] , wait: false}); + +opn("foo", { app: "bar" }, errorCallback); +opn("foo", { app: ["bar", "--arg"] }, errorCallback); +opn("foo", { app: "bar", wait: false }, errorCallback); +opn("foo", { app: ["bar", "--arg"], wait: false }, errorCallback); diff --git a/opn/opn.d.ts b/opn/opn.d.ts index 10a34ce60c..6e6a5a1788 100644 --- a/opn/opn.d.ts +++ b/opn/opn.d.ts @@ -1,10 +1,82 @@ -// Type definitions for opn 1.0.0 +// Type definitions for opn 3.0.2 // Project: https://github.com/sindresorhus/opn -// Definitions by: Shinnosuke Watanabe +// Definitions by: Shinnosuke Watanabe , +// Maxime LUCE // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module 'opn' { - function opn(target: string, callback?: (err: Error) => void): void; - function opn(target: string, app: string, callback?: (err: Error) => void): void; - export = opn; +/// + +declare namespace Opn { + export interface Options { + /** + * Wait for the opened app to exit before calling the `callback`. + * If `false` it's called immediately when opening the app. + * On Windows you have to explicitly specify an app for it to be able to wait. + */ + wait?: boolean; + + /** + * Specify the app to open the target with, or an array with the app and app arguments. + * The app name is platform dependent. Don't hard code it in reusable modules. + * Eg. Chrome is `google chrome` on OS X, `google-chrome` on Linux and `chrome` on Windows. + */ + app?: string | string[]; + } +} + +declare module "opn" { + import * as cp from "child_process"; + + interface DefaultFunction { + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + */ + (target: string): cp.ChildProcess; + + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + * @param callback- Called when the opened app exits, or if `wait: false`, immediately when opening. + */ + (target: string, callback: (err: Error) => void): cp.ChildProcess; + + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + * @param options - Options to be passed to opn. + */ + (target: string, options: Opn.Options): cp.ChildProcess; + + /** + * Uses the command open on OS X, start on Windows and xdg-open on other platforms. + * + * Returns the spawned child process. + * You'd normally not need to use this for anything, but it can be useful if you'd like + * to attach custom event listeners or perform other operations directly on the spawned process. + * + * @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. Eg. URLs opens in your default browser. + * @param options - Options to be passed to opn. + * @param callback- Called when the opened app exits, or if `wait: false`, immediately when opening. + */ + (target: string, options: Opn.Options, callback: (err: Error) => void): cp.ChildProcess; + } + + const opn: DefaultFunction; + export = opn; } From 75e8c438092a15804594e46bc82973b86bed3e22 Mon Sep 17 00:00:00 2001 From: AllBogs Date: Wed, 4 Nov 2015 10:10:29 +0100 Subject: [PATCH 015/474] Update snapsvg.d.ts Seemed to be some confusion between the functions "Matrix()" (argument-less constructor function) and "matrix()" (utility function that takes arguments and returns a Matrix object). --- snapsvg/snapsvg.d.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/snapsvg/snapsvg.d.ts b/snapsvg/snapsvg.d.ts index aff964a6da..6543eaa908 100644 --- a/snapsvg/snapsvg.d.ts +++ b/snapsvg/snapsvg.d.ts @@ -15,7 +15,7 @@ declare module mina { } export interface AnimationDescriptor { - id: string; + id: string; start: number; end: number; b: number; @@ -35,7 +35,7 @@ declare module mina { pause(): void; resume(): void; update(): void; - } + } export function backin(n:number):number; export function backout(n:number):number; @@ -57,8 +57,9 @@ declare module Snap { export var filter:Filter; export var path:Path; - export function Matrix(a:number,b:number,c:number,d:number,e:number,f:number):Matrix; - export function Matrix(svgMatrix:SVGMatrix):Matrix; + export function Matrix():void; + export function matrix(a:number,b:number,c:number,d:number,e:number,f:number):Matrix; + export function matrix(svgMatrix:SVGMatrix):Matrix; export function ajax(url:string,postData:string,callback:Function,scope?:Object):XMLHttpRequest; export function ajax(url:string,postData:Object,callback:Function,scope?:Object):XMLHttpRequest; From 344ad0763e4fd64c431b2169bdc93ea045dfdb63 Mon Sep 17 00:00:00 2001 From: AllBogs Date: Wed, 4 Nov 2015 10:23:57 +0100 Subject: [PATCH 016/474] Update snapsvg.d.ts --- snapsvg/snapsvg.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snapsvg/snapsvg.d.ts b/snapsvg/snapsvg.d.ts index 6543eaa908..6a941f3d73 100644 --- a/snapsvg/snapsvg.d.ts +++ b/snapsvg/snapsvg.d.ts @@ -57,7 +57,7 @@ declare module Snap { export var filter:Filter; export var path:Path; - export function Matrix():void; + export function Matrix():void; export function matrix(a:number,b:number,c:number,d:number,e:number,f:number):Matrix; export function matrix(svgMatrix:SVGMatrix):Matrix; From a029b45c6db83de4b58baed4611fb804ee721ae1 Mon Sep 17 00:00:00 2001 From: Sixin Li Date: Thu, 5 Nov 2015 15:54:34 -0500 Subject: [PATCH 017/474] `state` properties belongs to CodeMirror.Editor, not CodeMorrir.Doc --- codemirror/codemirror-showhint.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codemirror/codemirror-showhint.d.ts b/codemirror/codemirror-showhint.d.ts index 48a904a3bb..9573f95bc6 100644 --- a/codemirror/codemirror-showhint.d.ts +++ b/codemirror/codemirror-showhint.d.ts @@ -39,11 +39,11 @@ declare module CodeMirror { /** An extension of the existing CodeMirror typings for the Editor.on("keyup", func) syntax */ on(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void; off(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void; + /** Extend CodeMirror.Editor with a state object, so that the Editor.state.completionActive property is reachable*/ + state: any; } - /** Extend CodeMirror.Doc with a state object, so that the Doc.state.completionActive property is reachable*/ interface Doc { - state: any; showHint: (options: ShowHintOptions) => void; } From 63e48f4210cf95d7a8ddc93480eaa1a10cbf02a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Tue, 10 Nov 2015 17:04:33 +0100 Subject: [PATCH 018/474] three: Update comment for WebGLRenderer.clear --- threejs/three.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index fd165f9366..dd1521d846 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -4686,7 +4686,7 @@ declare module THREE { /** * Tells the renderer to clear its color, depth or stencil drawing buffer(s). - * If no parameters are passed, no buffer will be cleared. + * Arguments default to true */ clear(color?: boolean, depth?: boolean, stencil?: boolean): void; From ced9f3bb50955947e4ae2e4b9d736602f9f3a4a8 Mon Sep 17 00:00:00 2001 From: Sixin Li Date: Wed, 11 Nov 2015 23:52:19 -0500 Subject: [PATCH 019/474] move `state` from codemirror-showhint.d.ts to codemirror.d.ts --- codemirror/codemirror-showhint.d.ts | 2 -- codemirror/codemirror.d.ts | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/codemirror/codemirror-showhint.d.ts b/codemirror/codemirror-showhint.d.ts index 9573f95bc6..8b620a414f 100644 --- a/codemirror/codemirror-showhint.d.ts +++ b/codemirror/codemirror-showhint.d.ts @@ -39,8 +39,6 @@ declare module CodeMirror { /** An extension of the existing CodeMirror typings for the Editor.on("keyup", func) syntax */ on(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void; off(eventName: string, handler: (doc: CodeMirror.Doc, event: any) => void): void; - /** Extend CodeMirror.Editor with a state object, so that the Editor.state.completionActive property is reachable*/ - state: any; } interface Doc { diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index 2ca58c7024..3fb29e4259 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -390,6 +390,9 @@ declare module CodeMirror { The handler may mess with the style of the resulting element, or add event handlers, but should not try to change the state of the editor. */ on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void; + + /** Expose the state object, so that the Editor.state.completionActive property is reachable*/ + state: any; } interface EditorFromTextArea extends Editor { @@ -589,6 +592,8 @@ declare module CodeMirror { /** The reverse of posFromIndex. */ indexFromPos(object: CodeMirror.Position): number; + /** Expose the state object, so that the Doc.state.completionActive property is reachable*/ + state: any; } interface LineHandle { From 3c032bd7f68ace09840c363cdbd0fc8bc3106a1f Mon Sep 17 00:00:00 2001 From: emmanuel Date: Fri, 13 Nov 2015 12:28:49 +0100 Subject: [PATCH 020/474] First commit: add type definitions for slick 1.5.8 --- jquery.slick/slick-tests.ts | 232 ++++++++++++++++++++++ jquery.slick/slick.d.ts | 381 ++++++++++++++++++++++++++++++++++++ 2 files changed, 613 insertions(+) create mode 100644 jquery.slick/slick-tests.ts create mode 100644 jquery.slick/slick.d.ts diff --git a/jquery.slick/slick-tests.ts b/jquery.slick/slick-tests.ts new file mode 100644 index 0000000000..499e6974c7 --- /dev/null +++ b/jquery.slick/slick-tests.ts @@ -0,0 +1,232 @@ +/// +/// + + +// -------------------------------------------------------- +// ------------------- WEBSITE EXAMPLE -------------------- +// ---------- http://kenwheeler.github.io/slick/ ---------- +// -------------------------------------------------------- + +$('.single-item').slick(); + +$('.multiple-items').slick({ + infinite: true, + slidesToShow: 3, + slidesToScroll: 3 +}); + +$('.responsive').slick({ + dots: true, + infinite: false, + speed: 300, + slidesToShow: 4, + slidesToScroll: 4, + responsive: [ + { + breakpoint: 1024, + settings: { + slidesToShow: 3, + slidesToScroll: 3, + infinite: true, + dots: true + } + }, + { + breakpoint: 600, + settings: { + slidesToShow: 2, + slidesToScroll: 2 + } + }, + { + breakpoint: 480, + settings: { + slidesToShow: 1, + slidesToScroll: 1 + } + } + // You can unslick at a given breakpoint now by adding: + // settings: "unslick" + // instead of a settings object + ] +}); + +$('.variable-width').slick({ + dots: true, + infinite: true, + speed: 300, + slidesToShow: 1, + centerMode: true, + variableWidth: true +}); + +$('.one-time').slick({ + dots: true, + infinite: true, + speed: 300, + slidesToShow: 1, + adaptiveHeight: true +}); + +$('.center').slick({ + centerMode: true, + centerPadding: '60px', + slidesToShow: 3, + responsive: [ + { + breakpoint: 768, + settings: { + arrows: false, + centerMode: true, + centerPadding: '40px', + slidesToShow: 3 + } + }, + { + breakpoint: 480, + settings: { + arrows: false, + centerMode: true, + centerPadding: '40px', + slidesToShow: 1 + } + } + ] +}); + +// To use lazy loading, set a data-lazy attribute +// on your img tags and leave off the src +// + +$('.lazy').slick({ + lazyLoad: 'ondemand', + slidesToShow: 3, + slidesToScroll: 1 +}); + +$('.autoplay').slick({ + slidesToShow: 3, + slidesToScroll: 1, + autoplay: true, + autoplaySpeed: 2000, +}); + +$('.fade').slick({ + dots: true, + infinite: true, + speed: 500, + fade: true, + cssEase: 'linear' +}); + +var slideIndex = 1; +$('.add-remove').slick({ + slidesToShow: 3, + slidesToScroll: 3 +}); +$('.js-add-slide').on('click', function() { + slideIndex++; + $('.add-remove').slick('slickAdd','

' + slideIndex + '

'); +}); + +$('.js-remove-slide').on('click', function() { + $('.add-remove').slick('slickRemove', slideIndex - 1); + if (slideIndex !== 0){ + slideIndex--; + } +}); + +$('.filtering').slick({ + slidesToShow: 4, + slidesToScroll: 4 +}); + +var filtered = false; + +$('.js-filter').on('click', function(){ + if (filtered === false) { + $('.filtering').slick('slickFilter',':even'); + $(this).text('Unfilter Slides'); + filtered = true; + } else { + $('.filtering').slick('slickUnfilter'); + $(this).text('Filter Slides'); + filtered = false; + } +}); + +$('.your-slider').slick('unslick'); + +$('.slider-for').slick({ + slidesToShow: 1, + slidesToScroll: 1, + arrows: false, + fade: true, + asNavFor: '.slider-nav' +}); +$('.slider-nav').slick({ + slidesToShow: 3, + slidesToScroll: 1, + asNavFor: '.slider-for', + dots: true, + centerMode: true, + focusOnSelect: true +}); + +$('.single-item-rtl').slick({ + rtl: true +}); + + + +// -------------------------------------------------------- +// ---------------- TEST DEFAULT OPTIONS ------------------ +// -------------------------------------------------------- + +$("#diaporama").slick({ + accessibility: true, + adaptiveHeight: false, + autoplay: false, + autoplaySpeed: 3000, + arrows: true, + asNavFor: "#slideshow", + appendArrows: "", + prevArrow: "", + nextArrow: "", + centerMode: false, + centerPadding: "50px", + cssEase: "ease", + customPaging: (slider, i: number) => { + console.log("customPaging slider", slider); + console.log("customPaging index", i); + }, + dots: false, + draggable: true, + fade: false, + focusOnSelect: false, + easing: "linear", + edgeFriction: 0.15, + infinite: true, + initialSlide: 0, + lazyLoad: "ondemand", + mobileFirst: false, + pauseOnHover: true, + pauseOnDotsHover: false, + respondTo: "window", + responsive: null, + rows: 1, + slide: "div", + slidesPerRow: 1, + slidesToShow: 1, + slidesToScroll: 1, + speed: 300, + swipe: true, + swipeToSlide: false, + touchMove: true, + touchThreshold: 5, + useCSS: true, + variableWidth: false, + vertical: false, + verticalSwiping: false, + rtl: false +}); diff --git a/jquery.slick/slick.d.ts b/jquery.slick/slick.d.ts new file mode 100644 index 0000000000..cc9aa626bf --- /dev/null +++ b/jquery.slick/slick.d.ts @@ -0,0 +1,381 @@ +// Type definitions for stick 1.5.8 +// Project: http://kenwheeler.github.io/slick/ +// Definitions by: John Gouigouix +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface JQuerySlickOptions { + + /** + * Enables tabbing and arrow key navigation + * Default: true + */ + accessibility?: boolean; + + /** + * Enables adaptive height for single slide horizontal carousels. + * Default: false + */ + adaptiveHeight?: boolean; + + /** + * Enables Autoplay + * Default: false + */ + autoplay?: boolean; + + /** + * Autoplay Speed in milliseconds + * Default: 3000 + */ + autoplaySpeed?: number; + + /** + * Prev/Next Arrows + * Default: true + */ + arrows?: boolean; + + /** + * Set the slider to be the navigation of other slider (Class or ID Name) + * Default: null + */ + asNavFor?: string; + + /** + * Change where the navigation arrows are attached (Selector, htmlString, Array, Element, jQuery object) + * Default: $(element) + */ + appendArrows?: any; + + /** + * Allows you to select a node or customize the HTML for the "Previous" arrow. + * Default: + */ + prevArrow?: string | Object; + + /** + * Allows you to select a node or customize the HTML for the "Next" arrow. + * Default: + */ + nextArrow?: string | Object; + + /** + * Enables centered view with partial prev/next slides. Use with odd numbered slidesToShow counts. + * Default: false + */ + centerMode?: boolean; + + /** + * Side padding when in center mode (px or %) + * Default: '50px' + */ + centerPadding?: string; + + /** + * CSS3 Animation Easing + * Default: 'ease' + */ + cssEase?: string; + + /** + * Custom paging templates. See source for use example. + * Default: n/a + */ + customPaging?: (slider, i: number) => string; + + /** + * Show dot indicators + * Default: false + */ + dots?: boolean; + + /** + * Enable mouse dragging + * Default: true + */ + draggable?: boolean; + + /** + * Enable fade + * Default: false + */ + fade?: boolean; + + /** + * Enable focus on selected element (click) + * Default: false + */ + focusOnSelect?: boolean; + + /** + * Add easing for jQuery animate. Use with easing libraries or default easing methods + * Default: 'linear' + */ + easing?: string; + + /** + * Resistance when swiping edges of non-infinite carousels + * Default: 0.15 + */ + edgeFriction?: number; + + /** + * Infinite loop sliding + * Default: true + */ + infinite?: boolean; + + /** + * Slide to start on + * Default: 0 + */ + initialSlide?: number; + + /** + * Set lazy loading technique. Accepts 'ondemand' or 'progressive'. + * Default: 'ondemand' + */ + lazyLoad?: string; + + /** + * Responsive settings use mobile first calculation + * Default: false + */ + mobileFirst?: boolean; + + /** + * Pause Autoplay On Hover + * Default: true + */ + pauseOnHover?: boolean; + + /** + * Pause Autoplay when a dot is hovered + * Default: false + */ + pauseOnDotsHover?: boolean; + + /** + * Width that responsive object responds to. Can be 'window', 'slider' or 'min' (the smaller of the two) + * Default: 'window' + */ + respondTo?: string; + + /** + * Object containing breakpoints and settings objects (see demo). + * Enables settings sets at given screen width. + * Set settings to "unslick" instead of an object to disable slick at a given breakpoint. + * Default: none + */ + responsive?: Object; + + /** + * Setting this to more than 1 initializes grid mode. Use slidesPerRow to set how many slides should be in each row. + * Default: 1 + */ + rows?: number; + + /** + * Element query to use as slide + * Default: 'div' + */ + slide?: string; + + /** + * With grid mode intialized via the rows option, this sets how many slides are in each grid row. + * Default: 1 + */ + slidesPerRow?: number; + + /** + * # of slides to show + * Default: 1 + */ + slidesToShow?: number; + + /** + * # of slides to scroll + * Default: 1 + */ + slidesToScroll?: number; + + /** + * Slide/Fade animation speed (ms) + * Default: 300 + */ + speed?: number; + + /** + * Enable swiping + * Default: true + */ + swipe?: boolean; + + /** + * Allow users to drag or swipe directly to a slide irrespective of slidesToScroll. + * Default: false + */ + swipeToSlide?: boolean; + + /** + * Enable slide motion with touch + * Default: true + */ + touchMove?: boolean; + + /** + * To advance slides, the user must swipe a length of (1/touchThreshold) * the width of the slider. + * Default: 5 + */ + touchThreshold?: number; + + /** + * Enable/Disable CSS Transitions + * Default: true + */ + useCSS?: boolean; + + /** + * Variable width slides. + * Default: false + */ + variableWidth?: boolean; + + /** + * Vertical slide mode + * Default: false + */ + vertical?: boolean; + + /** + * Vertical swipe mode + * Default: false + */ + verticalSwiping?: boolean; + + /** + * Change the slider's direction to become right-to-left + * Default: false + */ + rtl?: boolean; + +} + + +interface JQuery { + + /** + * Create slick component + */ + slick(): JQuery; + slick(options: JQuerySlickOptions): JQuery; + + /** + * Returns the current slide index + * @param methodName The name of the method + */ + slick(methodName: "slickCurrentSlide"): number; + + /** + * Navigates to a slide by index + * @param methodName The name of the method + * @param slide + * @param animate + */ + slick(methodName: "slickGoTo", slide: number, animate?: boolean): JQuery; + + /** + * Navigates to the next slide + * @param methodName The name of the method + */ + slick(methodName: "slickNext"): JQuery; + + /** + * Navigates to the previous slide + * @param methodName The name of the method + */ + slick(methodName: "slickPrev"): JQuery; + + /** + * Pauses autoplay + * @param methodName The name of the method + */ + slick(methodName: "slickPause"): JQuery; + + /** + * Starts autoplay + * @param methodName The name of the method + */ + slick(methodName: "slickPlay"): JQuery; + + /** + * Add a slide. If an index is provided, will add at that index, or before if addBefore is set. If no index is provided, + * add to the end or to the beginning if addBefore is set. Accepts HTML String || Object + * @param methodName The name of the method + * @param html + * @param index/div> + * @param addBefore + */ + slick(methodName: "slickAdd", html: string | Object, index?: number, addBefore?: number): JQuery; + + /** + * Remove slide by index. If removeBefore is set true, remove slide preceding index, or the first slide if no index is specified. + * If removeBefore is set to false, remove the slide following index, or the last slide if no index is set. + * @param methodName The name of the method + * @param index + * @param removeBefore + */ + slick(methodName: "slickRemove", index: number, removeBefore?: number): JQuery; + + /** + * Filters slides using jQuery .filter() + * @param methodName The name of the method + * @param selector + */ + slick(methodName : "slickFilter", selector: string): JQuery; + + /** + * Filters slides using jQuery .filter() + * @param methodName The name of the method + * @param func + */ + slick(methodName : "slickFilter", func: (index: number, element: Element) => any): JQuery; + + /** + * Removes applied filtering + * @param methodName The name of the method + * @param index + */ + slick(methodName: "slickUnfilter", index: number): JQuery; + + /** + * Sets an individual value live. Set refresh to true if it's a UI update. + * @param methodName The name of the method + * @param option The option name + */ + slick(methodName: "slickGetOption", option: any): JQuerySlickOptions; + + /** + * Sets an individual value live. Set refresh to true if it's a UI update. + * @param methodName The name of the method + * @param option The option name + * @param value depends on option + * @param refresh + */ + slick(methodName: "slickSetOption", option: string, value: JQuerySlickOptions, refresh?: boolean): JQuery; + + /** + * Deconstructs slick + * @param methodName The name of the method + */ + slick(methodName: "unslick"): JQuery; + + /** + * Get Slick Object + * @param methodName "getSlick" + */ + slick(methodName: "getSlick"): Object; + +} From 366488bc0c33117797b3725905d0ddae8dd1c708 Mon Sep 17 00:00:00 2001 From: emmanuel Date: Fri, 13 Nov 2015 14:16:45 +0100 Subject: [PATCH 021/474] Fixed error name --- jquery.slick/slick.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.slick/slick.d.ts b/jquery.slick/slick.d.ts index cc9aa626bf..949f217364 100644 --- a/jquery.slick/slick.d.ts +++ b/jquery.slick/slick.d.ts @@ -374,7 +374,7 @@ interface JQuery { /** * Get Slick Object - * @param methodName "getSlick" + * @param methodName The name of the method */ slick(methodName: "getSlick"): Object; From 9545151e70db4d285c5f7bcfaf41b5fb879cebb8 Mon Sep 17 00:00:00 2001 From: emmanuel Date: Fri, 13 Nov 2015 16:25:13 +0100 Subject: [PATCH 022/474] First commit: add type definitions for mmenu 5.5.3 --- jquery.mmenu/jquery.mmenu-tests.ts | 85 +++++++++++ jquery.mmenu/jquery.mmenu.d.ts | 229 +++++++++++++++++++++++++++++ 2 files changed, 314 insertions(+) create mode 100644 jquery.mmenu/jquery.mmenu-tests.ts create mode 100644 jquery.mmenu/jquery.mmenu.d.ts diff --git a/jquery.mmenu/jquery.mmenu-tests.ts b/jquery.mmenu/jquery.mmenu-tests.ts new file mode 100644 index 0000000000..9fbb9b7769 --- /dev/null +++ b/jquery.mmenu/jquery.mmenu-tests.ts @@ -0,0 +1,85 @@ +/// +/// + + +// -------------------------------------------------------- +// ---------------- TEST DEFAULT OPTIONS ------------------ +// -------------------------------------------------------- + +var menu: JQuery = $("#my-menu"); +menu.mmenu( + // options + { + extensions: [], + navbar: { + add: true, + title: "Menu", + titleLink: "parent" + }, + onClick: { + close: true, + preventDefault: false, + setSelected: false + }, + slidingSubmenus: true + }, + // configurations + { + classNames: { + divider: "Divider", + inset: "Inset", + panel: "Panel", + selected: "Selected", + vertical: "vertical" + }, + clone: false, + openingInterval: 25, + panelNodetype: "div, ul, ol", + transitionDuration: 400 + } +); + + +// -------------------------------------------------------- +// ------------------- TEST MMENU API --------------------- +// -------------------------------------------------------- + +var api: JQueryMmenu.API = menu.data("mmenu"); +var myPanel: JQuery = $("#panel"); +var listItem: JQuery = $(".list-item"); + +api.closeAllPanels(); +api.bind("closeAllPanels", function() { + console.log("close all opened panels and go back to the first panel."); +}); + +api.closePanel(myPanel); +api.bind("closePanel", function(panel) { + console.log("close this ", panel); +}); + +api.getInstance(); +api.bind("getInstance", function() { + console.log("get the class instance for the menu."); +}); + +api.init(myPanel); +api.bind("init", function(panel) { + console.log("method to (re)initialize a newly added ", panel); +}); + +api.openPanel(myPanel); +api.bind("openPanel", function(panel) { + console.log("This panel is now opened ", panel); +}); + +api.setSelected(listItem, true); +api.bind("setSelected", function(listItem, selected) { + console.log("set or unset a list item as selected ", listItem); + console.log("has selected ", selected); +}); + +api.update(); +api.bind("update", function() { + console.log("update the appearance for the menu"); +}); diff --git a/jquery.mmenu/jquery.mmenu.d.ts b/jquery.mmenu/jquery.mmenu.d.ts new file mode 100644 index 0000000000..97874f8f08 --- /dev/null +++ b/jquery.mmenu/jquery.mmenu.d.ts @@ -0,0 +1,229 @@ +// Type definitions for jQuery mmenu v5.5.3 +// Project: http://mmenu.frebsite.nl/ +// Definitions by: John Gouigouix +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module JQueryMmenu { + + interface NavbarOptions { + + /** + * Whether or not to add a navbar above the panels. + * Default: true + */ + add?: boolean; + + /** + * The title above the main panel. + * Default: "Menu" + */ + title?: string; + + /** + * The type of link to set for the title. + * Possible values: "parent", "anchor" or "none". + * Default: "parent" + */ + titleLink?: string; + + } + + interface OnclickOptions { + + /** + * Whether or not the menu should close after clicking a link inside it. + * The default value varies per link: true if the default behavior for + * the clicked link is prevented, false otherwise. + * Default: null + */ + close?: boolean | any; + + /** + * Whether or not to prevent the default behavior for the clicked link. + * The default value varies per link: true if its href is equal to + * or starts with a hash (#), false otherwise. + * Default: null + */ + preventDefault?: boolean | any; + + /** + * Whether or not the clicked link should be visibly "selected". + * Default: true + */ + setSelected?: boolean | any; + + } + + interface Options { + + /** + * A collection of extension names to enable for the menu. + * You'll need this option when using the extensions. + * Default: [] + */ + extensions?: Array; + + /** + * navbar options + */ + navbar?: NavbarOptions; + + /** + * onClick options + */ + onClick?: OnclickOptions; + + /** + * Whether or not submenus should come sliding in from the right. + * If false, submenus expand below their parent. + * To expand a single submenu below its parent item, add the class "Vertical" to it. + * Default: true + */ + slidingSubmenus?: boolean; + + } + + interface ClassnamesConfigurations { + + /** + * The classname on a LI that should be displayed as a divider. + * Default: "Divider" + */ + divider?: string; + + /** + * The classname on a submenu (a nested UL) that should be displayed as a default list. + * Default: "Inset" + */ + inset?: string; + + /** + * The classname on an element (for example a DIV) that should be considered to be a panel. + * Only applies if the "isMenu" option is set to false. + * Default: "Panel" + */ + panel?: string; + + /** + * The classname on the LI that should be displayed as selected. + * Default: "Selected" + */ + selected?: string; + + /** + * The classname on a submenu (a nested UL) that should expand below + * their parent instead of slide in from the right. + * Default: "vertical" + */ + vertical?: string; + + } + + interface Configurations { + + /** + * the CSS class names object + */ + classNames?: ClassnamesConfigurations; + + /** + * Whether or not the menu should be cloned (and the original menu kept intact). + * Default: false + */ + clone?: boolean; + + /** + * The number of milliseconds between opening/closing the menu and panels, + * needed to force CSS transitions. + * Default: 25 + */ + openingInterval?: number; + + /** + * jQuery selector containing the node-type of panels. + * Default: "div, ul, ol" + */ + panelNodetype?: string; + + /** + * The number of milliseconds used in the CSS transitions. + * Default: 400 (The value should match the associated CSS value.) + */ + transitionDuration?: number; + + } + + interface API { + + /** + * Trigger this method to close all opened panels and go back to the first panel. + */ + closeAllPanels(): JQuery; + /** @see closeAllPanels() */ + bind(methodName: "closeAllPanels", callback: () => void): JQuery; + + /** + * Trigger this method to close a panel + * (only available if the "slidingSubmenus" option is set to false). + * @param panel + */ + closePanel(panel: JQuery); + /** @see closePanel() */ + bind(methodName: "closePanel", callback: (panel: JQuery) => void); + + /** + * Trigger this method to get the class instance for the menu. + */ + getInstance(); + /** @see getInstance() */ + bind(methodName: "getInstance", callback: () => void); + + /** + * Trigger this method to (re)initialize a newly added panel. + * @param panel The panel to (re)initialize. + */ + init(panel: JQuery); + /** @see init() */ + bind(methodName: "init", callback: (panel: JQuery) => void); + + /** + * Trigger this method to open a panel. + * @param panel The panel to open. + */ + openPanel(panel: JQuery); + /** @see openPanel() */ + bind(methodName: "openPanel", callback: (panel: JQuery) => void); + + /** + * Trigger this method to set or unset a list item as "selected". + * @param li The list item to set or unset as "selected". + * @param selected Whether to set or unset the list item as "selected". Default: true + */ + setSelected(li: JQuery, selected?: boolean); + /** @see setSelected() */ + bind(methodName: "setSelected", callback: (li: JQuery, selected?: boolean) => void); + + /** + * Trigger this method to update the appearance for the menu. + */ + update(); + /** @see update() */ + bind(methodName: "update", callback: () => void); + + } + +} + + +interface JQuery { + + /** + * Create mmenu component + */ + mmenu(): JQuery; + mmenu(options: JQueryMmenu.Options): JQuery; + mmenu(options: JQueryMmenu.Options, configurations: JQueryMmenu.Configurations): JQuery; + +} From f297bc50a4310c58bde65a6de686ab840dbee3e3 Mon Sep 17 00:00:00 2001 From: dreamair Date: Fri, 13 Nov 2015 22:17:05 +0100 Subject: [PATCH 023/474] Update some options for gulp-typescript 2.9.2. --- gulp-typescript/gulp-typescript.d.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gulp-typescript/gulp-typescript.d.ts b/gulp-typescript/gulp-typescript.d.ts index 7b16d0a5a2..f85245a305 100644 --- a/gulp-typescript/gulp-typescript.d.ts +++ b/gulp-typescript/gulp-typescript.d.ts @@ -20,10 +20,21 @@ declare module "gulp-typescript" { noImplicitAny?: boolean; noLib?: boolean; removeComments?: boolean; - sourceRoot?: string; + sourceRoot?: string; // use gulp-sourcemaps instead sortOutput?: boolean; target?: string; typescript?: any; + outFile?: string; + outDir?: string; + suppressImplicitAnyIndexErrors?: boolean; + jsx?: string; + declaration?: boolean; + emitDecoratorMetadata?: boolean; + experimentalAsyncFunctions?: boolean; + moduleResolution?: string; + noEmitHelpers?: boolean; + preserveConstEnums?: boolean; + isolatedModules?: boolean; } interface Project { @@ -51,4 +62,4 @@ declare module "gulp-typescript" { } export = GulpTypescript; -} \ No newline at end of file +} From 709f97cb32513e322a3ad98b71af51a48788b3e8 Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Sat, 14 Nov 2015 12:47:05 -0800 Subject: [PATCH 024/474] update to maker.js 0.5.3 --- maker.js/makerjs-tests.ts | 10 +++ maker.js/makerjs.d.ts | 135 +++++++++++++++++++++++++++++++++++--- 2 files changed, 135 insertions(+), 10 deletions(-) diff --git a/maker.js/makerjs-tests.ts b/maker.js/makerjs-tests.ts index 59a50e4fce..ae17a8fe9b 100644 --- a/maker.js/makerjs-tests.ts +++ b/maker.js/makerjs-tests.ts @@ -40,6 +40,8 @@ function test() { function testExporter() { new makerjs.exporter.Exporter({}); makerjs.exporter.toDXF(model); + makerjs.exporter.toOpenJsCad(model); + makerjs.exporter.toSTL(model); makerjs.exporter.toSVG(model); makerjs.exporter.tryGetModelUnits(model); } @@ -66,12 +68,17 @@ function test() { function testModel(){ makerjs.model.combine(model, model, true, false, true, false); makerjs.model.convertUnits(model, makerjs.unitType.Centimeter); + makerjs.model.countChildModels(model); + makerjs.model.detachLoop(model); + makerjs.model.findLoops(model); makerjs.model.getSimilarPathId(model, 'foo'); + makerjs.model.isPathInsideModel(paths.line, model); makerjs.model.mirror(model, false, true); makerjs.model.move(makerjs.model.originate(model, [9,9]), [0,0]); makerjs.model.moveRelative(model, [1,1]); makerjs.model.originate(model); makerjs.model.rotate(makerjs.model.scale(model, 6), 45, [0,0]); + makerjs.model.scale(model, 7); makerjs.model.walkPaths(model, (modelContext: MakerJs.IModel, pathId: string, pathContext: MakerJs.IPath) => {}); } @@ -80,6 +87,7 @@ function test() { new makerjs.models.BoltCircle(7, 7, 7, 7), new makerjs.models.BoltRectangle(2, 2, 2), new makerjs.models.ConnectTheDots(true, [ [0,0], [1,1] ]), + new makerjs.models.Dome(5, 7), new makerjs.models.Oval(7, 7), new makerjs.models.OvalArc(6, 4, 2, 12), new makerjs.models.Polygon(7, 5), @@ -141,7 +149,9 @@ function test() { makerjs.point.middle(paths.line); makerjs.point.mirror(p1, true, false); makerjs.point.rotate(p1, 5, p2); + makerjs.point.rounded(p1); makerjs.point.scale(p2, 8); + makerjs.point.serialize(p1); makerjs.point.subtract(p2, p1); makerjs.point.zero(); } diff --git a/maker.js/makerjs.d.ts b/maker.js/makerjs.d.ts index 69cd3dbb7f..779af05345 100644 --- a/maker.js/makerjs.d.ts +++ b/maker.js/makerjs.d.ts @@ -247,6 +247,37 @@ declare module MakerJs { */ path2Angles?: number[]; } + /** + * Options when matching points + */ + interface IPointMatchOptions { + /** + * Optional exemplar of number of decimal places. + */ + accuracy?: number; + } + /** + * Options to pass to model.findLoops. + */ + interface IFindLoopsOptions extends IPointMatchOptions { + /** + * Flag to remove looped paths from the original model. + */ + removeFromOriginal?: boolean; + } + /** + * A path that may be indicated to "flow" in either direction between its endpoints. + */ + interface IPathDirectional extends IPath { + /** + * The endpoints of the path. + */ + endPoints: IPoint[]; + /** + * Path flows forwards or reverse. + */ + reversed?: boolean; + } /** * Path objects by id. */ @@ -302,6 +333,12 @@ declare module MakerJs { */ layer?: string; } + /** + * Callback signature for model.walkPaths(). + */ + interface IModelPathCallback { + (modelContext: IModel, pathId: string, pathContext: IPath): void; + } /** * Test to see if an object implements the required properties of a model. */ @@ -408,6 +445,7 @@ declare module MakerJs.point { * * @param a First point. * @param b Second point. + * @param accuracy Optional exemplar of number of decimal places. * @returns true if points are the same, false if they are not */ function areEqualRounded(a: IPoint, b: IPoint, accuracy?: number): boolean; @@ -456,7 +494,7 @@ declare module MakerJs.point { */ function fromPathEnds(pathContext: IPath): IPoint[]; /** - * Get the middle point of a path. Currently only supports Arc and Line paths. + * Get the middle point of a path. * * @param pathContext The path object. * @param ratio Optional ratio (between 0 and 1) of point along the path. Default is .5 for middle. @@ -472,6 +510,14 @@ declare module MakerJs.point { * @returns Mirrored point. */ function mirror(pointToMirror: IPoint, mirrorX: boolean, mirrorY: boolean): IPoint; + /** + * Round the values of a point. + * + * @param pointContext The point to serialize. + * @param accuracy Optional exemplar number of decimal places. + * @returns A new point with the values rounded. + */ + function rounded(pointContext: IPoint, accuracy?: number): IPoint; /** * Rotate a point. * @@ -489,6 +535,14 @@ declare module MakerJs.point { * @returns A new point. */ function scale(pointToScale: IPoint, scaleValue: number): IPoint; + /** + * Get a string representation of a point. + * + * @param pointContext The point to serialize. + * @param accuracy Optional exemplar of number of decimal places. + * @returns String representing the point. + */ + function serialize(pointContext: IPoint, accuracy?: number): string; /** * Subtract a point from another point, and return the result as a new point. Shortcut to Add(a, b, subtract = true). * @@ -637,6 +691,13 @@ declare module MakerJs.paths { } } declare module MakerJs.model { + /** + * Count the number of child models within a given model. + * + * @param modelContext The model containing other models. + * @returns Number of child models. + */ + function countChildModels(modelContext: IModel): number; /** * Get an unused id in the paths map with the same prefix. * @@ -702,12 +763,6 @@ declare module MakerJs.model { * @returns The scaled model (for chaining). */ function convertUnits(modeltoConvert: IModel, destUnitType: string): IModel; - /** - * Callback signature for walkPaths. - */ - interface IModelPathCallback { - (modelContext: IModel, pathId: string, pathContext: IPath): void; - } /** * Recursively walk through all paths for a given model. * @@ -717,6 +772,15 @@ declare module MakerJs.model { function walkPaths(modelContext: IModel, callback: IModelPathCallback): void; } declare module MakerJs.model { + /** + * Check to see if a path is inside of a model. + * + * @param pathContext The path to check. + * @param modelContext The model to check against. + * @param farPoint Optional point of reference which is outside the bounds of the modelContext. + * @returns Boolean true if the path is inside of the modelContext. + */ + function isPathInsideModel(pathContext: IPath, modelContext: IModel, farPoint?: IPoint): boolean; /** * Combine 2 models. The models should be originated. * @@ -726,9 +790,10 @@ declare module MakerJs.model { * @param includeAOutsideB Flag to include paths from modelA which are outside of modelB. * @param includeBInsideA Flag to include paths from modelB which are inside of modelA. * @param includeBOutsideA Flag to include paths from modelB which are outside of modelA. + * @param keepDuplicates Flag to include paths which are duplicate in both models. * @param farPoint Optional point of reference which is outside the bounds of both models. */ - function combine(modelA: IModel, modelB: IModel, includeAInsideB: boolean, includeAOutsideB: boolean, includeBInsideA: boolean, includeBOutsideA: boolean, farPoint?: IPoint): void; + function combine(modelA: IModel, modelB: IModel, includeAInsideB?: boolean, includeAOutsideB?: boolean, includeBInsideA?: boolean, includeBOutsideA?: boolean, keepDuplicates?: boolean, farPoint?: IPoint): void; } declare module MakerJs.units { /** @@ -927,7 +992,7 @@ declare module MakerJs.path { * @param line2 Second line to fillet, which will be modified to fit the fillet. * @returns Arc path object of the new fillet. */ - function dogbone(line1: IPathLine, line2: IPathLine, filletRadius: number): IPathArc; + function dogbone(line1: IPathLine, line2: IPathLine, filletRadius: number, options?: IPointMatchOptions): IPathArc; /** * Adds a round corner to the inside angle between 2 paths. The paths must meet at one point. * @@ -935,7 +1000,7 @@ declare module MakerJs.path { * @param path2 Second path to fillet, which will be modified to fit the fillet. * @returns Arc path object of the new fillet. */ - function fillet(path1: IPath, path2: IPath, filletRadius: number): IPathArc; + function fillet(path1: IPath, path2: IPath, filletRadius: number, options?: IPointMatchOptions): IPathArc; } declare module MakerJs.kit { /** @@ -998,6 +1063,22 @@ declare module MakerJs.kit { */ function getParameterValues(ctor: IKit): any[]; } +declare module MakerJs.model { + /** + * Find paths that have common endpoints and form loops. + * + * @param modelContext The model to search for loops. + * @param options Optional options object. + * @returns A new model with child models ranked according to their containment within other found loops. The paths of models will be IPathDirectionalWithPrimeContext. + */ + function findLoops(modelContext: IModel, options?: IFindLoopsOptions): IModel; + /** + * Remove all paths in a loop model from the model(s) which contained them. + * + * @param loopToDetach The model to search for loops. + */ + function detachLoop(loopToDetach: IModel): void; +} declare module MakerJs.exporter { /** * Attributes for an XML tag. @@ -1052,6 +1133,34 @@ declare module MakerJs.exporter { toString(): string; } } +declare module MakerJs.exporter { + function toOpenJsCad(modelToExport: IModel, options?: IOpenJsCadOptions): string; + function toOpenJsCad(pathsToExport: IPath[], options?: IOpenJsCadOptions): string; + function toOpenJsCad(pathToExport: IPath, options?: IOpenJsCadOptions): string; + /** + * Executes a JavaScript string with the OpenJsCad engine - converts 2D to 3D. + * + * @param modelToExport Model object to export. + * @param options Export options object. + * @param options.extrusion Height of 3D extrusion. + * @param options.resolution Size of facets. + * @returns String of STL format of 3D object. + */ + function toSTL(modelToExport: IModel, options?: IOpenJsCadOptions): string; + /** + * OpenJsCad export options. + */ + interface IOpenJsCadOptions extends IFindLoopsOptions { + /** + * Optional depth of 3D extrusion. + */ + extrusion?: number; + /** + * Optional size of curve facets. + */ + facetSize?: number; + } +} declare module MakerJs.exporter { function toSVG(modelToExport: IModel, options?: ISVGRenderOptions): string; function toSVG(pathsToExport: IPath[], options?: ISVGRenderOptions): string; @@ -1118,6 +1227,12 @@ declare module MakerJs.models { constructor(width: number, height: number, holeRadius: number); } } +declare module MakerJs.models { + class Dome implements IModel { + paths: IPathMap; + constructor(width: number, height: number, radius?: number); + } +} declare module MakerJs.models { class RoundRectangle implements IModel { paths: IPathMap; From 47441e47c0e3ef775e27e9a73ebd4392f7951e96 Mon Sep 17 00:00:00 2001 From: emmanuel Date: Mon, 16 Nov 2015 11:29:52 +0100 Subject: [PATCH 025/474] Fix test error for mmenu 5.5.3 --- jquery.mmenu/jquery.mmenu-tests.ts | 4 ++-- jquery.mmenu/jquery.mmenu.d.ts | 37 ++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/jquery.mmenu/jquery.mmenu-tests.ts b/jquery.mmenu/jquery.mmenu-tests.ts index 9fbb9b7769..ae52793d62 100644 --- a/jquery.mmenu/jquery.mmenu-tests.ts +++ b/jquery.mmenu/jquery.mmenu-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// // -------------------------------------------------------- @@ -44,7 +44,7 @@ menu.mmenu( // ------------------- TEST MMENU API --------------------- // -------------------------------------------------------- -var api: JQueryMmenu.API = menu.data("mmenu"); +var api = menu.data("mmenu"); var myPanel: JQuery = $("#panel"); var listItem: JQuery = $(".list-item"); diff --git a/jquery.mmenu/jquery.mmenu.d.ts b/jquery.mmenu/jquery.mmenu.d.ts index 97874f8f08..a502c37cdb 100644 --- a/jquery.mmenu/jquery.mmenu.d.ts +++ b/jquery.mmenu/jquery.mmenu.d.ts @@ -157,6 +157,13 @@ declare module JQueryMmenu { interface API { + /** + * Trigger non-specialized signature method + * @param methodName + * @param callback + */ + bind(methodName: string, callback: (...args: any[]) => void): any; + /** * Trigger this method to close all opened panels and go back to the first panel. */ @@ -169,48 +176,48 @@ declare module JQueryMmenu { * (only available if the "slidingSubmenus" option is set to false). * @param panel */ - closePanel(panel: JQuery); + closePanel(panel: JQuery): void; /** @see closePanel() */ - bind(methodName: "closePanel", callback: (panel: JQuery) => void); + bind(methodName: "closePanel", callback: (panel: JQuery) => void): void; /** * Trigger this method to get the class instance for the menu. */ - getInstance(); + getInstance(): void; /** @see getInstance() */ - bind(methodName: "getInstance", callback: () => void); + bind(methodName: "getInstance", callback: () => void): void; /** * Trigger this method to (re)initialize a newly added panel. * @param panel The panel to (re)initialize. */ - init(panel: JQuery); + init(panel: JQuery): void; /** @see init() */ - bind(methodName: "init", callback: (panel: JQuery) => void); + bind(methodName: "init", callback: (panel: JQuery) => void): void; /** * Trigger this method to open a panel. * @param panel The panel to open. */ - openPanel(panel: JQuery); + openPanel(panel: JQuery): void; /** @see openPanel() */ - bind(methodName: "openPanel", callback: (panel: JQuery) => void); + bind(methodName: "openPanel", callback: (panel: JQuery) => void): void; /** * Trigger this method to set or unset a list item as "selected". * @param li The list item to set or unset as "selected". * @param selected Whether to set or unset the list item as "selected". Default: true */ - setSelected(li: JQuery, selected?: boolean); + setSelected(li: JQuery, selected?: boolean): void; /** @see setSelected() */ - bind(methodName: "setSelected", callback: (li: JQuery, selected?: boolean) => void); + bind(methodName: "setSelected", callback: (li: JQuery, selected?: boolean) => void): void; /** * Trigger this method to update the appearance for the menu. */ - update(); + update(): void; /** @see update() */ - bind(methodName: "update", callback: () => void); + bind(methodName: "update", callback: () => void): void; } @@ -226,4 +233,10 @@ interface JQuery { mmenu(options: JQueryMmenu.Options): JQuery; mmenu(options: JQueryMmenu.Options, configurations: JQueryMmenu.Configurations): JQuery; + /** + * Return the mmenu object + * @param element + */ + data(element: "mmenu"): JQueryMmenu.API; + } From 38eb9eab293520f4902c5cec93528508777fd699 Mon Sep 17 00:00:00 2001 From: emmanuel Date: Mon, 16 Nov 2015 11:30:34 +0100 Subject: [PATCH 026/474] Fix test error for slick 1.5.8 --- jquery.slick/slick-tests.ts | 7 +++---- jquery.slick/slick.d.ts | 9 ++++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/jquery.slick/slick-tests.ts b/jquery.slick/slick-tests.ts index 499e6974c7..90f61ca672 100644 --- a/jquery.slick/slick-tests.ts +++ b/jquery.slick/slick-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// // -------------------------------------------------------- @@ -196,9 +196,8 @@ $("#diaporama").slick({ centerMode: false, centerPadding: "50px", cssEase: "ease", - customPaging: (slider, i: number) => { - console.log("customPaging slider", slider); - console.log("customPaging index", i); + customPaging: (slider, i) => { + return "customPaging slider " + slider + " customPaging index " + i; }, dots: false, draggable: true, diff --git a/jquery.slick/slick.d.ts b/jquery.slick/slick.d.ts index 949f217364..d75090bb22 100644 --- a/jquery.slick/slick.d.ts +++ b/jquery.slick/slick.d.ts @@ -83,7 +83,7 @@ interface JQuerySlickOptions { * Custom paging templates. See source for use example. * Default: n/a */ - customPaging?: (slider, i: number) => string; + customPaging?: (slider: any, i: number) => string; /** * Show dot indicators @@ -272,6 +272,13 @@ interface JQuery { slick(): JQuery; slick(options: JQuerySlickOptions): JQuery; + /** + * Trigger non-specialized signature method + * @param methodName + * @param arg + */ + slick(methodName: string, ...arg: any[]): any; + /** * Returns the current slide index * @param methodName The name of the method From 790dca65ae53d6ee95cdfcefb2666f169a588e7c Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 22:18:02 +0500 Subject: [PATCH 027/474] added definations for lobibox --- lobibox/lobibox.d.ts | 197 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 lobibox/lobibox.d.ts diff --git a/lobibox/lobibox.d.ts b/lobibox/lobibox.d.ts new file mode 100644 index 0000000000..3ae7ebaef9 --- /dev/null +++ b/lobibox/lobibox.d.ts @@ -0,0 +1,197 @@ +// Type definitions for lobibox 1.0.1 +// Project: https://github.com/arboshiki/lobibox +// Definitions by: Sabeeh Ul Hussnain +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var Lobibox: LobiboxModule.LobiboxStatic; +declare module "Lobibox" { + export = Lobibox; +} +declare module LobiboxModule { + interface MessageBoxesDefault { + title? : string; + horizontalOffset?: number; + width? : number; + height? : string; // Height is automatically given calculated by width + closeButton? : boolean; // Show close button or not + draggable? : boolean; // Make messagebox draggable + customBtnClass? : string; // Class for custom buttons + modal? : boolean; + debug? : boolean; + buttonsAlign? : string; // Position where buttons should be aligned + closeOnEsc? : boolean; // Close messagebox on Esc press + delayToRemove? : number; + baseClass? : string; + showClass? : string; + hideClass? : string; + msg? : string; + + // methods + hide? (): MessageBoxesDefault; + show? (): MessageBoxesDefault; + setWidth? (width?: number): MessageBoxesDefault; + setHeight? (height?: number): MessageBoxesDefault; + setSize? (width?: number, height?: number): MessageBoxesDefault; + setPosition? (left?: number|string, top?: number): MessageBoxesDefault; + setTitle? (title?: string): MessageBoxesDefault; + getTitle? (): string; + + // events + // when messagebox show is called but before it is actually shown + onShow? (lobibox:LobiboxStatic): void ; + // after messagebox is shown + shown? (lobibox:LobiboxStatic): void; + // when messagebox remove method is called but before it is actually hidden + beforeClose? (lobibox:LobiboxStatic): void; + // after messagebox is hidden + closed? (lobibox:LobiboxStatic): void; + } + + interface MessageBoxesOptions extends MessageBoxesDefault { + bodyClass? : string; + modalClasses? : { + 'error'? : string, + 'success'? : string, + 'info'? : string, + 'warning'? : string, + 'confirm'? : string, + 'progress'? : string, + 'prompt'? : string, + 'default'? : string, + 'window'? : string + }, + buttonsAlign?: any; + buttons?: { + ok?: { + 'class'?: string, + text?: string, + closeOnClick?: boolean + }, + cancel?: { + 'class'?: string, + text?: string, + closeOnClick?: boolean + }, + yes?: { + 'class'?: string, + text?: string, + closeOnClick?: boolean + }, + no?: { + 'class'?: string, + text?: string, + closeOnClick?: boolean + } + }; + callback? (lobibox:any, type:string); + } + interface ConfirmOptions extends MessageBoxesOptions { + title? : string; + width? : number; + iconClass? : string; + } + + interface PromptOptions extends MessageBoxesOptions, PromptMethods { + width?: number; + attrs?: any; // Object of any valid attribute of input field + value?: string; // Value which is given to textfield when messagebox is created + multiline?: boolean; // Set this true for multiline prompt + lines?: number; // This works only for multiline prompt. Number of lines + type?: string; // Prompt type. Available types (text|number|color) + label?: string; // Set some text which will be shown exactly on top of textfield + } + interface AlertOptions extends MessageBoxesOptions { + warning?: { + title?: string, + iconClass?: string // Change warning alert icon globally + }; + info?:{ + title?: string, + iconClass?: string // Change info alert icon globally + }; + success?: { + title?: string, + iconClass?: string // Change success alert icon globally + }; + error?: { + title?: string, + iconClass?: string // Change error alert icon globally + }; + } + interface ProgressOptions extends MessageBoxesOptions, ProgressMethods, ProgressEvents { + width? : number; + showProgressLabel? : boolean; // Show percentage of progress + label? : string; // Show progress label + progressTpl? : boolean; //Template of progress bar + + //Events + progressUpdated? : any; + progressCompleted? : any; + } + interface WindowOptions extends MessageBoxesOptions { + width? : number; + height? : any; + content? : string; // HTML Content of window + url? : string; // URL which will be used to load content + draggable? : boolean; // Override default option + autoload? : boolean; // Auto load from given url when window is created + loadMethod? : string; // Ajax method to load content + showAfterLoad? : boolean; // Show window after content is loaded or show and then load content + params? : {}; // Parameters which will be send by ajax for loading content + } + interface ProgressEvents { + progressUpdated? (lobibox:LobiboxStatic): void; + progressComplete? (lobibox:LobiboxStatic): void; + } + interface PromptMethods { + setValue? (val?:string): PromptMethods; + getValue? (): string; + } + interface ProgressMethods { + setProgress? (progress:number): ProgressMethods; + getProgress? (): number; + } + + interface NotifyDefault { + title?: boolean; // Title of notification. If you do not include the title in options it will automatically takes its value + //from Lobibox.notify.OPTIONS object depending of the type of the notifications or set custom string. Set this false to disable title + size?: string; // normal, mini, large + soundPath?: string; // The folder path where sounds are located + soundExt?: string; // Default extension for all sounds + showClass?: string; // Show animation class. + hideClass?: string; // Hide animation class. + icon?: boolean; // Icon of notification. Leave as is for default icon or set custom string + msg?: string; // Message of notification + img?: string; // Image source string + closable?: boolean; // Make notifications closable + delay?: number; // Hide notification after this time (in miliseconds) + delayIndicator?: boolean; // Show timer indicator + closeOnClick?: boolean; // Close notifications by clicking on them + width?: number; // Width of notification box + sound?: boolean; // Sound of notification. Set this false to disable sound. Leave as is for default sound or set custom soud path + position?: string; // Place to show notification. Available options: "top left", "top right", "bottom left", "bottom right" + } + interface NotifyOptions extends NotifyDefault, NotifyMethods { + 'class'?: string; //You can override options for large notifications from here + large?: {width?: number}; //You can override options for small notifications from here + mini?: {'class'?: string}; //Default options of different style notifications + success?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string}; + error?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string}; + warning?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string}; + info?: {'class'?: string, 'title'?: string,'icon'?: string,sound?: string}; + } + + interface NotifyMethods { + remove? (); + } + + interface LobiboxStatic { + base: {OPTIONS: MessageBoxesOptions, DEFAULTS: MessageBoxesDefault}; + alert: {(type: string, options?: AlertOptions), DEFAULTS: AlertOptions}; + prompt: {(type: string, options?: PromptOptions), DEFAULTS: PromptOptions}; + confirm: {(options?: ConfirmOptions), DEFAULTS: ConfirmOptions}; + progress: {(options: ProgressOptions), DEFAULTS: ProgressOptions}; + window: {(options: WindowOptions), DEFAULTS: WindowOptions}; + notify: {(type: string, options?: NotifyOptions), DEFAULTS?: NotifyDefault,OPTIONS?:NotifyOptions}; + } +} From f7c659b988a242220f3e82105957fa053c264b76 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 22:52:27 +0500 Subject: [PATCH 028/474] lobibox test code --- lobibox/lobibox.js-test.ts | 134 +++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 lobibox/lobibox.js-test.ts diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-test.ts new file mode 100644 index 0000000000..4a14edf477 --- /dev/null +++ b/lobibox/lobibox.js-test.ts @@ -0,0 +1,134 @@ +/** + * Created by itboy on 11/22/2015. + */ + /// + /// + + //extending default parameters +Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, { + //override any options from default options + delay: false, + soundPath: '/libraries/lobibox/sounds/', + size: 'mini' +}); + +// notify +Lobibox.notify("error", {msg: "Hello world"}); +Lobibox.notify("success", {msg: "Hello world"}); +Lobibox.notify("warning", {msg: "Hello world"}); +Lobibox.notify("info", {msg: "Hello world"}); + +// alert +Lobibox.alert("error", {msg: "Hello world"}); +Lobibox.alert("success", {msg: "Hello world"}); +Lobibox.alert("warning", {msg: "Hello world"}); +Lobibox.alert("info", {msg: "Hello world"}); + +//alert with more options +Lobibox.alert('error', { + msg: 'This is an error message', + //buttons: ['ok', 'cancel', 'yes', 'no'], + //Or more powerfull way + buttons: { + ok: { + 'class': 'btn btn-info', + closeOnClick: false + }, + cancel: { + 'class': 'btn btn-danger', + closeOnClick: false + }, + yes: { + 'class': 'btn btn-success', + closeOnClick: false + }, + no: { + 'class': 'btn btn-warning', + closeOnClick: false + }, + custom: { + 'class': 'btn btn-default', + text: 'Custom' + } + }, + callback: function (lobibox, type) { + var btnType; + if (type === 'no') { + btnType = 'warning'; + } else if (type === 'yes') { + btnType = 'success'; + } else if (type === 'ok') { + btnType = 'info'; + } else if (type === 'cancel') { + btnType = 'error'; + } + Lobibox.notify(btnType, { + size: 'mini', + msg: 'This is ' + btnType + ' message' + }); + } +}); + +// confirm +Lobibox.confirm({ + msg: "Are you ok", +}); + +// prompt +Lobibox.prompt("text", { + title: 'Please enter username', + //Attributes of + attrs: { + placeholder: "Username" + } +}); + +// progress +Lobibox.progress({ + title: 'Please wait', + label: 'Uploading files...', + onShow: function ($this) { + var i = 0; + var inter = setInterval(function () { + window.console.log(i); + if (i > 100) { + clearInterval(inter); + } + i = i + 0.1; + $this.setProgress(i); + }, 10); + } +}); + +// window +Lobibox.window({ + title: 'Window title', + //Available types: string, jquery object, function + content: function () { + return $('.container'); + }, + url: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.css', + autoload: false, + loadMethod: 'GET', + //Load parameters + params: { + param1: 'Lorem', + param2: 'Ipsum' + }, + buttons: { + load: { + text: 'Load from url' + }, + close: { + text: 'Close', + closeOnClick: true + } + }, + callback: function ($this, type, ev) { + if (type === 'load') { + $this.load(function () { + //Do something when content is loaded + }); + } + } +}); From 53fba494cd604075a86f161829963ca08871f213 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 22:54:34 +0500 Subject: [PATCH 029/474] added definations for lobibox --- lobibox/lobibox.d.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lobibox/lobibox.d.ts b/lobibox/lobibox.d.ts index 3ae7ebaef9..a68be83684 100644 --- a/lobibox/lobibox.d.ts +++ b/lobibox/lobibox.d.ts @@ -38,13 +38,13 @@ declare module LobiboxModule { // events // when messagebox show is called but before it is actually shown - onShow? (lobibox:LobiboxStatic): void ; + onShow? (lobibox:any): void ; // after messagebox is shown - shown? (lobibox:LobiboxStatic): void; + shown? (lobibox:any): void; // when messagebox remove method is called but before it is actually hidden - beforeClose? (lobibox:LobiboxStatic): void; + beforeClose? (lobibox:any): void; // after messagebox is hidden - closed? (lobibox:LobiboxStatic): void; + closed? (lobibox:any): void; } interface MessageBoxesOptions extends MessageBoxesDefault { @@ -81,7 +81,8 @@ declare module LobiboxModule { 'class'?: string, text?: string, closeOnClick?: boolean - } + }, + custom?: any, }; callback? (lobibox:any, type:string); } From 924aba24b25b21f9c38f2b8c65a201eaf5584927 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 23:38:23 +0500 Subject: [PATCH 030/474] definitions for lobibox errors fixed --- lobibox/lobibox.d.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lobibox/lobibox.d.ts b/lobibox/lobibox.d.ts index a68be83684..2a951451f3 100644 --- a/lobibox/lobibox.d.ts +++ b/lobibox/lobibox.d.ts @@ -82,9 +82,8 @@ declare module LobiboxModule { text?: string, closeOnClick?: boolean }, - custom?: any, - }; - callback? (lobibox:any, type:string); + }|any; + callback? (lobibox:any, type:string, ev: any): void; } interface ConfirmOptions extends MessageBoxesOptions { title? : string; @@ -132,7 +131,7 @@ declare module LobiboxModule { interface WindowOptions extends MessageBoxesOptions { width? : number; height? : any; - content? : string; // HTML Content of window + content? : any; // HTML Content of window url? : string; // URL which will be used to load content draggable? : boolean; // Override default option autoload? : boolean; // Auto load from given url when window is created @@ -183,16 +182,16 @@ declare module LobiboxModule { } interface NotifyMethods { - remove? (); + remove? (): any; } interface LobiboxStatic { base: {OPTIONS: MessageBoxesOptions, DEFAULTS: MessageBoxesDefault}; - alert: {(type: string, options?: AlertOptions), DEFAULTS: AlertOptions}; - prompt: {(type: string, options?: PromptOptions), DEFAULTS: PromptOptions}; - confirm: {(options?: ConfirmOptions), DEFAULTS: ConfirmOptions}; - progress: {(options: ProgressOptions), DEFAULTS: ProgressOptions}; - window: {(options: WindowOptions), DEFAULTS: WindowOptions}; - notify: {(type: string, options?: NotifyOptions), DEFAULTS?: NotifyDefault,OPTIONS?:NotifyOptions}; + alert: {(type: string, options?: T): LobiboxStatic, DEFAULTS: AlertOptions}; + prompt: {(type: string, options?: T): LobiboxStatic, DEFAULTS: PromptOptions}; + confirm: {(options?: ConfirmOptions): T, DEFAULTS: ConfirmOptions}; + progress: {(options: ProgressOptions): T, DEFAULTS: ProgressOptions}; + window: {(options: WindowOptions): T, DEFAULTS: WindowOptions}; + notify: {(type: string, options?: NotifyOptions): T, DEFAULTS?: NotifyDefault,OPTIONS?:NotifyOptions}; } } From 2440326118730fd8ec352217dc43cd6688955eb0 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 23:39:01 +0500 Subject: [PATCH 031/474] lobibox test code updated --- lobibox/lobibox.js-test.ts | 224 +++++++++++++++++++------------------ 1 file changed, 114 insertions(+), 110 deletions(-) diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-test.ts index 4a14edf477..6060ac175f 100644 --- a/lobibox/lobibox.js-test.ts +++ b/lobibox/lobibox.js-test.ts @@ -5,130 +5,134 @@ /// //extending default parameters -Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, { - //override any options from default options - delay: false, - soundPath: '/libraries/lobibox/sounds/', - size: 'mini' -}); +class LobiboxTest { + static test() { + Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, { + //override any options from default options + delay: false, + soundPath: '/libraries/lobibox/sounds/', + size: 'mini' + }); // notify -Lobibox.notify("error", {msg: "Hello world"}); -Lobibox.notify("success", {msg: "Hello world"}); -Lobibox.notify("warning", {msg: "Hello world"}); -Lobibox.notify("info", {msg: "Hello world"}); + Lobibox.notify("error", {msg: "Hello world"}); + Lobibox.notify("success", {msg: "Hello world"}); + Lobibox.notify("warning", {msg: "Hello world"}); + Lobibox.notify("info", {msg: "Hello world"}); // alert -Lobibox.alert("error", {msg: "Hello world"}); -Lobibox.alert("success", {msg: "Hello world"}); -Lobibox.alert("warning", {msg: "Hello world"}); -Lobibox.alert("info", {msg: "Hello world"}); + Lobibox.alert("error", {msg: "Hello world"}); + Lobibox.alert("success", {msg: "Hello world"}); + Lobibox.alert("warning", {msg: "Hello world"}); + Lobibox.alert("info", {msg: "Hello world"}); //alert with more options -Lobibox.alert('error', { - msg: 'This is an error message', - //buttons: ['ok', 'cancel', 'yes', 'no'], - //Or more powerfull way - buttons: { - ok: { - 'class': 'btn btn-info', - closeOnClick: false - }, - cancel: { - 'class': 'btn btn-danger', - closeOnClick: false - }, - yes: { - 'class': 'btn btn-success', - closeOnClick: false - }, - no: { - 'class': 'btn btn-warning', - closeOnClick: false - }, - custom: { - 'class': 'btn btn-default', - text: 'Custom' - } - }, - callback: function (lobibox, type) { - var btnType; - if (type === 'no') { - btnType = 'warning'; - } else if (type === 'yes') { - btnType = 'success'; - } else if (type === 'ok') { - btnType = 'info'; - } else if (type === 'cancel') { - btnType = 'error'; - } - Lobibox.notify(btnType, { - size: 'mini', - msg: 'This is ' + btnType + ' message' + Lobibox.alert('error', { + msg: 'This is an error message', + //buttons: ['ok', 'cancel', 'yes', 'no'], + //Or more powerfull way + buttons: { + ok: { + 'class': 'btn btn-info', + closeOnClick: false + }, + cancel: { + 'class': 'btn btn-danger', + closeOnClick: false + }, + yes: { + 'class': 'btn btn-success', + closeOnClick: false + }, + no: { + 'class': 'btn btn-warning', + closeOnClick: false + }, + custom: { + 'class': 'btn btn-default', + text: 'Custom' + } + }, + callback: function (lobibox, type) { + var btnType; + if (type === 'no') { + btnType = 'warning'; + } else if (type === 'yes') { + btnType = 'success'; + } else if (type === 'ok') { + btnType = 'info'; + } else if (type === 'cancel') { + btnType = 'error'; + } + Lobibox.notify(btnType, { + size: 'mini', + msg: 'This is ' + btnType + ' message' + }); + } }); - } -}); // confirm -Lobibox.confirm({ - msg: "Are you ok", -}); + Lobibox.confirm({ + msg: "Are you ok", + }); // prompt -Lobibox.prompt("text", { - title: 'Please enter username', - //Attributes of - attrs: { - placeholder: "Username" - } -}); + Lobibox.prompt("text", { + title: 'Please enter username', + //Attributes of + attrs: { + placeholder: "Username" + } + }); // progress -Lobibox.progress({ - title: 'Please wait', - label: 'Uploading files...', - onShow: function ($this) { - var i = 0; - var inter = setInterval(function () { - window.console.log(i); - if (i > 100) { - clearInterval(inter); + Lobibox.progress({ + title: 'Please wait', + label: 'Uploading files...', + onShow: function ($this) { + var i = 0; + var inter = setInterval(function () { + window.console.log(i); + if (i > 100) { + clearInterval(inter); + } + i = i + 0.1; + $this.setProgress(i); + }, 10); } - i = i + 0.1; - $this.setProgress(i); - }, 10); - } -}); + }); // window -Lobibox.window({ - title: 'Window title', - //Available types: string, jquery object, function - content: function () { - return $('.container'); - }, - url: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.css', - autoload: false, - loadMethod: 'GET', - //Load parameters - params: { - param1: 'Lorem', - param2: 'Ipsum' - }, - buttons: { - load: { - text: 'Load from url' - }, - close: { - text: 'Close', - closeOnClick: true - } - }, - callback: function ($this, type, ev) { - if (type === 'load') { - $this.load(function () { - //Do something when content is loaded - }); - } + Lobibox.window({ + title: 'Window title', + //Available types: string, jquery object, function + content: function () { + return $('.container'); + }, + url: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.css', + autoload: false, + loadMethod: 'GET', + //Load parameters + params: { + param1: 'Lorem', + param2: 'Ipsum' + }, + buttons: { + load: { + text: 'Load from url' + }, + close: { + text: 'Close', + closeOnClick: true + } + }, + callback: function ($this, type, ev) { + if (type === 'load') { + $this.load(function () { + //Do something when content is loaded + }); + } + } + }); } -}); +} From 8b698cb8bb9f94b34168f613afe9cf171d69e65f Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 23:48:55 +0500 Subject: [PATCH 032/474] updated lobibox test code --- lobibox/lobibox.js-test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-test.ts index 6060ac175f..b4fea7a144 100644 --- a/lobibox/lobibox.js-test.ts +++ b/lobibox/lobibox.js-test.ts @@ -1,12 +1,14 @@ /** * Created by itboy on 11/22/2015. */ - /// + /// /// - //extending default parameters + // run test by calling + // LobiboxTest.test(); class LobiboxTest { static test() { + //extending default parameters Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, { //override any options from default options delay: false, From 76bd92c8ac2aedb9f5e0a7c8c1c7e3799822f4b8 Mon Sep 17 00:00:00 2001 From: SirTobi Date: Sun, 22 Nov 2015 19:52:52 +0100 Subject: [PATCH 033/474] Renamed old jssha files of version 1.6.0 to contain their version --- jssha/{jssha-tests.ts => jssha-1.6.0-tests.ts} | 2 +- jssha/{jssha.d.ts => jssha-1.6.0.d.ts} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename jssha/{jssha-tests.ts => jssha-1.6.0-tests.ts} (93%) rename jssha/{jssha.d.ts => jssha-1.6.0.d.ts} (98%) diff --git a/jssha/jssha-tests.ts b/jssha/jssha-1.6.0-tests.ts similarity index 93% rename from jssha/jssha-tests.ts rename to jssha/jssha-1.6.0-tests.ts index 8d6eec5a64..67e1ec026c 100755 --- a/jssha/jssha-tests.ts +++ b/jssha/jssha-1.6.0-tests.ts @@ -1,4 +1,4 @@ -/// +/// /// var imported = require("jssha"); diff --git a/jssha/jssha.d.ts b/jssha/jssha-1.6.0.d.ts similarity index 98% rename from jssha/jssha.d.ts rename to jssha/jssha-1.6.0.d.ts index 1c75c38620..7ff6e2a208 100755 --- a/jssha/jssha.d.ts +++ b/jssha/jssha-1.6.0.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jsSHA +// Type definitions for jsSHA-1.6.0 // Project: https://github.com/Caligatio/jsSHA // Definitions by: David Li // Definitions: https://github.com/borisyankov/DefinitelyTyped From 52b9b36e5dd45a8d58b43b4e4b3d0be6b59d90ee Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Sun, 22 Nov 2015 23:59:47 +0500 Subject: [PATCH 034/474] updated lobibox test code --- lobibox/lobibox.js-test.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-test.ts index b4fea7a144..bd0ff33d27 100644 --- a/lobibox/lobibox.js-test.ts +++ b/lobibox/lobibox.js-test.ts @@ -4,11 +4,11 @@ /// /// - // run test by calling - // LobiboxTest.test(); + + //Run test : LobiboxTest.test() class LobiboxTest { static test() { - //extending default parameters + // extending default parameters Lobibox.notify.DEFAULTS = $.extend({}, Lobibox.notify.DEFAULTS, { //override any options from default options delay: false, @@ -55,8 +55,8 @@ class LobiboxTest { text: 'Custom' } }, - callback: function (lobibox, type) { - var btnType; + callback: function (lobibox:any, type:string):any { + let btnType:string = ""; if (type === 'no') { btnType = 'warning'; } else if (type === 'yes') { @@ -91,9 +91,9 @@ class LobiboxTest { Lobibox.progress({ title: 'Please wait', label: 'Uploading files...', - onShow: function ($this) { + onShow: function ($this:any):void { var i = 0; - var inter = setInterval(function () { + var inter = setInterval(function ():void { window.console.log(i); if (i > 100) { clearInterval(inter); @@ -108,7 +108,7 @@ class LobiboxTest { Lobibox.window({ title: 'Window title', //Available types: string, jquery object, function - content: function () { + content: function ():any { return $('.container'); }, url: 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.css', @@ -128,9 +128,9 @@ class LobiboxTest { closeOnClick: true } }, - callback: function ($this, type, ev) { + callback: function ($this:any, type:string, ev:any):void { if (type === 'load') { - $this.load(function () { + $this.load(function ():any { //Do something when content is loaded }); } From e020d6b8a1a7c30d1678e2b75cd3ed15e95ae37b Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Mon, 23 Nov 2015 00:00:11 +0500 Subject: [PATCH 035/474] definitions for lobibox errors fixed --- lobibox/lobibox.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lobibox/lobibox.d.ts b/lobibox/lobibox.d.ts index 2a951451f3..d8a7588d51 100644 --- a/lobibox/lobibox.d.ts +++ b/lobibox/lobibox.d.ts @@ -83,7 +83,7 @@ declare module LobiboxModule { closeOnClick?: boolean }, }|any; - callback? (lobibox:any, type:string, ev: any): void; + callback? (lobibox:any, type?:string, ev?: any): void; } interface ConfirmOptions extends MessageBoxesOptions { title? : string; From 6e12544cf91956cf3b4f9811eab1fd1a12e1604c Mon Sep 17 00:00:00 2001 From: SirTobi Date: Sun, 22 Nov 2015 20:34:52 +0100 Subject: [PATCH 036/474] made option map properties optional --- jssha/jssha-1.6.0.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jssha/jssha-1.6.0.d.ts b/jssha/jssha-1.6.0.d.ts index 7ff6e2a208..b6dcef80fa 100755 --- a/jssha/jssha-1.6.0.d.ts +++ b/jssha/jssha-1.6.0.d.ts @@ -6,8 +6,8 @@ declare module jsSHA { export interface OutputFormatOptions { - outputUpper : boolean; - b64Pad : string; + outputUpper? : boolean; + b64Pad? : string; } export interface jsSHA { From 8bbf0548e54d6b7544d47940058c3bf42c5e71e8 Mon Sep 17 00:00:00 2001 From: SirTobi Date: Sun, 22 Nov 2015 20:38:19 +0100 Subject: [PATCH 037/474] add: added type definitions for new jssha version (2.0.2) because of the rework from 1.6 to 2.0 --- jssha/jssha-tests.ts | 50 +++++++++++++++++++++++++ jssha/jssha.d.ts | 87 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 jssha/jssha-tests.ts create mode 100644 jssha/jssha.d.ts diff --git a/jssha/jssha-tests.ts b/jssha/jssha-tests.ts new file mode 100644 index 0000000000..def07a2d2f --- /dev/null +++ b/jssha/jssha-tests.ts @@ -0,0 +1,50 @@ +/// +/// + +var imported = require("jssha"); + +// constructor +let shaObj1:jsSHA.jsSHA = imported("SHA-256", "HEX"); +let shaObj2:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT"); +let shaObj3:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { }); +let shaObj4:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { encoding: "UTF" }); +let shaObj5:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { numRounds: 1 }); +let shaObj6:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { encoding: "UTF", numRounds: 1 }); + +// setHMACKey +shaObj1.setHMACKey("key", "TEXT"); +shaObj1.setHMACKey("key", "TEXT", { }); +shaObj1.setHMACKey("key", "TEXT", { encoding: "UTF" }); + +// update +shaObj1.update("This is a test"); + +// getHash +let hash1:string = shaObj1.getHash("HEX"); +let hash2:string = shaObj1.getHash("HEX", {}); +let hash3:string = shaObj1.getHash("HEX", { b64Pad: "=" }); +let hash4:string = shaObj1.getHash("HEX", { outputUpper: true }); +let hash5:string = shaObj1.getHash("HEX", { outputUpper: true, b64Pad: '=' }); + +// getHMAC +let hmac1:string = shaObj1.getHMAC("HEX"); +let hmac2:string = shaObj1.getHMAC("HEX", {}); +let hmac3:string = shaObj1.getHMAC("HEX", { b64Pad: "=" }); +let hmac4:string = shaObj1.getHMAC("HEX", { outputUpper: true }); +let hmac5:string = shaObj1.getHMAC("HEX", { outputUpper: true, b64Pad: '=' }); + + +// examples from the readme.md (https://github.com/Caligatio/jsSHA/blob/v2.0.2/README.md) +{ + var shaObj = new jsSHA("SHA-512", "TEXT"); + shaObj.update("This is a test"); + var hash = shaObj.getHash("HEX"); +} + + +{ + let shaObj = new jsSHA("SHA-256", "TEXT"); + shaObj.setHMACKey("abc", "TEXT"); + shaObj.update("This is a test"); + let hmac = shaObj.getHMAC("HEX"); +} \ No newline at end of file diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts new file mode 100644 index 0000000000..8ce44f2c1e --- /dev/null +++ b/jssha/jssha.d.ts @@ -0,0 +1,87 @@ +// Type definitions for jsSHA +// Project: https://github.com/Caligatio/jsSHA +// Definitions by: Tobias Kahlert +// Definitions: https://github.com/SrTobi/DefinitelyTyped + + +declare module jsSHA { + + export interface EncodingOptions { + encoding? : string; + } + + export interface Options extends EncodingOptions { + numRounds? : number; + } + + export interface OutputFormatOptions { + outputUpper? : boolean; + b64Pad? : string; + } + + export interface jsSHA { + /** + * jsSHA is the workhorse of the library. Instantiate it with the string to + * be hashed as the parameter + * + * @constructor + * @this {jsSHA} + * @param {string} variant The desired SHA variant (SHA-1, SHA-224, SHA-256, + * SHA-384, or SHA-512) + * @param {string} inputFormat The format of srcString: HEX, TEXT, B64, or BYTES + * @param {{encoding: (string|undefined), numRounds: (string|undefined)}=} + * options Optional values + */ + new (variant:string, inputFormat:string, options?:Options):jsSHA; + + /** + * Sets the HMAC key for an eventual getHMAC call. Must be called + * immediately after jsSHA object instantiation + * + * @param {string} key The key used to calculate the HMAC + * @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES + * @param {{encoding : (string|undefined)}=} options Associative array + * of input format options + */ + setHMACKey(key:string, inputFormat:string, encodingOpts?:EncodingOptions):void; + + /** + * Takes strString and hashes as many blocks as possible. Stores the + * rest for either a future update or getHash call. + * + * @param {string} srcString The string to be hashed + */ + update(srcString:string):void; + + + /** + * Returns the desired SHA hash of the string specified at instantiation + * using the specified parameters + * + * @param {string} format The desired output formatting (B64, HEX, or BYTES) + * @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=} + * options Hash list of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHash(format:string, outputFormatOpts?:OutputFormatOptions):string; + + /** + * Returns the the HMAC in the specified format using the key given by + * a previous setHMACKey call. + * + * @param {string} format The desired output formatting + * (B64, HEX, or BYTES) + * @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=} + * options associative array of output formatting options + * @return {string} The string representation of the hash in the format + * specified + */ + getHMAC(format:string, outputFormatOpts?:OutputFormatOptions):string; + } +} + +declare var jsSHA: jsSHA.jsSHA; +declare module 'jssha' { + export = jsSHA; +} \ No newline at end of file From 4986b607ede2a16aa81881155603c45f99f9c842 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Mon, 23 Nov 2015 00:36:09 +0100 Subject: [PATCH 038/474] fixed parameter documentation --- jssha/jssha.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts index 8ce44f2c1e..2b5a2b7e0c 100644 --- a/jssha/jssha.d.ts +++ b/jssha/jssha.d.ts @@ -40,7 +40,7 @@ declare module jsSHA { * * @param {string} key The key used to calculate the HMAC * @param {string} inputFormat The format of key, HEX, TEXT, B64, or BYTES - * @param {{encoding : (string|undefined)}=} options Associative array + * @param {{encoding : (string|undefined)}=} encodingOpts Associative array * of input format options */ setHMACKey(key:string, inputFormat:string, encodingOpts?:EncodingOptions):void; @@ -60,7 +60,7 @@ declare module jsSHA { * * @param {string} format The desired output formatting (B64, HEX, or BYTES) * @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=} - * options Hash list of output formatting options + * outputFormatOpts Hash list of output formatting options * @return {string} The string representation of the hash in the format * specified */ @@ -73,7 +73,7 @@ declare module jsSHA { * @param {string} format The desired output formatting * (B64, HEX, or BYTES) * @param {{outputUpper : (boolean|undefined), b64Pad : (string|undefined)}=} - * options associative array of output formatting options + * outputFormatOpts associative array of output formatting options * @return {string} The string representation of the hash in the format * specified */ From 9dcb36b7e2cdad44b845f568e92fe0e602f75a28 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Mon, 23 Nov 2015 00:36:53 +0100 Subject: [PATCH 039/474] improved constructor documentation --- jssha/jssha.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts index 2b5a2b7e0c..0d880de456 100644 --- a/jssha/jssha.d.ts +++ b/jssha/jssha.d.ts @@ -24,8 +24,6 @@ declare module jsSHA { * jsSHA is the workhorse of the library. Instantiate it with the string to * be hashed as the parameter * - * @constructor - * @this {jsSHA} * @param {string} variant The desired SHA variant (SHA-1, SHA-224, SHA-256, * SHA-384, or SHA-512) * @param {string} inputFormat The format of srcString: HEX, TEXT, B64, or BYTES From 9bfee0e09d6b5678296e748dc075d2aca20daf24 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Mon, 23 Nov 2015 00:46:38 +0100 Subject: [PATCH 040/474] improved test --- jssha/jssha-tests.ts | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/jssha/jssha-tests.ts b/jssha/jssha-tests.ts index def07a2d2f..f6e0f96b48 100644 --- a/jssha/jssha-tests.ts +++ b/jssha/jssha-tests.ts @@ -1,30 +1,29 @@ /// /// -var imported = require("jssha"); +import imported = require("jssha"); // constructor -let shaObj1:jsSHA.jsSHA = imported("SHA-256", "HEX"); -let shaObj2:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT"); -let shaObj3:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { }); -let shaObj4:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { encoding: "UTF" }); -let shaObj5:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { numRounds: 1 }); -let shaObj6:jsSHA.jsSHA = new jsSHA("SHA-512", "TEXT", { encoding: "UTF", numRounds: 1 }); +let shaObj1:jsSHA.jsSHA = new imported("SHA-512", "TEXT"); +let shaObj2:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { }); +let shaObj3:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { encoding: "UTF8" }); +let shaObj4:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { numRounds: 1 }); +let shaObj5:jsSHA.jsSHA = new imported("SHA-512", "TEXT", { encoding: "UTF8", numRounds: 1 }); // setHMACKey shaObj1.setHMACKey("key", "TEXT"); -shaObj1.setHMACKey("key", "TEXT", { }); -shaObj1.setHMACKey("key", "TEXT", { encoding: "UTF" }); +shaObj2.setHMACKey("key", "TEXT", { }); +shaObj3.setHMACKey("key", "TEXT", { encoding: "UTF8" }); // update shaObj1.update("This is a test"); // getHash -let hash1:string = shaObj1.getHash("HEX"); -let hash2:string = shaObj1.getHash("HEX", {}); -let hash3:string = shaObj1.getHash("HEX", { b64Pad: "=" }); -let hash4:string = shaObj1.getHash("HEX", { outputUpper: true }); -let hash5:string = shaObj1.getHash("HEX", { outputUpper: true, b64Pad: '=' }); +let hash1:string = shaObj4.getHash("HEX"); +let hash2:string = shaObj4.getHash("HEX", {}); +let hash3:string = shaObj4.getHash("HEX", { b64Pad: "=" }); +let hash4:string = shaObj4.getHash("HEX", { outputUpper: true }); +let hash5:string = shaObj4.getHash("HEX", { outputUpper: true, b64Pad: '=' }); // getHMAC let hmac1:string = shaObj1.getHMAC("HEX"); @@ -36,14 +35,14 @@ let hmac5:string = shaObj1.getHMAC("HEX", { outputUpper: true, b64Pad: '=' }); // examples from the readme.md (https://github.com/Caligatio/jsSHA/blob/v2.0.2/README.md) { - var shaObj = new jsSHA("SHA-512", "TEXT"); + var shaObj = new imported("SHA-512", "TEXT"); shaObj.update("This is a test"); var hash = shaObj.getHash("HEX"); } { - let shaObj = new jsSHA("SHA-256", "TEXT"); + let shaObj = new imported("SHA-256", "TEXT"); shaObj.setHMACKey("abc", "TEXT"); shaObj.update("This is a test"); let hmac = shaObj.getHMAC("HEX"); From 8ed81ba63237a628ec63f7cd34697c6acc1bdaed Mon Sep 17 00:00:00 2001 From: SrTobi Date: Mon, 23 Nov 2015 00:53:32 +0100 Subject: [PATCH 041/474] hide jsSHA instance --- jssha/jssha.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts index 0d880de456..e8e8787c54 100644 --- a/jssha/jssha.d.ts +++ b/jssha/jssha.d.ts @@ -79,7 +79,7 @@ declare module jsSHA { } } -declare var jsSHA: jsSHA.jsSHA; declare module 'jssha' { + var jsSHA: jsSHA.jsSHA; export = jsSHA; } \ No newline at end of file From d8184977b0d72cce7fb5e03591de83b9424f6d0b Mon Sep 17 00:00:00 2001 From: emmanuel Date: Mon, 23 Nov 2015 14:35:47 +0100 Subject: [PATCH 042/474] Rename jquery.slick to slick-carousel --- .../slick-tests.ts => slick-carousel/slick-carousel-tests.ts | 2 +- jquery.slick/slick.d.ts => slick-carousel/slick-carousel.d.ts | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename jquery.slick/slick-tests.ts => slick-carousel/slick-carousel-tests.ts (98%) rename jquery.slick/slick.d.ts => slick-carousel/slick-carousel.d.ts (100%) diff --git a/jquery.slick/slick-tests.ts b/slick-carousel/slick-carousel-tests.ts similarity index 98% rename from jquery.slick/slick-tests.ts rename to slick-carousel/slick-carousel-tests.ts index 90f61ca672..0279f5131e 100644 --- a/jquery.slick/slick-tests.ts +++ b/slick-carousel/slick-carousel-tests.ts @@ -1,5 +1,5 @@ /// -/// +/// // -------------------------------------------------------- diff --git a/jquery.slick/slick.d.ts b/slick-carousel/slick-carousel.d.ts similarity index 100% rename from jquery.slick/slick.d.ts rename to slick-carousel/slick-carousel.d.ts From 97d7377cf8f38d1c4e8e424f4a55de99428fe281 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Mon, 23 Nov 2015 22:57:19 -0500 Subject: [PATCH 043/474] Initial commit. Created turf.d.ts and turf-test.ts files. --- turf/turf-test.ts | 0 turf/turf.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 turf/turf-test.ts create mode 100644 turf/turf.d.ts diff --git a/turf/turf-test.ts b/turf/turf-test.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/turf/turf.d.ts b/turf/turf.d.ts new file mode 100644 index 0000000000..e69de29bb2 From 8ccfe0dd015abcdae1625bfc795ca7ae6615fd78 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 14:54:21 -0500 Subject: [PATCH 044/474] Added definition for distance and pointOnLine. Added related tests. --- turf/turf-test.ts | 94 +++++++++++++++++++++++++++++++++++++++++++++++ turf/turf.d.ts | 65 ++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index e69de29bb2..1cf6be9b04 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -0,0 +1,94 @@ +/// + +////////////////////////////////////////////////////////////////////////// +// Tests Aggregation +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Measurement +////////////////////////////////////////////////////////////////////////// + +var point1 = { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-75.343, 39.984] + } +}; +var point2 = { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-75.534, 39.123] + } +}; +var units = "miles"; + +var points = { + "type": "FeatureCollection", + "features": [point1, point2] +}; + +var distance = turf.distance(point1, point2, units); + +////////////////////////////////////////////////////////////////////////// +// Tests Transformation +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Misc +////////////////////////////////////////////////////////////////////////// + +var line = { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "LineString", + "coordinates": [ + [-77.031669, 38.878605], + [-77.029609, 38.881946], + [-77.020339, 38.884084], + [-77.025661, 38.885821], + [-77.021884, 38.889563], + [-77.019824, 38.892368] + ] + } +}; +var pt = { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-77.037076, 38.884017] + } +}; + +var snapped = turf.pointOnLine(line, pt); +snapped.properties['marker-color'] = '#00f' + +var result = { + "type": "FeatureCollection", + "features": [line, pt, snapped] +}; + +////////////////////////////////////////////////////////////////////////// +// Tests Helper +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Data +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Interpolation +//////////////////////////////////////////////////////////////////////////; + +////////////////////////////////////////////////////////////////////////// +// Tests Joins +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Classification +////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index e69de29bb2..cde4b59d3e 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -0,0 +1,65 @@ +// Type definitions for Turf 2.0 +// Project: http://turfjs.org/ +// Definitions by: Guillaume Croteau +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module turf { + ////////////////////////////////////////////////////////////////////////// + // Aggregation + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Measurement + ////////////////////////////////////////////////////////////////////////// + + /** + * Calculates the distance between two points in degress, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature. + * @param from Origin point + * @param to Destination point + * @param units Can be degrees, radians, miles, or kilometers. Default is kilometers. + * @returns Distance between the two points + */ + function distance(from: GeoJSON.Feature, to: GeoJSON.Feature, units?: string): number; + + ////////////////////////////////////////////////////////////////////////// + // Transformation + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Misc + ////////////////////////////////////////////////////////////////////////// + + /** + * Takes a Point and a LineString and calculates the closest Point on the LineString. + * @param line Line to snap to + * @param point Point to snap from + * @returns Closest point on the line to point + */ + function pointOnLine(line: GeoJSON.Feature, point: GeoJSON.Feature): GeoJSON.Feature; + + ////////////////////////////////////////////////////////////////////////// + // Helper + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Data + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Interpolation + //////////////////////////////////////////////////////////////////////////; + + ////////////////////////////////////////////////////////////////////////// + // Joins + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Classification + ////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////// + // Types + ////////////////////////////////////////////////////////////////////////// +} From 9488d2229fd7f91287777bcd3d61f658b3a1c020 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 16:53:35 -0500 Subject: [PATCH 045/474] Added along and area definition. Added related tests. --- turf/turf-test.ts | 100 ++++++++++++++++++++++++++++++++-------------- turf/turf.d.ts | 18 ++++++++- 2 files changed, 86 insertions(+), 32 deletions(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 1cf6be9b04..5d1a73a93f 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -1,11 +1,7 @@ /// ////////////////////////////////////////////////////////////////////////// -// Tests Aggregation -////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////// -// Tests Measurement +// Tests data initialisation ////////////////////////////////////////////////////////////////////////// var point1 = { @@ -16,6 +12,7 @@ var point1 = { "coordinates": [-75.343, 39.984] } }; + var point2 = { "type": "Feature", "properties": {}, @@ -24,22 +21,6 @@ var point2 = { "coordinates": [-75.534, 39.123] } }; -var units = "miles"; - -var points = { - "type": "FeatureCollection", - "features": [point1, point2] -}; - -var distance = turf.distance(point1, point2, units); - -////////////////////////////////////////////////////////////////////////// -// Tests Transformation -////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////// -// Tests Misc -////////////////////////////////////////////////////////////////////////// var line = { "type": "Feature", @@ -56,21 +37,78 @@ var line = { ] } }; -var pt = { - "type": "Feature", - "properties": {}, - "geometry": { - "type": "Point", - "coordinates": [-77.037076, 38.884017] - } + +var polygons = { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [-67.031021, 10.458102], + [-67.031021, 10.53372], + [-66.929397, 10.53372], + [-66.929397, 10.458102], + [-67.031021, 10.458102] + ]] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [-66.919784, 10.397325], + [-66.919784, 10.513467], + [-66.805114, 10.513467], + [-66.805114, 10.397325], + [-66.919784, 10.397325] + ]] + } + } + ] }; -var snapped = turf.pointOnLine(line, pt); -snapped.properties['marker-color'] = '#00f' +////////////////////////////////////////////////////////////////////////// +// Tests Aggregation +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Measurement +////////////////////////////////////////////////////////////////////////// + +// -- Test along -- +var along = turf.along(line, 1, 'miles'); var result = { "type": "FeatureCollection", - "features": [line, pt, snapped] + "features": [line, along] +}; + +// -- Test area -- +var area = turf.area(polygons); + +// -- Test distance -- +var units = "miles"; +var distance = turf.distance(point1, point2, units); + +////////////////////////////////////////////////////////////////////////// +// Tests Transformation +////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////// +// Tests Misc +////////////////////////////////////////////////////////////////////////// + +// -- Test pointOnLine -- +var snapped = turf.pointOnLine(line, point1); +snapped.properties['marker-color'] = '#00f' + +result = { + "type": "FeatureCollection", + "features": [line, point1, snapped] }; ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index cde4b59d3e..15e9478db5 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -14,11 +14,27 @@ declare module turf { // Measurement ////////////////////////////////////////////////////////////////////////// + /** + * Takes a line and returns a point at a specified distance along the line. + * @param line Input line + * @param distance Distance along the line + * @param [units=miles] Can be degrees, radians, miles, or kilometers. Default is miles + * @returns Point along the line + */ + function along(line: GeoJSON.Feature, distance: number, units?: string): GeoJSON.Feature; + + /** + * Takes one or more features and returns their area in square meters. + * @param input Input features + * @returns Area in square meters + */ + function area(input: GeoJSON.Feature | GeoJSON.FeatureCollection): number; + /** * Calculates the distance between two points in degress, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature. * @param from Origin point * @param to Destination point - * @param units Can be degrees, radians, miles, or kilometers. Default is kilometers. + * @param [units=kilometers] Can be degrees, radians, miles, or kilometers. Default is kilometers. * @returns Distance between the two points */ function distance(from: GeoJSON.Feature, to: GeoJSON.Feature, units?: string): number; From 848b9d84676b802a37e6d0d9dca226780c9f311c Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 19:52:59 -0500 Subject: [PATCH 046/474] Completed the Measurement definitions. --- turf/turf-test.ts | 157 ++++++++++++++++++++++++++++++++++++++++++---- turf/turf.d.ts | 135 ++++++++++++++++++++++++++++++++------- 2 files changed, 259 insertions(+), 33 deletions(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 5d1a73a93f..c248ebda16 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -71,6 +71,112 @@ var polygons = { ] }; +var polygon = { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [105.818939,21.004714], + [105.818939,21.061754], + [105.890007,21.061754], + [105.890007,21.004714], + [105.818939,21.004714] + ]] + } +}; + +var features = { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.522259, 35.4691] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.502754, 35.463455] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.508269, 35.463245] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.516809, 35.465779] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.515372, 35.467072] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.509363, 35.463053] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.511123, 35.466601] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.518547, 35.469327] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.519706, 35.469659] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.517839, 35.466998] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.508678, 35.464942] + } + }, { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Point", + "coordinates": [-97.514914, 35.463453] + } + } + ] +}; + ////////////////////////////////////////////////////////////////////////// // Tests Aggregation ////////////////////////////////////////////////////////////////////////// @@ -82,18 +188,53 @@ var polygons = { // -- Test along -- var along = turf.along(line, 1, 'miles'); -var result = { - "type": "FeatureCollection", - "features": [line, along] -}; - // -- Test area -- var area = turf.area(polygons); +// -- Test bboxPolygon -- +var bbox = [0, 0, 10, 10]; +var poly = turf.bboxPolygon(bbox); + +// -- Test bearing -- +var bearing = turf.bearing(point1, point2); + +// -- Test center +var centerPt = turf.center(features); + +// -- Test centroid -- +var centroidPt = turf.centroid(poly); + +// -- Test destination -- +var distance = 50; +var bearing = 90; +var units = 'miles'; +var destination = turf.destination(point1, distance, bearing, units); + // -- Test distance -- var units = "miles"; var distance = turf.distance(point1, point2, units); +// -- Test envelope -- +var enveloped = turf.envelope(polygons); + +// -- Test extent -- +var bbox = turf.extent(polygons); + +// -- Test lineDistance +var length = turf.lineDistance(line, 'miles'); + +// -- Test midpoint -- +var midpointed = turf.midpoint(point1, point2); + +// -- Test pointOnSurface -- +var pointOnPolygon = turf.pointOnSurface(polygon); + +// -- Test size -- +var resized = turf.size(bbox, 2); + +// -- Test square -- +var squared = turf.square(bbox); + ////////////////////////////////////////////////////////////////////////// // Tests Transformation ////////////////////////////////////////////////////////////////////////// @@ -104,12 +245,6 @@ var distance = turf.distance(point1, point2, units); // -- Test pointOnLine -- var snapped = turf.pointOnLine(line, point1); -snapped.properties['marker-color'] = '#00f' - -result = { - "type": "FeatureCollection", - "features": [line, point1, snapped] -}; ////////////////////////////////////////////////////////////////////////// // Tests Helper diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 15e9478db5..2b0c69c139 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -6,13 +6,13 @@ /// declare module turf { - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Aggregation - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Measurement - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// /** * Takes a line and returns a point at a specified distance along the line. @@ -29,7 +29,46 @@ declare module turf { * @returns Area in square meters */ function area(input: GeoJSON.Feature | GeoJSON.FeatureCollection): number; - + + /** + * Takes a bbox and returns an equivalent polygon. + * @param bbox An Array of bounding box coordinates in the form: [xLow, yLow, xHigh, yHigh] + * @returns A Polygon representation of the bounding box + */ + function bboxPolygon(bbox: Array): GeoJSON.Feature; + + /** + * Takes two points and finds the geographic bearing between them. + * @param start Starting Point + * @param end Ending point + * @returns Bearing in decimal degrees + */ + function bearing(start: GeoJSON.Feature, end: GeoJSON.Feature): number; + + /** + * Takes a FeatureCollection and returns the absolute center point of all features. + * @param features Input features + * @returns A Point feature at the absolute center point of all input features + */ + function center(features: GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Takes one or more features and calculates the centroid using the arithmetic mean of all vertices. This lessens the effect of small islands and artifacts when calculating the centroid of a set of polygons. + * @param features Input features + * @returns The centroid of the input features + */ + function centroid(features: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Takes a Point and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. This uses the Haversine formula to account for global curvature. + * @param start Starting point + * @param distance Distance from the starting point + * @param bearing Ranging from -180 and 180 + * @param units Miles, kilometers, degrees or radians + * @returns Destination point + */ + function destination(start: GeoJSON.Feature, distance: number, bearing: number, units: string): GeoJSON.Feature; + /** * Calculates the distance between two points in degress, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature. * @param from Origin point @@ -39,13 +78,65 @@ declare module turf { */ function distance(from: GeoJSON.Feature, to: GeoJSON.Feature, units?: string): number; - ////////////////////////////////////////////////////////////////////////// - // Transformation - ////////////////////////////////////////////////////////////////////////// + /** + * Takes any number of features and returns a rectangular Polygon that encompasses all vertices. + * @param fc Input features + * @returns A rectangular Polygon feature that encompasses all vertices + */ + function envelope(fc: GeoJSON.FeatureCollection): GeoJSON.Feature; - ////////////////////////////////////////////////////////////////////////// + /** + * Takes a set of features, calculates the extent of all input features, and returns a bounding box. + * @param input Input features + * @returns The bounding box of input given as an array in WSEN order (west, south, east, north) + */ + function extent(input: GeoJSON.Feature | GeoJSON.FeatureCollection): Array; + + /** + * Takes a line and measures its length in the specified units. + * @param line Line to measure + * @param units Can be degrees, radians, miles, or kilometers + * @returns Length of the input line + */ + function lineDistance(line: GeoJSON.Feature, units: string): number; + + /** + * Takes two points and returns a point midway between them. + * @param pt1 First point + * @param pt2 Second point + * @returns A point midway between pt1 and pt2 + */ + function midpoint(pt1: GeoJSON.Feature, pt2: GeoJSON.Feature): GeoJSON.Feature; + + /** + * Takes a feature and returns a Point guaranteed to be on the surface of the feature. Given a Polygon, the point will be in the area of the polygon. Given a LineString, the point will be along the string. Given a Point, the point will the same as the input. + * @param input Any feature or set of features + * @returns A point on the surface of input + */ + function pointOnSurface(input: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Takes a bounding box and returns a new bounding box with a size expanded or contracted by a factor of X. + * @param bbox A bounding box + * @param factor The ratio of the new bbox to the input bbox + * @returns The resized bbox + */ + function size(bbox: Array, factor: number): Array; + + /** + * Takes a bounding box and calculates the minimum square bounding box that would contain the input. + * @param bbox A bounding box + * @returns A square surrounding bbox + */ + function square(bbox: Array): Array; + + ////////////////////////////////////////////////////// + // Transformation + ////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////// // Misc - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// /** * Takes a Point and a LineString and calculates the closest Point on the LineString. @@ -55,27 +146,27 @@ declare module turf { */ function pointOnLine(line: GeoJSON.Feature, point: GeoJSON.Feature): GeoJSON.Feature; - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Helper - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Data - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Interpolation - //////////////////////////////////////////////////////////////////////////; + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Joins - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Classification - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// // Types - ////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////// } From bbc2af3a3fc34fb1c64d0596cb8c5f2be7f493b7 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 20:22:20 -0500 Subject: [PATCH 047/474] Completed the Transformation definitions. --- turf/turf-test.ts | 52 ++++++++++++++++++++++++++++-- turf/turf.d.ts | 82 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 128 insertions(+), 6 deletions(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index c248ebda16..85b2c7b9a7 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -71,7 +71,7 @@ var polygons = { ] }; -var polygon = { +var polygon1 = { "type": "Feature", "properties": {}, "geometry": { @@ -86,6 +86,26 @@ var polygon = { } }; +var polygon2 = { + "type": "Feature", + "properties": { + "fill": "#00f" + }, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [-122.520217, 45.535693], + [-122.64038, 45.553967], + [-122.720031, 45.526554], + [-122.669906, 45.507309], + [-122.723464, 45.446643], + [-122.532577, 45.408574], + [-122.487258, 45.477466], + [-122.520217, 45.535693] + ]] + } +} + var features = { "type": "FeatureCollection", "features": [ @@ -227,7 +247,7 @@ var length = turf.lineDistance(line, 'miles'); var midpointed = turf.midpoint(point1, point2); // -- Test pointOnSurface -- -var pointOnPolygon = turf.pointOnSurface(polygon); +var pointOnPolygon = turf.pointOnSurface(polygon1); // -- Test size -- var resized = turf.size(bbox, 2); @@ -239,6 +259,34 @@ var squared = turf.square(bbox); // Tests Transformation ////////////////////////////////////////////////////////////////////////// +// -- Test bezier -- +var curved = turf.bezier(line); + +// -- Test buffer -- +var buffered = turf.buffer(point1, 500, units); + +// -- Test concave -- +var hull = turf.concave(features, 1, 'miles'); + +// -- Test convex -- +var hull = turf.convex(features); + +// -- Test difference -- +var differenced = turf.difference(polygon1, polygon2); + +// -- Test intersect -- +var intersection = turf.intersect(polygon1, polygon2); + +// -- Test merge -- +var merged = turf.merge(polygons); + +// -- Test simplify -- +var tolerance = 0.01; +var simplified = turf.simplify(polygon1, tolerance, false); + +// -- Test union -- +var union = turf.union(polygon1, polygon2); + ////////////////////////////////////////////////////////////////////////// // Tests Misc ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 2b0c69c139..77bba0c740 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -18,7 +18,7 @@ declare module turf { * Takes a line and returns a point at a specified distance along the line. * @param line Input line * @param distance Distance along the line - * @param [units=miles] Can be degrees, radians, miles, or kilometers. Default is miles + * @param [units=miles] 'miles', 'feet', 'kilometers', 'meters', or 'degrees' * @returns Point along the line */ function along(line: GeoJSON.Feature, distance: number, units?: string): GeoJSON.Feature; @@ -64,7 +64,7 @@ declare module turf { * @param start Starting point * @param distance Distance from the starting point * @param bearing Ranging from -180 and 180 - * @param units Miles, kilometers, degrees or radians + * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' * @returns Destination point */ function destination(start: GeoJSON.Feature, distance: number, bearing: number, units: string): GeoJSON.Feature; @@ -73,7 +73,7 @@ declare module turf { * Calculates the distance between two points in degress, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature. * @param from Origin point * @param to Destination point - * @param [units=kilometers] Can be degrees, radians, miles, or kilometers. Default is kilometers. + * @param [units=kilometers] 'miles', 'feet', 'kilometers', 'meters', or 'degrees' * @returns Distance between the two points */ function distance(from: GeoJSON.Feature, to: GeoJSON.Feature, units?: string): number; @@ -95,7 +95,7 @@ declare module turf { /** * Takes a line and measures its length in the specified units. * @param line Line to measure - * @param units Can be degrees, radians, miles, or kilometers + * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' * @returns Length of the input line */ function lineDistance(line: GeoJSON.Feature, units: string): number; @@ -134,6 +134,80 @@ declare module turf { // Transformation ////////////////////////////////////////////////////// + /** + * Takes a line and returns a curved version by applying a Bezier spline algorithm. The bezier spline implementation is by Leszek Rybicki. + * @param line Input LineString + * @param [resolution=10000] Time in milliseconds between points + * @param [sharpness=0.85] A measure of how curvy the path should be between splines + * @returns Curved line + */ + function bezier(line: GeoJSON.Feature, resolution?: number, sharpness?: number): GeoJSON.Feature; + + /** + * Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees. + * @param feature Input to be buffered + * @param distance Distance to draw the buffer + * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @returns Buffered features + */ + function buffer(feature: GeoJSON.Feature | GeoJSON.FeatureCollection, distance: number, units: string): GeoJSON.Feature | GeoJSON.FeatureCollection; + + /** + * Takes a set of points and returns a concave hull polygon. Internally, this implements a Monotone chain algorithm. + * @param points Input points + * @param maxEdge The size of an edge necessary for part of the hull to become concave (in miles) + * @param units Used for maxEdge distance (miles or kilometers) + * @returns A concave hull + */ + function concave(points: GeoJSON.FeatureCollection, maxEdge: number, units: string): GeoJSON.Feature; + + /** + * Takes a set of points and returns a convex hull polygon. Internally this uses the convex-hull module that implements a monotone chain hull. + * @param input Input points + * @returns A convex hull + */ + function convex(points: GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Finds the difference between two polygons by clipping the second polygon from the first. + * @param poly1 Input Polygon feaure + * @param poly2 Polygon feature to difference from poly1 + * @returns A Polygon feature showing the area of poly1 excluding the area of poly2 + */ + function difference(poly1: GeoJSON.Feature, poly2: GeoJSON.Feature): GeoJSON.Feature; + + /** + * Takes two polygons and finds their intersection. If they share a border, returns the border; if they don't intersect, returns undefined. + * @param poly1 The first polygon + * @param poly2 The second polygon + * @returns If poly1 and poly2 overlap, returns a Polygon feature representing the area they overlap; if poly1 and poly2 do not overlap, returns undefined; if poly1 and poly2 share a border, a MultiLineString of the locations where their borders are shared + */ + function intersect(poly1: GeoJSON.Feature, poly2: GeoJSON.Feature): GeoJSON.Feature; + + /** + * Takes a set of polygons and returns a single merged polygon feature. If the input polygon features are not contiguous, this function returns a MultiPolygon feature. + * @param fc Input polygons + * @returns Merged polygon or multipolygon + */ + function merge(fc: GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Takes a LineString or Polygon and returns a simplified version. Internally uses simplify-js to perform simplification. + * @param feature Feature to be simplified + * @param tolerance Simplification tolerance + * @param highQuality Whether or not to spend more time to create a higher-quality simplification with a different algorithm + * @returns A simplified feature + */ + function simplify(feature: GeoJSON.Feature | GeoJSON.FeatureCollection | GeoJSON.GeometryCollection, tolerance: number, highQuality: boolean): GeoJSON.Feature | GeoJSON.FeatureCollection | GeoJSON.GeometryCollection; + + /** + * Takes two polygons and returns a combined polygon. If the input polygons are not contiguous, this function returns a MultiPolygon feature. + * @param poly1 Input polygon + * @param poly2 Another input polygon + * @returns A combined Polygon or MultiPolygon feature + */ + function union(poly1: GeoJSON.Feature, poly2: GeoJSON.Feature): GeoJSON.Feature; + ////////////////////////////////////////////////////// // Misc ////////////////////////////////////////////////////// From bd95f700d11867f1f18f1faaf6675906f5fa6c27 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 21:57:25 -0500 Subject: [PATCH 048/474] Completed the Misc definitions. --- turf/turf-test.ts | 17 ++++++++++++++++- turf/turf.d.ts | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 85b2c7b9a7..b053e761ea 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -222,7 +222,7 @@ var bearing = turf.bearing(point1, point2); var centerPt = turf.center(features); // -- Test centroid -- -var centroidPt = turf.centroid(poly); +var centroidPt = turf.centroid(polygon1); // -- Test destination -- var distance = 50; @@ -291,6 +291,21 @@ var union = turf.union(polygon1, polygon2); // Tests Misc ////////////////////////////////////////////////////////////////////////// +// -- Test combine -- +var combined = turf.combine(features); + +// -- Test explode -- +var points = turf.explode(polygon1); + +// -- Test flip -- +var flipedPoint = turf.flip(point1); + +// -- Test kinks -- +var kinks = turf.kinks(polygon1); + +// -- Test lineSlice -- +var sliced = turf.lineSlice(point1, point2, line); + // -- Test pointOnLine -- var snapped = turf.pointOnLine(line, point1); diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 77bba0c740..fb479ae347 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -212,6 +212,43 @@ declare module turf { // Misc ////////////////////////////////////////////////////// + /** + * Combines a FeatureCollection of Point, LineString, or Polygon features into MultiPoint, MultiLineString, or MultiPolygon features. + * @param fc A FeatureCollection of any type + * @returns A FeatureCollection of corresponding type to input + */ + function combine(fc: GeoJSON.FeatureCollection): GeoJSON.FeatureCollection; + + /** + * Takes a feature or set of features and returns all positions as points. + * @param input Input features + * @returns Points representing the exploded input features + */ + function explode(input: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.FeatureCollection; + + /** + * Takes input features and flips all of their coordinates from [x, y] to [y, x]. + * @param input Input features + * @returns A feature or set of features of the same type as input with flipped coordinates + */ + function flip(input: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.Feature | GeoJSON.FeatureCollection; + + /** + * Takes a polygon and returns points at all self-intersections. + * @param polygon Input polygon + * @returns Self-intersections + */ + function kinks(polygon: GeoJSON.Feature): GeoJSON.FeatureCollection; + + /** + * Takes a line, a start Point, and a stop point and returns the line in between those points. + * @param point1 Starting point + * @param point2 Stopping point + * @param line Line to slice + * @returns Sliced line + */ + function lineSlice(point1: GeoJSON.Feature, point2: GeoJSON.Feature, line: GeoJSON.Feature): GeoJSON.Feature; + /** * Takes a Point and a LineString and calculates the closest Point on the LineString. * @param line Line to snap to From 4d5969f17cd9411d5bf5d87eba035ecd012a48d2 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 22:47:30 -0500 Subject: [PATCH 049/474] Completed the Helper definitions. --- turf/turf-test.ts | 30 ++++++++++++++++++++++++++++++ turf/turf.d.ts | 31 +++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index b053e761ea..2965428684 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -313,6 +313,36 @@ var snapped = turf.pointOnLine(line, point1); // Tests Helper ////////////////////////////////////////////////////////////////////////// +// -- Test featurecollection -- +var fc = turf.featurecollection([point1, point2]); + +// -- Test linestring -- +var linestring1 = turf.linestring([ + [-21.964416, 64.148203], + [-21.956176, 64.141316], + [-21.93901, 64.135924], + [-21.927337, 64.136673] +]); +var linestring2 = turf.linestring([ + [-21.929054, 64.127985], + [-21.912918, 64.134726], + [-21.916007, 64.141016], + [-21.930084, 64.14446] +], {name: 'line 1', distance: 145}); + +// -- Test point -- +var pt1 = turf.point([-75.343, 39.984]); +var pt2 = turf.point([-75.343, 39.984], {name: 'point 1', distance: 145}); + +// -- Test polygon -- +var polygon = turf.polygon([[ + [-2.275543, 53.464547], + [-2.275543, 53.489271], + [-2.215118, 53.489271], + [-2.215118, 53.464547], + [-2.275543, 53.464547] +]], { name: 'poly1', population: 400}); + ////////////////////////////////////////////////////////////////////////// // Tests Data ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index fb479ae347..0f68686302 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -261,6 +261,37 @@ declare module turf { // Helper ////////////////////////////////////////////////////// + /** + * Takes one or more Features and creates a FeatureCollection. + * @param features Input features + * @returns A FeatureCollection of input features + */ + function featurecollection(features: Array): GeoJSON.FeatureCollection; + + /** + * Creates a LineString based on a coordinate array. Properties can be added optionally. + * @param coordinates An array of Positions + * @param [properties] An Object of key-value pairs to add as properties + * @returns A LineString feature + */ + function linestring(coordinates: Array>, properties?: any): GeoJSON.Feature; + + /** + * Takes coordinates and properties (optional) and returns a new Point feature. + * @param coordinates Longitude, latitude position (each in decimal degrees) + * @param [properties] An Object of key-value pairs to add as properties + * @returns A Point feature + */ + function point(coordinates: Array, properties?: any): GeoJSON.Feature; + + /** + * Takes an array of LinearRings and optionally an Object with properties and returns a Polygon feature. + * @param rings An array of LinearRings + * @param [properties] An Object of key-value pairs to add as properties + * @returns A Polygon feature + */ + function polygon(rings: Array>>, properties?: any): GeoJSON.Feature; + ////////////////////////////////////////////////////// // Data ////////////////////////////////////////////////////// From b5b7ec2ce07a810c2d19a111196e2753197e733e Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 24 Nov 2015 23:44:45 -0500 Subject: [PATCH 050/474] Added filter definition. --- turf/turf-test.ts | 5 +++++ turf/turf.d.ts | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 2965428684..4d89f140ea 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -347,6 +347,11 @@ var polygon = turf.polygon([[ // Tests Data ////////////////////////////////////////////////////////////////////////// +// -- Test filter -- +var key = "species"; +var value = "oak"; +var filtered = turf.filter(features, key, value); + ////////////////////////////////////////////////////////////////////////// // Tests Interpolation //////////////////////////////////////////////////////////////////////////; diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 0f68686302..85d7b25f9f 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -296,6 +296,15 @@ declare module turf { // Data ////////////////////////////////////////////////////// + /** + * Takes a FeatureCollection and filters it by a given property and value. + * @param features Input features + * @param key The property on which to filter + * @param value The value of that property on which to filter + * @returns A filtered collection with only features that match input key and value + */ + function filter(features: GeoJSON.FeatureCollection, key: string, value: string): GeoJSON.FeatureCollection; + ////////////////////////////////////////////////////// // Interpolation ////////////////////////////////////////////////////// From 9ce1cff36fceab03314c25d0513f23b7d8453cb7 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Wed, 25 Nov 2015 17:08:37 -0500 Subject: [PATCH 051/474] Completed Data definitions. --- turf/turf-test.ts | 18 ++++++++++++++++++ turf/turf.d.ts | 29 +++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 4d89f140ea..a69d36d474 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -352,6 +352,24 @@ var key = "species"; var value = "oak"; var filtered = turf.filter(features, key, value); +// -- Test random -- +var points = turf.random('points', 100, { + bbox: [-70, 40, -60, 60] +}); + +var points = turf.random('points', 100, { + bbox: [-70, 40, -60, 60], + num_vertices: 2, + max_radial_length: 10 +}); + +// -- Test remove -- +var filtered = turf.remove(points, 'marker-color', '#00f'); + +// -- Test sample -- +var points = turf.random('points', 1000); +var sample = turf.sample(points, 10); + ////////////////////////////////////////////////////////////////////////// // Tests Interpolation //////////////////////////////////////////////////////////////////////////; diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 85d7b25f9f..c10fe2ac9e 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -305,6 +305,35 @@ declare module turf { */ function filter(features: GeoJSON.FeatureCollection, key: string, value: string): GeoJSON.FeatureCollection; + /** + * Generates random GeoJSON data, including Points and Polygons, for testing and experimentation. + * @param [type='point'] Type of features desired: 'points' or 'polygons' + * @param [count=1] How many geometries should be generated. + * @param [options] Options relevant to the feature desired. Can include: + * - A bounding box inside of which geometries are placed. In the case of Point features, they are guaranteed to be within this bounds, while Polygon features have their centroid within the bounds. + * - The number of vertices added to polygon features. Default is 10; + * - The total number of decimal degrees longitude or latitude that a polygon can extent outwards to from its center. Default is 10. + * @returns Generated random features + */ + function random(type?: string, count?: number, options?: {bbox?: Array; num_vertices?: number; max_radial_length?: number;}): GeoJSON.FeatureCollection; + + /** + * Takes a FeatureCollection of any type, a property, and a value and returns a FeatureCollection with features matching that property-value pair removed. + * @param features Set of input features + * @param property The property to remove + * @param value The value to remove + * @returns The resulting FeatureCollection without features that match the property-value pair + */ + function remove(features: GeoJSON.FeatureCollection, property: string, value: string): GeoJSON.FeatureCollection; + + /** + * Takes a FeatureCollection and returns a FeatureCollection with given number of features at random. + * @param features Set of input features + * @param n Number of features to select + * @returns A FeatureCollection with n features + */ + function sample(features: GeoJSON.FeatureCollection, n: number): GeoJSON.FeatureCollection; + ////////////////////////////////////////////////////// // Interpolation ////////////////////////////////////////////////////// From ab3aa41ff74a961268a1ebe7aee2218e099bb4d9 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Wed, 25 Nov 2015 19:47:29 -0500 Subject: [PATCH 052/474] Added Interpolation definitions to turf.d.ts. --- turf/turf-test.ts | 43 +++++++++++++++++++++++++++++++ turf/turf.d.ts | 64 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index a69d36d474..e8aaec7083 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -197,6 +197,24 @@ var features = { ] }; +var triangle = { + "type": "Feature", + "properties": { + "a": 11, + "b": 122, + "c": 44 + }, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [-75.1221, 39.57], + [-75.58, 39.18], + [-75.97, 39.86], + [-75.1221, 39.57] + ]] + } +}; + ////////////////////////////////////////////////////////////////////////// // Tests Aggregation ////////////////////////////////////////////////////////////////////////// @@ -374,6 +392,31 @@ var sample = turf.sample(points, 10); // Tests Interpolation //////////////////////////////////////////////////////////////////////////; +// -- Test hexGrid -- +var cellWidth = 50; +var hexgrid = turf.hexGrid(bbox, cellWidth, units); + +// -- Test isolines -- +var breaks = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; +var isolined = turf.isolines(points, 'z', 15, breaks); + +// -- Test planepoint -- +var zValue = turf.planepoint(point1, triangle); + +// -- Test pointGrid -- +var extent = [-70.823364, -33.553984, -70.473175, -33.302986]; +var cellWidth = 3; +var grid = turf.pointGrid(extent, cellWidth, units); + +// -- Test squareGrid -- +var squareGrid = turf.squareGrid(extent, cellWidth, units); + +// -- Test tin -- +var tin = turf.tin(points, 'z'); + +// -- Test triangleGrid -- +var triangleGrid = turf.triangleGrid(extent, cellWidth, units); + ////////////////////////////////////////////////////////////////////////// // Tests Joins ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index c10fe2ac9e..b74681a89a 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -338,6 +338,70 @@ declare module turf { // Interpolation ////////////////////////////////////////////////////// + /** + * Takes a bounding box and a cell size in degrees and returns a FeatureCollection of flat-topped hexagons (Polygon features) aligned in an "odd-q" vertical grid as described in Hexagonal Grids. + * @param bbox Bounding box in [minX, minY, maxX, maxY] order + * @param cellWidth Width of cell in specified units + * @param units Used in calculating cellWidth ('miles' or 'kilometers') + * @returns A hexagonal grid + */ + function hexGrid(bbox: Array, cellWidth: number, units: string): GeoJSON.FeatureCollection; + + /** + * Takes points with z-values and an array of value breaks and generates isolines. + * @param points Input points + * @param z The property name in points from which z-values will be pulled + * @param resolution Resolution of the underlying grid + * @param breaks Where to draw contours + * @returns Isolines + */ + function isolines(points: GeoJSON.FeatureCollection, z: string, resolution: number, breaks: Array): GeoJSON.FeatureCollection; + + /** + * Takes a triangular plane as a Polygon and a Point within that triangle and returns the z-value at that point. The Polygon needs to have properties a, b, and c that define the values at its three corners. + * @param interpolatedPoint The Point for which a z-value will be calculated + * @param triangle A Polygon feature with three vertices + * @returns The z-value for interpolatedPoint + */ + function planepoint(interpolatedPoint: GeoJSON.Feature, triangle: GeoJSON.Feature): number; + + /** + * Takes a bounding box and a cell depth and returns a set of points in a grid. + * @param extent Extent in [minX, minY, maxX, maxY] order + * @param cellWidth The distance across each cell + * @param units Used in calculating cellWidth ('miles' or 'kilometers') + * @returns Grid of points + */ + function pointGrid(extent: Array, cellWidth: number, units: string): GeoJSON.FeatureCollection; + + /** + * Takes a bounding box and a cell depth and returns a set of square polygons in a grid. + * @param extent Extent in [minX, minY, maxX, maxY] order + * @param cellWidth Width of each cell + * @param units Used in calculating cellWidth ('miles' or 'kilometers') + * @returns Grid of polygons + */ + function squareGrid(extent: Array, cellWidth: number, units: string): GeoJSON.FeatureCollection; + + /** + * Takes a set of points and the name of a z-value property and creates a Triangulated Irregular Network, or a TIN for short, returned as a collection of Polygons. + * These are often used for developing elevation contour maps or stepped heat visualizations. + * This triangulates the points, as well as adds properties called a, b, and c representing the value of the given propertyName at each of the points that represent the corners of the triangle. + * @param points Input points + * @param [propertyName] Name of the property from which to pull z values This is optional: if not given, then there will be no extra data added to the derived triangles. + * @returns TIN output + */ + function tin(points: GeoJSON.FeatureCollection, propertyName?: string): GeoJSON.FeatureCollection; + + /** + * Takes a bounding box and a cell depth and returns a set of triangular polygons in a grid. + * @param extent Extent in [minX, minY, maxX, maxY] order + * @param cellWidth Width of each cell + * @param units Used in calculating cellWidth ('miles' or 'kilometers') + * @returns Grid of triangles + */ + function triangleGrid(extent: Array, cellWidth: number, units: string): GeoJSON.FeatureCollection; + ////////////////////////////////////////////////////// // Joins ////////////////////////////////////////////////////// From 1c55a6117750de906e301ff3a39204844f3a1069 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Wed, 25 Nov 2015 19:56:27 -0500 Subject: [PATCH 053/474] Added Joins definitions to turf.d.ts. --- turf/turf-test.ts | 9 +++++++++ turf/turf.d.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index e8aaec7083..d46bf2e81d 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -421,6 +421,15 @@ var triangleGrid = turf.triangleGrid(extent, cellWidth, units); // Tests Joins ////////////////////////////////////////////////////////////////////////// +// -- Test inside -- +var isInside1 = turf.inside(point1, polygon); + +// -- Test tag -- +var tagged = turf.tag(points, triangleGrid, 'fill', 'marker-color'); + +// -- Test within -- +var ptsWithin = turf.within(points, polygons); + ////////////////////////////////////////////////////////////////////////// // Tests Classification ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index b74681a89a..f90668b4f0 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -406,6 +406,32 @@ declare module turf { // Joins ////////////////////////////////////////////////////// + /** + * Takes a Point and a Polygon or MultiPolygon and determines if the point resides inside the polygon. The polygon can be convex or concave. The function accounts for holes. + * @param point Input point + * @param polygon Input polygon or multipolygon + * @returns true if the Point is inside the Polygon; false if the Point is not inside the Polygon + */ + function inside(point: GeoJSON.Feature, polygon: GeoJSON.Feature): boolean; + + /** + * Takes a set of points and a set of polygons and performs a spatial join. + * @param points Input points + * @param polygons Input polygons + * @param polyId Property in polygons to add to joined Point features + * @param containingPolyId Property in points in which to store joined property from polygons + * @returns Points with containingPolyId property containing values from polyId + */ + function tag(points: GeoJSON.FeatureCollection, polygons: GeoJSON.FeatureCollection, polyId: string, containingPolyId: string): GeoJSON.FeatureCollection; + + /** + * Takes a set of points and a set of polygons and returns the points that fall within the polygons. + * @param points Input points + * @param polygons Input polygons + * @returns Points that land within at least one polygon + */ + function within(points: GeoJSON.FeatureCollection, polygons: GeoJSON.FeatureCollection): GeoJSON.FeatureCollection; + ////////////////////////////////////////////////////// // Classification ////////////////////////////////////////////////////// From 77365e3b156e2230e735a1aeec914bcfe9281dd4 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Wed, 25 Nov 2015 20:11:13 -0500 Subject: [PATCH 054/474] Added Classification definitions to turf.d.ts. --- turf/turf-test.ts | 17 +++++++++++++++++ turf/turf.d.ts | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index d46bf2e81d..5a8501c747 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -433,3 +433,20 @@ var ptsWithin = turf.within(points, polygons); ////////////////////////////////////////////////////////////////////////// // Tests Classification ////////////////////////////////////////////////////////////////////////// + +// -- Test jenks -- +var breaks = turf.jenks(points, 'population', 3); + +// -- Test nearest -- +var nearest = turf.nearest(point1, points); + +// -- Test quantile -- +var breaks = turf.quantile(points, 'population', [25, 50, 75, 99]); + +// -- Test reclass -- +var translations = [ + [0, 200, "small"], + [200, 400, "medium"], + [400, 600, "large"] +]; +var reclassed = turf.reclass(points, 'population', 'size', translations); diff --git a/turf/turf.d.ts b/turf/turf.d.ts index f90668b4f0..0da75e33bc 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -436,7 +436,39 @@ declare module turf { // Classification ////////////////////////////////////////////////////// - ////////////////////////////////////////////////////// - // Types - ////////////////////////////////////////////////////// + /** + * Takes a set of features and returns an array of the Jenks Natural breaks for a given property. + * @param input Input features + * @param field The property in input on which to calculate Jenks natural breaks + * @param numberOfBreaks Number of classes in which to group the data + * @returns The break number for each class plus the minimum and maximum values + */ + function jenks(input: GeoJSON.FeatureCollection, field: string, numberOfBreaks: number): Array; + + /** + * Takes a reference point and a set of points and returns the point from the set closest to the reference. + * @param point The reference point + * @param against Input point set + * @returns The closest point in the set to the reference point + */ + function nearest(point: GeoJSON.Feature, against: GeoJSON.FeatureCollection): GeoJSON.Feature; + + /** + * Takes a FeatureCollection, a property name, and a set of percentiles and returns a quantile array. + * @param input Set of features + * @param field The property in input from which to retrieve quantile values + * @param percentiles An Array of percentiles on which to calculate quantile values + * @returns An array of the break values + */ + function quantile(input: GeoJSON.FeatureCollection, field: string, percentiles: Array): Array; + + /** + * Takes a FeatureCollection, an input field, an output field, and an array of translations and outputs an identical FeatureCollection with the output field property populated. + * @param input Set of input features + * @param inField The field to translate + * @param outField The field in which to store translated results + * @param translations An array of translations + * @returns A FeatureCollection with identical geometries to input but with outField populated. + */ + function reclass(input: GeoJSON.FeatureCollection, inField: string, outField: string, translations: Array): GeoJSON.FeatureCollection; } From 3ea58099e4095399e4c1c79177876637dd3bbf99 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Fri, 27 Nov 2015 08:38:28 +0500 Subject: [PATCH 055/474] test updated and file renamed --- lobibox/{lobibox.js-test.ts => lobibox.js-tests.ts} | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) rename lobibox/{lobibox.js-test.ts => lobibox.js-tests.ts} (97%) diff --git a/lobibox/lobibox.js-test.ts b/lobibox/lobibox.js-tests.ts similarity index 97% rename from lobibox/lobibox.js-test.ts rename to lobibox/lobibox.js-tests.ts index bd0ff33d27..c5fe295a82 100644 --- a/lobibox/lobibox.js-test.ts +++ b/lobibox/lobibox.js-tests.ts @@ -5,7 +5,7 @@ /// - //Run test : LobiboxTest.test() + //Run test : LobiboxTest.test() after window load event class LobiboxTest { static test() { // extending default parameters @@ -138,3 +138,7 @@ class LobiboxTest { }); } } + +window.onload = (): void => { + Notify.error("test"); +}; From 33663d7a9ff040cbe309c8607c0e540adeaaca71 Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Fri, 27 Nov 2015 08:41:41 +0500 Subject: [PATCH 056/474] test updated and file renamed --- lobibox/lobibox.js-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lobibox/lobibox.js-tests.ts b/lobibox/lobibox.js-tests.ts index c5fe295a82..78637114a1 100644 --- a/lobibox/lobibox.js-tests.ts +++ b/lobibox/lobibox.js-tests.ts @@ -140,5 +140,5 @@ class LobiboxTest { } window.onload = (): void => { - Notify.error("test"); + LobiboxTest.test(); }; From 36b68a0023358c4c39ff49a9b330639e5c662a0f Mon Sep 17 00:00:00 2001 From: gcroteau Date: Thu, 26 Nov 2015 23:28:51 -0500 Subject: [PATCH 057/474] Added Aggregation definitions to turf.d.ts. --- turf/turf-test.ts | 70 +++++++++++++++++++++++++++++++++++++ turf/turf.d.ts | 88 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index 5a8501c747..a6bb7e2ac3 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -215,10 +215,80 @@ var triangle = { } }; +var aggregations = [ + { + aggregation: 'sum', + inField: 'population', + outField: 'pop_sum' + }, + { + aggregation: 'average', + inField: 'population', + outField: 'pop_avg' + }, + { + aggregation: 'median', + inField: 'population', + outField: 'pop_median' + }, + { + aggregation: 'min', + inField: 'population', + outField: 'pop_min' + }, + { + aggregation: 'max', + inField: 'population', + outField: 'pop_max' + }, + { + aggregation: 'deviation', + inField: 'population', + outField: 'pop_deviation' + }, + { + aggregation: 'variance', + inField: 'population', + outField: 'pop_variance' + }, + { + aggregation: 'count', + inField: '', + outField: 'point_count' + } +]; + ////////////////////////////////////////////////////////////////////////// // Tests Aggregation ////////////////////////////////////////////////////////////////////////// +// -- Test aggregate -- +var aggregated = turf.aggregate(polygons, points, aggregations); + +// -- Test average -- +var averaged = turf.average(polygons, points, 'population', 'pop_avg'); + +// -- Test count -- +var counted = turf.count(polygons, points, 'pt_count'); + +// -- Test deviation -- +var deviated = turf.deviation(polygons, points, 'population', 'pop_deviation'); + +// -- Test max -- +var aggregated = turf.max(polygons, points, 'population', 'max'); + +// -- Test median -- +var medians = turf.median(polygons, points, 'population', 'median'); + +// -- Test min -- +var minimums = turf.min(polygons, points, 'population', 'min'); + +// -- Test sum -- +var summed = turf.sum(polygons, points, 'population', 'sum'); + +// -- Test variance -- +var varianced = turf.variance(polygons, points, 'population', 'variance'); + ////////////////////////////////////////////////////////////////////////// // Tests Measurement ////////////////////////////////////////////////////////////////////////// diff --git a/turf/turf.d.ts b/turf/turf.d.ts index 0da75e33bc..bbc84eac35 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -10,6 +10,94 @@ declare module turf { // Aggregation ////////////////////////////////////////////////////// + /** + * Calculates a series of aggregations for a set of points within a set of polygons. Sum, average, count, min, max, and deviation are supported. + * @param polygons Polygons with values on which to aggregate + * @param points Points to be aggregated + * @param aggregations An array of aggregation objects + * @returns Polygons with properties listed based on outField values in aggregations + */ + function aggregate(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, aggregations: Array<{aggregation: string, inField: string, outField: string}>): GeoJSON.FeatureCollection; + + /** + * Calculates the average value of a field for a set of points within a set of polygons. + * @param polygons Polygons with values on which to average + * @param points Points from which to calculate the average + * @param field The field in the points features from which to pull values to average + * @param outField The field in polygons to put results of the averages + * @returns Polygons with the value of outField set to the calculated averages + */ + function average(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, field: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Takes a set of points and a set of polygons and calculates the number of points that fall within the set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param countField A field to append to the attributes of the Polygon features representing Point counts + * @returns Polygons with countField appended + */ + function count(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, countField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the standard deviation value of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in points from which to aggregate + * @param outField The field to append to polygons representing deviation + * @returns Polygons with appended field representing deviation + */ + function deviation(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the maximum value of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in input data to analyze + * @param outField The field in which to store results + * @returns Polygons with properties listed as outField values + */ + function max(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the median value of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in input data to analyze + * @param outField The field in which to store results + * @returns Polygons with properties listed as outField values + */ + function median(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the minimum value of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in input data to analyze + * @param outField The field in which to store results + * @returns Polygons with properties listed as outField values + */ + function min(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the sum of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in input data to analyze + * @param outField The field in which to store results + * @returns Polygons with properties listed as outField + */ + function sum(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + + /** + * Calculates the variance value of a field for a set of points within a set of polygons. + * @param polygons Input polygons + * @param points Input points + * @param inField The field in input data to analyze + * @param outField The field in which to store results + * @returns Polygons with properties listed as outField + */ + function variance(polygons: GeoJSON.FeatureCollection, points: GeoJSON.FeatureCollection, inField: string, outField: string): GeoJSON.FeatureCollection; + ////////////////////////////////////////////////////// // Measurement ////////////////////////////////////////////////////// From 05e7d8d0cdb21c89944f7d7157ac59cb2a2f36e7 Mon Sep 17 00:00:00 2001 From: sodatea Date: Sun, 29 Nov 2015 00:56:20 +0800 Subject: [PATCH 058/474] Update tape-tests to match tape v4.2.2 documentation --- tape/tape-tests.ts | 165 ++++++++++++++++++++++++++++++--------------- 1 file changed, 111 insertions(+), 54 deletions(-) diff --git a/tape/tape-tests.ts b/tape/tape-tests.ts index 2c4e4ec1bb..85bb19a6ec 100644 --- a/tape/tape-tests.ts +++ b/tape/tape-tests.ts @@ -4,21 +4,16 @@ import tape = require('tape'); -var x: any; -var value: any; -var err: any; -var a: any; -var b: any; -var err: any; -var num: number; var name: string; -var msg: string; -var rs: NodeJS.ReadableStream; - var cb: tape.TestCase; +var opts: tape.TestOptions; var t: tape.Test; +tape(cb); tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + tape(name, (test: tape.Test) => { t = test; }); @@ -26,29 +21,51 @@ tape(name, (test: tape.Test) => { tape.skip(name, cb); tape.only(name, cb); -rs = tape.createStream(); -rs = tape.createStream(x); -var tx = tape.createHarness(); -tx(name, cb); -tape.skip(name, cb); -tape.only(name, cb); +var sopts: tape.StreamOptions; +var rs: NodeJS.ReadableStream; +rs = tape.createStream(); +rs = tape.createStream(sopts); + + +var htest: typeof tape; +htest = tape.createHarness(); + tape(name, (test: tape.Test) => { + var num: number; + var ms: number; + var value: any; + var actual: any; + var expected: any; + var err: any; + var fn = function() {}; + var msg: string; + + var exceptionExpected: RegExp | (() => void); + test.plan(num); test.end(); + test.end(err); test.fail(msg); test.pass(msg); + test.timeoutAfter(ms); test.skip(msg); + test.ok(value); test.ok(value, msg); + test.true(value); test.true(value, msg); + test.assert(value); test.assert(value, msg); + test.notOk(value); test.notOk(value, msg); + test.false(value); test.false(value, msg); + test.notok(value); test.notok(value, msg); test.error(err, msg); @@ -56,51 +73,91 @@ tape(name, (test: tape.Test) => { test.ifErr(err, msg); test.iferror(err, msg); - test.equal(a, b, msg); - test.equals(a, b, msg); - test.isEqual(a, b, msg); - test.is(a, b, msg); - test.strictEqual(a, b, msg); - test.strictEquals(a, b, msg); + test.equal(actual, expected); + test.equal(actual, expected, msg); + test.equals(actual, expected); + test.equals(actual, expected, msg); + test.isEqual(actual, expected); + test.isEqual(actual, expected, msg); + test.is(actual, expected); + test.is(actual, expected, msg); + test.strictEqual(actual, expected); + test.strictEqual(actual, expected, msg); + test.strictEquals(actual, expected); + test.strictEquals(actual, expected, msg); - test.notEqual(a, b, msg); - test.notEquals(a, b, msg); - test.notStrictEqual(a, b, msg); - test.notStrictEquals(a, b, msg); - test.isNotEqual(a, b, msg); - test.isNot(a, b, msg); - test.not(a, b, msg); - test.doesNotEqual(a, b, msg); - test.notEqual(a, b, msg); - test.isInequal(a, b, msg); + test.notEqual(actual, expected); + test.notEqual(actual, expected, msg); + test.notEquals(actual, expected); + test.notEquals(actual, expected, msg); + test.notStrictEqual(actual, expected); + test.notStrictEqual(actual, expected, msg); + test.notStrictEquals(actual, expected); + test.notStrictEquals(actual, expected, msg); + test.isNotEqual(actual, expected); + test.isNotEqual(actual, expected, msg); + test.isNot(actual, expected); + test.isNot(actual, expected, msg); + test.not(actual, expected); + test.not(actual, expected, msg); + test.doesNotEqual(actual, expected); + test.doesNotEqual(actual, expected, msg); + test.isInequal(actual, expected); + test.isInequal(actual, expected, msg); - test.deepEqual(a, b, msg); - test.deepEquals(a, b, msg); - test.isEquivalent(a, b, msg); - test.same(a, b, msg); + test.deepEqual(actual, expected); + test.deepEqual(actual, expected, msg); + test.deepEquals(actual, expected); + test.deepEquals(actual, expected, msg); + test.isEquivalent(actual, expected); + test.isEquivalent(actual, expected, msg); + test.same(actual, expected); + test.same(actual, expected, msg); - test.notDeepEqual(a, b, msg); - test.notEquivalent(a, b, msg); - test.notDeeply(a, b, msg); - test.notSame(a, b, msg); - test.isNotDeepEqual(a, b, msg); - test.isNotDeeply(a, b, msg); - test.isNotEquivalent(a, b, msg); - test.isInequivalent(a, b, msg); + test.notDeepEqual(actual, expected); + test.notDeepEqual(actual, expected, msg); + test.notEquivalent(actual, expected); + test.notEquivalent(actual, expected, msg); + test.notDeeply(actual, expected); + test.notDeeply(actual, expected, msg); + test.notSame(actual, expected); + test.notSame(actual, expected, msg); + test.isNotDeepEqual(actual, expected); + test.isNotDeepEqual(actual, expected, msg); + test.isNotDeeply(actual, expected); + test.isNotDeeply(actual, expected, msg); + test.isNotEquivalent(actual, expected); + test.isNotEquivalent(actual, expected, msg); + test.isInequivalent(actual, expected); + test.isInequivalent(actual, expected, msg); - test.deepLooseEqual(a, b, msg); - test.looseEqual(a, b, msg); - test.looseEquals(a, b, msg); + test.deepLooseEqual(actual, expected); + test.deepLooseEqual(actual, expected, msg); + test.looseEqual(actual, expected); + test.looseEqual(actual, expected, msg); + test.looseEquals(actual, expected); + test.looseEquals(actual, expected, msg); - test.notDeepLooseEqual(a, b, msg); - test.notLooseEqual(a, b, msg); - test.notLooseEquals(a, b, msg); + test.notDeepLooseEqual(actual, expected); + test.notDeepLooseEqual(actual, expected, msg); + test.notLooseEqual(actual, expected); + test.notLooseEqual(actual, expected, msg); + test.notLooseEquals(actual, expected); + test.notLooseEquals(actual, expected, msg); - test.throws(() => { + test.throws(fn); + test.throws(fn, msg); + test.throws(fn, exceptionExpected); + test.throws(fn, exceptionExpected, msg); - }, value, msg); + test.doesNotThrow(fn); + test.doesNotThrow(fn, msg); + test.doesNotThrow(fn, exceptionExpected); + test.doesNotThrow(fn, exceptionExpected, msg); - test.doesNotThrow(() => { + test.test(name, (st) => { + t = st; + }); - }, value, msg); + test.comment(msg); }); From 3a605075a65f9d994c0878ca16f0151085a9db55 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Mon, 30 Nov 2015 12:05:22 +0200 Subject: [PATCH 059/474] Add debounce --- debounce/debounce.d.ts | 11 +++++++++++ debounce/debounce.ts | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 debounce/debounce.d.ts create mode 100644 debounce/debounce.ts diff --git a/debounce/debounce.d.ts b/debounce/debounce.d.ts new file mode 100644 index 0000000000..7aa24601a7 --- /dev/null +++ b/debounce/debounce.d.ts @@ -0,0 +1,11 @@ +// Type definitions for compose-function +// Project: https://github.com/component/debounce +// Definitions by: Denis Sokolov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "debounce" { + // Overload on boolean constants would allow us to narrow further, + // but it is not implemented for TypeScript yet + function f(f: A, interval?: number, immediate?: boolean): A + export default f; +} diff --git a/debounce/debounce.ts b/debounce/debounce.ts new file mode 100644 index 0000000000..fb0e52b467 --- /dev/null +++ b/debounce/debounce.ts @@ -0,0 +1,14 @@ +/// + +import debounce = require("debounce"); + +const doThings = () => 1; + +debounce(function(){ doThings(); })(); + +debounce(function(){ doThings(); }, 1000)(); + +debounce(function(a: string){ doThings(); }, 1000)("foo"); + +// Immediate true should return the value +const imm1: number = (debounce((x: number) => x * 2, 100, true))(2); From 25f513d3bf40cc952819d0d6839f4b10bccffef9 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Mon, 30 Nov 2015 10:17:44 -0500 Subject: [PATCH 060/474] Cleaned up the definition file. --- turf/turf-test.ts | 40 ++++++++++++++++++------------------ turf/turf.d.ts | 52 ++++++++++++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 39 deletions(-) diff --git a/turf/turf-test.ts b/turf/turf-test.ts index a6bb7e2ac3..a262b359e9 100644 --- a/turf/turf-test.ts +++ b/turf/turf-test.ts @@ -1,8 +1,8 @@ /// -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests data initialisation -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// var point1 = { "type": "Feature", @@ -258,9 +258,9 @@ var aggregations = [ } ]; -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Aggregation -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test aggregate -- var aggregated = turf.aggregate(polygons, points, aggregations); @@ -289,9 +289,9 @@ var summed = turf.sum(polygons, points, 'population', 'sum'); // -- Test variance -- var varianced = turf.variance(polygons, points, 'population', 'variance'); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Measurement -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test along -- var along = turf.along(line, 1, 'miles'); @@ -343,9 +343,9 @@ var resized = turf.size(bbox, 2); // -- Test square -- var squared = turf.square(bbox); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Transformation -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test bezier -- var curved = turf.bezier(line); @@ -375,9 +375,9 @@ var simplified = turf.simplify(polygon1, tolerance, false); // -- Test union -- var union = turf.union(polygon1, polygon2); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Misc -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test combine -- var combined = turf.combine(features); @@ -397,9 +397,9 @@ var sliced = turf.lineSlice(point1, point2, line); // -- Test pointOnLine -- var snapped = turf.pointOnLine(line, point1); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Helper -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test featurecollection -- var fc = turf.featurecollection([point1, point2]); @@ -431,9 +431,9 @@ var polygon = turf.polygon([[ [-2.275543, 53.464547] ]], { name: 'poly1', population: 400}); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Data -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test filter -- var key = "species"; @@ -458,9 +458,9 @@ var filtered = turf.remove(points, 'marker-color', '#00f'); var points = turf.random('points', 1000); var sample = turf.sample(points, 10); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Interpolation -//////////////////////////////////////////////////////////////////////////; +/////////////////////////////////////////// // -- Test hexGrid -- var cellWidth = 50; @@ -487,9 +487,9 @@ var tin = turf.tin(points, 'z'); // -- Test triangleGrid -- var triangleGrid = turf.triangleGrid(extent, cellWidth, units); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Joins -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test inside -- var isInside1 = turf.inside(point1, polygon); @@ -500,9 +500,9 @@ var tagged = turf.tag(points, triangleGrid, 'fill', 'marker-color'); // -- Test within -- var ptsWithin = turf.within(points, polygons); -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // Tests Classification -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////// // -- Test jenks -- var breaks = turf.jenks(points, 'population', 3); diff --git a/turf/turf.d.ts b/turf/turf.d.ts index bbc84eac35..07299e766d 100644 --- a/turf/turf.d.ts +++ b/turf/turf.d.ts @@ -11,7 +11,8 @@ declare module turf { ////////////////////////////////////////////////////// /** - * Calculates a series of aggregations for a set of points within a set of polygons. Sum, average, count, min, max, and deviation are supported. + * Calculates a series of aggregations for a set of points within a set of polygons. + * Sum, average, count, min, max, and deviation are supported. * @param polygons Polygons with values on which to aggregate * @param points Points to be aggregated * @param aggregations An array of aggregation objects @@ -106,7 +107,7 @@ declare module turf { * Takes a line and returns a point at a specified distance along the line. * @param line Input line * @param distance Distance along the line - * @param [units=miles] 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @param [units=miles] 'miles', 'kilometers', 'radians' or 'degrees' * @returns Point along the line */ function along(line: GeoJSON.Feature, distance: number, units?: string): GeoJSON.Feature; @@ -141,27 +142,30 @@ declare module turf { function center(features: GeoJSON.FeatureCollection): GeoJSON.Feature; /** - * Takes one or more features and calculates the centroid using the arithmetic mean of all vertices. This lessens the effect of small islands and artifacts when calculating the centroid of a set of polygons. + * Takes one or more features and calculates the centroid using the arithmetic mean of all vertices. + * This lessens the effect of small islands and artifacts when calculating the centroid of a set of polygons. * @param features Input features * @returns The centroid of the input features */ function centroid(features: GeoJSON.Feature | GeoJSON.FeatureCollection): GeoJSON.Feature; /** - * Takes a Point and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. This uses the Haversine formula to account for global curvature. + * Takes a Point and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. + * This uses the Haversine formula to account for global curvature. * @param start Starting point * @param distance Distance from the starting point * @param bearing Ranging from -180 and 180 - * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @param units 'miles', 'kilometers', 'radians', or 'degrees' * @returns Destination point */ function destination(start: GeoJSON.Feature, distance: number, bearing: number, units: string): GeoJSON.Feature; /** - * Calculates the distance between two points in degress, radians, miles, or kilometers. This uses the Haversine formula to account for global curvature. + * Calculates the distance between two points in degress, radians, miles, or kilometers. + * This uses the Haversine formula to account for global curvature. * @param from Origin point * @param to Destination point - * @param [units=kilometers] 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @param [units=kilometers] 'miles', 'kilometers', 'radians', or 'degrees' * @returns Distance between the two points */ function distance(from: GeoJSON.Feature, to: GeoJSON.Feature, units?: string): number; @@ -183,7 +187,7 @@ declare module turf { /** * Takes a line and measures its length in the specified units. * @param line Line to measure - * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @param units 'miles', 'kilometers', 'radians', or 'degrees' * @returns Length of the input line */ function lineDistance(line: GeoJSON.Feature, units: string): number; @@ -197,7 +201,8 @@ declare module turf { function midpoint(pt1: GeoJSON.Feature, pt2: GeoJSON.Feature): GeoJSON.Feature; /** - * Takes a feature and returns a Point guaranteed to be on the surface of the feature. Given a Polygon, the point will be in the area of the polygon. Given a LineString, the point will be along the string. Given a Point, the point will the same as the input. + * Takes a feature and returns a Point guaranteed to be on the surface of the feature. Given a Polygon, the point will be in the area of the polygon. + * Given a LineString, the point will be along the string. Given a Point, the point will the same as the input. * @param input Any feature or set of features * @returns A point on the surface of input */ @@ -223,7 +228,8 @@ declare module turf { ////////////////////////////////////////////////////// /** - * Takes a line and returns a curved version by applying a Bezier spline algorithm. The bezier spline implementation is by Leszek Rybicki. + * Takes a line and returns a curved version by applying a Bezier spline algorithm. + * The bezier spline implementation is by Leszek Rybicki. * @param line Input LineString * @param [resolution=10000] Time in milliseconds between points * @param [sharpness=0.85] A measure of how curvy the path should be between splines @@ -235,7 +241,7 @@ declare module turf { * Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees. * @param feature Input to be buffered * @param distance Distance to draw the buffer - * @param units 'miles', 'feet', 'kilometers', 'meters', or 'degrees' + * @param units 'miles', 'kilometers', 'radians', or 'degrees' * @returns Buffered features */ function buffer(feature: GeoJSON.Feature | GeoJSON.FeatureCollection, distance: number, units: string): GeoJSON.Feature | GeoJSON.FeatureCollection; @@ -254,7 +260,7 @@ declare module turf { * @param input Input points * @returns A convex hull */ - function convex(points: GeoJSON.FeatureCollection): GeoJSON.Feature; + function convex(input: GeoJSON.FeatureCollection): GeoJSON.Feature; /** * Finds the difference between two polygons by clipping the second polygon from the first. @@ -265,22 +271,27 @@ declare module turf { function difference(poly1: GeoJSON.Feature, poly2: GeoJSON.Feature): GeoJSON.Feature; /** - * Takes two polygons and finds their intersection. If they share a border, returns the border; if they don't intersect, returns undefined. + * Takes two polygons and finds their intersection. + * If they share a border, returns the border; if they don't intersect, returns undefined. * @param poly1 The first polygon * @param poly2 The second polygon - * @returns If poly1 and poly2 overlap, returns a Polygon feature representing the area they overlap; if poly1 and poly2 do not overlap, returns undefined; if poly1 and poly2 share a border, a MultiLineString of the locations where their borders are shared + * @returns If poly1 and poly2 overlap, returns a Polygon feature representing the area they overlap; + * if poly1 and poly2 do not overlap, returns undefined; + * if poly1 and poly2 share a border, a MultiLineString of the locations where their borders are shared */ function intersect(poly1: GeoJSON.Feature, poly2: GeoJSON.Feature): GeoJSON.Feature; /** - * Takes a set of polygons and returns a single merged polygon feature. If the input polygon features are not contiguous, this function returns a MultiPolygon feature. + * Takes a set of polygons and returns a single merged polygon feature. + * If the input polygon features are not contiguous, this function returns a MultiPolygon feature. * @param fc Input polygons * @returns Merged polygon or multipolygon */ function merge(fc: GeoJSON.FeatureCollection): GeoJSON.Feature; /** - * Takes a LineString or Polygon and returns a simplified version. Internally uses simplify-js to perform simplification. + * Takes a LineString or Polygon and returns a simplified version. + * Internally uses simplify-js to perform simplification. * @param feature Feature to be simplified * @param tolerance Simplification tolerance * @param highQuality Whether or not to spend more time to create a higher-quality simplification with a different algorithm @@ -289,7 +300,8 @@ declare module turf { function simplify(feature: GeoJSON.Feature | GeoJSON.FeatureCollection | GeoJSON.GeometryCollection, tolerance: number, highQuality: boolean): GeoJSON.Feature | GeoJSON.FeatureCollection | GeoJSON.GeometryCollection; /** - * Takes two polygons and returns a combined polygon. If the input polygons are not contiguous, this function returns a MultiPolygon feature. + * Takes two polygons and returns a combined polygon. + * If the input polygons are not contiguous, this function returns a MultiPolygon feature. * @param poly1 Input polygon * @param poly2 Another input polygon * @returns A combined Polygon or MultiPolygon feature @@ -446,7 +458,8 @@ declare module turf { function isolines(points: GeoJSON.FeatureCollection, z: string, resolution: number, breaks: Array): GeoJSON.FeatureCollection; /** - * Takes a triangular plane as a Polygon and a Point within that triangle and returns the z-value at that point. The Polygon needs to have properties a, b, and c that define the values at its three corners. + * Takes a triangular plane as a Polygon and a Point within that triangle and returns the z-value at that point. + * The Polygon needs to have properties a, b, and c that define the values at its three corners. * @param interpolatedPoint The Point for which a z-value will be calculated * @param triangle A Polygon feature with three vertices * @returns The z-value for interpolatedPoint @@ -495,7 +508,8 @@ declare module turf { ////////////////////////////////////////////////////// /** - * Takes a Point and a Polygon or MultiPolygon and determines if the point resides inside the polygon. The polygon can be convex or concave. The function accounts for holes. + * Takes a Point and a Polygon or MultiPolygon and determines if the point resides inside the polygon. + * The polygon can be convex or concave. The function accounts for holes. * @param point Input point * @param polygon Input polygon or multipolygon * @returns true if the Point is inside the Polygon; false if the Point is not inside the Polygon From e088fd2475fcda1072bbe16c54755bc6138b41bd Mon Sep 17 00:00:00 2001 From: Tim Haase Date: Mon, 30 Nov 2015 21:48:04 +0100 Subject: [PATCH 061/474] Fix module export in state-machine typing --- state-machine/state-machine.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/state-machine/state-machine.d.ts b/state-machine/state-machine.d.ts index 67f7012b1c..d17c58dc69 100644 --- a/state-machine/state-machine.d.ts +++ b/state-machine/state-machine.d.ts @@ -79,5 +79,5 @@ interface StateMachine { declare var StateMachine: StateMachineStatic; declare module "state-machine" { - export = StateMachineStatic; + export = StateMachine; } From 8888d55a20ff2c5db1a575a98196f3e926898808 Mon Sep 17 00:00:00 2001 From: gcroteau Date: Tue, 1 Dec 2015 10:04:25 -0500 Subject: [PATCH 062/474] Renamed turf/turf-test.ts to turf/turf-tests.ts --- turf/{turf-test.ts => turf-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename turf/{turf-test.ts => turf-tests.ts} (100%) diff --git a/turf/turf-test.ts b/turf/turf-tests.ts similarity index 100% rename from turf/turf-test.ts rename to turf/turf-tests.ts From 93297476d1c3581d58f6cae25c54c14b1133b9fe Mon Sep 17 00:00:00 2001 From: Nick Malaguti Date: Mon, 30 Nov 2015 17:38:57 -0500 Subject: [PATCH 063/474] Add definitions for webdriverio --- webdriverio/webdriverio-tests.ts | 128 ++++ webdriverio/webdriverio.d.ts | 1064 ++++++++++++++++++++++++++++++ 2 files changed, 1192 insertions(+) create mode 100644 webdriverio/webdriverio-tests.ts create mode 100644 webdriverio/webdriverio.d.ts diff --git a/webdriverio/webdriverio-tests.ts b/webdriverio/webdriverio-tests.ts new file mode 100644 index 0000000000..205a2c6a6e --- /dev/null +++ b/webdriverio/webdriverio-tests.ts @@ -0,0 +1,128 @@ +/// +/// +/// + +import {assert} from "chai"; + +describe("webdriver.io page", function() { + + it("should have the right title - the good old callback way", function(done) { + + browser + .url("/") + .getTitle(function(err, title) { + assert.equal(err, undefined); + assert.equal(title, "WebdriverIO - Selenium 2.0 javascript bindings for nodejs"); + }) + .call(done); + + }); + + it("should have the right title - the promise way", function() { + + return browser + .url("/") + .getTitle().then(function(title) { + assert.equal(title, "WebdriverIO - Selenium 2.0 javascript bindings for nodejs"); + }); + + }); +}); + +import * as webdriverio from "webdriverio"; + +describe("my webdriverio tests", function(){ + + this.timeout(99999999); + var client: webdriverio.Client; + + before(function(done){ + client = webdriverio.remote({ desiredCapabilities: {browserName: "phantomjs"} }); + client.init(done); + }); + + it("Github test",function(done) { + client + .url("https://github.com/") + .getElementSize(".header-logo-wordmark", function(err: any, result: webdriverio.Size) { + assert.equal(undefined, err); + assert.strictEqual(result.height, 26); + assert.strictEqual(result.width, 89); + }) + .getTitle(function(err: any, title: string) { + assert.equal(undefined, err); + assert.strictEqual(title,"GitHub · Where software is built"); + }) + .getCssProperty("a[href='/plans']", "color", function(err: any, result: webdriverio.CssProperty){ + assert.equal(undefined, err); + assert.strictEqual(result.value, "rgba(64,120,192,1)"); + }) + .call(done); + }); + + after(function(done) { + client.end(done); + }); +}); + +var matrix = webdriverio.multiremote({ + browserA: { + desiredCapabilities: { + browserName: "chrome", + chromeOptions: { + args: [ + "use-fake-device-for-media-stream", + "use-fake-ui-for-media-stream", + ] + } + } + }, + browserB: { + desiredCapabilities: { + browserName: "chrome", + chromeOptions: { + args: [ + "use-fake-device-for-media-stream", + "use-fake-ui-for-media-stream", + ] + } + } + } + }); + +var channel = Math.round(Math.random() * 100000000000); + +matrix + .init() + .url("https://apprtc.appspot.com/r/" + channel) + .click("#confirm-join-button") + .pause(5000) + .end(); + +var options = { + desiredCapabilities: { + browserName: "chrome" + } +}; + +webdriverio + .remote(options) + .init() + .url("https://news.ycombinator.com/") + .selectorExecute("//div", function(inputs: HTMLElement[], message: string) { + return inputs.length + " " + message; + }, "divs on the page") + .then(function(res){ + console.log(res); + }) + .end(); + +webdriverio + .remote(options) + .init() + .url("http://www.google.com/") + .waitForVisible("//input[@type='submit']", 5000) + .then(function(visible){ + console.log(visible); //Should return true + }) + .end(); diff --git a/webdriverio/webdriverio.d.ts b/webdriverio/webdriverio.d.ts new file mode 100644 index 0000000000..c123c47c83 --- /dev/null +++ b/webdriverio/webdriverio.d.ts @@ -0,0 +1,1064 @@ +// Type definitions for webdriverio 3.3.0 +// Project: http://www.webdriver.io/ +// Definitions by: Nick Malaguti +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare namespace WebdriverIO { + // EventEmitter + export interface Client { + addListener(event: string, listener: Function): Client; + on(event: string, listener: Function): Client; + once(event: string, listener: Function): Client; + removeListener(event: string, listener: Function): Client; + removeAllListeners(event?: string): Client; + setMaxListeners(n: number): Client; + listeners(event: string): Client; + emit(event: string, ...args: any[]): Client; + } + + // Promise + export interface Client { + call(callback: () => any): Client; + finally(callback: () => any): Client; + then

(onFulfilled?: (value: T) => P | Client

, onRejected?: (err: any) => P | Client

): Client

; + catch

(onRejected?: (err: any) => P | Client

): Client

; + inspect(): Q.PromiseState; + } + + // Action + export interface Client { + addValue(selector: string, value: string | number): Client; + addValue

( + selector: string, + value: string | number, + callback: (err: any) => P + ): Client

; + + clearElement(selector: string): Client; + clearElement

( + selector: string, + callback: (err: any) => P + ): Client

; + + click(selector: string): Client; + click

( + selector: string, + callback: (err: any) => P + ): Client

; + + doubleClick(selector: string): Client; + doubleClick

( + selector: string, + callback: (err: any) => P + ): Client

; + + dragAndDrop(sourceElem: string, destinationElem: string): Client; + dragAndDrop

( + sourceElem: string, + destinationElem: string, callback: (err: any) => P + ): Client

; + + leftClick(selector: string): Client; + leftClick

( + selector: string, + callback: (err: any) => P + ): Client

; + + middleClick(selector: string): Client; + middleClick

( + selector: string, + callback: (err: any) => P + ): Client

; + + moveToObject(selector: string): Client; + moveToObject(selector: string, xoffset: number, yoffset: number): Client; + moveToObject

( + selector: string, + callback: (err: any) => P + ): Client

; + moveToObject

( + selector: string, + xoffset: number, + yoffset: number, + callback: (err: any) => P + ): Client

; + + rightClick(selector: string): Client; + rightClick

( + selector: string, + callback: (err: any) => P + ): Client

; + + selectByIndex(selectElem: string, index: number): Client; + selectByIndex

( + selectElem: string, + index: number, + callback: (err: any) => P + ): Client

; + + selectByValue(selectElem: string, value: string): Client; + selectByValue

( + selectElem: string, + value: string, + callback: (err: any) => P + ): Client

; + + selectByVisibleText(selectElem: string, text: string): Client; + selectByVisibleText

( + selectElem: string, + text: string, + callback: (err: any) => P + ): Client

; + + selectorExecute

( + selectors: string | string[], + script: (elements: HTMLElement | HTMLElement[], ...args: any[]) => P, + ...args: any[] + ): Client

; + + selectorExecuteAsync

( + selectors: string | string[], + script: (elements: HTMLElement | HTMLElement[], ...args: any[]) => P, + ...args: any[] + ): Client

; + + setValue(selector: string, values: number | string | Array): Client; + setValue

( + selector: string, + values: number | string | Array, + callback: (err: any) => P + ): Client; + + submitForm(selector: string): Client; + submitForm

( + selector: string, + callback: (err: any) => P + ): Client; + } + + // Appium + export interface Client { + // backgroundApp + // closeApp + // context + // contexts + // deviceKeyEvent + // getAppStrings + // getCurrentDeviceActivity + // getNetworkConnection + // hideDeviceKeyboard + // installAppOnDevice + // isAppInstalledOnDevice + // launchApp + // lock + // openNotifications + // performMultiAction + // performTouchAction + // pullFileFromDevice + // pushFileToDevice + // removeAppFromDevice + // resetApp + // rotate + // setImmediateValueInApp + // setNetworkConnection + // shake + // toggleAirplaneModeOnDevice + // toggleDataOnDevice + // toggleLocationServicesOnDevice + // toggleWiFiOnDevice + } + + export interface Cookie { + name: string; + value: string; + } + + // Cookie + export interface Client { + deleteCookie(name?: string): Client; + deleteCookie

( + callback: (err: any) => P + ): Client

; + deleteCookie

( + name: string, + callback: (err: any) => P + ): Client

; + + getCookie(): Client; + getCookie(name: string): Client; + getCookie

( + callback: (err: any, cookies: Cookie[]) => P + ): Client

; + getCookie

( + name: string, + callback: (err: any, cookie: Cookie) => P + ): Client

; + + setCookie(cookie: Cookie): Client; + setCookie

( + cookie: Cookie, + callback: (err: any) => P + ): Client

; + } + + // Mobile + export interface Client { + // flick + // flickDown + // flickLeft + // flickRight + // flickUp + // getGeoLocation + // getOrientation + // hold + // release + // setGeoLocation + // setOrientation + // touch + } + + export interface CssProperty { + property: string; + value: string; + parsed: ParsedCssProperty; + } + + export interface ParsedCssProperty { + type: string; + string: string; + quote: string; + unit: string; + value: string | number | string[] | number[]; + } + + export interface Size { + width: number; + height: number; + } + + export interface Location { + x: number; + y: number; + } + + // Property + export interface Client { + getAttribute(selector: string, attributeName: string): Client; + getAttribute

( + selector: string, + attributeName: string, + callback: (err: any, attribute: string | string[]) => P + ): Client

; + + getCssProperty(selector: string, cssProperty: string): Client; + getCssProperty

( + selector: string, + cssProperty: string, + callback: (err: any, cssProperty: CssProperty | CssProperty[]) => P + ): Client

; + + getElementSize(selector: string): Client; + getElementSize(selector: string, dimension: string): Client; + getElementSize

( + selector: string, + callback: (err: any, size: Size | Size[]) => P + ): Client

; + getElementSize

( + selector: string, + dimension: string, + callback: (err: any, elementSize: number | number[]) => P + ): Client

; + + getHTML(selector: string, includeSelectorTag?: boolean): Client; + getHTML

( + selector: string, + callback: (err: any, html: string | string[]) => P + ): Client

; + getHTML

( + selector: string, + includeSelectorTag: boolean, + callback: (err: any, html: string | string[]) => P + ): Client

; + + getLocation(selector: string): Client; + getLocation(selector: string, axis: string): Client; + getLocation

( + selector: string, + callback: (err: any, size: Size) => P + ): Client

; + getLocation

( + selector: string, + axis: string, + callback: (err: any, location: number) => P + ): Client

; + + getLocationInView(selector: string): Client; + getLocationInView(selector: string, axis: string): Client; + getLocationInView

( + selector: string, + callback: (err: any, size: Size | Size[]) => P + ): Client

; + getLocationInView

( + selector: string, + axis: string, + callback: (err: any, location: number | number[]) => P + ): Client

; + + getSource(): Client; + getSource

(callback: (err: any, source: string) => P): Client

; + + getTagName(selector: string): Client; + getTagName

( + selector: string, + callback: (err: any, tagName: string | string[]) => P + ): Client

; + + getText(selector: string): Client; + getText

( + selector: string, + callback: (err: any, text: string | string[]) => P + ): Client

; + + getTitle(): Client; + getTitle

( + callback: (err: any, title: string) => P + ): Client

; + + getUrl(): Client; + getUrl

( + callback: (err: any, title: string) => P + ): Client

; + + getValue(selector: string): Client; + getValue

( + selector: string, + callback: (err: any, value: string | string[]) => P + ): Client

; + } + + export interface LogEntry { + timestamp: number; + level: string; + message: string; + } + + export enum ApplicationCacheStatus { + UNCACHED = 0, + IDLE = 1, + CHECKING = 2, + DOWNLOADING = 3, + UPDATE_READY = 4, + OBSOLETE = 5 + } + + export enum Button { + left = 0, + middle = 1, + right = 2 + } + + export interface StorageItem { + key: string; + value: any; + } + + export interface Location { + latitude: number; + longitude: number; + altitude: number; + } + + export interface Session { + id: string; + capabilities: any; + } + + export interface RawResult { + value: T; + } + + // Navigation + export interface Client { + back(): Client; + back

( + callback: (err: any) => P + ): Client

; + + forward(): Client; + forward

( + callback: (err: any) => P + ): Client

; + + refresh(): Client; + refresh

( + callback: (err: any) => P + ): Client

; + + url(): Client>; + url(url: string): Client; + url

( + callback: (err: any, result: RawResult) => P + ): Client

; + url

( + url: string, + callback: (err: any) => P + ): Client

; + } + + // Advanced input + export interface Client { + // you probably want to use the click and drag and drop commands instead + buttonDown(button?: string | Button): Client; + buttonDown

( + callback: (err: any) => P + ): Client

; + buttonDown

( + button: string | Button, + callback: (err: any) => P + ): Client

; + + // you probably want to use the click and drag and drop commands instead + buttonPress(button?: string | Button): Client; + buttonPress

( + callback: (err: any) => P + ): Client

; + buttonPress

( + button: string | Button, + callback: (err: any) => P + ): Client

; + + // you probably want to use the click and drag and drop commands instead + buttonUp(button?: string | Button): Client; + buttonUp

( + callback: (err: any) => P + ): Client

; + buttonUp(button?: string | Button): Client; + buttonUp

( + button: string | Button, + callback: (err: any) => P + ): Client

; + + // you probably want to use the click and drag and drop commands instead + doDoubleClick(): Client; + doDoubleClick

( + callback: (err: any) => P + ): Client

; + + // you probably want to use addValue and setValue instead + keys(value: string | string[]): Client; + keys

( + value: string | string[], + callback: (err: any) => P + ): Client

; + + // you probably want to use the moveToObject command instead + moveTo(id: ElementId, xoffset?: number, yoffset?: number): Client; + moveTo(xoffset?: number, yoffset?: number): Client; + moveTo

( + id: ElementId, + callback: (err: any) => P + ): Client

; + moveTo

( + id: ElementId, + xoffset: number, + callback: (err: any) => P + ): Client

; + moveTo

( + id: ElementId, + xoffset: number, + yoffset: number, + callback: (err: any) => P + ): Client

; + + // touchClick + // touchDoubleClick + // touchDown + // touchFlick + // touchLongClick + // touchMove + // touchScroll + // touchUp + } + + // Useful Protocol + export interface Client { + alertAccept(): Client; + alertAccept

( + callback: (err: any) => P + ): Client

; + + alertDismiss(): Client; + alertDismiss

( + callback: (err: any) => P + ): Client

; + + alertText(text?: string): Client; + alertText

( + callback: (err: any, text: string) => P + ): Client

; + alertText

( + text: string, + callback: (err: any, text: string) => P + ): Client

; + + frame(id: any): Client; + frame

( + id: any, + callback: (err: any) => P + ): Client

; + + frameParent(): Client; + frameParent

( + callback: (err: any) => P + ): Client

; + + init(capabilities?: DesiredCapabilities): Client; + init

( + callback: (err: any) => P + ): Client

; + init

( + capabilities: DesiredCapabilities, + callback: (err: any) => P + ): Client

; + + log(type: string): Client>; + log

( + type: string, + callback: (err: any, result: RawResult) => P + ): Client

; + + logTypes(): Client>; + logTypes

( + callback: (err: any, result: RawResult) => P + ): Client

; + + session(action?: string, sessionId?: string): Client>; + session

( + callback: (err: any, result: RawResult) => P + ): Client

; + session

( + action: string, + callback: (err: any, result: RawResult) => P + ): Client

; + session

( + action: string, + sessionId: string, + callback: (err: any, result: RawResult) => P + ): Client

; + + sessions(): Client>; + sessions

( + callback: (err: any, sessions: RawResult) => P + ): Client

; + + // timeouts + // timeoutsAsyncScript + // timeoutsImplicitWait + + // window + // windowHandle + // windowHandleMaximize + // windowHandlePosition + // windowHandleSize + // windowHandles + } + + export type ElementId = string; + + export interface Element { + ELEMENT: ElementId; + } + + // Element + export interface Client { + element(selector: string): Client>; + element

( + selector: string, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementActive(): Client>; + elementActive

( + callback: (err: any, element: Element) => P + ): Client

; + + elementIdAttribute(id: ElementId, attributeName: string): Client>; + elementIdAttribute

( + id: ElementId, + attributeName: string, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdClear(id: ElementId): Client; + elementIdClear

( + id: ElementId, + callback: (err: any) => P + ): Client

; + + elementIdClick(id: ElementId): Client; + elementIdClick

( + id: ElementId, + callback: (err: any) => P + ): Client

; + + elementIdCssProperty(id: ElementId, propertyName: string): Client>; + elementIdCssProperty

( + id: ElementId, + propertyName: string, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdDisplayed(id: ElementId): Client>; + elementIdDisplayed

( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdElement(id: ElementId, selector: string): Client>; + elementIdElement

( + id: ElementId, + selector: string, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdElements(id: ElementId, selector: string): Client>; + elementIdElements

( + id: ElementId, + selector: string, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdEnabled(id: ElementId): Client>; + elementIdEnabled

( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdLocation(id: ElementId): Client>; + elementIdLocation

( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdLocationInView(id: ElementId): Client>; + elementIdLocationInView

( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdName(id: ElementId): Client>; + elementIdName

( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdSelected(id: ElementId): Client>; + elementIdSelected

( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdSize(id: ElementId): Client>; + elementIdSize

( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdText(id: ElementId): Client>; + elementIdText

( + id: ElementId, + callback: (err: any, result: RawResult) => P + ): Client

; + + elementIdValue(id: ElementId, values: string | string[]): Client>; + elementIdValue

( + id: ElementId, + values: string | string[], + callback: (err: any, result: RawResult) => P + ): Client

; + + elements(selector: string): Client>; + elements

( + selector: string, + callback: (err: any, result: RawResult) => P + ): Client

; + } + + // Unuseful Protocol + export interface Client { + // applicationCacheStatus + // cookie + + // use selectorExecute instead + execute(script: string | Function, ...args: any[]): Client>; + + // use selectorExecuteAsync instead + executeAsync(script: string | Function, ...args: any[]): Client>; + + // file + // imeActivate + // imeActivated + // imeActiveEngine + // imeAvailableEngines + // imeDeactivated + // localStorage + // localStorageSize + // location + // orientation + // screenshot + // sessionStorage + // sessionStorageSize + // source + // status + + // use submitForm instead + submit(id: ElementId): Client; + submit

( + id: ElementId, + callback: (err: any) => P + ): Client

; + + // title + } + + // State + export interface Client { + isEnabled(selector: string): Client; + isEnabled

( + selector: string, + callback: (err: any, isEnabled: boolean) => P + ): Client

; + + isExisting(selector: string): Client; + isExisting

( + selector: string, + callback: (err: any, isExisting: boolean) => P + ): Client

; + + isSelected(selector: string): Client; + isSelected

( + selector: string, + callback: (err: any, isSelected: boolean) => P + ): Client

; + + isVisible(selector: string): Client; + isVisible

( + selector: string, + callback: (err: any, isVisible: boolean) => P + ): Client

; + + isVisibleWithinViewport(selector: string): Client; + isVisibleWithinViewport

( + selector: string, + callback: (err: any, isVisible: boolean) => P + ): Client

; + } + + export interface CommandHistoryEntry { + command: string; + args: any[]; + } + + // Utility + export interface Client { + addCommand(commandName: string, customMethod: Function, overwrite?: boolean): Client; + addCommand

( + commandName: string, + customMethod: Function, + callback: (err: any) => P + ): Client

; + addCommand

( + commandName: string, + customMethod: Function, + overwrite: boolean, + callback: (err: any) => P + ): Client

; + + chooseFile(selector: string, localPath: string): Client; + chooseFile

( + selector: string, + localPath: string, + callback: (err: any) => P + ): Client

; + + debug(): Client; + debug

( + callback: (err: any) => P + ): Client

; + + end(): Client; + end

( + callback: (err: any) => P + ): Client

; + + endAll(): Client; + endAll

( + callback: (err: any) => P + ): Client

; + + getCommandHistory(): Client; + getCommandHistory

( + callback: (err: any, history: CommandHistoryEntry[]) => P + ): Client

; + + pause(milliseconds: number): Client; + pause

(milliseconds: number, callback: (err: any) => P): Client

; + + saveScreenshot(filename?: string): Client; + saveScreenshot

( + callback: (err: any, screenshot: Buffer) => P + ): Client

; + saveScreenshot

( + filename: string, + callback: (err: any, screenshot: Buffer) => P + ): Client

; + + scroll(selector: string): Client; + scroll(selector: string, xoffset: number, yoffset: number): Client; + scroll(xoffset: number, yoffset: number): Client; + scroll

( + selector: string, + callback: (err: any) => P + ): Client

; + scroll

( + selector: string, + xoffset: number, + yoffset: number, + callback: (err: any) => P + ): Client

; + scroll

( + xoffset: number, + yoffset: number, + callback: (err: any) => P + ): Client

; + + uploadFile(localPath: string): Client; + uploadFile

( + localPath: string, + callback: (err: any) => P + ): Client

; + + waitForEnabled(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForEnabled

( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForEnabled

( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForEnabled

( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

; + + waitForExist(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForExist

( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForExist

( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForExist

( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

; + + waitForSelected(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForSelected

( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForSelected

( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForSelected

( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

; + + waitForText(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForText

( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForText

( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForText

( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

; + + waitForValue(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForValue

( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForValue

( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForValue

( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

; + + waitForVisible(selector: string, milliseconds?: number, reverse?: boolean): Client; + waitForVisible

( + selector: string, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForVisible

( + selector: string, + milliseconds: number, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitForVisible

( + selector: string, + milliseconds: number, + reverse: boolean, + callback: (err: any, enabled: boolean) => P + ): Client

; + + waitUntil( + condition: () => boolean | Q.IPromise, + timeout?: number, + interval?: number + ): Client; + waitUntil

( + condition: () => boolean | Q.IPromise, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitUntil

( + condition: () => boolean | Q.IPromise, + timeout: number, + callback: (err: any, enabled: boolean) => P + ): Client

; + waitUntil

( + condition: () => boolean | Q.IPromise, + timeout: number, + interval: number, + callback: (err: any, enabled: boolean) => P + ): Client

; + } + + // Window + export interface Client { + close(windowHandle?: string): Client; + close

( + callback: (err: any) => P + ): Client

; + close

( + windowHandle: string, + callback: (err: any) => P + ): Client

; + + getCurrentTabId(): Client; + getCurrentTabId

( + callback: (err: any, tabId: string) => P + ): Client

; + + getTabIds(): Client; + getTabIds

( + callback: (err: any, tabIds: string[]) => P + ): Client

; + + getViewportSize(): Client; + getViewportSize(dimension: string): Client; + getViewportSize

( + callback: (err: any, size: Size) => P + ): Client

; + getViewportSize

( + dimension: string, + callback: (err: any, viewportSize: number) => P + ): Client

; + + newWindow(url: string, windowName: string, windowFeatures: string): Client; + newWindow

( + url: string, + windowName: string, + windowFeatures: string, + callback: (err: any, windowId: string) => P + ): Client

; + + setViewportSize(size: Size, type: boolean): Client; + setViewportSize

( + size: Size, + type: boolean, + callback: (err: any) => P + ): Client

; + + switchTab(windowHandle?: string): Client; + switchTab

( + callback: (err: any) => P + ): Client

; + switchTab

( + windowHandle: string, + callback: (err: any) => P + ): Client

; + } + + export interface Options { + protocol: string; + waitforTimeout: number; + coloredLogs: boolean; + logLevel: string; + baseUrl: string; + desiredCapabilities: DesiredCapabilities; + screenshotPath: string; + } + + // Options + export interface Client { + options: Options; + } + + export type DesiredCapabilities = any; + + export interface RemoteOptions { + protocol?: string; + waitforTimeout?: number; + waitforInterval?: number; + coloredLogs?: boolean; + logLevel?: string; + baseUrl?: string; + desiredCapabilities?: DesiredCapabilities; + } + + export interface MultiremoteOptions { + [key: string]: RemoteOptions; + } + + export function remote(options?: RemoteOptions | string): Client; + + export function multiremote(options?: MultiremoteOptions): Client; +} + +declare var browser: WebdriverIO.Client; + +declare module "webdriverio" { + export = WebdriverIO; +} From cc35e0f7a01116f425d2a9334c7ff5c24b122ae0 Mon Sep 17 00:00:00 2001 From: SrTobi Date: Tue, 1 Dec 2015 16:35:26 +0100 Subject: [PATCH 064/474] fixed definition header --- jssha/jssha.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts index e8e8787c54..6dc4f65d3e 100644 --- a/jssha/jssha.d.ts +++ b/jssha/jssha.d.ts @@ -1,7 +1,7 @@ // Type definitions for jsSHA // Project: https://github.com/Caligatio/jsSHA -// Definitions by: Tobias Kahlert -// Definitions: https://github.com/SrTobi/DefinitelyTyped +// Definitions by: David Li , Tobias Kahlert +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module jsSHA { From a9d32277887e04382960651d1a90ac02a335cee6 Mon Sep 17 00:00:00 2001 From: olemp Date: Tue, 1 Dec 2015 17:26:14 +0100 Subject: [PATCH 065/474] Added function declarations for ExecuteOrDelayUntilBodyLoaded, ExecuteOrDelayUntilScriptLoaded and ExecuteOrDelayUntilEventNotified. --- sharepoint/SharePoint.d.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sharepoint/SharePoint.d.ts b/sharepoint/SharePoint.d.ts index c62b68b16b..4e32dade4c 100644 --- a/sharepoint/SharePoint.d.ts +++ b/sharepoint/SharePoint.d.ts @@ -1,12 +1,15 @@ -// Type definitions for SharePoint 2010 and 2013 -// Project: https://github.com/gandjustas/sptypescript -// Definitions by: Stanislav Vyshchepan , Andrey Markeev -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// +// Type definitions for SharePoint 2010 and 2013 +// Project: https://github.com/gandjustas/sptypescript +// Definitions by: Stanislav Vyshchepan , Andrey Markeev +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// declare var _spBodyOnLoadFunctions: Function[]; declare var _spBodyOnLoadFunctionNames: string[]; declare var _spBodyOnLoadCalled: boolean; +declare function ExecuteOrDelayUntilBodyLoaded(initFunc: () => void): void; +declare function ExecuteOrDelayUntilScriptLoaded(func: () => void, depScriptFileName: string): boolean; +declare function ExecuteOrDelayUntilEventNotified(func: Function, eventName: string): boolean; declare var Strings:any; declare module SP { From 3337b8a8c2f1da308b4820027a9206c0875f194f Mon Sep 17 00:00:00 2001 From: Dasa Paddock Date: Tue, 1 Dec 2015 09:55:18 -0800 Subject: [PATCH 066/474] Update for ArcGIS API for JavaScript version 3.15 --- arcgis-js-api/arcgis-js-api.d.ts | 681 ++++++++++++++++++++----------- 1 file changed, 440 insertions(+), 241 deletions(-) diff --git a/arcgis-js-api/arcgis-js-api.d.ts b/arcgis-js-api/arcgis-js-api.d.ts index ba5e0fb9f4..88d68cb19f 100644 --- a/arcgis-js-api/arcgis-js-api.d.ts +++ b/arcgis-js-api/arcgis-js-api.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ArcGIS API for JavaScript v3.14 +// Type definitions for ArcGIS API for JavaScript v3.15 // Project: http://js.arcgis.com // Definitions by: Esri // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -146,7 +146,7 @@ declare module "esri" { /** Class attribute to set for the layer's node. */ className?: string; /** Lists which levels to draw. */ - displayLevels?: number; + displayLevels?: number[]; /** An array of objects that define areas where a tiled map service should not display tiles. */ exclusionAreas?: any[]; /** Id to assign to the layer. */ @@ -157,7 +157,7 @@ declare module "esri" { opacity?: number; /** Refresh interval of the layer in minutes. */ refreshInterval?: number; - /** When true, tile resampling is enabled. */ + /** The purpose of resampling is to enlarge the image and fill in at the levels where there are no tiles available. */ resampling?: boolean; /** Number of levels beyond the last level where tiles are available. */ resamplingTolerance?: number; @@ -215,6 +215,8 @@ declare module "esri" { opacity?: number; /** Specify subDomains where tiles are served to speed up tile retrieval (using subDomains gets around the browser limit of the max number of concurrent requests to a domain). */ subDomains?: string[]; + /** The URL template used to retrieve the tiles. */ + templateUrl?: string; /** Define the tile info for the layer including lods, rows, cols, origin and spatial reference. */ tileInfo?: TileInfo; /** Define additional tile server domains for the layer. */ @@ -307,19 +309,15 @@ declare module "esri" { export interface ClassedColorSliderOptions { /** Data map containing renderer information. */ breakInfos: any; - /** Classification method. */ + /** Indicates the classification method used to divide the range of values into bins. */ classificationMethod?: string; - /** Handles identified by their index values within the stops array. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of the histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ - maxValue?: number; - /** Absolute minimum value of the slider. */ - minValue?: number; - /** Normalization type. */ + /** Indicates how data values are normalized. */ normalizationType?: string; /** Handle identified by its index value within the stops array. */ primaryHandle?: number; @@ -333,61 +331,51 @@ declare module "esri" { showLabels?: boolean; /** Displays ticks on slider when true. */ showTicks?: boolean; - /** Represents statistics data object. */ + /** Represents the statistics data object. */ statistics?: any; } export interface ClassedSizeSliderOptions { - /** Data map containing renderer information. */ + /** The data map containing renderer information. */ breakInfos: any; - /** Classification method. */ + /** Optional: Indicates the classification method used to divide the range of values into bins. */ classificationMethod?: string; - /** Handles identified by their index values within the stops array. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ - maxValue?: number; - /** Absolute minimum value of the slider. */ - minValue?: number; - /** Normalization type. */ + /** Indicates how data values are normalized. */ normalizationType?: string; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; /** Width of slider ramp in pixels. */ rampWidth?: number; /** Displays slider handles when true. */ showHandles?: boolean; - /** Displays the histogram when true. */ + /** Indicates whether to display the histogram. */ showHistogram?: boolean; /** Displays labels when true. */ showLabels?: boolean; /** Displays slider ticks when true. */ showTicks?: boolean; - /** Represents statistics data object. */ + /** Optional: Represents the statistics data object. */ statistics?: any; - /** Indicates whether to use a circle or line-based ClassedSizeSlider. */ - symbol?: any; } export interface ColorInfoSliderOptions { - /** Classification method. */ - classificationMethod?: string; - /** Data map containing renderer information. */ + /** The data map containing renderer information. */ colorInfo: any; /** Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Optional: Represents the histogram data object. */ histogram?: any; /** Width of histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of slider. */ + /** The absolute maximum value of the slider. */ maxValue?: number; - /** Absolute minimum value of slider. */ + /** The absolute minimum value of the slider. */ minValue?: number; - /** Normalization Type. */ - normalizationType?: string; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; /** Width of widget ramp in pixels. */ rampWidth?: number; @@ -397,13 +385,15 @@ declare module "esri" { showHistogram?: boolean; /** Displays labels when set to true. */ showLabels?: boolean; - /** Displays ticks when set to true. */ + /** Indicates whether to display percentage labels. */ + showRatioLabels?: boolean | string; + /** Displays tick marks when set to true. */ showTicks?: boolean; /** Displays transparent background when set to true. */ showTransparentBackground?: boolean; - /** Represents statistics data object. */ + /** Represents a statistics data object. */ statistics?: any; - /** Object containing additional options. */ + /** Additional options to customize slider. */ zoomOptions?: any; } export interface ColorPickerOptions { @@ -655,8 +645,6 @@ declare module "esri" { traffic?: boolean; /** The traffic layer used for real-time traffic. */ trafficLayer?: ArcGISDynamicMapServiceLayer; - /** An example of when to use this is when working with a proxied ArcGIS Online route service item with stored credentials. */ - travelModesServiceUrl?: string; } export interface DissolveBoundariesOptions { /** The URL to the GPServer used to execute an analysis job. */ @@ -718,7 +706,7 @@ declare module "esri" { /** Specifies whether users can add new vertices. */ allowAddVertices?: boolean; /** Specifies whether users can delete vertices. */ - allowDeletevertices?: boolean; + allowDeleteVertices?: boolean; /** Line symbol used to draw the guild lines, displayed when moving vertices. */ ghostLineSymbol?: LineSymbol; /** Marker symbol used to display the insertable vertices. */ @@ -859,8 +847,14 @@ declare module "esri" { cellNavigation?: boolean; /** Object defining the date options specifically for formatting date and time editors. */ dateOptions?: any; + /** Allows selection of a table's row via clicking a feature on the map. */ + enableLayerClick?: boolean; + /** Allows selection of a feature on a map via clicking row in the table. */ + enableLayerSelection?: boolean; /** The featureLayer that the table is associated with. */ featureLayer: FeatureLayer; + /** Reference to the 'Options' drop-down menu. */ + gridMenu?: any; /** Columns to hide by default using the dGrid ColumnHider extension. */ hiddenFields?: string[]; /** A reference to the Map. */ @@ -1173,8 +1167,12 @@ declare module "esri" { map: Map; /** Indicates whether to remove underscores from the layer title. */ removeUnderscores?: boolean; + /** Indicates whether to display a legend for the layer items. */ + showLegend?: boolean; + /** Indicates whether to display the opacity slider. */ + showOpacitySlider?: boolean; /** Indicates whether to show sublayers in the list of layers. */ - subLayers?: boolean; + showSubLayers?: boolean; /** The CSS class selector used to uniquely style the widget. */ theme?: string; /** Indicates whether to show the LayerList widget. */ @@ -1455,19 +1453,19 @@ declare module "esri" { export interface OpacitySliderOptions { /** Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ + /** The absolute maximum value of the slider. */ maxValue?: number; - /** Absolute minimum value of the slider. */ + /** The absolute minimum value of the slider. */ minValue?: number; - /** Data map containing renderer information. */ + /** The data map containing renderer information. */ opacityInfo: any; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; - /** Width of slider ramp in pixels. */ + /** Represents the width of the SVG ramp in pixels. */ rampWidth?: number; /** Displays slider handles when true. */ showHandles?: boolean; @@ -1479,9 +1477,9 @@ declare module "esri" { showTicks?: boolean; /** Displays the transparent background when true. */ showTransparentBackground?: boolean; - /** Represents statistics data object. */ + /** Represents a statistics data object. */ statistics?: any; - /** Additional options for slider customization. */ + /** Additional options to customize slider. */ zoomOptions?: any; } export interface OpenStreetMapLayerOptions { @@ -1699,7 +1697,7 @@ declare module "esri" { minimum: number; /** Bottom label for the slider. */ minLabel?: string; - /** **CHECK THIS: Is it num of dec places? - Accuracy of the data (related to rounding). */ + /** Accuracy of the data (related to rounding). */ precision?: number; /** Primary handle identified by its index value within the related infos array (color, size, break). */ primaryHandle?: number; @@ -1737,9 +1735,11 @@ declare module "esri" { activeSourceIndex?: number | string; /** Indicates whether to automatically add all the feature layers from the map. */ addLayersFromMap?: boolean; + /** This is the default value used as a hint for input text when searching on multiple sources. */ + allPlaceholder?: string; /** Indicates whether to automatically navigate to the selected result. */ autoNavigate?: boolean; - /** Indicates whether to automatically select the first result. */ + /** Indicates whether to automatically select the first geocoded result (not the first suggestion). */ autoSelect?: boolean; /** Indicates whether to enable an option to collapse/expand the search into a button. */ enableButtonMode?: boolean; @@ -1749,6 +1749,8 @@ declare module "esri" { enableInfoWindow?: boolean; /** Indicates whether to enable showing a label for the geometry.The default value is false. */ enableLabel?: boolean; + /** Indicates whether to display the option to search "All" sources. */ + enableSearchingAll?: boolean; /** Indicates whether to enable the menu for selecting different sources. */ enableSourcesMenu?: boolean; /** Indicates whether or not to enable suggest on the widget. */ @@ -1765,7 +1767,7 @@ declare module "esri" { infoTemplate?: InfoTemplate; /** The text symbol for the label graphic. */ labelSymbol?: TextSymbol; - /** The default distance specified in meters used to reverse geocode, (if not specified by source).The default value is 1500. */ + /** The default distance specified in meters used to reverse geocode, (if not specified by source). */ locationToAddressDistance?: number; /** Reference to the map. */ map?: Map; @@ -1791,23 +1793,19 @@ declare module "esri" { zoomScale?: number; } export interface SizeInfoSliderOptions { - /** Classification method. */ - classificationMethod?: string; /** Handles identified by their index values within the stops array. */ handles: number[]; - /** Represents histogram data object. */ + /** Represents the histogram data object. */ histogram?: any; /** Width of the histogram in pixels. */ histogramWidth?: number; - /** Absolute maximum value of the slider. */ + /** The absolute maximum value of the slider. */ maxValue?: number; - /** Absolute minimum value of the slider. */ + /** The absolute minimum value of the slider. */ minValue?: number; - /** Normalization type. */ - normalizationType?: string; - /** Handle identified by its index value within the stops array. */ + /** The handle identified by its index value within the stops array. */ primaryHandle?: number; - /** Width of slider ramp in pixels. */ + /** Represents the width of the SVG ramp in pixels. */ rampWidth?: number; /** Displays slider handles when true. */ showHandles?: boolean; @@ -1817,11 +1815,11 @@ declare module "esri" { showLabels?: boolean; /** Displays slider ticks when true. */ showTicks?: boolean; - /** Data map containing renderer information. */ + /** Defines the size of the symbol where feature size is proportional to data value. */ sizeInfo: any; - /** Represents statistics data object. */ + /** Represents the statistics data object. */ statistics?: any; - /** The symbol used with the widget. */ + /** The SimpleLineSymbol or SimpleMarkerSymbol used with the widget. */ symbol: Symbol; /** Additional options to customize slider. */ zoomOptions?: any; @@ -1969,10 +1967,12 @@ declare module "esri" { sumWithinLayer: FeatureLayer; } export interface SymbolStylerOptions { + /** Added at v. */ + portal?: string | any; /** Self response of Portal used as symbol provider. */ - portalSelf: string; + portalSelf?: any; /** URL to Portal used as symbol provider. */ - portalUrl: string; + portalUrl?: string; } export interface TemplatePickerOptions { /** Number of visible columns. */ @@ -2062,6 +2062,18 @@ declare module "esri" { /** A predefined style. */ style?: string; } + export interface VectorTileLayerOptions { + /** Lists which levels of the layer to draw. */ + displayLevels?: number[]; + /** Maximum visible scale for the layer. */ + maxScale?: number; + /** Minimum visible scale for the layer. */ + minScale?: number; + /** Initial opacity or transparency of layer. */ + opacity?: number; + /** Visibility of the layer. */ + visible?: boolean; + } export interface VisibleScaleRangeSliderOptions { /** Layer used to determine the suggested scale range and set the minScale, maxScale values. */ layer: FeatureLayer; @@ -2275,7 +2287,7 @@ declare module "esri/IdentityManager" { /** Dialog box widget used to challenge the user for their credentials when the application attempts to access a secure resource. */ dialog: any; /** - * When accessing secure resources via Oauth2 from ArcGIS.com or one of its sub-domains the IdentityManager redirects the user to the ArcGIS.com or Portal for ArcGIS sign-in page. + * When accessing secure resources via OAuth2 from ArcGIS.com or one of its sub-domains the IdentityManager redirects the user to the ArcGIS.com or Portal for ArcGIS sign-in page. * @param handlerFunction When called, the function passed to setOAuthRedirectionHandler receives an object containing the redirection properties. */ setOAuthRedirectionHandler(handlerFunction: Function): void; @@ -2391,7 +2403,7 @@ declare module "esri/IdentityManagerBase" { /** Return properties of this object in JSON. */ toJson(): any; /** Fired when a credential is created. */ - on(type: "credential-create", listener: (event: { target: IdentityManagerBase }) => void): esri.Handle; + on(type: "credential-create", listener: (event: { credential: Credential; target: IdentityManagerBase }) => void): esri.Handle; /** Fired when all credentials are destroyed. */ on(type: "credentials-destroy", listener: (event: { target: IdentityManagerBase }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; @@ -2675,7 +2687,7 @@ declare module "esri/arcgis/OAuthInfo" { minTimeUntilExpiration: number; /** Set to true to show the OAuth sign in page in a popup window. */ popup: boolean; - /** The relative page URL for the user to be sent to from the OAuth sign in page. */ + /** Applicable if working with the popup user-login workflow. */ popupCallbackUrl: string; /** The window features passed to window.open(). */ popupWindowFeatures: string; @@ -2886,7 +2898,7 @@ declare module "esri/arcgis/Portal" { /** The date the group was last modified. */ modified: Date; /** The username of the group's owner. */ - owner: Portal; + owner: string; /** The portal for the group. */ portal: Portal; /** A short summary that describes the group. */ @@ -3062,7 +3074,7 @@ declare module "esri/arcgis/Portal" { * Retrieve all the items in the specified folder. * @param folderId The id of the folder that contains the items to retrieve. */ - getItems(folderId: string): any; + getItems(folderId?: string): any; /** Get information about any notifications for the portal user. */ getNotifications(): any; /** Access the tag objects that have been created by the portal user. */ @@ -3087,6 +3099,11 @@ declare module "esri/arcgis/utils" { * @param itemId The itemId for a publicly shared ArcGIS.com item. */ getItem(itemId: string): any; + /** + * Can be used with LayerList widget to get the layers list to be passed into the constructor. + * @param createMapResponse The object created from the resolved promise returned by createMap(). + */ + getLayerList(createMapResponse: any): any[]; /** * Can be used with esri.dijit.Legend to get the layerInfos list to be passed into the Legend constructor. * @param createMapResponse Object returned by .createMap() in the .then() callback. @@ -3422,37 +3439,35 @@ declare module "esri/dijit/ClassedColorSlider" { /** A widget to assist with managing a renderer used for visualizing features by their class and color. */ class ClassedColorSlider extends RendererSlider { - /** Required */ + /** Required: The data map containing renderer information. */ breakInfos: any; - /** Optional */ + /** Optional: Indicates the classification method used to divide the range of values into bins. */ classificationMethod: string; /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional: Property representing histogram data object. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional */ + /** Optional: The width of the histogram in pixels. */ histogramWidth: boolean; - /** Optional */ + /** Read Only. */ maxValue: number; - /** Optional */ + /** Read Only. */ minValue: number; - /** Optional */ + /** Optional: Indicates how data values are normalized. */ normalizationType: string; - /** Optional: Handle identified by its index value within the stops array. */ + /** Optional: The handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Width of the widget ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display handles. */ showHandles: boolean; - /** Optional: Property for displaying the histogram. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display tick marks. */ showTicks: boolean; - /** Property for displaying the transparent background. */ - showTransparentBackground: boolean; - /** Optional: Property representing statistics data object. */ + /** Optional: Represents the statistics data object. */ statistics: any; /** * Creates a new ClassedColorSlider widget. @@ -3464,7 +3479,7 @@ declare module "esri/dijit/ClassedColorSlider" { startup(): void; /** Fires when the ClassedColorSlider widget properties change. */ on(type: "change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of ClassedColorSlider changes. */ + /** Fires when minValue or maxValue of the ClassedColorSlider changes. */ on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedColorSlider }) => void): esri.Handle; /** Fires when a ClassedColorSlider handle is moved. */ on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle; @@ -3479,35 +3494,35 @@ declare module "esri/dijit/ClassedSizeSlider" { /** A widget to assist with managing a renderer for visualizing features by varying classes and size. */ class ClassedSizeSlider extends RendererSlider { - /** Required. */ + /** Required: The data map containing renderer information. */ breakInfos: any; - /** Optional. */ + /** Optional: Indicates the classification method used to divide the range of values into bins. */ classificationMethod: string; - /** Required. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional. */ - histogramWidth: boolean; - /** Optional. */ + /** Optional: Width of histogram in pixels. */ + histogramWidth: number; + /** Read Only. */ maxValue: number; - /** Optional. */ + /** Read Only. */ minValue: number; - /** Optional. */ + /** Optional: Indicates how data values are normalized. */ normalizationType: string; - /** Optional. */ + /** Optional: Handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Width of the widget ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display handles. */ showHandles: boolean; - /** Optional. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display ticks marks. */ showTicks: boolean; - /** Optional. */ + /** Optional: Represents the statistics data object. */ statistics: any; /** * Creates a new ClassedSizeSlider widget within the provided DOM node srcNodeRef. @@ -3517,7 +3532,7 @@ declare module "esri/dijit/ClassedSizeSlider" { constructor(params: esri.ClassedSizeSliderOptions, srcNodeRef: Node | string); /** Fires when ClassedSizeSlider changes. */ on(type: "change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue changes in ClassedSizeSlider. */ + /** Fires when minValue or maxValue of the ClassedSizeSlider changes. */ on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedSizeSlider }) => void): esri.Handle; /** Fires when a ClassedSizeSlider handle is moved. */ on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle; @@ -3532,39 +3547,41 @@ declare module "esri/dijit/ColorInfoSlider" { /** A widget to assist with managing a renderer for visualizing features based upon colors. */ class ColorInfoSlider extends RendererSlider { - /** Optional */ + /** The classification method used for the ColorInfoSlider. */ classificationMethod: string; - /** Required: Example colorInfo: colorRenderer.renderer.visualVariables[0]. */ + /** Required: The data map containing renderer information. */ colorInfo: any; /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional: Property representing histogram data object. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional */ - histogramWidth: boolean; - /** Optional */ + /** Optional: Width of histogram in pixels. */ + histogramWidth: number; + /** Optional: The absolute maximum value of the slider. */ maxValue: number; - /** Optional */ + /** Optional: The absolute minimum value of the slider. */ minValue: number; /** Optional */ normalizationType: string; - /** Optional: Handle identified by its index value within the stops array. */ + /** Optional: The handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Width of the widget ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display handles. */ showHandles: boolean; - /** Optional: Property for displaying the histogram. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display handles. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Indicates whether to display percentage labels. */ + showRatioLabels: boolean | string; + /** Optional: Indicates whether to display ticks marks. */ showTicks: boolean; - /** Property for displaying the transparent background. */ + /** Optional: Indicates whether to display a transparent background. */ showTransparentBackground: boolean; - /** Optional: Property representing statistics data object. */ + /** Optional: Represents a statistics data object. */ statistics: any; - /** Optional */ + /** Optional: Additional options to customize slider. */ zoomOptions: any; /** * Creates a new ColorInfoSlider widget within the provided DOM node srcNodeRef. @@ -3576,10 +3593,12 @@ declare module "esri/dijit/ColorInfoSlider" { startup(): void; /** Fires when ColorInfoSlider changes. */ on(type: "change", listener: (event: { colorInfo: any; target: ColorInfoSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of ColorInfoSlider changes. */ + /** Fires when minValue or maxValue of the ColorInfoSlider changes. */ on(type: "data-value-change", listener: (event: { colorInfo: any; maxValue: number; minValue: number; target: ColorInfoSlider }) => void): esri.Handle; /** Fires when a ColorInfoSlider handle is moved. */ - on(type: "handle-value-change", listener: (event: { target: ColorInfoSlider }) => void): esri.Handle; + on(type: "handle-value-change", listener: (event: { colorInfo: any; target: ColorInfoSlider }) => void): esri.Handle; + /** Fires when the zoom state changes. */ + on(type: "zoomed", listener: (event: { zoomed: boolean; target: ColorInfoSlider }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = ColorInfoSlider; @@ -3765,6 +3784,8 @@ declare module "esri/dijit/ElevationProfile" { measureUnits: string; /** The polyline input geometry used to create the elevation profile. */ profileGeometry: Geometry; + /** The title of the resulting elevation profile. */ + title: string; /** * Create a new ElevationProfile widget using the given DOM node. * @param options See options table below for the full descriptions of the properties needed for this object. @@ -3781,6 +3802,8 @@ declare module "esri/dijit/ElevationProfile" { on(type: "clear-profile", listener: (event: { target: ElevationProfile }) => void): esri.Handle; /** Fires when the widget has fully loaded. */ on(type: "load", listener: (event: { target: ElevationProfile }) => void): esri.Handle; + /** Fires when the title of the elevation profile is changed */ + on(type: "title-changed", listener: (event: { target: ElevationProfile }) => void): esri.Handle; /** Fires when the elevation profile is updated. */ on(type: "update-profile", listener: (event: { profileResults: any; target: ElevationProfile }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; @@ -3793,7 +3816,7 @@ declare module "esri/dijit/FeatureTable" { import FeatureLayer = require("esri/layers/FeatureLayer"); import Map = require("esri/map"); - /** (Currently in beta) Creates an instance of the FeatureTable widget within the provided DOM node. */ + /** Creates an instance of the FeatureTable widget within the provided DOM node. */ class FeatureTable { /** An optional dGrid property. */ allowSelectAll: boolean; @@ -3805,10 +3828,16 @@ declare module "esri/dijit/FeatureTable" { dataStore: any; /** Object defining the date options specifically for formatting date and time editors. */ dateOptions: any; + /** Allows selection of a table's row via clicking a feature on the map. */ + enableLayerClick: boolean; + /** Allows selection of a feature on a map via clicking row in the table. */ + enableLayerSelection: boolean; /** The featureLayer that the table is associated with. */ featureLayer: FeatureLayer; /** Reference to the dGrid. */ grid: any; + /** Reference to the 'Options' drop-down menu. */ + gridMenu: any; /** Optional columns to hide by default using the dGrid ColumnHider extension. */ hiddenFields: string[]; /** A reference to the primary key used by the dataStore to differentiate columns. */ @@ -4004,15 +4033,15 @@ declare module "esri/dijit/HeatmapSlider" { import esri = require("esri"); import RendererSlider = require("esri/dijit/RendererSlider"); - /** A widget to assist in managing properties of a HeatmapRenderer. */ + /** A widget to assist in obtaining values for managing and setting properties on a HeatmapRenderer. */ class HeatmapSlider extends RendererSlider { /** Required. */ colorStops: any; /** Required. */ handles: number[]; - /** Optional. */ + /** Optional, absolute maximum value of the slider.NOTE: This value overrides statistics' max property. */ maxValue: number; - /** Optional. */ + /** Optional, absolute minimum value of the slider.NOTE: This value overrides statistics' min property. */ minValue: number; /** Optional */ rampWidth: number; @@ -4127,6 +4156,7 @@ declare module "esri/dijit/ImageServiceMeasure" { import SimpleFillSymbol = require("esri/symbols/SimpleFillSymbol"); import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol"); + import ImageServiceMeasureTool = require("esri/toolbars/ImageServiceMeasureTool"); /** This widget allows you to perform measurements on image services. */ class ImageServiceMeasure { @@ -4136,6 +4166,8 @@ declare module "esri/dijit/ImageServiceMeasure" { lineSymbol: SimpleLineSymbol; /** Symbol to be used when drawing a point. */ markerSymbol: SimpleMarkerSymbol; + /** The instance of ImageServiceMeasureTool associated with this widget. */ + measureToolbar: ImageServiceMeasureTool; /** * Creates an instance of the ImageServiceMeasure widget. * @param params An Object containing constructor options. @@ -4294,8 +4326,12 @@ declare module "esri/dijit/LayerList" { map: Map; /** Indicates whether to remove underscores from the layer title */ removeUnderscores: boolean; + /** Indicates whether to display a legend for the layer items. */ + showLegend: boolean; + /** Indicates whether to display the opacity slider. */ + showOpacitySlider: boolean; /** Indicates whether to show sublayers in the list of layers. */ - sublayers: boolean; + showSubLayers: boolean; /** CSS Class for uniquely styling the widget. */ theme: string; /** Indicates whether to show the widget. */ @@ -4314,7 +4350,7 @@ declare module "esri/dijit/LayerList" { startup(): void; /** Fired when the LayerList widget has fully loaded. */ on(type: "load", listener: (event: { target: LayerList }) => void): esri.Handle; - /** Fired when refresh is called on the LabelList widget. */ + /** Fired when refresh() is called on the widget. */ on(type: "refresh", listener: (event: { target: LayerList }) => void): esri.Handle; /** Fired when the layer is toggled on/off within the widget. */ on(type: "toggle", listener: (event: { layerIndex: number; subLayerIndex: number; visible: boolean; target: LayerList }) => void): esri.Handle; @@ -4622,33 +4658,35 @@ declare module "esri/dijit/OpacitySlider" { /** A widget to assist with managing opacity with a renderer. */ class OpacitySlider extends RendererSlider { - /** Required. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional: */ - histogramWidth: boolean; - /** Optional. */ + /** Optional: Width of histogram in pixels. */ + histogramWidth: number; + /** Optional: The absolute maximum value of the slider. */ maxValue: number; - /** Optional. */ + /** Optional: The absolute minimum value of the slider. */ minValue: number; - /** Required. */ + /** Required: The data map containing renderer information. */ opacityInfo: any; - /** Optional */ + /** Optional: The handle identified by its index value within the stops array. */ + primaryHandle: number; + /** Optional: Represents the width of the SVG ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display slider handles. */ showHandles: boolean; - /** Optional. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display slider labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display slider tick marks. */ showTicks: boolean; - /** Property for displaying the transparent background. */ + /** Optional: Indicates whether to display the transparent background. */ showTransparentBackground: boolean; - /** Optional. */ + /** Optional: Represents a statistics data object. */ statistics: any; - /** Optional. */ + /** Optional: Additional options to customize slider. */ zoomOptions: any; /** * Creates a new OpacitySlider widget within the provided DOM node srcNodeRef. @@ -4658,10 +4696,12 @@ declare module "esri/dijit/OpacitySlider" { constructor(params: esri.OpacitySliderOptions, srcNodeRef: Node | string); /** Fires when OpacitySlider changes. */ on(type: "change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of OpacitySlider changes. */ + /** Fires when minValue or maxValue of the OpacitySlider changes. */ on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; /** Fires when an OpacitySlider handle is moved. */ on(type: "handle-value-change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle; + /** Fires when the zoom state changes. */ + on(type: "zoomed", listener: (event: { zoomed: boolean; target: OpacitySlider }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = OpacitySlider; @@ -4985,7 +5025,7 @@ declare module "esri/dijit/RendererSlider" { showLabels: boolean | string[]; /** Toggle for showing the horizontal line indicators from the center of the handle. */ showTicks: boolean; - /** Handle positions represented as numbers that fall between minimum and maximum. */ + /** Required: Handle positions represented as numbers that fall between minimum and maximum. */ values: number[]; /** * Creates a new RendererSlider widget. @@ -5044,10 +5084,14 @@ declare module "esri/dijit/Search" { activeSourceIndex: number; /** Indicates whether to automatically add all the feature layers from the map. */ addLayersFromMap: boolean; + /** This is the default value used as a hint for input text when searching on multiple sources. */ + allPlaceholder: string; /** Indicates whether to automatically navigate to the selected result. */ autoNavigate: boolean; - /** Indicates whether to automatically select and zoom to the first geocoded result. */ + /** Indicates whether to automatically select the first geocoded result. */ autoSelect: boolean; + /** (Read-only), the default source used for the Search widget. */ + defaultSource: any; /** Indicates whether to enable an option to collapse/expand the search into a button. */ enableButtonMode: boolean; /** Show the selected feature on the map using a default symbol determined by the source's geometry type. */ @@ -5056,6 +5100,8 @@ declare module "esri/dijit/Search" { enableInfoWindow: boolean; /** Indicates whether to enable showing a label for the geometry. */ enableLabel: boolean; + /** Indicates whether to display the option to search "All" sources. */ + enableSearchingAll: boolean; /** Indicates whether to enable the menu for selecting different sources. */ enableSourcesMenu: boolean; /** Enable suggestions for the widget. */ @@ -5150,8 +5196,8 @@ declare module "esri/dijit/Search" { /** Finalizes the creation of the Search widget. */ startup(): void; /** - * Performs a suggest() request on the active Locator. - * @param value The string value used to suggest() on an active Locator. + * Performs a suggest() request on the active Locator or feature layer. + * @param value The string value used to suggest() on an active locator or feature layer. */ suggest(value?: string): any; /** Fired when the widget's text input loses focus. */ @@ -5176,39 +5222,44 @@ declare module "esri/dijit/Search" { declare module "esri/dijit/SizeInfoSlider" { import esri = require("esri"); import RendererSlider = require("esri/dijit/RendererSlider"); + import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol"); + import SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); + /** A widget to assist with managing size with a renderer. */ class SizeInfoSlider extends RendererSlider { - /** Optional. */ + /** Optional, the classification method used for the SizeInfoSlider. */ classificationMethod: string; - /** Required. */ + /** Required: Handles identified by their index values within the stops array. */ handles: number[]; - /** Optional. */ + /** Optional: Represents the histogram data object. */ histogram: any; - /** Optional. */ - histogramWidth: boolean; - /** Optional. */ + /** Optional: Width of the histogram in pixels. */ + histogramWidth: number; + /** Optional: The absolute maximum value of the slider. */ maxValue: number; - /** Optional. */ + /** Optional: The absolute minimum value of the slider. */ minValue: number; - /** Optional. */ + /** Optional, indicates how data values are normalized. */ normalizationType: string; - /** Optional. */ + /** Optional: The handle identified by its index value within the stops array. */ primaryHandle: number; - /** Optional */ + /** Optional: Represents the width of the SVG ramp in pixels. */ rampWidth: number; - /** Property for showing handles. */ + /** Optional: Indicates whether to display slider handles. */ showHandles: boolean; - /** Optional. */ + /** Optional: Indicates whether to display the histogram. */ showHistogram: boolean; - /** Property for showing labels. */ + /** Optional: Indicates whether to display the slider labels. */ showLabels: boolean; - /** Property for showing ticks. */ + /** Optional: Indicates whether to display the slider tick marks. */ showTicks: boolean; - /** Required. */ + /** Required: Defines the size of the symbol where feature size is proportional to data value. */ sizeInfo: any; - /** Optional. */ + /** Optional: Represents the statistics data object. */ statistics: any; - /** Optional. */ + /** Required: The SimpleLineSymbol or SimpleMarkerSymbol used with the widget. */ + symbol: SimpleMarkerSymbol | SimpleLineSymbol; + /** Optional: Additional options to customize slider. */ zoomOptions: any; /** * Creates a new SizeInfoSlider widget. @@ -5220,10 +5271,12 @@ declare module "esri/dijit/SizeInfoSlider" { startup(): void; /** Fires when the SizeInfoSlider properties change. */ on(type: "change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; - /** Fires when minValue or maxValue of SizeInfoSlider change. */ + /** Fires when minValue or maxValue of the SizeInfoSlider changes. */ on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; /** Fires when a SizeInfoSlider handle is moved. */ on(type: "handle-value-change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle; + /** Fires when the zoom state changes. */ + on(type: "zoomed", listener: (event: { zoomed: boolean; target: SizeInfoSlider }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = SizeInfoSlider; @@ -6730,7 +6783,7 @@ declare module "esri/dijit/geoenrichment/DataBrowser" { export = DataBrowser; } -declare module "esri/dijit/geoenrichment/InfoGraphic" { +declare module "esri/dijit/geoenrichment/Infographic" { import esri = require("esri"); import GeometryStudyArea = require("esri/tasks/geoenrichment/GeometryStudyArea"); import RingBuffer = require("esri/tasks/geoenrichment/RingBuffer"); @@ -7451,13 +7504,13 @@ declare module "esri/geometry/geometryEngine" { import SpatialReference = require("esri/SpatialReference"); import Point = require("esri/geometry/Point"); - /** (Currently in beta) A client-side geometry engine. */ + /** A client-side geometry engine. */ var geometryEngine: { /** * Creates planar (or Euclidean) buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ buffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): Polygon | Polygon[]; @@ -7495,7 +7548,7 @@ declare module "esri/geometry/geometryEngine" { * Densify geometries by plotting points between existing vertices. * @param geometry The geometry to be densified. * @param maxSegmentLength The maximum segment length allowed. - * @param maxSegmentLengthUnit Unit for the maximum segment length. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. */ densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit: string | number): Geometry; /** @@ -7514,7 +7567,7 @@ declare module "esri/geometry/geometryEngine" { * Calculates the shortest planar distance between two geometries. * @param geometry1 First input geometry. * @param geometry2 Second input geometry. - * @param distanceUnit Units of the return value. + * @param distanceUnit Measurement unit of the return value. */ distance(geometry1: Geometry, geometry2: Geometry, distanceUnit: string | number): number; /** @@ -7545,27 +7598,34 @@ declare module "esri/geometry/geometryEngine" { * @param geometry The geometry to be generalized. * @param maxDeviation The maximum allowed deviation from the generalized geometry to the original geometry. * @param removeDegenerateParts When true, the degenerate parts of the geometry will be removed from the output (may be undesired for drawing). - * @param maxDeviationUnit A unit for maximum deviation. + * @param maxDeviationUnit Measurement unit for maxDeviation. */ generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: string | number): Geometry; /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicArea(geometry: Geometry, unit: string | number): number; /** * Creates geodesic buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ geodesicBuffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): Polygon | Polygon[]; + /** + * Returns a geodesically densified version of the input geometry. + * @param geometry A polyline or polygon geometry to densify. + * @param maxSegmentLength The maximum segment length allowed. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. + */ + geodesicDensify(geometry: Polyline | Polygon, maxSegmentLength: number, maxSegmentLengthUnit?: number): Geometry; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicLength(geometry: Geometry, unit: string | number): number; /** @@ -7609,7 +7669,7 @@ declare module "esri/geometry/geometryEngine" { * Creates offset version of the input geometry. * @param geometry The geometries to offset. * @param offsetDistance The offset distance for the Geometries. - * @param offsetUnit Unit for the offset. + * @param offsetUnit Measurement unit for the offset. * @param joinType The join type. * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. @@ -7624,13 +7684,13 @@ declare module "esri/geometry/geometryEngine" { /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarArea(geometry: Geometry, unit: string | number): number; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarLength(geometry: Geometry, unit: string | number): number; /** @@ -7685,14 +7745,15 @@ declare module "esri/geometry/geometryEngineAsync" { import Polyline = require("esri/geometry/Polyline"); import SpatialReference = require("esri/SpatialReference"); import Point = require("esri/geometry/Point"); + import Polygon = require("esri/geometry/Polygon"); - /** (Currently in beta) A client-side asynchronous geometry engine. */ + /** A client-side asynchronous geometry engine. */ var geometryEngineAsync: { /** * Creates planar (or Euclidean) buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ buffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): any; @@ -7730,7 +7791,7 @@ declare module "esri/geometry/geometryEngineAsync" { * Densify geometries by plotting points between existing vertices. * @param geometry The geometry to be densified. * @param maxSegmentLength The maximum segment length allowed. - * @param maxSegmentLengthUnit Defaults to the units of the input geometries. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. */ densify(geometry: Geometry, maxSegmentLength: number, maxSegmentLengthUnit: string | number): any; /** @@ -7749,7 +7810,7 @@ declare module "esri/geometry/geometryEngineAsync" { * Calculates the shortest planar distance between two geometries. * @param geometry1 First input geometry. * @param geometry2 Second input geometry. - * @param distanceUnit Units of the return value. + * @param distanceUnit Measurement unit of the return value. */ distance(geometry1: Geometry, geometry2: Geometry, distanceUnit: string | number): any; /** @@ -7780,27 +7841,34 @@ declare module "esri/geometry/geometryEngineAsync" { * @param geometry The geometry to be generalized. * @param maxDeviation The maximum allowed deviation from the generalized geometry to the original geometry. * @param removeDegenerateParts When true, the degenerate parts of the geometry will be removed from the output (may be undesired for drawing). - * @param maxDeviationUnit Defaults to the units of the input geometries. + * @param maxDeviationUnit Measurement unit for maxDeviation. */ generalize(geometry: Geometry, maxDeviation: number, removeDegenerateParts?: boolean, maxDeviationUnit?: string | number): any; /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicArea(geometry: Geometry, unit: string | number): any; /** * Creates geodesic buffer polygons at a specified distance around the input geometries. * @param geometry The buffer input geometry. * @param distance The specified distance(s) for buffering. - * @param unit Unit for the distance(s). + * @param unit Measurement unit for the distance(s). * @param unionResults Whether the output geometries should be unioned into a single polygon. */ geodesicBuffer(geometry: Geometry | Geometry[], distance: number | number[], unit: string | number, unionResults?: boolean): any; + /** + * Resolves to a geodesically densified version of the input geometry. + * @param geometry A polyline or polygon geometry to densify. + * @param maxSegmentLength The maximum segment length allowed. + * @param maxSegmentLengthUnit Measurement unit for maxSegmentLength. + */ + geodesicDensify(geometry: Polyline | Polygon, maxSegmentLength: number, maxSegmentLengthUnit?: number): any; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ geodesicLength(geometry: Geometry, unit: string | number): any; /** @@ -7844,7 +7912,7 @@ declare module "esri/geometry/geometryEngineAsync" { * Creates offset version of the input geometry. * @param geometry The geometries to offset. * @param offsetDistance The offset distance for the Geometries. - * @param offsetUnit Unit for the offset. + * @param offsetUnit Measurement unit for the offset. * @param joinType The join type. * @param bevelRatio Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled. * @param flattenError Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. @@ -7859,13 +7927,13 @@ declare module "esri/geometry/geometryEngineAsync" { /** * Calculates the area of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarArea(geometry: Geometry, unit: string | number): any; /** * Calculates the length of the input geometry. * @param geometry The input geometry. - * @param unit Units of the return value. + * @param unit Measurement unit of the return value. */ planarLength(geometry: Geometry, unit: string | number): any; /** @@ -9219,7 +9287,7 @@ declare module "esri/layers/FeatureLayer" { */ setAutoGeneralize(enable: boolean): FeatureLayer; /** - * Set's the definition expression for the FeatureLayer. + * Sets the definition expression for the FeatureLayer. * @param expression The definition expression to apply. */ setDefinitionExpression(expression: string): FeatureLayer; @@ -9275,7 +9343,7 @@ declare module "esri/layers/FeatureLayer" { */ setScaleRange(minScale: number, maxScale: number): void; /** - * Set's the selection symbol for the feature layer. + * Sets the selection symbol for the feature layer. * @param symbol Symbol for the current selection. */ setSelectionSymbol(symbol: Symbol): FeatureLayer; @@ -9285,7 +9353,7 @@ declare module "esri/layers/FeatureLayer" { */ setShowLabels(showLabels: boolean): void; /** - * Set's the time definition for the feature layer. + * Sets the time definition for the feature layer. * @param definition The new time extent used to filter the layer. */ setTimeDefinition(definition: TimeExtent): FeatureLayer; @@ -9458,6 +9526,8 @@ declare module "esri/layers/GeoRSSLayer" { items: Graphic[]; /** The name of the layer. */ name: string; + /** The publicly accessible URL to a GeoRSS file. */ + url: string; /** * Creates a new GeoRSSLayer object. * @param url URL to the GeoRSS resource. @@ -9805,10 +9875,14 @@ declare module "esri/layers/LOD" { declare module "esri/layers/LabelClass" { import TextSymbol = require("esri/symbols/TextSymbol"); - /** LabelClass defines the styles of labels for ArcGISDynamicMapServiceLayer. */ + /** Use label classes to restrict labels to certain features or to specify different label fields, symbols, scale ranges, label priorities, and sets of label placement options for different groups of labels. */ class LabelClass { + /** An array of objects representing field information to label. */ + fieldInfos: any[]; /** Adjusts the formatting of labels. */ labelExpression: string; + /** Use this when working with FeatureLayer layer types. */ + labelExpressionInfo: any; /** The position of the label. */ labelPlacement: string; /** The maximum scale to show labels. */ @@ -9824,7 +9898,7 @@ declare module "esri/layers/LabelClass" { /** A where clause determining which features are labeled. */ where: string; /** - * Create a LabelClass, in order to be added to layerDrawingOption.labelingInfo. + * Creates a label class, used for formatting parameters, symbols, date, etc. * @param json Various options to configure this LabelClass. */ constructor(json?: Object); @@ -9840,7 +9914,7 @@ declare module "esri/layers/LabelLayer" { import UniqueValueRenderer = require("esri/renderers/UniqueValueRenderer"); import ClassBreaksRenderer = require("esri/renderers/ClassBreaksRenderer"); - /** The LabelLayer inherits from the graphics layer and can be used to display texts and symbols on map. */ + /** NOTE: Deprecated as of version 3.14, read below for additional information on the suggested method of labeling. */ class LabelLayer extends GraphicsLayer { /** * Creates a new Label layer. @@ -10248,6 +10322,8 @@ declare module "esri/layers/RasterLayer" { /** The RasterLayer is used to display image services. */ class RasterLayer extends Layer { + /** A function that takes a pixelData object as input, processes it, and returns it. */ + pixelFilter: Function; /** * Creates a new RasterLayer object. * @param url URL to the ArcGIS Server REST resource that represents a raster layer service. @@ -10262,6 +10338,11 @@ declare module "esri/layers/RasterLayer" { * @param doNotRefresh Use true to avoid refreshing the layer; false to refresh it. */ setImageFormat(imageFormat: string, doNotRefresh?: boolean): void; + /** + * Sets a pixelFilter on the layer. + * @param pixelFilter The function defining the PixelFilter to set on the layer. + */ + setPixelFilter(pixelFilter: Function): void; /** * Determines if the layer will update its content based on the map's current time extent. * @param use Use true to update the layer's content based on the map's current time extent. @@ -10495,16 +10576,55 @@ declare module "esri/layers/TimeInfo" { } declare module "esri/layers/TimeReference" { - /** TimeReference contains information about how the time was measured. */ + /** TimeReference contains read-only information about how the time was captured when the data was created. */ class TimeReference { - /** Indicates whether the time reference respects daylight savings time. */ + /** A read-only property that indicates whether the time reference takes into account daylight savings time. */ respectsDaylightSaving: boolean; - /** The time zone information associated with the time reference. */ + /** The time zone in which the data was captured. */ timeZone: string; } export = TimeReference; } +declare module "esri/layers/VectorTileLayer" { + import esri = require("esri"); + import Layer = require("esri/layers/layer"); + import Extent = require("esri/geometry/Extent"); + import SpatialReference = require("esri/SpatialReference"); + import TileInfo = require("esri/layers/TileInfo"); + + /** A VectorTileLayer accesses cached tiles of data and renders it in vector format. */ + class VectorTileLayer extends Layer { + /** The full extent of the layer. */ + fullExtent: Extent; + /** The initial extent of the layer. */ + initialExtent: Extent; + /** The spatial reference of the layer. */ + spatialReference: SpatialReference; + /** The style object of the service with fully qualified URLs for glyphs and sprite. */ + style: any; + /** Contains information about the tiling scheme for the layer. */ + tileInfo: TileInfo; + /** The URL to the vector tile service or style JSON that will be used to draw the layer. */ + url: string; + /** + * Create a new VectorTileLayer object. + * @param url The URL to the vector tile service or style JSON that will be used to draw the layer. + * @param options Optional parameters. + */ + constructor(url: string | any, options?: esri.VectorTileLayerOptions); + /** + * Changes the style properties used to render the layers. + * @param styleUrl A url to a JSON file containing the stylesheet information to render the layer. + */ + setStyle(styleUrl: string | any): void; + /** Fires when the style is changed on the layer. */ + on(type: "style-change", listener: (event: { style: any; target: VectorTileLayer }) => void): esri.Handle; + on(type: string, listener: (event: any) => void): esri.Handle; + } + export = VectorTileLayer; +} + declare module "esri/layers/WFSLayer" { import esri = require("esri"); import Field = require("esri/layers/Field"); @@ -10513,7 +10633,7 @@ declare module "esri/layers/WFSLayer" { import InfoTemplate = require("esri/InfoTemplate"); import Renderer = require("esri/renderers/Renderer"); - /** (Currently in beta)A layer for OGC Web Feature Services (WFS). */ + /** (Currently in beta) A layer for OGC Web Feature Services (WFS). */ class WFSLayer { /** An array of fields in the layer. */ fields: Field[]; @@ -11262,6 +11382,8 @@ declare module "esri/opsdashboard/DataSourceProxy" { id: string; /** Read-only: Indicates if the last query failed and the data source is in a broken state. */ isBroken: boolean; + /** Read-only: The mapWidgetId of the data source. */ + mapWidgetId: string; /** Read-only: The name of the data source. */ name: string; /** Read-only: The name of the object id field. */ @@ -11279,6 +11401,8 @@ declare module "esri/opsdashboard/DataSourceProxy" { * @param query The query object to apply. */ executeQuery(query: Query): any; + /** An object that contains service level metadata about whether or not the layer supports queries using statistics, order by fields, DISTINCT, pagination, query with distance, and returning queries with extents. */ + getAdvancedQueryCapabilities(): any; /** Retrieve the associated data source that supports selection. */ getAssociatedSelectionDataSourceProxy(): any; /** Get the associated popupInfo for the data source if any available. */ @@ -11334,8 +11458,8 @@ declare module "esri/opsdashboard/ExtensionBase" { static POLYLINE: any; /** Read-only: Indicates if the host application is the Windows Operations Dashboard. */ isNative: boolean; - /** Get the collection of data sources from the host application. */ - getDataSourceProxies(): any; + /** Read-only: The URL to the ArcGIS.com site or in-house portal that you are currently signed in to. */ + portalUrl: string; /** Get the collection of data sources from the host application. */ getDataSourceProxies(): any; /** Get the data source corresponding to the data source id from the host application. */ @@ -11386,6 +11510,8 @@ declare module "esri/opsdashboard/ExtensionConfigurationBase" { /** ExtensionConfigurationBase is a base class used by all the extension configuration proxies. */ class ExtensionConfigurationBase extends ExtensionBase { + /** The object that will store the Widget/MapTool/FeatureAction configuration. */ + config: any; /** Indicates that the configuration is ready to be persisted or not. */ readyToPersistConfig: boolean; } @@ -11467,10 +11593,10 @@ declare module "esri/opsdashboard/GraphicsLayerProxy" { */ addOrUpdateGraphic(graphic: Graphic): void; /** - * Update a graphic in the host graphics layer with a new version. - * @param graphic The graphic to update in the host graphics layer. + * Update graphics in the host graphics layer with a new version. + * @param graphics The graphics to update in the host graphics layer. */ - addOrUpdateGraphics(graphic: Graphic): void; + addOrUpdateGraphics(graphics: Graphic[]): void; /** Removes all the graphics from the host graphics layer. */ clear(): void; /** @@ -11625,8 +11751,6 @@ declare module "esri/opsdashboard/WidgetConfigurationProxy" { /** WidgetConfigurationProxy is a class used to provide the configuration user experience for an operations dashboard extension widget. */ class WidgetConfigurationProxy extends ExtensionConfigurationBase { - /** The object that will store the widget configuration. */ - config: any; /** * Called by the host application when the user has changed the selected data source in the data source selector. * @param dataSourceProxy The selected data source. @@ -11639,7 +11763,7 @@ declare module "esri/opsdashboard/WidgetConfigurationProxy" { */ getDataSourceConfig(dataSourceProxyOrDataSourceId: DataSourceProxy | string): any; /** - * Called by the host application when the user has changed the slected map widget in the map widget selector. + * Called by the host application when the user has changed the selected map widget in the map widget selector. * @param mapWidgetProxy The selected map widget. */ mapWidgetSelectionChanged(mapWidgetProxy: MapWidgetProxy): void; @@ -11897,7 +12021,7 @@ declare module "esri/renderers/BlendRenderer" { import esri = require("esri"); import Symbol = require("esri/symbols/Symbol"); - /** (Currently in beta) BlendRenderer allows you to easily identify a predominant attribute among two or more competing attributes in a feature. */ + /** (Currently in beta) BlendRenderer allows you to easily identify the predominant attribute among two or more competing attributes of a feature and visualizes the strength of that predominance using blended colors. */ class BlendRenderer { /** This determines how colors are blended together. */ blendMode: string; @@ -12129,7 +12253,7 @@ declare module "esri/renderers/Renderer" { import Color = require("esri/Color"); import Symbol = require("esri/symbols/Symbol"); - /** The base class for the renderers - SimpleRenderer, ClassBreaksRenderer, UniqueValueRenderer, DotDensityRenderer, ScaleDependentRenderer, and TemporalRenderer used with a GraphicsLayer and FeatureLayer. */ + /** The base class for the renderers - SimpleRenderer, ClassBreaksRenderer, UniqueValueRenderer, DotDensityRenderer, ScaleDependentRenderer, TemporalRenderer, HeatmapRenderer, and VectorFieldRenderer used with a GraphicsLayer and FeatureLayer. */ class Renderer { /** An object defining a color ramp used to render the layer. */ colorInfo: any; @@ -12188,11 +12312,14 @@ declare module "esri/renderers/Renderer" { * @param info An object with the same properties as rotationInfo. */ setRotationInfo(info: any): Renderer; - /** Set size info of the renderer to modify the symbol size based on data value. */ - setSizeInfo(): Renderer; + /** + * Set size info of the renderer to modify the symbol size based on data value. + * @param info An object with the same properties as sizeInfo. + */ + setSizeInfo(info: any): Renderer; /** * Sets the renderer with the specified visualVariables. - * @param visualParams The specified visualVariables. + * @param visualParams The specified visualVariables. */ setVisualVariables(visualParams: any[]): void; /** Converts object to its ArcGIS Server JSON representation. */ @@ -12503,6 +12630,11 @@ declare module "esri/renderers/smartMapping" { * @param params See the object specifications table below for the structure of the params object. */ createClassedSizeRenderer(params: any): any; + /** + * Creates an object defining a color ramp used to render a layer. + * @param params See the object specifications table below for the structure of the params object. + */ + createColorInfo(params: any): any; /** * Creates a renderer for visualizing features using colors. * @param params See the object specifications table below for the structure of the params object. @@ -12518,6 +12650,16 @@ declare module "esri/renderers/smartMapping" { * @param params See the object specifications table below for the structure of the params object. */ createOpacityInfo(params: any): any; + /** + * Creates a renderer for identifying features by their color. + * @param params See the Object Specifications table below for the structure of the params object. + */ + createPredominanceRenderer(params: any): any; + /** + * Defines the size of the symbol where feature size is proportional to data value. + * @param params See the object specifications table below for the structure of the params object. + */ + createSizeInfo(params: any): any; /** * Creates a renderer for visualizing features by varying their size based on data. * @param params See the object specifications table below for the structure of the params object. @@ -13113,6 +13255,10 @@ declare module "esri/symbols/TextSymbol" { decoration: string; /** Font for displaying text. */ font: Font; + /** The halo color used for the text symbol.Known limitations:IE 9 and below not supported.Sub-pixel halo (i.e. */ + haloColor: Color; + /** The size (in pixel units) used if setting a halo on a text symbol.Known limitations:IE 9 and below not supported.Sub-pixel halo (i.e. */ + haloSize: number; /** Horizontal alignment of the text with respect to the graphic. */ horizontalAlignment: string; /** Determines whether to adjust the spacing between characters in the text string. */ @@ -13164,6 +13310,16 @@ declare module "esri/symbols/TextSymbol" { * @param font Text font. */ setFont(font: Font): TextSymbol; + /** + * Sets a halo color for the text symbol.NOTE: Known limitations when working with the text symbol halo:IE 9 and below not supported.Sub-pixel halo (i.e. + * @param color The color used for the text symbol halo. + */ + setHaloColor(color: Color): TextSymbol; + /** + * Sets the size of the halo (in pixels) used for the text symbol.NOTE: Known limitations when working with the text symbol halo:IE 9 and below not supported.Sub-pixel halo (i.e. + * @param size The size (in pixels) of the text symbol halo. + */ + setHaloSize(size: number): TextSymbol; /** * Updates the horizontal alignment of the text symbol. * @param alignment Horizontal alignment of the text with respect to the graphic. @@ -13658,6 +13814,8 @@ declare module "esri/tasks/FindParameters" { contains: boolean; /** An array of DynamicLayerInfos used to change the layer ordering or redefine the map. */ dynamicLayerInfos: DynamicLayerInfo[]; + /** Specifies the number of decimal places for the geometries returned by the query operation. */ + geometryPrecision: number; /** Array of layer definition expressions that allows you to filter the features of individual layers. */ layerDefinitions: string[]; /** The layers to perform the find operation on. */ @@ -13731,26 +13889,26 @@ declare module "esri/tasks/FindTask" { declare module "esri/tasks/GPMessage" { /** Represents a message generated during the execution of a geoprocessing task. */ class GPMessage { - /** esriJobMessageTypeAbort */ + /** esriJobMessageTypeAbort - Indicates the job has aborted. */ static TYPE_ABORT: any; - /** esriGPMessageTypeEmpty */ + /** esriJobMessageTypeEmpty - Indicates the task returned an empty result. */ static TYPE_EMPTY: any; - /** esriGPMessageTypeError */ + /** esriJobMessageTypeError - Indicates an error was returned during the execution of the job. */ static TYPE_ERROR: any; - /** esriGPMessageTypeInformative */ + /** esriJobMessageTypeInformative - Indicates the message is informative. */ static TYPE_INFORMATIVE: any; - /** TBA */ + /** esriJobMessageTypeProcessDefinition */ static TYPE_PROCESS_DEFINITION: any; - /** TBA */ + /** esriJobMessageTypeProcessStart - Indicates the GP process has started. */ static TYPE_PROCESS_START: any; - /** TBA */ + /** esriJobMessageTypeProcessStop - Indicates the GP process has stopped. */ static TYPE_PROCESS_STOP: any; - /** esriGPMessageTypeWarning */ + /** esriJobMessageTypeWarning - Indicates the message is a warning. */ static TYPE_WARNING: any; /** A description of the geoprocessing message. */ description: string; /** The geoprocessing message type. */ - type: number; + type: string; } export = GPMessage; } @@ -14127,7 +14285,7 @@ declare module "esri/tasks/Geoprocessor" { * @param callback The function to call when the method has completed. * @param errback An error object is returned if an error occurs on the Server during task execution. */ - checkJobStatus(jobId: string, callback?: Function, errback?: Function): void; + checkJobStatus(jobId: string, callback?: Function, errback?: Function): any; /** * Sends a request to the server to execute a synchronous GP task. * @param inputParameters The inputParameters argument specifies the input parameters accepted by the task and their corresponding values. @@ -14187,7 +14345,7 @@ declare module "esri/tasks/Geoprocessor" { * @param statusCallback Checks the current status of the job. * @param errback An error object is returned if an error occurs on the Server during task execution. */ - submitJob(inputParameters: any, callback?: Function, statusCallback?: Function, errback?: Function): void; + submitJob(inputParameters: any, callback?: Function, statusCallback?: Function, errback?: Function): any; /** Fires when an error occurs when executing the task. */ on(type: "error", listener: (event: { error: Error; target: Geoprocessor }) => void): esri.Handle; /** Fires when a synchronous GP task is completed. */ @@ -14231,6 +14389,8 @@ declare module "esri/tasks/IdentifyParameters" { dynamicLayerInfos: DynamicLayerInfo[]; /** The geometry used to select features during Identify. */ geometry: Geometry; + /** Specifies the number of decimal places for the geometries returned by the query operation. */ + geometryPrecision: number; /** Height of the map currently being viewed in pixels. */ height: number; /** Array of layer definition expressions that allows you to filter the features of individual layers. */ @@ -14403,6 +14563,28 @@ declare module "esri/tasks/ImageServiceMeasureParameters" { /** Defines parameters for the ImageServiceMeasureTask. */ class ImageServiceMeasureParameters { + /** Calculates the area and perimeter of given geometry. */ + static OPERATION_AREA_PERIMETER: any; + /** Calculates the area and perimeter of the given geometry using the DEM defined by the service to refine the calculation. */ + static OPERATION_AREA_PERIMETER_3D: any; + /** Calculates the height of a structure by measuring from the base of the structure to the top of the structure. */ + static OPERATION_BASE_TOP: any; + /** Calculates the height of a structure by measuring from the base of the structure to the top of the structure's shadow on the ground. */ + static OPERATION_BASE_TOP_SHADOW: any; + /** Calculates the centroid of a given area. */ + static OPERATION_CENTROID: any; + /** Calculates the centroid of a given area, using the DEM defined by the service to refine the calculation. */ + static OPERATION_CENTROID_3D: any; + /** Calculates the distance and azimuth angle between two points. */ + static OPERATION_DISTANCE_ANGLE: any; + /** Calculates the distance and azimuth angle between two points using the DEM defined by the service to refine the calculation. */ + static OPERATION_DISTANCE_ANGLE_3D: any; + /** Measures the location of a given point. */ + static OPERATION_POINT: any; + /** Measures the location of a given point, using the DEM defined by the service to refine the calculation. */ + static OPERATION_POINT_3D: any; + /** Calculates the height of a structure by measuring from the top of the structure to the top of the structure's shadow on the ground. */ + static OPERATION_TOP_TOP_SHADOW: any; /** The angular unit in which directions of line segments will be calculated. */ angularUnit: string; /** The area unit in which areas of polygons will be calculated. */ @@ -14613,6 +14795,8 @@ declare module "esri/tasks/ParameterValue" { class ParameterValue { /** Specifies the type of data for the parameter. */ dataType: string; + /** The name of the output parameter as defined by the geoprocessing task in the Services Directory. */ + paramName: string; /** The value of the parameter. */ value: any; } @@ -14707,7 +14891,7 @@ declare module "esri/tasks/ProjectParameters" { geometries: Geometry[]; /** The spatial reference to which you are projecting the geometries. */ outSR: SpatialReference; - /** The well-known id {wkid:number} or well-known text {wkt:string} or for the datum transfomation to be applied on the projected geometries. */ + /** The well-known id {wkid:number} or well-known text {wkt:string} or for the datum transformation to be applied on the projected geometries. */ transformation: any; /** Indicates whether to transform forward or not. */ transformForward: boolean; @@ -15331,6 +15515,8 @@ declare module "esri/tasks/datareviewer/BatchValidationTask" { executeJob(parameters: BatchValidationParameters): any; /** Retrieves all adhoc jobs from the server and returns an array of BatchValidationJob with the information. */ getAdhocJobsList(): any; + /** Returns an array of custom field names defined in a Reviewer workspace. */ + getCustomFieldNames(): any; /** * Fetches Batch Validation Job details. * @param jobId Job Id of the batch validation job. @@ -15373,19 +15559,21 @@ declare module "esri/tasks/datareviewer/BatchValidationTask" { /** Fires when the executeJob method is complete. */ on(type: "execute-job", listener: (event: { jobId: string; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getAdhocJobsList method is complete. */ - on(type: "get-adhoc-jobs-list", listener: (event: { adhocJobs: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-adhoc-jobs-list", listener: (event: { adhocJobs: BatchValidationJob[]; target: BatchValidationTask }) => void): esri.Handle; + /** Fires when the getCustomFieldNames method is complete. */ + on(type: "get-custom-field-names", listener: (event: { customFieldNames: string[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getJobDetails method is complete. */ on(type: "get-job-details", listener: (event: { jobDetails: BatchValidationJob; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getJobExecutionDetails method is complete. */ on(type: "get-job-execution-details", listener: (event: { jobInfo: BatchValidationJobInfo; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getJobIds method is complete. */ - on(type: "get-job-ids", listener: (event: { adhocJobs: any[]; scheduledJobs: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-job-ids", listener: (event: { adhocJobs: string[]; scheduledJobs: string[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getLifecycleStatusStrings method is complete. */ - on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: string[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getReviewerSessions method is complete. */ - on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: ReviewerSession[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the getScheduledJobsList method is complete. */ - on(type: "get-scheduled-jobs-list", listener: (event: { scheduledJobs: any[]; target: BatchValidationTask }) => void): esri.Handle; + on(type: "get-scheduled-jobs-list", listener: (event: { scheduledJobs: BatchValidationJob[]; target: BatchValidationTask }) => void): esri.Handle; /** Fires when the scheduleJob method is complete. */ on(type: "schedule-job", listener: (event: { jobId: string; target: BatchValidationTask }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; @@ -15435,6 +15623,8 @@ declare module "esri/tasks/datareviewer/DashboardTask" { * @param sessionOptions Session properties to be used to create the session. */ createReviewerSession(sessionName: string, sessionOptions: SessionOptions): any; + /** Returns an array of custom field names defined in a Reviewer workspace. */ + getCustomFieldNames(): any; /** Requests Dashboard results field names. */ getDashboardFieldNames(): any; /** @@ -15453,14 +15643,16 @@ declare module "esri/tasks/datareviewer/DashboardTask" { on(type: "create-reviewer-sessions", listener: (event: { reviewerSession: ReviewerSession; target: DashboardTask }) => void): esri.Handle; /** Fires when an error occurs during a DashboardTask method execution. */ on(type: "error", listener: (event: { error: Error; target: DashboardTask }) => void): esri.Handle; + /** Fires when the getCustomFieldNames method is complete. */ + on(type: "get-custom-field-names", listener: (event: { customFieldNames: string[]; target: DashboardTask }) => void): esri.Handle; /** Fires when the getDashboardFieldNames method is complete. */ - on(type: "get-dashboard-field-names", listener: (event: { fieldNames: any[]; target: DashboardTask }) => void): esri.Handle; + on(type: "get-dashboard-field-names", listener: (event: { fieldNames: string[]; target: DashboardTask }) => void): esri.Handle; /** Fires when the getDashboardResults method is complete. */ on(type: "get-dashboard-results", listener: (event: { dashboardResult: DashboardResult; target: DashboardTask }) => void): esri.Handle; /** Fires when the getLifecycleStatusStrings method is complete. */ - on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: any[]; target: DashboardTask }) => void): esri.Handle; + on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: string[]; target: DashboardTask }) => void): esri.Handle; /** Fires when the getReviewerSessions method is complete. */ - on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: any[]; target: DashboardTask }) => void): esri.Handle; + on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: ReviewerSession[]; target: DashboardTask }) => void): esri.Handle; on(type: string, listener: (event: any) => void): esri.Handle; } export = DashboardTask; @@ -15542,8 +15734,8 @@ declare module "esri/tasks/datareviewer/ReviewerFilters" { } declare module "esri/tasks/datareviewer/ReviewerLifecycle" { - /** The ReviewerLifecycle class specifies constant values for all lifecycle status and lifecycle phase strings within the Reviewer quality control workflow. */ - class ReviewerLifecycle { + /** The ReviewerLifecycle object specifies constant values for all lifecycle status and lifecycle phase strings within the Reviewer quality control workflow. */ + var ReviewerLifecycle: { /** Acceptable lifecycleStatus code = 4 belongs to Verification Phase. */ ACCEPTABLE: number; /** Code for Correction Phase. */ @@ -15600,7 +15792,7 @@ declare module "esri/tasks/datareviewer/ReviewerLifecycle" { * @param lifecycleStatus The lifecycle status code. */ toLifecycleStatusString(lifecycleStatus: number): string; - } + }; export = ReviewerLifecycle; } @@ -15614,6 +15806,7 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { import Geometry = require("esri/geometry/Geometry"); import ReviewerSession = require("esri/tasks/datareviewer/ReviewerSession"); import FeatureSet = require("esri/tasks/FeatureSet"); + import FeatureEditResult = require("esri/layers/FeatureEditResult"); /** ReviewerResults allows access to the reviewer workspace. */ class ReviewerResultsTask { @@ -15633,6 +15826,8 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { * @param batchRunIds Array of batchRunIds used to get batch run details. */ getBatchRunDetails(batchRunIds: any[]): any; + /** Returns an array of custom field names defined in a Reviewer workspace. */ + getCustomFieldNames(): any; /** * Utility operation that returns a where clause given a set of input filters. * @param filters An instance of ReviewerFilters used to create a layer definition. @@ -15646,8 +15841,10 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { * @param filters Instance of ReviewerFilters used to query reviewer results. */ getResults(getResultsQueryParameters: GetResultsQueryParameters, filters?: ReviewerFilters): any; + /** Retrieves a list of field names that can be used to fetch or query results from reviewer workspace. */ + getResultsFieldNames(): string[]; /** Extracts the MapServer url from the full ArcGIS Data Reviewer for Server SOE url. */ - getReviewerMapServerUrl(): any; + getReviewerMapServerUrl(): string; /** Returns an array of sessions in a Reviewer workspace. */ getReviewerSessions(): any; /** @@ -15676,16 +15873,18 @@ declare module "esri/tasks/datareviewer/ReviewerResultsTask" { on(type: "error", listener: (event: { error: Error; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getBatchRunDetails method is complete. */ on(type: "get-batch-run-details", listener: (event: { featureSet: FeatureSet; target: ReviewerResultsTask }) => void): esri.Handle; + /** Fires when the getCustomFieldNames method is complete. */ + on(type: "get-custom-field-names", listener: (event: { customFieldNames: string[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getLayerDefinition method is complete. */ on(type: "get-layer-definition", listener: (event: { whereClause: string; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getLifecycleStatusStrings method is complete. */ - on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: any[]; target: ReviewerResultsTask }) => void): esri.Handle; + on(type: "get-lifecycle-status-strings", listener: (event: { lifecycleStatusStrings: string[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getResults method is complete. */ on(type: "get-results", listener: (event: { featureSet: FeatureSet; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the getReviewerSessions method is complete. */ - on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: any[]; target: ReviewerResultsTask }) => void): esri.Handle; + on(type: "get-reviewer-sessions", listener: (event: { reviewerSessions: ReviewerSession[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the updateLifecycleStatus method is complete. */ - on(type: "update-lifecycle-status", listener: (event: { featureEditResults: any[]; target: ReviewerResultsTask }) => void): esri.Handle; + on(type: "update-lifecycle-status", listener: (event: { featureEditResults: FeatureEditResult[]; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the writeFeatureAsResult method is complete. */ on(type: "write-feature-as-result", listener: (event: { success: boolean; target: ReviewerResultsTask }) => void): esri.Handle; /** Fires when the writeResult method is complete. */ From dc61765718929572e520610c19d99c32486b7720 Mon Sep 17 00:00:00 2001 From: leonuh Date: Tue, 1 Dec 2015 23:14:22 +0100 Subject: [PATCH 067/474] fix(material-ui) - spacing, gridlist style, gridtile style --- material-ui/material-ui-tests.tsx | 7 +++++-- material-ui/material-ui.d.ts | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index 0165dee1f7..8c7ff2997e 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -6,6 +6,7 @@ import * as React from "react"; import * as LinkedStateMixin from "react-addons-linked-state-mixin"; import Checkbox = require("material-ui/lib/checkbox"); import Colors = require("material-ui/lib/styles/colors"); +import Spacing = require("material-ui/lib/styles/spacing"); import AppBar = require("material-ui/lib/app-bar"); import Badge = require("material-ui/lib/badge"); import IconButton = require("material-ui/lib/icon-button"); @@ -488,7 +489,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta element = ; + cellHeight={200} + style={{ color: 'red' }} />; element = implements React.LinkedSta titlePosition="top" titleBackground="rgba(0, 0, 0, 0.4)" cols={2} - rows={1} > + rows={1} + style={{ color: 'red' }}>

Children are Required!

; diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index df6a088a7a..5ea7eb8a04 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -870,6 +870,8 @@ declare namespace __MaterialUI { desktopSubheaderHeight?: number; desktopToolbarHeight?: number; } + export var Spacing: Spacing; + interface ThemePalette { primary1Color?: string; primary2Color?: string; @@ -1532,6 +1534,7 @@ declare namespace __MaterialUI { cols?: number; padding?: number; cellHeight?: number; + style?: React.CSSProperties; } export class GridList extends React.Component{ @@ -1547,6 +1550,7 @@ declare namespace __MaterialUI { cols?: number; rows?: number; rootClass?: string | __React.Component; + style?: React.CSSProperties; } export class GridTile extends React.Component{ From 9322940349e79faeccb65b8f4e3f898e958580ec Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Tue, 1 Dec 2015 16:44:13 -0700 Subject: [PATCH 068/474] material-ui - update to new dialog usage. --- material-ui/material-ui-tests.tsx | 30 +++++++++++++++++++++++++----- material-ui/material-ui.d.ts | 6 +++++- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/material-ui/material-ui-tests.tsx b/material-ui/material-ui-tests.tsx index 0165dee1f7..ace37bdc7d 100644 --- a/material-ui/material-ui-tests.tsx +++ b/material-ui/material-ui-tests.tsx @@ -47,7 +47,13 @@ type CheckboxProps = __MaterialUI.CheckboxProps; type MuiTheme = __MaterialUI.Styles.MuiTheme; type TouchTapEvent = __MaterialUI.TouchTapEvent; -class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedStateMixin { +interface MaterialUiTestsState { + showDialogStandardActions: boolean; + showDialogCustomActions: boolean; + showDialogScrollable: boolean; +} + +class MaterialUiTests extends React.Component<{}, MaterialUiTestsState> implements React.LinkedStateMixin { // injected with mixin linkState: (key: string) => React.ReactLink; @@ -60,6 +66,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta } private selectFieldChangeHandler(e: TouchTapEvent, si: number, mi: any) { } + private handleRequestClose(buttonClicked: boolean) { + } render() { @@ -193,7 +201,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta title="Dialog With Standard Actions" actions={standardActions} actionFocus="submit" - modal={true}> + open={this.state.showDialogStandardActions} + onRequestClose={this.handleRequestClose}> The actions in this window are created from the json that's passed in. ; @@ -212,12 +221,23 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta element = + open={this.state.showDialogCustomActions} + onRequestClose={this.handleRequestClose}> The actions in this window were passed in as an array of react objects. ; + element = +
+ Really long content +
+
; + // "http://material-ui.com/#/components/dropdown-menu" let menuItems = [ diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index df6a088a7a..a27a0ee09d 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -1,4 +1,4 @@ -// Type definitions for material-ui v0.13.1 +// Type definitions for material-ui v0.13.4 // Project: https://github.com/callemall/material-ui // Definitions by: Nathan Brown , Oliver Herrmann // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -379,14 +379,18 @@ declare namespace __MaterialUI { openImmediately?: boolean; repositionOnUpdate?: boolean; title?: React.ReactNode; + defaultOpen?: boolean; + open?: boolean; onClickAway?: () => void; onDismiss?: () => void; onShow?: () => void; + onRequestClose?: (buttonClicked: boolean) => void; } export class Dialog extends React.Component { dismiss(): void; show(): void; + isOpen(): boolean; } interface DropDownIconProps extends React.Props { From 002ff03420252103f68752c8bfdfc40199e07e31 Mon Sep 17 00:00:00 2001 From: Jonathan Price Date: Tue, 1 Dec 2015 23:55:03 +0000 Subject: [PATCH 069/474] Bluebird: Make return type of promisifyAll less restrictive --- bluebird/bluebird-1.0.d.ts | 2 +- bluebird/bluebird.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bluebird/bluebird-1.0.d.ts b/bluebird/bluebird-1.0.d.ts index db9dd0dd24..b8287e57cc 100644 --- a/bluebird/bluebird-1.0.d.ts +++ b/bluebird/bluebird-1.0.d.ts @@ -394,7 +394,7 @@ declare class Promise implements Promise.Thenable { * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. */ // TODO how to model promisifyAll? - static promisifyAll(target: Object): Object; + static promisifyAll(target: Object): any; /** * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index 9b55578efd..da3b9902a3 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -421,7 +421,7 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. */ // TODO how to model promisifyAll? - static promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): Object; + static promisifyAll(target: Object, options?: Promise.PromisifyAllOptions): any; /** From 64ed3fcbf0a47510b51d167f5323ed2ea6b25caf Mon Sep 17 00:00:00 2001 From: pmccloghrylaing Date: Wed, 25 Nov 2015 01:12:37 +1100 Subject: [PATCH 070/474] ngCordova plugins: ActionSheet, Badge, File, FileTransfer --- ng-cordova/actionSheet-tests.ts | 27 +++++ ng-cordova/actionSheet.d.ts | 22 ++++ ng-cordova/badge-tests.ts | 59 ++++++++++ ng-cordova/badge.d.ts | 18 +++ ng-cordova/file-tests.ts | 184 +++++++++++++++++++++++++++++++ ng-cordova/file.d.ts | 51 +++++++++ ng-cordova/fileTransfer-tests.ts | 53 +++++++++ ng-cordova/fileTransfer.d.ts | 30 +++++ ng-cordova/tsd.d.ts | 4 + 9 files changed, 448 insertions(+) create mode 100644 ng-cordova/actionSheet-tests.ts create mode 100644 ng-cordova/actionSheet.d.ts create mode 100644 ng-cordova/badge-tests.ts create mode 100644 ng-cordova/badge.d.ts create mode 100644 ng-cordova/file-tests.ts create mode 100644 ng-cordova/file.d.ts create mode 100644 ng-cordova/fileTransfer-tests.ts create mode 100644 ng-cordova/fileTransfer.d.ts diff --git a/ng-cordova/actionSheet-tests.ts b/ng-cordova/actionSheet-tests.ts new file mode 100644 index 0000000000..07d105b549 --- /dev/null +++ b/ng-cordova/actionSheet-tests.ts @@ -0,0 +1,27 @@ +/// +/// + +module ngCordova { + 'use strict'; + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/actionSheet/ + .controller('ThisCtrl', function($cordovaActionSheet: ngCordova.IActionSheetService) { + + var options = { + title: 'What do you want with this image?', + buttonLabels: ['Share via Facebook', 'Share via Twitter'], + addCancelButtonWithLabel: 'Cancel', + androidEnableCancelButton: true, + winphoneEnableCancelButton: true, + addDestructiveButtonWithLabel: 'Delete it' + }; + + document.addEventListener("deviceready", function() { + $cordovaActionSheet.show(options) + .then(function(btnIndex) { + var index: number = btnIndex; + }); + }, false); + }); +} diff --git a/ng-cordova/actionSheet.d.ts b/ng-cordova/actionSheet.d.ts new file mode 100644 index 0000000000..1809d7fb0e --- /dev/null +++ b/ng-cordova/actionSheet.d.ts @@ -0,0 +1,22 @@ +// Type definitions for ngCordova Action Sheet plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module ngCordova { + export interface IActionSheetService { + show(options: ShowOptions): ng.IPromise; + hide(): ng.IPromise; + } + + export interface ShowOptions { + title?: string; + buttonLabels?: string[]; + addCancelButtonWithLabel?: string; + addDestructiveButtonWithLabel?: string; + androidEnableCancelButton?: boolean; + winphoneEnableCancelButton?: boolean; + } +} diff --git a/ng-cordova/badge-tests.ts b/ng-cordova/badge-tests.ts new file mode 100644 index 0000000000..854f66b39d --- /dev/null +++ b/ng-cordova/badge-tests.ts @@ -0,0 +1,59 @@ +/// +/// + +module ngCordova { + 'use strict'; + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/badge/ + .controller('ThisCtrl', function($cordovaBadge: ngCordova.IBadgeService) { + + $cordovaBadge.hasPermission().then(function(yes) { + // You have permission + }, function(no) { + // You do not have permission + }); + + $cordovaBadge.set(3).then(function() { + // You have permission, badge set. + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.get().then(function(badge) { + // You have permission, badge returned. + var badgeNo: number = badge; + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.clear().then(function() { + // You have permission, badge cleared. + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.increase().then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + $cordovaBadge.increase(3).then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + + $cordovaBadge.decrease().then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + $cordovaBadge.decrease(2).then(function() { + // You have permission, badge increased. + }, function(err) { + // You do not have permission. + }); + + }); +} diff --git a/ng-cordova/badge.d.ts b/ng-cordova/badge.d.ts new file mode 100644 index 0000000000..b73b3182c4 --- /dev/null +++ b/ng-cordova/badge.d.ts @@ -0,0 +1,18 @@ +// Type definitions for ngCordova badge plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module ngCordova { + export interface IBadgeService { + hasPermission(): ng.IPromise; + promptForPermission(): ng.IPromise; + set(badge: number, callback?: Function, scope?: {}): ng.IPromise; + get(): ng.IPromise; + clear(callback?: Function, scope?: {}): ng.IPromise; + increase(count?: number, callback?: Function, scope?: {}): ng.IPromise; + decrease(count?: number, callback?: Function, scope?: {}): ng.IPromise; + } +} diff --git a/ng-cordova/file-tests.ts b/ng-cordova/file-tests.ts new file mode 100644 index 0000000000..6a4297394d --- /dev/null +++ b/ng-cordova/file-tests.ts @@ -0,0 +1,184 @@ +/// +/// +/// + +module ngCordova { + 'use strict'; + + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/file/ + .controller('MyCtrl', function($scope: ng.IScope, $cordovaFile: ngCordova.IFileService) { + + document.addEventListener('deviceready', function() { + + $cordovaFile.getFreeDiskSpace() + .then(function(success) { + // success in kilobytes + var freeSpace: number = success; + }, function(error) { + // error + }); + + + // CHECK + $cordovaFile.checkDir(cordova.file.dataDirectory, "dir/other_dir") + .then(function(success) { + // success + var dir: DirectoryEntry = success; + }, function(error) { + // error + }); + + + $cordovaFile.checkFile(cordova.file.dataDirectory, "some_file.txt") + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + // CREATE + $cordovaFile.createDir(cordova.file.dataDirectory, "new_dir", false) + .then(function(success) { + // success + var dir: DirectoryEntry = success; + }, function(error) { + // error + }); + + $cordovaFile.createFile(cordova.file.dataDirectory, "new_file.txt", true) + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + // REMOVE + $cordovaFile.removeDir(cordova.file.dataDirectory, "some_dir") + .then(function(success) { + // success + if (success.success) { + var dirResult: DirectoryEntry = success.fileRemoved; + } + }, function(error) { + // error + }); + + $cordovaFile.removeFile(cordova.file.dataDirectory, "some_file.txt") + .then(function(success) { + // success + if (success.success) { + var fileResult: FileEntry = success.fileRemoved; + } + }, function(error) { + // error + }); + + $cordovaFile.removeRecursively(cordova.file.dataDirectory, "") + .then(function(success) { + // success + if (success.success) { + var dirResult: DirectoryEntry = success.fileRemoved; + } + }, function(error) { + // error + }); + + + // WRITE + $cordovaFile.writeFile(cordova.file.dataDirectory, "file.txt", "text", true) + .then(function(success) { + // success + var endEvent: ProgressEvent = success; + }, function(error) { + // error + }); + + $cordovaFile.writeExistingFile(cordova.file.dataDirectory, "file.txt", "text") + .then(function(success) { + // success + var endEvent: ProgressEvent = success; + }, function(error) { + // error + }); + + + // READ + $cordovaFile.readAsText(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var text: string = success; + }, function(error) { + // error + }); + + $cordovaFile.readAsDataURL(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var text: string = success; + }, function(error) { + // error + }); + + $cordovaFile.readAsBinaryString(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var text: string = success; + }, function(error) { + // error + }); + + $cordovaFile.readAsArrayBuffer(cordova.file.dataDirectory, "file.txt") + .then(function(success) { + // success + var buffer: ArrayBuffer = success; + }, function(error) { + // error + }); + + + // MOVE + $cordovaFile.moveDir(cordova.file.dataDirectory, "dir", cordova.file.tempDirectory, "new_dir") + .then(function(success) { + // success + var dirResult: DirectoryEntry = success; + }, function(error) { + // error + }); + + $cordovaFile.moveFile(cordova.file.dataDirectory, "file.txt", cordova.file.tempDirectory) + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + // COPY + $cordovaFile.copyDir(cordova.file.dataDirectory, "dir", cordova.file.tempDirectory, "new_dir") + .then(function(success) { + // success + var dirResult: DirectoryEntry = success; + }, function(error) { + // error + }); + + $cordovaFile.copyFile(cordova.file.dataDirectory, "file.txt", cordova.file.tempDirectory, "new_file.txt") + .then(function(success) { + // success + var fileResult: FileEntry = success; + }, function(error) { + // error + }); + + + }); + + }); +} diff --git a/ng-cordova/file.d.ts b/ng-cordova/file.d.ts new file mode 100644 index 0000000000..04f19080a1 --- /dev/null +++ b/ng-cordova/file.d.ts @@ -0,0 +1,51 @@ +// Type definitions for ngCordova file plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module ngCordova { + export interface IFileService { + getFreeDiskSpace(): IFilePromise; + + checkDir(path: string, directory: string): IFilePromise; + checkFile(path: string, file: string): IFilePromise; + + createDir(path: string, directory: string, replace?: boolean): IFilePromise; + createFile(path: string, file: string, replace?: boolean): IFilePromise; + + removeDir(path: string, directory: string): IFilePromise>; + removeFile(path: string, file: string): IFilePromise>; + removeRecursively(path: string, directory: string): IFilePromise>; + + writeFile(path: string, file: string, text: string | Blob, replace?: boolean): IFilePromise; + writeExistingFile(path: string, file: string, text: string | Blob): IFilePromise; + + readAsText(path: string, file: string): ng.IPromise; + readAsDataURL(path: string, file: string): ng.IPromise; + readAsBinaryString(path: string, file: string): ng.IPromise; + readAsArrayBuffer(path: string, file: string): ng.IPromise; + + moveDir(path: string, directory: string, newPath: string, newDirectory?: string): IFilePromise; + moveFile(path: string, file: string, newPath: string, newFile?: string): IFilePromise; + + copyDir(path: string, directory: string, newPath: string, newDirectory?: string): IFilePromise; + copyFile(path: string, file: string, newPath: string, newFile?: string): IFilePromise; + } + + export interface IFilePromise extends ng.IPromise { + then(successCallback: (promiseValue: T) => ng.IPromise | TResult, errorCallback?: (error: IFileError) => ng.IPromise | TResult): ng.IPromise; + catch(onRejected: (error: IFileError) => ng.IPromise | TResult): ng.IPromise; + } + + export interface IFileRemoveResult { + success: boolean; + fileRemoved: TEntry; + } + + export interface IFileError extends FileError { + message: string; + } +} diff --git a/ng-cordova/fileTransfer-tests.ts b/ng-cordova/fileTransfer-tests.ts new file mode 100644 index 0000000000..0c188f239f --- /dev/null +++ b/ng-cordova/fileTransfer-tests.ts @@ -0,0 +1,53 @@ +/// +/// +/// + +module ngCordova { + 'use strict'; + + angular.module('test') + // Adapted from http://ngcordova.com/docs/plugins/fileTransfer/ + .controller('MyCtrl', function($scope: ng.IScope & { downloadProgress: number; }, $timeout: ng.ITimeoutService, $cordovaFileTransfer: ngCordova.IFileTransferService) { + + document.addEventListener('deviceready', function() { + + var url = "http://cdn.wall-pix.net/albums/art-space/00030109.jpg"; + var targetPath = cordova.file.documentsDirectory + "testImage.png"; + var trustHosts = true + var options = {}; + + $cordovaFileTransfer.download(url, targetPath, options, trustHosts) + .then(function(result) { + // Success! + var file: FileEntry = result; + }, function(err) { + // Error + }, function(progress) { + $timeout(function() { + $scope.downloadProgress = (progress.loaded / progress.total) * 100; + }) + }); + + }, false); + + + document.addEventListener('deviceready', function() { + + var url = "http://cdn.wall-pix.net/uploads"; + var filePath = cordova.file.documentsDirectory + "testImage.png"; + var trustHosts = true + var options = {}; + + $cordovaFileTransfer.upload(url, filePath, options, trustHosts) + .then(function(result) { + // Success! + var file: FileUploadResult = result; + }, function(err) { + // Error + }, function(progress) { + // constant progress updates + }); + + }, false); + }); +} diff --git a/ng-cordova/fileTransfer.d.ts b/ng-cordova/fileTransfer.d.ts new file mode 100644 index 0000000000..838302e10c --- /dev/null +++ b/ng-cordova/fileTransfer.d.ts @@ -0,0 +1,30 @@ +// Type definitions for ngCordova file-transfer plugin +// Project: https://github.com/driftyco/ng-cordova +// Definitions by: Phil McCloghry-Laing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// + +declare module ngCordova { + export interface IFileTransferService { + download(url: string, filePath: string, options?: IFileDownloadOptions, trustAllHosts?: boolean): IFileTransferPromise; + upload(url: string, filePath: string, options?: IFileUploadOptions, trustAllHosts?: boolean): IFileTransferPromise; + } + + export interface IFileTransferPromise extends ng.IPromise { + then(successCallback: (promiseValue: T) => ng.IPromise | TResult, errorCallback?: (error: FileTransferError) => ng.IPromise | TResult, notifyCallback?: (state: any) => any): ng.IPromise; + catch(onRejected: (error: FileTransferError) => ng.IPromise | TResult): ng.IPromise; + } + + export interface IFileDownloadOptions extends FileDownloadOptions { + encodeURI?: boolean; + timeout?: number; + } + + export interface IFileUploadOptions extends FileUploadOptions { + encodeURI?: boolean; + timeout?: number; + } +} diff --git a/ng-cordova/tsd.d.ts b/ng-cordova/tsd.d.ts index 5f17dd7065..791b61144b 100644 --- a/ng-cordova/tsd.d.ts +++ b/ng-cordova/tsd.d.ts @@ -15,3 +15,7 @@ /// /// /// +/// +/// +/// +/// From db8c6b7997a689a6aec02ede8abe369f6eeae92b Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Wed, 18 Nov 2015 04:06:07 -0500 Subject: [PATCH 071/474] ZeroCLipboard 2.x.x and jsdoc Test for 1.x.x Fix encoding Fix styling Code review --- zeroclipboard/zeroclipboard-1.x.x-tests.ts | 158 ++++++ zeroclipboard/zeroclipboard-1.x.x.d.ts | 79 +++ zeroclipboard/zeroclipboard-tests.ts | 542 ++++++++++++++++++++ zeroclipboard/zeroclipboard.d.ts | 554 ++++++++++++++++++--- 4 files changed, 1271 insertions(+), 62 deletions(-) create mode 100644 zeroclipboard/zeroclipboard-1.x.x-tests.ts create mode 100644 zeroclipboard/zeroclipboard-1.x.x.d.ts create mode 100644 zeroclipboard/zeroclipboard-tests.ts diff --git a/zeroclipboard/zeroclipboard-1.x.x-tests.ts b/zeroclipboard/zeroclipboard-1.x.x-tests.ts new file mode 100644 index 0000000000..e087561f67 --- /dev/null +++ b/zeroclipboard/zeroclipboard-1.x.x-tests.ts @@ -0,0 +1,158 @@ +/// +/// + +// main.js +var client = new ZeroClipboard( document.getElementById("copy-button"), { + moviePath: "/path/to/ZeroClipboard.swf" +} ); + +client.on( "load", function(client) { + // alert( "movie is loaded" ); + + client.on( "complete", function(client, args) { + // `this` is the element that was clicked + this.style.display = "none"; + alert("Copied text to clipboard: " + args.text ); + } ); +} ); + +ZeroClipboard.config( { moviePath: 'http://YOURSERVER/path/ZeroClipboard.swf' } ); + +var client = new ZeroClipboard(); + +var client = new ZeroClipboard($(".copy-button")); + +var _globalConfig = { + // NOTE: For versions >= v1.3.x and < v2.x, you must use `swfPath` by setting `moviePath`: + // `ZeroClipboard.config({ moviePath: ZeroClipboard.config("swfPath") });` + // URL to movie, relative to the page. Default value will be "ZeroClipboard.swf" under the + // same path as the ZeroClipboard JS file. + swfPath: "path/to/ZeroClipboard.swf", + + // SWF inbound scripting policy: page domains that the SWF should trust. (single string or array of strings) + trustedDomains: [window.location.host], + + // Include a "nocache" query parameter on requests for the SWF + cacheBust: true, + + // Forcibly set the hand cursor ("pointer") for all clipped elements + forceHandCursor: false, + + // The z-index used by the Flash object. Max value (32-bit): 2147483647 + zIndex: 999999999, + + // Debug enabled: send `console` messages with deprecation warnings, etc. + debug: true, + + // Sets the title of the `div` encapsulating the Flash object + title: 'div', + + // Setting this to `false` would allow users to handle calling `ZeroClipboard.activate(...);` + // themselves instead of relying on our per-element `mouseover` handler + autoActivate: true, + + + /** @deprecated */ + // The class used to indicate that a clipped element is being hovered over + hoverClass: "zeroclipboard-is-hover", + + /** @deprecated */ + // The class used to indicate that a clipped element is active (is being clicked) + activeClass: "zeroclipboard-is-active", + + /** @deprecated */ + // DEPRECATED!!! Use `trustedDomains` instead! + // SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings) + trustedOrigins: ['origin'], + + /** @deprecated */ + // SWF outbound scripting policy. Possible values: "never", "sameDomain", "always" + allowScriptAccess: 'always', + + /** @deprecated */ + // Include a "nocache" query parameter on requests for the SWF + useNoCache: true, + + /** @deprecated */ + // URL to movie + moviePath: "ZeroClipboard.swf" +}; + +ZeroClipboard.config(_globalConfig); + +ZeroClipboard.config({ moviePath: "new/path" }); + +var client = new ZeroClipboard($("#d_clip_button"), { moviePath: "new/path" }); +client.on( 'dataRequested', function (client, args) { + client.setText( "Copy me!" ); + }); + +client.setText( "Copy me!" ); + +client.clip( document.getElementById('d_clip_button') ); + +var client = new ZeroClipboard( $("button#my-button") ); + +function my_load_handler() { + +} + +client.on( 'load', my_load_handler ); + +client.off( 'load', my_load_handler ); + +client.on( 'load', function ( client, args ) { + alert( "movie has loaded" ); +}); + +client.on( 'mouseover', function ( client, args ) { + alert( "mouse is over movie" ); +}); + +client.on( 'mouseout', function ( client, args ) { + alert( "mouse has left movie" ); +} ); + +client.on( 'mousedown', function ( client, args ) { + alert( "mouse button is down" ); +} ); + +client.on( 'mouseup', function ( client, args ) { + alert( "mouse button is up" ); +} ); + +client.on( 'complete', function ( client, args ) { + alert("Copied text to clipboard: " + args.text ); +} ); + +client.on( 'noflash', function ( client, args ) { + alert("You don't support flash"); +} ); + +client.on( 'wrongflash', function ( client, args ) { + alert("Your flash is too old " + args.flashVersion); +} ); + +client.on( 'dataRequested', function ( client, args ) { + client.setText( 'Copied to clipboard.' ); +} ); + +var client = new ZeroClipboard( $('.clip_button') ); + +client.on( 'load', function(client) { + // alert( "movie is loaded" ); + + client.on( 'datarequested', function(client) { + client.setText(this.innerHTML); + } ); + + client.on( 'complete', function(client, args) { + alert("Copied text to clipboard: " + args.text ); + } ); +} ); + +client.on( 'wrongflash noflash', function() { + ZeroClipboard.destroy(); +}); + +ZeroClipboard.config({ debug: false }); diff --git a/zeroclipboard/zeroclipboard-1.x.x.d.ts b/zeroclipboard/zeroclipboard-1.x.x.d.ts new file mode 100644 index 0000000000..4305c18bcf --- /dev/null +++ b/zeroclipboard/zeroclipboard-1.x.x.d.ts @@ -0,0 +1,79 @@ +// Type definitions for ZeroClipboard v1.x.x +// Project: https://github.com/jonrohan/ZeroClipboard +// Definitions by: Eric J. Smith , Blake Niemyjski , György Balássy , Leon Yu +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class ZeroClipboard { + constructor(elements?: Element | { [index: number]: Element }, options?: ZeroClipboardOptions); + + activate(element: Element): void; + setText(newText: string): void; + title(newTitle: string): void; + setSize(width: number, height: number): void; + version: string; + moviePath: string; + trustedDomains: any; + text: string; + hoverClass: string; + activeClass: string; + deactivate(): void; + ready: boolean; + reposition(): void; // returns false in some scenarios, but never returns true + on(eventName: string, func: (client: ZeroClipboard, args: any) => void): void; + off(eventName: string, func: (client: ZeroClipboard, args: any) => void): void; + clip(elements: Element | { [index: number]: Element }): void; + unclip(elements: Element | { [index: number]: Element }): void; + + + static config(options: ZeroClipboardOptions): void; + static destroy(): void; + static emit(eventName: string, args: any): void; +} + +interface ZeroClipboardOptions { + + /** Setting this to false would allow users to handle calling ZeroClipboard.activate(...); themselves instead of relying on our per-element mouseover handler */ + autoActivate?: boolean; + + /** Include a "nocache" query parameter on requests for the SWF. */ + cacheBust?: boolean; + + /** Debug enabled: send console messages with deprecation warnings, etc. */ + debug?: boolean; + + /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ + forceHandCursor?: boolean; + + /** URL to the movie. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ + moviePath?: string; + + /** URL to the movie, relative to the page. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ + swfPath?: string; + + /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ + trustedDomains?: any; + + /** Sets the title of the div encapsulating the Flash object. */ + title?: string; + + /** The z-index used by the Flash object. */ + zIndex?: number; + + /** DEPRECATED. The class used to indicate that a clipped element is active (is being clicked). */ + activeClass?: string; + + /** DEPRECATED. The class used to indicate that a clipped element is being hovered over. */ + hoverClass?: string; + + /** DEPRECATED. SWF outbound scripting policy. Possible values: "never", "sameDomain", "always". */ + allowScriptAccess?: string; + + /** DEPRECATED, use trustedDomains instead! SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings. */ + trustedOrigins?: any; + + /** DEPRECATED, use cacheBust instead! Include a "nocache" query parameter on requests for the SWF. */ + useNoCache?: boolean; +} + +// Support AMD. +declare module "zeroclipboard" { export = ZeroClipboard; } diff --git a/zeroclipboard/zeroclipboard-tests.ts b/zeroclipboard/zeroclipboard-tests.ts new file mode 100644 index 0000000000..26855210da --- /dev/null +++ b/zeroclipboard/zeroclipboard-tests.ts @@ -0,0 +1,542 @@ +/// +/// + +import ZeroClipboard = require("zeroclipboard"); +// import * as ZeroClipboard from "zeroclipboard"; + +namespace SimpleExample { + ZeroClipboard.config( { swfPath: "http://YOURSERVER/path/ZeroClipboard.swf" } ); + + let client = new ZeroClipboard(document.getElementById("copy-button")); + let client2 = new ZeroClipboard(jQuery('.copy-button')); + + client.on( "ready", function( readyEvent ) { + // alert( "ZeroClipboard SWF is ready!" ); + + client.on( "aftercopy", function( event ) { + this === client; + event.target === document.getElementById('el') + event.target.style.display = "none"; + alert("Copied text to clipboard: " + event.data["text/plain"] ); + }); + }); + + client.on( "copy", function (event) { + var clipboard = event.clipboardData; + clipboard.setData( "text/plain", "Copy me!" ); + clipboard.setData( "text/html", "Copy me!" ); + clipboard.setData( "application/rtf", "{\\rtf1\\ansi\n{\\b Copy me!}}" ); + }); + + ZeroClipboard.setData( "text/plain", "Copy me!" ); + + client.setText( "Copy me!" ); + + client.clip( document.getElementById("d_clip_button") ); + + var $client = new ZeroClipboard( $("button#my-button") ); + + function example() { + var client = new ZeroClipboard( $('.clip_button') ); + + client.on( 'ready', function(event) { + // console.log( 'movie is loaded' ); + + client.on( 'copy', function(event) { + event.clipboardData.setData('text/plain', event.target.innerHTML); + } ); + + client.on( 'aftercopy', function(event) { + console.log('Copied text to clipboard: ' + event.data['text/plain']); + } ); + } ); + + client.on( 'error', function(event) { + // console.log( 'ZeroClipboard error of type "' + event.name + '": ' + event.message ); + ZeroClipboard.destroy(); + } ); + } + + ZeroClipboard.config({ + fixLineEndings: false + }); + + ZeroClipboard.config({ + forceEnhancedClipboard: true + }); + +} + +namespace Static { + var version:String = ZeroClipboard.version; + + var config = ZeroClipboard.config(); + + var swfPath:String = ZeroClipboard.config("swfPath"); + + ZeroClipboard.config({}); + + ZeroClipboard.destroy(); + + ZeroClipboard.setData("text/plain", "Blah"); + + ZeroClipboard.setData({ + "text/plain": "Blah", + "text/html": "Blah" + }); + + ZeroClipboard.clearData("text/plain"); + + var text:String = ZeroClipboard.getData("text/plain"); + + var dataObj = ZeroClipboard.getData(); + + ZeroClipboard.focus(document.getElementById("d_clip_button")); + + ZeroClipboard.blur(); + + var el = document.getElementById("d_clip_button"); + ZeroClipboard.focus(el); + var activeEl = ZeroClipboard.activeElement(); + activeEl === el; + + ZeroClipboard.state(); + + let b:boolean = ZeroClipboard.isFlashUnusable(); + + var listenerFn = function(e: Object) { var ZeroClipboard = this; /* ... */ }; + ZeroClipboard.on("ready", listenerFn); + + var listenerObj = { + handleEvent: function(e: Object) { var listenerObj = this; /* ... */ } + }; + ZeroClipboard.on("error", listenerObj); + + ZeroClipboard.on("ready error", function(e) { /* ... */ }); + + ZeroClipboard.on({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + ZeroClipboard.off("ready", listenerFn); + ZeroClipboard.off("error", listenerObj); + + ZeroClipboard.off("ready error", listenerFn); + + ZeroClipboard.off({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + ZeroClipboard.off("ready"); + + ZeroClipboard.off(); + + ZeroClipboard.emit("ready"); + ZeroClipboard.emit({ + type: "error", + name: "flash-disabled" + }); + + var pendingCopyData = ZeroClipboard.emit("copy"); + + var listener = ZeroClipboard.handlers("ready"); + + var listeners = ZeroClipboard.handlers(); + + var currentlyActivatedElementOrNull = document.getElementById('currentlyActivatedElementOrNull'); + var dataClipboardElementTargetOfCurrentlyActivatedElementOrNull = document.getElementById('dataClipboardElementTargetOfCurrentlyActivatedElementOrNull') + var flashSwfObjectRef = document.getElementById('flashSwfObjectRef') as HTMLObjectElement; + + ZeroClipboard.on("ready", function(e) { + e = { + type: "ready", + message: "Flash communication is established", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + version: "11.2.202", + timeStamp: Date.now() + }; + }); + + ZeroClipboard.on("beforecopy", function(e) { + e = { + type: "beforecopy", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now() + }; + }); + + ZeroClipboard.on("copy", function(e) { + e.clipboardData.setData('text/html','
'); + e.clipboardData.setData({'text/html':'
'}); + e = { + type: "copy", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + clipboardData: { + setData: ZeroClipboard.setData, + clearData: ZeroClipboard.clearData + } + }; + }); + + + ZeroClipboard.on("aftercopy", function(e) { + e = { + type: "aftercopy", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + success: { + "text/plain": true, + "text/html": true, + "application/rtf": false + }, + data: { + "text/plain": "Blah", + "text/html": "Blah", + "application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}" + }, + errors: [ + { + name: "SecurityError", + message: "Clipboard security error OMG", + errorID: 7320, + stack: null, + format: "application/rtf", + clipboard: "desktop" + } + ] + }; + }); + + ZeroClipboard.on("destroy", function(e) { + e = { + type: "destroy", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + success: { + "text/plain": true, + "text/html": true, + "application/rtf": false + }, + data: { + "text/plain": "Blah", + "text/html": "Blah", + "application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}" + } + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-disabled", + message: "Flash is disabled or not installed. May also be attempting to run Flash in a sandboxed iframe, which is impossible.", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-sandboxed", + message: "Attempting to run Flash in a sandboxed iframe, which is impossible", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-unavailable", + message: "Flash is unable to communicate bidirectionally with JavaScript", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-degraded", + message: "Flash is unable to preserve data fidelity when communicating with JavaScript", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-deactivated", + message: "Flash is too outdated for your browser and/or is configured as click-to-activate. This may also mean that the ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity. May also be attempting to run Flash in a sandboxed iframe, which is impossible.", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "flash-overdue", + message: "Flash communication was established but NOT within the acceptable time limit", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + minimumVersion: "11.0.0", + version: "11.2.202" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "version-mismatch", + message: "ZeroClipboard JS version number does not match ZeroClipboard SWF version number", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + jsVersion: "2.2.1", + swfVersion: "2.2.0" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "clipboard-error", + message: "At least one error was thrown while ZeroClipboard was attempting to inject your data into the clipboard", + target: currentlyActivatedElementOrNull, + relatedTarget: dataClipboardElementTargetOfCurrentlyActivatedElementOrNull, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + data: { + "text/plain": "Blah", + "text/html": "Blah", + "application/rtf": "{\\rtf1\\ansi\n{\\b Blah}}" + }, + errors: [ + { + name: "SecurityError", + message: "Clipboard security error OMG", + errorID: 7320, + stack: null, + format: "application/rtf", + clipboard: "desktop" + } + ] + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "config-mismatch", + message: "ZeroClipboard configuration does not match Flash's reality", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now(), + property: "swfObjectId", + configuredValue: "my-zeroclipboard-object", + actualValue: "global-zeroclipboard-flash-bridge" + }; + }); + + ZeroClipboard.on("error", function(e) { + e = { + type: "error", + name: "swf-not-found", + message: "The ZeroClipboard SWF object could not be loaded, so please check your `swfPath` configuration and/or network connectivity", + target: null, + relatedTarget: null, + currentTarget: flashSwfObjectRef, + timeStamp: Date.now() + }; + }); +} + +namespace Instance { + var clippedEl = document.getElementById("d_clip_button"); + var client = new ZeroClipboard(clippedEl); + + client.setText("Blah"); + + client.setHtml("Blah"); + + client.setRichText("{\\rtf1\\ansi\n{\\b Blah}}"); + + client.setData("text/plain", "Blah"); + client.setData({ + "text/plain": "Blah", + "text/html": "Blah" + }); + + client.clearData("text/plain"); + client.clearData(); + + var text:String = client.getData("text/plain"); + var dataObj = client.getData(); + + client.clip(document.getElementById("d_clip_button")) + client.clip(document.querySelectorAll(".clip_button")); + client.clip(jQuery(".clip_button")); + + client.unclip(document.getElementById("d_clip_button")) + client.unclip(document.querySelectorAll(".clip_button")); + client.unclip(jQuery(".clip_button")); + client.unclip(); + + var els:HTMLElement[] = client.elements(); + + var listenerFn = function(e: Object) { var client = this; /* ... */ }; + client.on("ready", listenerFn); + + var listenerObj = { + handleEvent: function(e: Object) { var listenerObj = this; /* ... */ } + }; + client.on("error", listenerObj); + + client.on("ready error", function(e) { /* ... */ }); + + client.on({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + client.off("ready", listenerFn); + client.off("error", listenerObj); + + client.off("ready error", listenerFn); + + client.off({ + "ready": function(e) { /* ... */ }, + "error": function(e) { /* ... */ } + }); + + client.off("ready"); + + client.off(); + + client.emit("ready"); + client.emit({ + type: "error", + name: "flash-disabled" + }); + + var readyListeners = client.handlers("ready"); + + var listeners = client.handlers(); + + var client = new ZeroClipboard(); + client.on("ready", function(e) { + if (e.client === client && client === this) { + console.log("This client instance is ready!"); + } + }); +} + +namespace GlobalConfig { + var _globalConfig = { + + // SWF URL, relative to the page. Default value will be "ZeroClipboard.swf" + // under the same path as the ZeroClipboard JS file. + swfPath: '_swfPath', + + // SWF inbound scripting policy: page domains that the SWF should trust. + // (single string, or array of strings) + trustedDomains: window.location.host ? [window.location.host] : [], + + // Include a "noCache" query parameter on requests for the SWF. + cacheBust: true, + + // Enable use of the fancy "Desktop" clipboard, even on Linux where it is + // known to suck. + forceEnhancedClipboard: false, + + // How many milliseconds to wait for the Flash SWF to load and respond before assuming that + // Flash is deactivated (e.g. click-to-play) in the user's browser. If you don't care about + // how long it takes to load the SWF, you can set this to `null`. + flashLoadTimeout: 30000, + + // Setting this to `false` would allow users to handle calling `ZeroClipboard.focus(...);` + // themselves instead of relying on our per-element `mouseover` handler. + autoActivate: true, + + // Bubble synthetic events in JavaScript after they are received by the Flash object. + bubbleEvents: true, + + // Ensure OS-compliant line endings, i.e. "\r\n" on Windows, "\n" elsewhere + fixLineEndings: true, + + // Sets the ID of the `div` encapsulating the Flash object. + // Value is validated against the [HTML4 spec for `ID` tokens][valid_ids]. + containerId: "global-zeroclipboard-html-bridge", + + // Sets the class of the `div` encapsulating the Flash object. + containerClass: "global-zeroclipboard-container", + + // Sets the ID and name of the Flash `object` element. + // Value is validated against the [HTML4 spec for `ID` and `Name` tokens][valid_ids]. + swfObjectId: "global-zeroclipboard-flash-bridge", + + // The class used to indicate that a clipped element is being hovered over. + hoverClass: "zeroclipboard-is-hover", + + // The class used to indicate that a clipped element is active (is being clicked). + activeClass: "zeroclipboard-is-active", + + + + // Forcibly set the hand cursor ("pointer") for all clipped elements. + // IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + forceHandCursor: false, + + // Sets the title of the `div` encapsulating the Flash object. + // IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + title: 'title', + + // The z-index used by the Flash object. + // Max value (32-bit): 2147483647. + // IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + zIndex: 999999999 + + }; + + ZeroClipboard.config(_globalConfig); + +} diff --git a/zeroclipboard/zeroclipboard.d.ts b/zeroclipboard/zeroclipboard.d.ts index 6db1ba180d..2a192a71e9 100644 --- a/zeroclipboard/zeroclipboard.d.ts +++ b/zeroclipboard/zeroclipboard.d.ts @@ -1,75 +1,505 @@ -// Type definitions for ZeroClipboard -// Project: https://github.com/jonrohan/ZeroClipboard -// Definitions by: Eric J. Smith , Blake Niemyjski , György Balássy -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Type definitions for ZeroClipboard v2.x.x +// Project: https://github.com/zeroclipboard/zeroclipboard +// Definitions by: Eric J. Smith , Blake Niemyjski , György Balássy , Leon Yu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare class ZeroClipboard { - constructor(elements?: any, options?: ZeroClipboardOptions); - activate(element: any): void; - setText(newText: string): void; - title(newTitle: string): void; - setSize(width: number, height: number): void; +declare namespace ZC { + // Basic collection types for shorthands and interoperation + interface List { [index: number]: T; length: number; } + interface Dictionary { [key: string]: T; } + + // Generic version EventHandler containers. + // Mimicking native interfaces in lib.dom.d.ts of the same name. + interface EventListener { (ev: T): void; } + interface EventListenerObject { handleEvent(ev: T): void; } + type EventListenerOrEventListenerObject = EventListener | EventListenerObject; + + export interface ZeroClipboardStatic extends ZeroClipboardCommon { + new(elements?: Element | List): ZeroClipboardClient; + + /** + * The version of the ZeroClipboard library being used, e.g. "2.0.0". + * @type {string} + */ version: string; - moviePath: string; - trustedDomains: any; - text: string; - hoverClass: string; - activeClass: string; + /** + * Get a copy of the active configuration for ZeroClipboard. + * @return {ZeroClipboardConfig} + */ + config(): ZeroClipboardConfig; + /** + * Get a copy of the actively configured value for this configuration property for ZeroClipboard. + * @param {string} propName + * @return {any} + */ + config(propName: string): any; + config(propName: "swfPath"): string; + config(propName: "trustedDomains"): string[]; + config(propName: "cacheBust"): boolean; + config(propName: "forceEnhancedClipboard"): boolean; + config(propName: "flashLoadTimeout"): number; + config(propName: "autoActivate"): boolean; + config(propName: "bubbleEvents"): boolean; + config(propName: "fixLineEndings"): boolean; + config(propName: "containerId"): string; + config(propName: "containerClass"): string; + config(propName: "swfObjectId"): string; + config(propName: "hoverClass"): string; + config(propName: "activeClass"): string; + config(propName: "forceHandCursor"): boolean; + config(propName: "title"): string; + config(propName: "zIndex"): number; + /** + * Set the active configuration for ZeroClipboard. Returns a copy of the updated active configuration. + * @param {ZeroClipboardConfig} config + * @return {ZeroClipboardConfig} + */ + config(config: ZeroClipboardConfig): ZeroClipboardConfig; + /** + * Create the Flash bridge SWF object. + * IMPORTANT: This method should be considered private. + * @private + */ + create(): void; + /** + * Emit the "destroy" event, remove all event handlers, and destroy the Flash bridge. + */ + destroy(): void; + /** + * Focus/"activate" the provided element by moving the Flash SWF object in front of it. + * @param {Element} element + * @since 2.1.0 + */ + focus(element: Element): void; + /** + * Focus/"activate" the provided element by moving the Flash SWF object in front of it. + * @param {Element} element + * @deprecated: The preferred method to use is focus but the alias activate is available for backward compatibility's sake. + */ + activate(element: Element): void; + /** + * Blur/"deactivate" the currently focused/"activated" element, moving the Flash SWF object off the screen. + * @since 2.1.0 + */ + blur(): void; + /** + * Blur/"deactivate" the currently focused/"activated" element, moving the Flash SWF object off the screen. + * @deprecated: The preferred method to use is blur but the alias deactivate is available for backward compatibility's sake. + */ deactivate(): void; - ready: boolean; - reposition(): void; // returns false in some scenarios, but never returns true - on(eventName: string, func: Function): void; - off(eventName: string, func: Function): void; - clip(elements: any): void; - unclip(elements: any): void; - static config(options: ZeroClipboardOptions): void; - static destroy(): void; - static emit(eventName: string, args: any): void; -} + /** + * Return the currently "activated" element that the Flash SWF object is in front of it. + * @return {HTMLElement} or {null} + */ + activeElement(): HTMLElement; + /** + * Diagnostic method that describes the state of the browser, Flash Player, and ZeroClipboard. + * @return {Object} + */ + state(): Object; + /** + * Indicates if Flash Player is definitely unusable (disabled, outdated, unavailable, or deactivated). + * IMPORTANT: This method should be considered private. + * @return {boolean} + * @private + */ + isFlashUnusable(): boolean; + } -interface ZeroClipboardOptions { - /** Setting this to false would allow users to handle calling ZeroClipboard.activate(...); themselves instead of relying on our per-element mouseover handler */ - autoActivate?: boolean; + interface ZeroClipboardClient extends ZeroClipboardCommon { + /** + * A unique identifier for this ZeroClipboard client instance. + * @type {string} + */ + id: string; + /** + * Remove all event handlers and unclip all clipped elements. + */ + destroy(): void; + /** + * Set the pending data of type "text/plain" for clipboard injection. + * @param {string} data + */ + setText(data: string): void; + /** + * Set the pending data of type "text/html" for clipboard injection. + * @param {string} data + */ + setHtml(data: string): void; + /** + * Set the pending data of type "application/rtf" for clipboard injection. + * @param {string} data + */ + setRichText(data: string): void; + /** + * Register clipboard actions for new element(s) to the client. This includes automatically invoking + * ZeroClipboard.focus on the current element when it is hovered over, unless the autoActivate configuration + * property is set to false. + * @param {Element[]} elements + * @return {ZeroClipboardClient} + */ + clip(elements: List): ZeroClipboardClient; + /** + * Register clipboard actions for new element(s) to the client. This includes automatically invoking + * ZeroClipboard.focus on the current element when it is hovered over, unless the autoActivate configuration + * property is set to false. + * @param {Element} element + * @return {ZeroClipboardClient} + */ + clip(element: Element): ZeroClipboardClient; + /** + * Unregister the clipboard actions of previously registered element(s) on the page. If no elements are provided, + * ALL clipped/registered elements will be unregistered. + * @param {Element[]} elements + * @return {ZeroClipboardClient} + */ + unclip(elements: List): ZeroClipboardClient; + /** + * Unregister the clipboard actions of previously registered element(s) on the page. If no elements are provided, + * ALL clipped/registered elements will be unregistered. + * @param {Element} element + * @return {ZeroClipboardClient} + */ + unclip(elements?: Element): ZeroClipboardClient; + /** + * Get all of the elements to which this client is clipped/registered. + * @return {HTMLElement[]} + */ + elements(): HTMLElement[]; + } - /** Include a "nocache" query parameter on requests for the SWF. */ - cacheBust?: boolean; + interface ZeroClipboardEvent { + client?: ZeroClipboardClient; + type: string; + target: HTMLElement; + relatedTarget: HTMLElement; + currentTarget: HTMLObjectElement; + timeStamp: number; + } - /** Debug enabled: send console messages with deprecation warnings, etc. */ - debug?: boolean; + interface ZeroClipboardReadyEvent extends ZeroClipboardEvent { + message: string; + version: string; + } - /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ - forceHandCursor?: boolean; + interface ZeroClipboardBeforeCopyEvent extends ZeroClipboardEvent { - /** URL to the movie. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ - moviePath?: string; + } - /** URL to the movie, relative to the page. NOTE: For versions >= v1.3.x and < v2.x, you must use swfPath by setting moviePath! */ + interface ZeroClipboardCopyEvent extends ZeroClipboardEvent { + clipboardData: { + setData(format: string, data: string): void; + setData(data: Dictionary): void; + clearData(mimeType?: string): void; + }; + } + + interface ZeroClipboardAfterCopyEvent extends ZeroClipboardEvent { + success: Dictionary; + data: Dictionary; + errors: any[]; + } + + interface ZeroClipboardDestroyEvent extends ZeroClipboardEvent { + success: Dictionary; + data: Dictionary; + } + + interface ZeroClipboardErrorEvent extends ZeroClipboardEvent { + name: string; + message: string; + minimumVersion?: string; + version?: string; + jsVersion?: string; + swfVersion?: string; + property?: string; + configuredValue?: string; + actualValue?: string; + data?: Dictionary; + errors?: any[]; + } + + interface ZeroClipboardCommon { + /** + * Set the pending data of type format for clipboard injection. + * @param {string} format + * @param {string} data + */ + setData(format: string, data: string): void; + /** + * Set the pending data of various formats for clipboard injection. This particular function signature (passing in + * an Object) will implicitly clear out any existing pending data. + * @param {Dictionary} data + */ + setData(data: Dictionary): void; + /** + * Clear the pending data of type format for clipboard injection. + * @param {string} mimeType + */ + clearData(mimeType: string): void; + /** + * Clear the pending data of ALL formats for clipboard injection. + */ + clearData(): void; + /** + * Get the pending data of type format for clipboard injection. + * @param {string} format + * @return {string} + * @since 2.1.0 + */ + getData(format: string): string; + /** + * Get a copy of the pending data of ALL formats for clipboard injection. + * @return {Dictionary} + * @since 2.1.0 + */ + getData(): Dictionary; + /** + * Add a listener function/object for an eventType. If called as a client method will be within the client instance. + * @param {string} eventType + * @param {EventListener} listener + */ + on(eventType: string, listener: EventListenerOrEventListenerObject): void; + /** + * The ready event is fired when the Flash SWF completes loading and is ready for action. Please note that you need + * to set most configuration options [with ZeroClipboard.config(...)] before ZeroClipboard.create() is invoked. + * @param {"ready"} eventType + * @param {EventListener} listener + */ + on(eventType: "ready", listener: EventListenerOrEventListenerObject): void; + /** + * On click, the Flash object will fire off a beforecopy event. This event is generally only used for "UI + * preparation" if you want to alter anything before the copy event fires. + * IMPORTANT: Handlers of this event are expected to operate synchronously if they intend to be finished before + * the "copy" event is triggered. + * @param {"beforecopy"} eventType + * @param {EventListener} listener + */ + on(eventType: "beforecopy", listener: EventListenerOrEventListenerObject): void; + /** + * On click (and after the beforecopy event), the Flash object will fire off a copy event. If the HTML object has + * data-clipboard-text or data-clipboard-target, then ZeroClipboard will take care of getting an initial set of + * data. It will then invoke any copy event handlers, in which you can call event.clipboardData.setData to set the + * text, which will complete the loop. + * IMPORTANT: If a handler of this event intends to modify the pending data for clipboard injection, it MUST + * operate synchronously in order to maintain the temporarily elevated permissions granted by the user's click + * event. The most common "gotcha" for this restriction is if someone wants to make an asynchronous XMLHttpRequest + * in response to the copy event to get the data to inject - this won't work; make it a synchronous XMLHttpRequest + * instead, or do the work in advance before the copy event is fired. + * @param {"copy"} eventType + * @param {EventListener} listener + */ + on(eventType: "copy", listener: EventListenerOrEventListenerObject): void; + /** + * The aftercopy event is fired when the text is copied [or failed to copy] to the clipboard. + * @param {"aftercopy"} eventType + * @param {EventListener} listener + */ + on(eventType: "aftercopy", listener: EventListenerOrEventListenerObject): void; + /** + * The destroy event is fired when ZeroClipboard.destroy() is invoked. + * IMPORTANT: Handlers of this event are expected to operate synchronously if they intend to be finished before the + * destruction is complete. + * @param {"destroy"} eventType + * @param {EventListener} listener + */ + on(eventType: "destroy", listener: EventListenerOrEventListenerObject): void; + /** + * The error event is fired under a number of conditions, which will be detailed as sub-sections. Some consumers + * may not consider all error types to be critical, and thus ZeroClipboard does not take it upon itself to implode + * by calling ZeroClipboard.destroy() under error conditions. However, many consumers may want to do just that. + * @param {"error"} eventType + * @param {EventListener} listener + */ + on(eventType: "error", listener: EventListenerOrEventListenerObject): void; + /** + * Add a set of eventType to listener function/object mappings. + * @param {EventListener} listenerObj + */ + on(listenerObj: { + ready?: EventListenerOrEventListenerObject; + beforecopy?: EventListenerOrEventListenerObject; + copy?: EventListenerOrEventListenerObject; + aftercopy?: EventListenerOrEventListenerObject; + destroy?: EventListenerOrEventListenerObject; + error?: EventListenerOrEventListenerObject; + }): void; + /** + * Remove a listener function/object for an eventType. + * @param {string} eventType + * @param {EventListener} listener + */ + off(eventType: string, listener: EventListenerOrEventListenerObject): void; + off(eventType: "ready", listener: EventListenerOrEventListenerObject): void; + off(eventType: "beforecopy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "copy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "aftercopy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "destroy", listener: EventListenerOrEventListenerObject): void; + off(eventType: "error", listener: EventListenerOrEventListenerObject): void; + /** + * Remove a set of eventType to listener function/object mappings. + * @param {EventListener} listenerObj + */ + off(listenerObj: { + ready?: EventListenerOrEventListenerObject; + beforecopy?: EventListenerOrEventListenerObject; + copy?: EventListenerOrEventListenerObject; + aftercopy?: EventListenerOrEventListenerObject; + destroy?: EventListenerOrEventListenerObject; + error?: EventListenerOrEventListenerObject; + }): void; + /** + * Remove ALL listener functions/objects for ALL registered event types. + */ + off(): void; + /** + * Dispatch an event to all registered listeners. The emission of some types of events will result in side effects. + * @param {string} eventType + * @return {any} + */ + emit(eventType: string): any; + emit(eventType: "ready"): void; + emit(eventType: "beforecopy"): void; + emit(eventType: "copy"): any; + emit(eventType: "aftercopy"): void; + emit(eventType: "destroy"): void; + emit(eventType: "error"): void; + /** + * Dispatch an event to all registered listeners. The emission of some types of events will result in side effects. + * @param {string} data + * @param {string} name + * @return {any} + */ + emit(data: {type: string, name: string}): any; + /** + * Retrieves a copy of the registered listener functions/objects for the given eventType. + * @param {string} eventType + * @return {EventListener} + */ + handlers(eventType: string): EventListenerOrEventListenerObject[]; + handlers(eventType: "ready"): EventListenerOrEventListenerObject[]; + handlers(eventType: "beforecopy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "copy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "aftercopy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "destroy"): EventListenerOrEventListenerObject[]; + handlers(eventType: "error"): EventListenerOrEventListenerObject[]; + /** + * Retrieves a copy of the map of registered listener functions/objects for ALL event types. + * @return {Object} + */ + handlers(): { + ready?: EventListenerOrEventListenerObject[]; + beforecopy?: EventListenerOrEventListenerObject[]; + copy?: EventListenerOrEventListenerObject[]; + aftercopy?: EventListenerOrEventListenerObject[]; + destroy?: EventListenerOrEventListenerObject[]; + error?: EventListenerOrEventListenerObject[]; + }; + } + + interface ZeroClipboardConfig { + /** + * SWF URL, relative to the page. Default value will be "ZeroClipboard.swf" under the same path as the ZeroClipboard JS file. + * @type {string} + */ swfPath?: string; - - /** Forcibly set the hand cursor ("pointer") for all clipped elements. */ - trustedDomains?: any; - - /** Sets the title of the div encapsulating the Flash object. */ - title?: string; - - /** The z-index used by the Flash object. */ - zIndex?: number; - - /** DEPRECATED. The class used to indicate that a clipped element is active (is being clicked). */ - activeClass?: string; - - /** DEPRECATED. The class used to indicate that a clipped element is being hovered over. */ + /** + * SWF inbound scripting policy: page domains that the SWF should trust. (single string, or array of strings) + * @type {SingleOrList} + */ + trustedDomains?: string[]; + /** + * Include a "noCache" query parameter on requests for the SWF. + * @type {boolean} + */ + cacheBust?: boolean; + /** + * Enable use of the fancy "Desktop" clipboard, even on Linux where it is known to suck. + * @type {boolean} + */ + forceEnhancedClipboard?: boolean; + /** + * How many milliseconds to wait for the Flash SWF to load and respond before assuming that + * Flash is deactivated (e.g. click-to-play) in the user's browser. If you don't care about + * how long it takes to load the SWF, you can set this to `null`. + * @type {number} + */ + flashLoadTimeout?: number; + /** + * Setting this to `false` would allow users to handle calling `ZeroClipboard.focus(...);` + * themselves instead of relying on our per-element `mouseover` handler. + * @type {boolean} + */ + autoActivate?: boolean; + /** + * Bubble synthetic events in JavaScript after they are received by the Flash object. + * @type {boolean} + */ + bubbleEvents?: boolean; + /** + * Ensure OS-compliant line endings, i.e. "\r\n" on Windows, "\n" elsewhere + * @type {boolean} + */ + fixLineEndings?: boolean; + /** + * Sets the ID of the `div` encapsulating the Flash object. + * Value is validated against the [HTML4 spec for `ID` tokens][valid_ids]. + * @type {string} + */ + containerId?: string; + /** + * Sets the class of the `div` encapsulating the Flash object. + * @type {string} + */ + containerClass?: string; + /** + * Sets the ID and name of the Flash `object` element. + * Value is validated against the [HTML4 spec for `ID` and `Name` tokens][valid_ids]. + * @type {string} + */ + swfObjectId?: string; + /** + * The class used to indicate that a clipped element is being hovered over. + * @type {string} + */ hoverClass?: string; - - /** DEPRECATED. SWF outbound scripting policy. Possible values: "never", "sameDomain", "always". */ - allowScriptAccess?: string; - - /** DEPRECATED, use trustedDomains instead! SWF inbound scripting policy: page origins that the SWF should trust. (single string or array of strings. */ - trustedOrigins?: any; - - /** DEPRECATED, use cacheBust instead! Include a "nocache" query parameter on requests for the SWF. */ - useNoCache?: boolean; + /** + * The class used to indicate that a clipped element is active (is being clicked). + * @type {string} + */ + activeClass?: string; + /** + * Forcibly set the hand cursor ("pointer") for all clipped elements. + * IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + * @type {boolean} + */ + forceHandCursor?: boolean; + /** + * Sets the title of the `div` encapsulating the Flash object. + * IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + * @type {string} + */ + title?: string; + /** + * The z-index used by the Flash object. + * Max value (32-bit): 2147483647. + * IMPORTANT: This configuration value CAN be modified while a SWF is actively embedded. + * @type {number} + */ + zIndex?: number; + } } -// Support AMD. -declare module "zeroclipboard" { export = ZeroClipboard; } +/** + * [ZeroClipboard description] + * @type {ZC.ZeroClipboardStatic} + */ +declare var ZeroClipboard: ZC.ZeroClipboardStatic; + +/** + * AMD and CommonJS module `zeroclipboard` + * @module + */ +declare module "zeroclipboard" { + export = ZeroClipboard; +} From 025706049a03269ff69b82b77321d1b7e0d24804 Mon Sep 17 00:00:00 2001 From: Lars Michaelis Date: Wed, 2 Dec 2015 11:19:26 +0100 Subject: [PATCH 072/474] Initial commit --- jsf/jsf-tests.ts | 3 ++ jsf/jsf.d.ts | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 jsf/jsf-tests.ts create mode 100644 jsf/jsf.d.ts diff --git a/jsf/jsf-tests.ts b/jsf/jsf-tests.ts new file mode 100644 index 0000000000..c944bc72da --- /dev/null +++ b/jsf/jsf-tests.ts @@ -0,0 +1,3 @@ +/// + +import jsf = require("jsf"); diff --git a/jsf/jsf.d.ts b/jsf/jsf.d.ts new file mode 100644 index 0000000000..14f7b407d8 --- /dev/null +++ b/jsf/jsf.d.ts @@ -0,0 +1,72 @@ +// Type definitions for for the JSF 2.0 Ajax request API. +// Project: https://docs.oracle.com/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/js-api/symbols/jsf.ajax.html +// Definitions by: Lars Michaelis and Stephan Zerhusen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "jsf" { + module ajax { + + interface RequestData { + status: string; + description: string; + } + + interface RequestOptions { + /** + * space seperated list of client identifiers + */ + execute?: String; + + /** + * space seperated list of client identifiers + */ + render?: String; + + /** + * function to callback for event + * @param callback the callback function + */ + onevent?(callback:(data:RequestData) => void): void; + + /** + * function to callback for error + * @param callback the callback function + */ + onerror?(callback:(data:RequestData) => void): void; + + /** + * object containing parameters to include in the request + */ + params?: any; + } + + /** + * Register a callback for event handling. + * @param callback a reference to a function to call on an event + */ + function addOnEvent(callback:(data:RequestData) => void):void; + + /** + * Register a callback for error handling. + * @param callback a reference to a function to call on an error + */ + function addOnError(callback:(data:RequestData) => void):void; + + /** + * Send an asynchronous Ajax request to the server. + * @param source The DOM element that triggered this Ajax request, or an id string of the element to use as the triggering element. + * @param event The DOM event that triggered this Ajax request. The event argument is optional. + * @param options The set of available options that can be sent as request parameters to control client and/or server side request processing. + */ + function request(source:any, event?:String, options?:RequestOptions):void; + + /** + * Receive an Ajax response from the server. + * @param request The XMLHttpRequest instance that contains the status code and response message from the server. + * @param context An object containing the request context, including the following properties: the source element, per call onerror callback function, and per call onevent callback function. + * @throws EmptyResponse error if request contains no data + */ + function response(request:any, context:any):void; + + } +} From 56b3481c312ea9318b10b7f26df2b269c247c92d Mon Sep 17 00:00:00 2001 From: Lars Michaelis Date: Wed, 2 Dec 2015 11:30:10 +0100 Subject: [PATCH 073/474] make it compile with npm test --- jsf/jsf-tests.ts | 1 - jsf/jsf.d.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/jsf/jsf-tests.ts b/jsf/jsf-tests.ts index c944bc72da..b56749a4a9 100644 --- a/jsf/jsf-tests.ts +++ b/jsf/jsf-tests.ts @@ -1,3 +1,2 @@ /// -import jsf = require("jsf"); diff --git a/jsf/jsf.d.ts b/jsf/jsf.d.ts index 14f7b407d8..9c7f6a43dd 100644 --- a/jsf/jsf.d.ts +++ b/jsf/jsf.d.ts @@ -1,6 +1,6 @@ -// Type definitions for for the JSF 2.0 Ajax request API. +// Type definitions for for the JSF 2.0 Ajax request API // Project: https://docs.oracle.com/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/js-api/symbols/jsf.ajax.html -// Definitions by: Lars Michaelis and Stephan Zerhusen +// Definitions by: Lars Michaelis and Stephan Zerhusen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "jsf" { From 2c123744f00cb74676333a45e1ef4f0750b3b39f Mon Sep 17 00:00:00 2001 From: Lars Michaelis Date: Wed, 2 Dec 2015 11:46:17 +0100 Subject: [PATCH 074/474] add tests --- jsf/jsf-tests.ts | 25 +++++++++++++++++++++++++ jsf/jsf.d.ts | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/jsf/jsf-tests.ts b/jsf/jsf-tests.ts index b56749a4a9..3c594f1e52 100644 --- a/jsf/jsf-tests.ts +++ b/jsf/jsf-tests.ts @@ -1,2 +1,27 @@ /// +function callbackWithoutData() { + +} + +function callback(data: jsf.ajax.RequestData) { + +} + +class RequestOptionsImpl implements jsf.ajax.RequestOptions { + execute = "@all"; + render = "@none"; +} + + +jsf.ajax.addOnEvent(callbackWithoutData); +jsf.ajax.addOnEvent(callback); + +jsf.ajax.addOnError(callbackWithoutData); +jsf.ajax.addOnError(callback); + +jsf.ajax.request("someSource"); +jsf.ajax.request("someSource", "change"); +jsf.ajax.request("someSource", "change", new RequestOptionsImpl()); + +jsf.ajax.response("someRequestObject", "someContextObject"); diff --git a/jsf/jsf.d.ts b/jsf/jsf.d.ts index 9c7f6a43dd..d19dafe0eb 100644 --- a/jsf/jsf.d.ts +++ b/jsf/jsf.d.ts @@ -3,7 +3,7 @@ // Definitions by: Lars Michaelis and Stephan Zerhusen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module "jsf" { +declare module jsf { module ajax { interface RequestData { From 722e48a621b68c5acae43f51373bd799731dfb74 Mon Sep 17 00:00:00 2001 From: Lars Michaelis Date: Wed, 2 Dec 2015 11:49:37 +0100 Subject: [PATCH 075/474] add tests --- jsf/jsf-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jsf/jsf-tests.ts b/jsf/jsf-tests.ts index 3c594f1e52..76815bf9ee 100644 --- a/jsf/jsf-tests.ts +++ b/jsf/jsf-tests.ts @@ -4,13 +4,13 @@ function callbackWithoutData() { } -function callback(data: jsf.ajax.RequestData) { +function callback(data:jsf.ajax.RequestData) { } class RequestOptionsImpl implements jsf.ajax.RequestOptions { execute = "@all"; - render = "@none"; + render = "@none"; } @@ -24,4 +24,4 @@ jsf.ajax.request("someSource"); jsf.ajax.request("someSource", "change"); jsf.ajax.request("someSource", "change", new RequestOptionsImpl()); -jsf.ajax.response("someRequestObject", "someContextObject"); +jsf.ajax.response("someRequestObject", {context: "someContextObject"}); From f90557a3c9dc454eb3d30d7e6785899e9dcc6c22 Mon Sep 17 00:00:00 2001 From: Jan Aagaard Date: Wed, 2 Dec 2015 13:15:40 +0100 Subject: [PATCH 076/474] Fixed typing for find, findWhere, pluck and sum. --- lazy.js/lazy.js-tests.ts | 12 ++++++------ lazy.js/lazy.js.d.ts | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lazy.js/lazy.js-tests.ts b/lazy.js/lazy.js-tests.ts index 5e45ccf135..57d1ef37e8 100644 --- a/lazy.js/lazy.js-tests.ts +++ b/lazy.js/lazy.js-tests.ts @@ -28,6 +28,7 @@ var anyObjectSeq: LazyJS.ObjectLikeSequence; var fooAsyncSeq: LazyJS.AsyncSequence; var strSequence: LazyJS.Sequence; +var anySequence: LazyJS.Sequence; var stringSeq: LazyJS.StringLikeSequence; var obj: Object; @@ -44,7 +45,6 @@ function fnCallback(): void { } function fnErrorCallback(error: any): void { - } function fnValueCallback(value: Foo): void { @@ -108,8 +108,8 @@ fooSequence = fooSequence.dropWhile(fnTestCallback); fooSequence = fooSequence.each(fnValueCallback); bool = fooSequence.every(fnTestCallback); fooSequence = fooSequence.filter(fnTestCallback); -fooSequence = fooSequence.find(fnTestCallback); -fooSequence = fooSequence.findWhere(obj); +foo = fooSequence.find(fnTestCallback); +foo = fooSequence.findWhere(obj); x = fooSequence.first(); fooSequence = fooSequence.first(num); @@ -134,7 +134,7 @@ foo = fooSequence.max(); foo = fooSequence.max(fnNumberCallback); foo = fooSequence.min(); foo = fooSequence.min(fnNumberCallback); -fooSequence = fooSequence.pluck(str); +anySequence = fooSequence.pluck(str); bar = fooSequence.reduce(fnMemoCallback); bar = fooSequence.reduce(fnMemoCallback, bar); bar = fooSequence.reduceRight(fnMemoCallback, bar); @@ -152,8 +152,8 @@ fooSequence = fooSequence.sortBy(str, bool); fooSequence = fooSequence.sortBy(fnNumberCallback); fooSequence = fooSequence.sortBy(fnNumberCallback, bool); fooSequence = fooSequence.sortedIndex(foo); -fooSequence = fooSequence.sum(); -fooSequence = fooSequence.sum(fnNumberCallback); +foo = fooSequence.sum(); +foo = fooSequence.sum(fnNumberCallback); fooSequence = fooSequence.takeWhile(fnTestCallback); fooSequence = fooSequence.union(fooArr); fooSequence = fooSequence.uniq(); diff --git a/lazy.js/lazy.js.d.ts b/lazy.js/lazy.js.d.ts index 02cf1833b5..55406d5c50 100644 --- a/lazy.js/lazy.js.d.ts +++ b/lazy.js/lazy.js.d.ts @@ -135,8 +135,8 @@ declare module LazyJS { dropWhile(predicateFn: TestCallback): Sequence; every(predicateFn: TestCallback): boolean; filter(predicateFn: TestCallback): Sequence; - find(predicateFn: TestCallback): Sequence; - findWhere(properties: Object): Sequence; + find(predicateFn: TestCallback): T; + findWhere(properties: Object): T; flatten(): Sequence; groupBy(keyFn: GetKeyCallback): ObjectLikeSequence; @@ -150,7 +150,7 @@ declare module LazyJS { max(valueFn?: NumberCallback): T; min(valueFn?: NumberCallback): T; none(valueFn?: TestCallback): boolean; - pluck(propertyName: string): Sequence; + pluck(propertyName: string): Sequence; reduce(aggregatorFn: MemoCallback, memo?: U): U; reduceRight(aggregatorFn: MemoCallback, memo: U): U; reject(predicateFn: TestCallback): Sequence; @@ -162,7 +162,7 @@ declare module LazyJS { sortBy(sortFn: NumberCallback, descending?: boolean): Sequence; sortedIndex(value: T): Sequence; size(): number; - sum(valueFn?: NumberCallback): Sequence; + sum(valueFn?: NumberCallback): T; takeWhile(predicateFn: TestCallback): Sequence; union(var_args: T[]): Sequence; uniq(): Sequence; From 8f5faa4841838aeafdd63d446f9b5339ccfe2e34 Mon Sep 17 00:00:00 2001 From: Sam Vloeberghs Date: Wed, 2 Dec 2015 16:18:40 +0100 Subject: [PATCH 077/474] update fs --- foundation-sites/foundation.d.ts | 216 +++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 foundation-sites/foundation.d.ts diff --git a/foundation-sites/foundation.d.ts b/foundation-sites/foundation.d.ts new file mode 100644 index 0000000000..3f0a99adee --- /dev/null +++ b/foundation-sites/foundation.d.ts @@ -0,0 +1,216 @@ +// Type definitions for Foundation Sites v6.0.4 +// Project: http://foundation.zurb.com/ +// Definitions by: Sam Vloeberghs +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare module Foundation { + + // http://foundation.zurb.com/sites/docs/abide.html#javascript-reference + export interface Abide { + requiredCheck: (element: Object) => boolean; + findLabel: (element:Object) => boolean; + addErrorClasses: (element: Object) => void; + removeErrorClasses: (element:Object) => void; + validateInput: (element: Object, form: Object) => void; + validateForm: (element: Object) => void; + validateText: (element: Object) => boolean; + validateRadio: (group: String) => boolean; + resetform: ($form: Object) => void; + } + interface AbideOptions { + + } + + // http://foundation.zurb.com/sites/docs/accordion.html#javascript-reference + export interface Accordion { + toggle: ($target : JQuery) => void; + down: ($target : JQuery, firstTime: boolean) => void; + up: ($target: JQuery) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/accordion-menu.html#javascript-reference + export interface AccordionMenu { + toggle: ($target : JQuery) => void; + down: ($target : JQuery, firstTime: boolean) => void; + up: ($target: JQuery) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/drilldown-menu.html#javascript-reference + export interface Drilldown { + _hideAll: ($elem : JQuery) => void; + _show: ($elem : JQuery) => void; + _hide: ($elem : JQuery) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/dropdown.html#javascript-reference + export interface Dropdown { + getPositionClass: () => String; + open: () => void; + close: () => void; + toggle: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/dropdown-menu.html#javascript-reference + export interface DropdownMenu { + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/equalizer.html#javascript-reference + export interface Equalizer { + getHeights: (element: Object) => Array; + applyHeight: ($eqParent: Object, heights:Array) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/interchange.html#javascript-reference + export interface Interchange { + replace: (path: String) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/magellan.html#javascript-reference + export interface Magellan { + calcPoints: () => void; + reflow: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/offcanvas.html#javascript-reference + export interface OffCanvas { + open: (event: Object, trigger : JQuery) => void; + toggle: (event: Object, trigger : JQuery) => void; + close: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/orbit.html#javascript-reference + export interface Orbit { + changeSlide: (isLTR: boolean, chosenSlide?: Object, idx?: number) => void; + geoSync: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/reveal.html#javascript-reference + export interface Reveal { + open: () => void; + toggle: () => void; + close: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/slider.html#javascript-reference + export interface Slider { + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/sticky.html#javascript-reference + export interface Sticky { + _pauseListeners: (scrollListener: String) => void; + _calc: (checkSizes: boolean, scroll: number) => void; + destroy: () => void; + emCalc: (number: any) => void; + } + + // http://foundation.zurb.com/sites/docs/tabs.html#javascript-reference + export interface Tabs { + _handleTabChange: ($target : JQuery) => void; + selectTab: ($target : JQuery) => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/toggler.html#javascript-reference + export interface Toggler { + toggle: () => void; + destroy: () => void; + } + + // http://foundation.zurb.com/sites/docs/tooltip.html#javascript-reference + export interface Tooltip { + show: () => void; + hide: () =>void; + toggle: () => void; + destroy: () => void; + } + + // Utilities + // --------- + + export interface Box { + ImNotTouchingYou: (element: Object, parent?: Object, lrOnly?:boolean, tbOnly?:boolean) => boolean; + GetDimensions: (element: Object) => Object; + GetOffsets: (element: Object, anchor: Object, position:String, vOffset:number, hOffset:number, isOverflow:boolean) => Object; + } + + export interface KeyBoard { + parseKey: (event:any) => String; + findFocusable: ($element:Object) => Object; + } + + export interface MediaQuery { + get: (size:String) => String; + atLeast: (size:String) => boolean; + queries:Array; + current:any; + } + + export interface Motion { + animateIn: (element: Object, animation:any, cb:Function) => void; + animateOut: (element: Object, animation:any, cb:Function) => void; + } + + interface Move { + // TODO + } + + interface Nest { + // TODO + } + + export interface Timer { + start: () => void; + restart: () => void; + pause: () => void; + } + + interface Touch { + // TODO :extension on jQuery + } + + interface Triggers { + // TODO :extension on jQuery + } + + interface FoundationStatic { + version : string; + + rtl: () => boolean; + plugin: (plugin: Object, name:String) => void; + registerPlugin: (plugin: Object) => void; + unregisterPlugin: (plugin: Object) => void; + GetYoDigits: (length: number, namespace?: String) => String; + reflow: (elem: Object, plugins?: Array|String) => void; + getFnName: (fn: String) => String; + transitionend: () => String; + + util : { + throttle(func : (...args : any[]) => any, delay : number) : (...args : any[]) => any; + }; + onImagesLoaded: (images:Object, cb:Function) => void; + + Abide: (element:Object, options:AbideOptions) => void; + + } +} + +interface JQuery { + foundation(method:String|Array) : JQuery; +} + +declare var Foundation : Foundation.FoundationStatic; From e7791ea53eb7cbfe3357f1a15e9f304698bfacea Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 3 Dec 2015 01:13:31 +0900 Subject: [PATCH 078/474] Add type definitions for react-infinite package Project: https://github.com/seatgeek/react-infinite --- react-infinite/react-infinite-tests.tsx | 113 ++++++++++++++++++++++++ react-infinite/react-infinite.d.ts | 36 ++++++++ 2 files changed, 149 insertions(+) create mode 100644 react-infinite/react-infinite-tests.tsx create mode 100644 react-infinite/react-infinite.d.ts diff --git a/react-infinite/react-infinite-tests.tsx b/react-infinite/react-infinite-tests.tsx new file mode 100644 index 0000000000..91a86abce2 --- /dev/null +++ b/react-infinite/react-infinite-tests.tsx @@ -0,0 +1,113 @@ +/// +/// + +import * as React from 'react'; +import Infinite = require('react-infinite'); + +class Test1 extends React.Component<{}, {}> { + render() { + return ( + +
+
+
+ + ); + } +} + +class Test2 extends React.Component<{}, {}> { + render() { + return ( + +
+
+
+ + ); + } +} + +class Test3 extends React.Component<{}, {}> { + render() { + return ( + +
+
+
+ + ); + } +} + +class Test4 extends React.Component<{}, {}> { + render() { + return ( + +
+
+
+ + ); + } +} + +var ListItem = React.createClass<{key: number; num: number;}, {}>({ + render: function() { + return
+ List Item {this.props.num} +
; + } +}); + +var InfiniteList = React.createClass({ + getInitialState: function() { + return { + elements: this.buildElements(0, 20), + isInfiniteLoading: false + } + }, + + buildElements: function(start: number, end: number) { + var elements = [] as React.ReactElement[]; + for (var i = start; i < end; i++) { + elements.push() + } + return elements; + }, + + handleInfiniteLoad: function() { + var that = this; + this.setState({ + isInfiniteLoading: true + }); + setTimeout(function() { + var elemLength = that.state.elements.length, + newElements = that.buildElements(elemLength, elemLength + 1000); + that.setState({ + isInfiniteLoading: false, + elements: that.state.elements.concat(newElements) + }); + }, 2500); + }, + + elementInfiniteLoad: function() { + return
+ Loading... +
; + }, + + render: function() { + return + {this.state.elements} + ; + } +}); diff --git a/react-infinite/react-infinite.d.ts b/react-infinite/react-infinite.d.ts new file mode 100644 index 0000000000..123883a0e0 --- /dev/null +++ b/react-infinite/react-infinite.d.ts @@ -0,0 +1,36 @@ +// Type definitions for react-infinite +// Project: https://github.com/seatgeek/react-infinite +// Definitions by: rhysd +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "react-infinite" { + import Infinite = ReactInfinite.Infinite; + export = Infinite; +} + +declare namespace ReactInfinite { + import React = __React; + + interface InfiniteProps extends React.Props { + elementHeight: number | number[]; + containerHeight?: number; + preloadBatchSize?: number | Object; + preloadAdditionalHeight?: number | Object; + handleScroll?: (node: React.ReactElement) => void; + infiniteLoadBeginBottomOffset?: number; + infiniteLoadBeginEdgeOffset?: number; + onInfiniteLoad?: () => void; + loadingSpinnerDelegate?: React.ReactElement; + isInfiniteLoading?: boolean; + timeScrollStateLastsForAfterUserScrolls?: number; + className?: string; + useWindowAsScrollContainer?: boolean; + displayBottomUpwards?: boolean; + } + + export class Infinite extends React.Component { + static containerHeightScaleFactor(n: number): any; + } +} From f91008d4cd78bc2e8b419a7f19c2b0267aef932c Mon Sep 17 00:00:00 2001 From: gscshoyru Date: Wed, 2 Dec 2015 12:19:39 -0500 Subject: [PATCH 079/474] Add unregister functions to handlebars.d.ts --- handlebars/handlebars.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/handlebars/handlebars.d.ts b/handlebars/handlebars.d.ts index 9a0aa510ac..54dc7e9aef 100644 --- a/handlebars/handlebars.d.ts +++ b/handlebars/handlebars.d.ts @@ -7,6 +7,8 @@ declare module Handlebars { export function registerHelper(name: string, fn: Function, inverse?: boolean): void; export function registerPartial(name: string, str: any): void; + export function unregisterHelper(name: string): void; + export function unregisterPartial(name: string): void; export function K(): void; export function createFrame(object: any): any; export function Exception(message: string): void; From c27b57a8460685c6d181fe7e3effbe06009a8795 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Wed, 2 Dec 2015 18:25:59 +0100 Subject: [PATCH 080/474] Add very basic minimal hopscotch API --- hopscotch/hopscotch-tests.ts | 55 ++++++++++++++++++++++++++++++++++++ hopscotch/hopscotch.d.ts | 45 +++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 hopscotch/hopscotch-tests.ts create mode 100644 hopscotch/hopscotch.d.ts diff --git a/hopscotch/hopscotch-tests.ts b/hopscotch/hopscotch-tests.ts new file mode 100644 index 0000000000..52d0213952 --- /dev/null +++ b/hopscotch/hopscotch-tests.ts @@ -0,0 +1,55 @@ +/// + +var tourDefinition = { + id: 'intro-tour', + steps: [ + { + target: '.popupTarget', + placement: 'bottom', + title: 'A tour step', + content: 'A tour message' + }, + { + target: [".aSelector"], + placement: 'bottom', + + yOffset: 10, + width: 400, + xOffset: -420, + arrowOffset: 380 + }, + { + target: '.domainPatterns form', + placement: 'right', + title: 'A question?', + content: "Hello!", + onShow: function () { } + }, + { + target: '.home-button', + placement: 'left', + title: "Let's get started", + content: "Content", + + multipage: true, + nextOnTargetClick: true, + showNextButton: false + }, + { + target: '.buttons', + placement: 'top', + + title: 'Another title', + content: "A message", + + showNextButton: false, + nextOnTargetClick: true, + onShow: function () { } + } + ], + skipIfNoElement: false, + onClose: function () { }, + onEnd: function () { } +}; + +hopscotch.startTour(tourDefinition); diff --git a/hopscotch/hopscotch.d.ts b/hopscotch/hopscotch.d.ts new file mode 100644 index 0000000000..e7f7be6e9b --- /dev/null +++ b/hopscotch/hopscotch.d.ts @@ -0,0 +1,45 @@ +// Type definitions for Hopscotch v0.2.5 +// Project: http://linkedin.github.io/hopscotch/ +// Definitions by: Tim Perry +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface TourDefinition { + id: string; + steps: StepDefinition[]; + + skipIfNoElement: boolean; + + onEnd: () => void; + onClose: () => void; +} + +interface StepDefinition { + placement: string; + target: string | HTMLElement | Array + + title?: string; + content?: string; + + xOffset?: number; + yOffset?: number; + arrowOffset?: number; + + height?: number; + width?: number; + + multipage?: boolean; + showNextButton?: boolean; + nextOnTargetClick?: boolean; + + onShow?: () => void; +} + +interface HopscotchStatic { + startTour(tour: TourDefinition, stepNum?: number): void; +} + +declare var hopscotch: HopscotchStatic; + +declare module "hopscotch" { + export = hopscotch; +} From 2162519f36fb92efda7641788fb8e34fd9029be9 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 2 Dec 2015 23:05:34 +0500 Subject: [PATCH 081/474] lodash: signatures of _.sortedLastIndex have been changed --- lodash/lodash-tests.ts | 91 +++++++++++++-- lodash/lodash.d.ts | 249 +++++++++++++++++++++++++++++++++-------- 2 files changed, 280 insertions(+), 60 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9cae2a8721..b64751cf41 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1315,17 +1315,86 @@ module TestSortedIndex { // _.sortedLastIndex module TestSortedLastIndex { - result = _.sortedLastIndex([20, 30, 50], 40); - result = _.sortedLastIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); - var sortedLastIndexDict: { wordToNumber: { [idx: string]: number } } = { - 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } - }; - result = _.sortedLastIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) { - return sortedLastIndexDict.wordToNumber[word]; - }); - result = _.sortedLastIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) { - return this.wordToNumber[word]; - }, sortedLastIndexDict); + type SampleType = {a: number; b: string; c: boolean;}; + + let array: SampleType[]; + let list: _.List; + + let value: SampleType; + + let stringIterator: (x: string) => number; + let arrayIterator: (x: SampleType) => number; + let listIterator: (x: SampleType) => number; + + { + let result: number; + + result = _.sortedLastIndex('', ''); + result = _.sortedLastIndex('', '', stringIterator); + result = _.sortedLastIndex('', '', stringIterator, any); + result = _.sortedLastIndex('', '', stringIterator); + result = _.sortedLastIndex('', '', stringIterator, any); + + result = _.sortedLastIndex(array, value); + result = _.sortedLastIndex(array, value, arrayIterator); + result = _.sortedLastIndex(array, value, arrayIterator, any); + result = _.sortedLastIndex(array, value, ''); + result = _.sortedLastIndex(array, value, {a: 42}); + result = _.sortedLastIndex(array, value, arrayIterator); + result = _.sortedLastIndex(array, value, arrayIterator, any); + result = _.sortedLastIndex<{a: number}, SampleType>(array, value, {a: 42}); + + result = _.sortedLastIndex(list, value); + result = _.sortedLastIndex(list, value, listIterator); + result = _.sortedLastIndex(list, value, listIterator, any); + result = _.sortedLastIndex(list, value, ''); + result = _.sortedLastIndex(list, value, {a: 42}); + result = _.sortedLastIndex(list, value, listIterator); + result = _.sortedLastIndex(list, value, listIterator, any); + result = _.sortedLastIndex<{a: number}, SampleType>(list, value, {a: 42}); + + result = _('').sortedLastIndex(''); + result = _('').sortedLastIndex('', stringIterator); + result = _('').sortedLastIndex('', stringIterator, any); + + result = _(array).sortedLastIndex(value); + result = _(array).sortedLastIndex(value, arrayIterator); + result = _(array).sortedLastIndex(value, arrayIterator, any); + result = _(array).sortedLastIndex(value, ''); + result = _(array).sortedLastIndex<{a: number}>(value, {a: 42}); + + result = _(list).sortedLastIndex(value); + result = _(list).sortedLastIndex(value, listIterator); + result = _(list).sortedLastIndex(value, listIterator, any); + result = _(list).sortedLastIndex(value, ''); + result = _(list).sortedLastIndex(value, {a: 42}); + result = _(list).sortedLastIndex(value, listIterator); + result = _(list).sortedLastIndex(value, listIterator, any); + result = _(list).sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('').chain().sortedLastIndex(''); + result = _('').chain().sortedLastIndex('', stringIterator); + result = _('').chain().sortedLastIndex('', stringIterator, any); + + result = _(array).chain().sortedLastIndex(value); + result = _(array).chain().sortedLastIndex(value, arrayIterator); + result = _(array).chain().sortedLastIndex(value, arrayIterator, any); + result = _(array).chain().sortedLastIndex(value, ''); + result = _(array).chain().sortedLastIndex<{a: number}>(value, {a: 42}); + + result = _(list).chain().sortedLastIndex(value); + result = _(list).chain().sortedLastIndex(value, listIterator); + result = _(list).chain().sortedLastIndex(value, listIterator, any); + result = _(list).chain().sortedLastIndex(value, ''); + result = _(list).chain().sortedLastIndex(value, {a: 42}); + result = _(list).chain().sortedLastIndex(value, listIterator); + result = _(list).chain().sortedLastIndex(value, listIterator, any); + result = _(list).chain().sortedLastIndex<{a: number}, SampleType>(value, {a: 42}); + } } // _.tail diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ed8d72443a..a8d6e5736b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2156,71 +2156,222 @@ declare module _ { //_.sortedLastIndex interface LoDashStatic { /** - * Uses a binary search to determine the highest 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 - * return the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false. - * @param array The sorted list. - * @param value The value to determine its index within `list`. - * @param callback Iterator to compute the sort ranking of each value, optional. - * @return The index at which value should be inserted into array. - **/ - sortedLastIndex( - array: Array, - value: T, - callback?: (x: T) => TSort, - thisArg?: any): number; - - /** - * @see _.sortedLastIndex - **/ + * This method is like _.sortedIndex except that it returns the highest index at which value should be + * inserted into array in order to maintain its sort order. + * + * @param array The sorted array to inspect. + * @param value The value to evaluate. + * @param iteratee The function invoked per iteration. + * @param thisArg The this binding of iteratee. + * @return Returns the index at which value should be inserted into array. + */ sortedLastIndex( array: List, value: T, - callback?: (x: T) => TSort, - thisArg?: any): number; + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; /** - * @see _.sortedLastIndex - * @param pluckValue the _.pluck style callback - **/ - sortedLastIndex( - array: Array, - value: T, - pluckValue: string): number; - - /** - * @see _.sortedLastIndex - * @param pluckValue the _.pluck style callback - **/ + * @see _.sortedLastIndex + */ sortedLastIndex( array: List, value: T, - pluckValue: string): number; + iteratee?: (x: T) => any, + thisArg?: any + ): number; /** - * @see _.sortedLastIndex - * @param pluckValue the _.where style callback - **/ - sortedLastIndex( - array: Array, + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, value: T, - whereValue: W): number; + iteratee: string + ): number; /** - * @see _.sortedLastIndex - * @param pluckValue the _.where style callback - **/ + * @see _.sortedLastIndex + */ sortedLastIndex( array: List, value: T, - whereValue: W): number; + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + array: List, + value: T, + iteratee: Object + ): number; + } + + interface LoDashImplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): number; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): number; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): number; + } + + interface LoDashExplicitWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: string, + iteratee?: (x: string) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => TSort, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee?: (x: T) => any, + thisArg?: any + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: string + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: W + ): LoDashExplicitWrapper; + + /** + * @see _.sortedLastIndex + */ + sortedLastIndex( + value: T, + iteratee: Object + ): LoDashExplicitWrapper; } //_.tail From c9fe6c37beb8305805ed3f63749e1b6454f913fd Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Wed, 2 Dec 2015 11:41:00 -0700 Subject: [PATCH 082/474] material-ui - add missing event handler. Add `onClick` to `ListItem` component. --- material-ui/material-ui.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index a27a0ee09d..5da618dc73 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -571,6 +571,7 @@ declare namespace __MaterialUI { nestedItems?: React.ReactElement[]; onKeyboardFocus?: React.FocusEventHandler; onNestedListToggle?: (item: ListItem) => void; + onClick?: React.MouseEventHandler; rightAvatar?: React.ReactElement; rightIcon?: React.ReactElement; rightIconButton?: React.ReactElement; From ac1ab0907523267019a1ee4f0dc4dc268b5bc1d4 Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Wed, 2 Dec 2015 15:42:15 -0500 Subject: [PATCH 083/474] Intro.js - Fixing types --- intro.js/intro.js-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/intro.js/intro.js-tests.ts b/intro.js/intro.js-tests.ts index b8e8126ae9..0ec5938f5c 100644 --- a/intro.js/intro.js-tests.ts +++ b/intro.js/intro.js-tests.ts @@ -3,6 +3,8 @@ var intro = introJs(); intro.setOption('doneLabel', 'Next page'); +intro.setOption('overlayOpacity', 50); +intro.setOption('showProgress', true); intro.setOptions({ steps: [ { From c569355ceb6aaf433a17910ed943b2638fd9ecd1 Mon Sep 17 00:00:00 2001 From: Chris Barr Date: Wed, 2 Dec 2015 15:43:44 -0500 Subject: [PATCH 084/474] Fixing Types --- intro.js/intro.js.d.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/intro.js/intro.js.d.ts b/intro.js/intro.js.d.ts index 15a73f5178..6763124ba9 100644 --- a/intro.js/intro.js.d.ts +++ b/intro.js/intro.js.d.ts @@ -1,20 +1,13 @@ -// Type definitions for intro.js 1.0.0 +// Type definitions for intro.js 1.1.1 // Project: https://github.com/usablica/intro.js // Definitions by: Maxime Fabre // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module IntroJs { - enum Positions { - top, - left, - right, - bottom - } - interface Step { intro: string; - element?: string|HTMLElement; - position?: string|Positions; + element?: string|HTMLElement|Element; + position?: string; } interface Options { @@ -49,7 +42,7 @@ declare module IntroJs { refresh(): IntroJs; - setOption(option: string, value: string|number): IntroJs; + setOption(option: string, value: string|number|boolean): IntroJs; setOptions(options: Options): IntroJs; onexit(callback: Function): IntroJs; From ea650f84de4600c5b20a4cb9d6991e89aa218928 Mon Sep 17 00:00:00 2001 From: Merott Movahedi Date: Wed, 2 Dec 2015 21:06:24 +0000 Subject: [PATCH 085/474] add Stamplay.init definition for setting the app ID --- stamplay-js-sdk/stamplay-js-sdk-tests.ts | 2 +- stamplay-js-sdk/stamplay-js-sdk.d.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/stamplay-js-sdk/stamplay-js-sdk-tests.ts b/stamplay-js-sdk/stamplay-js-sdk-tests.ts index bfc229d491..88b6d713d6 100644 --- a/stamplay-js-sdk/stamplay-js-sdk-tests.ts +++ b/stamplay-js-sdk/stamplay-js-sdk-tests.ts @@ -1,5 +1,5 @@ /// - +Stamplay.init('sample'); var userFn = Stamplay.User(); var user = new userFn.Model; var colTags = Stamplay.Cobject('tag'); diff --git a/stamplay-js-sdk/stamplay-js-sdk.d.ts b/stamplay-js-sdk/stamplay-js-sdk.d.ts index 154dc414e4..ebd0d31b32 100644 --- a/stamplay-js-sdk/stamplay-js-sdk.d.ts +++ b/stamplay-js-sdk/stamplay-js-sdk.d.ts @@ -26,6 +26,7 @@ declare module Stamplay { } export interface StamplayStatic { + init(appId : string) : void; User() : IStamplayObject Cobject(object : string) : IStamplayObject } From f43a366a923d3e03f23c509a426e5818b72dcca1 Mon Sep 17 00:00:00 2001 From: matb Date: Wed, 2 Dec 2015 22:21:24 +0100 Subject: [PATCH 086/474] Add missing ; to swig.d.ts Swig.d.ts was missing a ; in line 31. This leads to warnings in this file. --- swig/swig.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swig/swig.d.ts b/swig/swig.d.ts index 4f2b221238..5de872c10c 100644 --- a/swig/swig.d.ts +++ b/swig/swig.d.ts @@ -28,7 +28,7 @@ declare module "swig" { compileFile(pathname: string, options?: SwigOptions): (locals?: any) => string; render(source: string, options?: SwigOptions): string; renderFile(pathName: string, locals: any, cb: (err: Error, output: string) => void): void; - renderFile(pathName: string, locals?: any): string + renderFile(pathName: string, locals?: any): string; run(templateFn: Function, locals?: any, filePath?: string): string; invalidateCache(): void; @@ -155,4 +155,4 @@ declare module "swig" { export function renderFile(pathName: string, locals?: any): string export function run(templateFn: Function, locals?: any, filePath?: string): string; export function invalidateCache(): void; -} \ No newline at end of file +} From dc36a0774fc9d9fba862daad4f42ad89513d8473 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 3 Dec 2015 06:43:54 +0500 Subject: [PATCH 087/474] lodash: signatures of _.isNaN have been changed --- lodash/lodash-tests.ts | 25 +++++++++++++++++++------ lodash/lodash.d.ts | 9 +++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9cae2a8721..dff86b8d21 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5397,12 +5397,25 @@ result = _({}).isMatch({}, testIsMatchCustiomizerFn); result = _({}).isMatch({}, testIsMatchCustiomizerFn, {}); // _.isNaN -result = _.isNaN(NaN); -result = _.isNaN(new Number(NaN)); -result = _.isNaN(undefined); -result = _(NaN).isNaN(); -result = _(new Number(NaN)).isNaN(); -result = _(undefined).isNaN(); +module TestIsNaN { + { + let result: boolean; + + result = _.isNaN(any); + + result = _(1).isNaN(); + result = _([]).isNaN(); + result = _({}).isNaN(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNaN(); + result = _([]).chain().isNaN(); + result = _({}).chain().isNaN(); + } +} // _.isNative result = _.isNative(Array.prototype.push); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ed8d72443a..a2142896b8 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9272,7 +9272,9 @@ declare module _ { interface LoDashStatic { /** * Checks if value is NaN. + * * Note: This method is not the same as isNaN which returns true for undefined and other non-numeric values. + * * @param value The value to check. * @return Returns true if value is NaN, else false. */ @@ -9286,6 +9288,13 @@ declare module _ { isNaN(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isNaN + */ + isNaN(): LoDashExplicitWrapper; + } + //_.isNative interface LoDashStatic { /** From 0ab253f326e45430cbad0e2182b080a13cfd0b60 Mon Sep 17 00:00:00 2001 From: Long Yinan Date: Thu, 3 Dec 2015 14:45:42 +0800 Subject: [PATCH 088/474] fix(angularjs): add toJSON method --- angularjs/angular-resource-tests.ts | 5 +++++ angularjs/angular-resource.d.ts | 3 +++ 2 files changed, 8 insertions(+) diff --git a/angularjs/angular-resource-tests.ts b/angularjs/angular-resource-tests.ts index cfa7712cc2..fcf0bd0a96 100644 --- a/angularjs/angular-resource-tests.ts +++ b/angularjs/angular-resource-tests.ts @@ -89,6 +89,9 @@ resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { var promise : angular.IPromise; var arrayPromise : angular.IPromise; +var json: { + [index: string]: any; +}; promise = resource.$delete(); promise = resource.$delete({ key: 'value' }); @@ -127,6 +130,8 @@ promise = resource.$save(function () { }); promise = resource.$save(function () { }, function () { }); promise = resource.$save({ key: 'value' }, function () { }, function () { }); +json = resource.toJSON(); + /////////////////////////////////////// // IResourceService /////////////////////////////////////// diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 76930196ba..2187130ac9 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -136,6 +136,9 @@ declare module angular.resource { /** the promise of the original server interaction that created this instance. **/ $promise : angular.IPromise; $resolved : boolean; + toJSON: () => { + [index: string]: any; + } } /** From 245c7df0958929a3e0e8bc05b2cd292217e8534d Mon Sep 17 00:00:00 2001 From: Harm Berntsen Date: Thu, 3 Dec 2015 13:00:04 +0100 Subject: [PATCH 089/474] Add module declaration for graham_scan --- graham_scan/graham_scan.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/graham_scan/graham_scan.d.ts b/graham_scan/graham_scan.d.ts index 617df2e7e8..dbc30517b2 100644 --- a/graham_scan/graham_scan.d.ts +++ b/graham_scan/graham_scan.d.ts @@ -6,3 +6,7 @@ declare class ConvexHullGrahamScan { addPoint(x: number, y: number): void; getHull(): {x: number, y: number}[]; } + +declare module 'graham_scan' { + export = ConvexHullGrahamScan; +} From 283cf3643ef1774fa0a95b1ab383a0efe3cf8eba Mon Sep 17 00:00:00 2001 From: Igor Kriklivetc Date: Thu, 3 Dec 2015 15:33:46 +0300 Subject: [PATCH 090/474] Update to 15.2.3 --- devextreme/devextreme-15.1.8.d.ts | 6580 +++++++++++++++++++++++++++++ devextreme/devextreme.d.ts | 1587 +++++-- 2 files changed, 7741 insertions(+), 426 deletions(-) create mode 100644 devextreme/devextreme-15.1.8.d.ts diff --git a/devextreme/devextreme-15.1.8.d.ts b/devextreme/devextreme-15.1.8.d.ts new file mode 100644 index 0000000000..83e69504be --- /dev/null +++ b/devextreme/devextreme-15.1.8.d.ts @@ -0,0 +1,6580 @@ +// Type definitions for DevExtreme 15.1.8 +// 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; + /** Hides the last displayed overlay widget. */ + export function hideTopOverlay(): boolean; + /** 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 as a jQuery plugin, Angular directive and Knockout binding. */ + 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 { + /** 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 animation state. */ + from?: any; + /** A function called before animation is started. */ + start?: (element: JQuery, config: AnimationOptions) => void; + /** Specifies a final 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: 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; + /** 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; + /** 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 class Devices implements EventsMixin { + constructor(options: { window: Window }); + /** Overrides actual device information to force the application to operate as if it was running on the specified device. */ + current(deviceName: any): void; + /** Returns information about the current device. */ + current(): Device; + orientationChanged: JQueryCallback; + /** Returns the current device orientation. */ + orientation(): string; + /** Returns real information about the current device regardless of the value passed to the devices.current(deviceName) method. */ + real(): Device; + on(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + on(eventName: string, eventHandler: Function): Devices; + on(events: { [eventName: string]: Function; }): Devices; + off(eventName: "orientationChanged"): Devices; + off(eventName: string): Devices; + off(eventName: "orientationChanged", eventHandler: (e: { orientation: string }) => void): Devices; + off(eventName: string, eventHandler: Function): Devices; + } + /** An object that serves as a namespace for the methods and events specifying information on the current device. */ + export var devices: Devices; + /** 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 initialized event. */ + onInitialized?: Function; + /** 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; + /** Returns the configuration options of this component. */ + option(): { + [optionKey: string]: any; + }; + /** Sets one or more options of this component. */ + option(options: { + [optionKey: string]: any; + }): void; + /** 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; + /** 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 { + 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 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(options?: { + filter?: Object; + group?: 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; + /** 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?: (options?: { + filter?: Object; + group?: Object; + }) => 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 whether or not the DataSource instance requests the total count of items available in the storage. */ + requireTotalCount?: boolean; + /** 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 requireTotalCount option value. */ + requireTotalCount(): boolean; + /** Sets the requireTotalCount option value. */ + requireTotalCount(value: boolean): 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 { + /** Creates an EdmLiteral instance and assigns the specified value to it. */ + constructor(value: string); + /** 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: { + url: string; + method: string; + timeout: number; + params: Object; + payload: Object; + headers: 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 { + 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; + /** 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 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; + /** Registers a handler when a specified key is pressed. */ + registerKeyHandler(key: string, handler: Function): 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; + }; + /** An object that serves as a namespace for DevExtreme Data Visualization Widgets. */ + export module viz { + /** Applies a theme for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(theme: string): void; + /** Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. */ + export function currentTheme(platform: string, colorScheme: string): void; + /** Registers a new theme based on the existing one. */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** Applies a predefined or registered custom palette to all visualization widgets at once. */ + export function currentPalette(paletteName: string): void; + /** Obtains the color sets of a predefined or registered palette. */ + export function getPalette(paletteName: string): Object; + /** Registers a new palette. */ + export function registerPalette(paletteName: string, palette: Object): void; + } +} +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 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; + } + /** A widget that displays required content in a resizable element. */ + export class dxResizable extends DOMComponent { + constructor(element: JQuery, options?: dxResizableOptions); + constructor(element: Element, options?: dxResizableOptions); + } + 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, DataExpressionMixinOptions { + /** 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. + * @deprecated dataSource.paginate.md + */ + 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; + } + /** 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; + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: 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; + /** The editor mask that 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 { + 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; + /** Returns 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, DataExpressionMixinOptions { + /** 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 popup 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; + /** 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. */ + 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 base 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; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: 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; + /** 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?: any; + /** 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; + } + /** 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?: any; + /** The zoom level of the map. */ + zoom?: number; + } + /** An interactive map widget. */ + export class dxMap extends Widget { + constructor(element: JQuery, options?: dxMapOptions); + constructor(element: Element, options?: dxMapOptions); + /** Adds a marker to the map. */ + addMarker(markerOptions: Object): JQueryPromise; + /** Adds a route to the map. */ + addRoute(routeOptions: Object): JQueryPromise; + /** Removes a marker from the map. */ + removeMarker(marker: Object): JQueryPromise; + /** Removes a route from the map. */ + removeRoute(route: any): JQueryPromise; + } + export interface dxLookupOptions extends dxDropDownListOptions { + /** An object defining widget animation options. */ + animation?: fx.AnimationOptions; + /** 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. */ + applyButtonText?: string; + /** A Boolean value specifying whether or not to display the lookup in full-screen mode. */ + fullScreen?: boolean; + focusStateEnabled?: 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; + /** 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; + /** 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. + * @deprecated pageLoadMode.md + */ + 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; + /** 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 { + 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 display a grouped list. */ + grouped?: boolean; + groupRender?: any; + /** 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; + 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 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 item selection mode. */ + 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; + activeStateEnabled?: 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. */ + 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. */ + 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; + /** 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 { + 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 widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: 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; + /** 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. */ + format?: string; + /** A Globalize format string specifying the date display format. */ + formatString?: string; + /** The last date that can be selected within the widget. */ + max?: any; + /** The minimum date that can be selected within the widget. */ + min?: any; + /** 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. + * @deprecated Use 'pickerType' option instead. + */ + useCalendar?: boolean; + /** An object or a value, specifying the date and time currently selected using the date box. */ + value?: any; + /** + * 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 minimal zoom level of a calendar, which is used to pick the date. */ + minZoomLevel?: string; + /** Specifies the type of date/time picker. */ + pickerType?: string; + } + /** A date box widget. */ + export class dxDateBox extends dxDropDownEditor { + constructor(element: JQuery, options?: dxDateBoxOptions); + constructor(element: Element, options?: dxDateBoxOptions); + } + export interface dxCheckBoxOptions extends EditorOptions { + /** 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; + /** 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 { + constructor(element: JQuery, options?: dxCalendarOptions); + 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; + /** Specifies the icon to be displayed on the button. */ + icon?: string; + iconSrc?: string; + /** A template to be used for rendering the dxButton widget. */ + template?: any; + /** 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; + /** Gets 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; + /** Specifies whether widget content is rendered when the widget is shown or when rendering the widget. */ + deferRendering?: boolean; + } + /** 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; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): 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; + 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. */ + 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; + /** Specifies a target Url for the upload request. */ + uploadUrl?: string; + /** Specifies if an end user can remove a file from the selection and interrupt uploading. */ + 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 handler for the uploaded event. */ + onUploaded?: Function; + /** A handler for the uploaded event. */ + onProgress?: Function; + /** A handler for the uploadError event. */ + onUploadError?: Function; + /** A handler for the valueChanged event. */ + onValueChanged?: Function; + } + /** 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 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. */ + 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); + } +} +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; + dxValidator(options: DevExpress.ui.dxValidatorOptions): JQuery; + 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; + dxValidationSummary(options: DevExpress.ui.dxValidationSummaryOptions): JQuery; + dxTooltip(): JQuery; + dxTooltip(options: "instance"): DevExpress.ui.dxTooltip; + dxTooltip(options: string): any; + dxTooltip(options: string, ...params: any[]): any; + dxTooltip(options: DevExpress.ui.dxTooltipOptions): JQuery; + dxResizable(): JQuery; + dxResizable(options: "instance"): DevExpress.ui.dxResizable; + dxResizable(options: string): any; + dxResizable(options: string, ...params: any[]): any; + dxResizable(options: DevExpress.ui.dxResizableOptions): 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; + dxTagBox(): JQuery; + dxTagBox(options: "instance"): DevExpress.ui.dxTagBox; + dxTagBox(options: string): any; + dxTagBox(options: string, ...params: any[]): any; + dxTagBox(options: DevExpress.ui.dxTagBoxOptions): 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; + dxResponsiveBox(): JQuery; + dxResponsiveBox(options: "instance"): DevExpress.ui.dxResponsiveBox; + dxResponsiveBox(options: string): any; + dxResponsiveBox(options: string, ...params: any[]): any; + dxResponsiveBox(options: DevExpress.ui.dxResponsiveBoxOptions): 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; +} + +declare module DevExpress.ui { + 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. */ + baseItemWidth?: number; + /** Specifies the height of the widget. */ + height?: any; + /** Specifies the distance in pixels between adjacent tiles. */ + itemMargin?: number; + /** 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 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; + /** 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; + /** 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. */ + 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 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; + /** The template to be used for rendering an item title. */ + itemTitleTemplate?: 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; + 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; + } +} +interface 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; +} +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; + beforeSend?: (request: Object) => void; + } + /** 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: any): PivotGridField; + /** Sets one or more options of a specified field. */ + field(id: any, 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; + /** Expands all header items of a field. */ + expandAll(id: any): void; + /** Collapses all header items of a field. */ + collapseAll(id: any): 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.ui { + export interface dxSchedulerOptions extends WidgetOptions { + /** Specifies a date displayed on the current scheduler view by default. */ + currentDate?: Date; + /** The earliest date the widget allows you to select. */ + min?: Date; + /** The latest date the widget allows you to select. */ + max?: 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 whether the scheduler data can be edited at runtime. */ + editing?: boolean; + /** 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 AppointmentAdding event. */ + onAppointmentAdding?: Function; + /** A handler for the appointmentAdded event. */ + onAppointmentAdded?: Function; + /** A handler for the AppointmentUpdating event. */ + onAppointmentUpdating?: Function; + /** A handler for the appointmentUpdated event. */ + onAppointmentUpdated?: Function; + /** A handler for the AppointmentDeleting 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; + /** Scrolls the scheduler work space to the specified time. */ + scrollToTime(hours: number, minutes: number): void; + } + 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; + /** 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 { + 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 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. */ + 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; + /** 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. */ + onItemSelected?: Function; + /** A handler for the itemExpanded event. */ + onItemExpanded?: Function; + /** A handler for the itemCollapsed event. */ + onItemCollapsed?: Function; + onItemClick?: Function; + onItemContextMenu?: Function; + onItemRendered?: Function; + onItemHold?: Function; + hoverStateEnabled?: boolean; + focusStateEnabled?: boolean; + } + /** 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 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; + } + 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 { + /** 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 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. */ + 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 { + /** 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. */ + 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; + /** 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 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. */ + 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 field name or a function that returns a field name or a value to be used for grouping column cells. */ + calculateGroupValue?: any; + /** Specifies a field name or a function that returns a field name or a value 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. */ + 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 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. */ + 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; + /** 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; + 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; + }; + /** 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. */ + 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 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 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. */ + 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; + /** 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 keyDown event. */ + onKeyDown?: (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. */ + 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; + /** Indicates whether to display group summary items in parentheses after 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; + /** 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 all the filters of a specific type applied to grid records. */ + 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: any, optionName: string): any; + /** Sets an option of a specific column. */ + columnOption(id: any, 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 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. */ + 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; + /** 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; + /** Deselects the rows that are currently selected within the applied filter. */ + 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; + /** 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 { + onContentReady?: Function; + /** Specifies a data source for the pivot grid. */ + dataSource?: any; + /** Specifies whether or not the widget uses native scrolling. */ + 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 handler for the contextMenuPreparing event. */ + onContextMenuPreparing?: (e: Object) => 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 height of the widget. */ + height?: any; + /** 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; + } +} +interface 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; + 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; +} +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 whether the current command is rendered when a view is being rendered or after a view is shown. */ + renderStage?: string; + /** Specifies the name of the icon shown inside the widget associated with this command. */ + icon?: string; + 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 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; + /** 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. */ + 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; + /** 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.viz.core { + /** + * Applies a theme for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(theme) method instead. + */ + export function currentTheme(theme: string): void; + /** + * Applies a new theme (with the color scheme defined separately) for the entire page with several DevExtreme visualization widgets. + * @deprecated Use the DevExpress.viz.currentTheme(platform, colorScheme) method instead. + */ + export function currentTheme(platform: string, colorScheme: string): void; + /** + * Registers a new theme based on the existing one. + * @deprecated Use the DevExpress.viz.registerTheme(customTheme, baseTheme) method instead. + */ + export function registerTheme(customTheme: Object, baseTheme: string): void; + /** + * Applies a predefined or registered custom palette to all visualization widgets at once. + * @deprecated Use the DevExpress.viz.currentPalette(paletteName) method instead. + */ + export function currentPalette(paletteName: string): void; + /** + * Obtains the color sets of a predefined or registered palette. + * @deprecated Use the DevExpress.viz.getPalette(paletteName) method instead. + */ + export function getPalette(paletteName: string): Object; + /** + * Registers a new palette. + * @deprecated Use the DevExpress.viz.registerPalette(paletteName, palette) method instead. + */ + export function registerPalette(paletteName: string, palette: Object): void; + 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 { + 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; + /** Specifies the z-index for tooltips. */ + zIndex?: number; + container?: any; + /** 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; + /** 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 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; + /** 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 { + /** Returns the widget's SVG markup. */ + svg(): string; + } +} +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 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 + */ + 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 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 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; + 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; + 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; + 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; + 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 that is small enough for the layout to begin adapting. */ + width?: number; + /** Specifies the height of the widget 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; + /** 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; + target: BasePoint; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseChart; + element: Element; + target: BasePoint; + }) => 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 to the Bar and Bubble 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 a 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; + } +} +interface 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; +} +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 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; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxBaseGauge; + element: Element; + target: {}; + }) => void; + } + 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; + } +} +interface JQuery { + 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; +} +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; + /** Sets the name of the palette to be used in the range selector's chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ + palette?: 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; + }; + /** 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: { + startValue: any; + endValue: any; + component: dxRangeSelector; + element: Element; + }) => void; + /** Specifies range selector shutter options. */ + 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. + * @deprecated Use the 'paddingTopBottom' and 'paddingLeftRight' options instead + */ + padding?: number; + /** 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; + /** 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; + }; + } + /** 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; + } +} +interface JQuery { + dxRangeSelector(options?: DevExpress.viz.rangeSelector.dxRangeSelectorOptions): JQuery; + dxRangeSelector(methodName: string, ...params: any[]): any; + dxRangeSelector(methodName: "instance"): DevExpress.viz.rangeSelector.dxRangeSelector; +} +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; + /** 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 { + /** 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; + /** 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. */ + 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 opacity of the Control_Bar. */ + opacity?: number; + }; + /** 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 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; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: dxVectorMap; + element: Element; + target: {}; + }) => 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: { + 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; + } +} +interface JQuery { + dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; + dxVectorMap(methodName: string, ...params: any[]): any; + dxVectorMap(methodName: "instance"): DevExpress.viz.map.dxVectorMap; +} +declare module DevExpress.viz.sparklines { + export interface SparklineTooltip extends viz.core.Tooltip { + /** + * 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. + * @deprecated Tooltip alignment is no more available. + */ + 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 tooltip options. */ + tooltip?: SparklineTooltip; + /** A handler for the tooltipShown event. */ + onTooltipShown?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + /** A handler for the tooltipHidden event. */ + onTooltipHidden?: (e: { + component: BaseSparkline; + element: Element; + }) => void; + } + /** 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; + /** 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 { + constructor(element: JQuery, options?: dxSparklineOptions); + constructor(element: Element, options?: dxSparklineOptions); + } +} +interface JQuery { + 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/devextreme.d.ts b/devextreme/devextreme.d.ts index 83e69504be..706b4bded7 100644 --- a/devextreme/devextreme.d.ts +++ b/devextreme/devextreme.d.ts @@ -1,4 +1,4 @@ -// Type definitions for DevExtreme 15.1.8 +// Type definitions for DevExtreme 15.2.3 // Project: http://js.devexpress.com/ // Definitions by: DevExpress Inc. // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -69,9 +69,7 @@ declare module DevExpress { 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 { } @@ -128,6 +126,8 @@ declare module DevExpress { 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; + /** Stops all started animations. */ + stop(): void; } export class AnimationPresetCollection { /** Resets all the changes made in the animation repository. */ @@ -163,8 +163,8 @@ declare module DevExpress { tablet?: 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; + /** Indicates whether or not the device platform is Windows. */ + win?: boolean; /** Specifies a performance grade of the current device. */ grade?: string; } @@ -262,16 +262,6 @@ declare module DevExpress { 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. */ @@ -310,16 +300,6 @@ declare module DevExpress { } /** 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; @@ -450,9 +430,6 @@ declare module DevExpress { /** 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. */ @@ -583,6 +560,7 @@ declare module DevExpress { /** A function used to customize a web request before it is sent. */ beforeSend?: (request: { url: string; + async: boolean; method: string; timeout: number; params: Object; @@ -593,6 +571,8 @@ declare module DevExpress { 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 whether or not dates found in the response are deserialized. */ + deserializeDates?: boolean; /** 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. */ @@ -714,26 +694,16 @@ declare module DevExpress { 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. */ @@ -774,7 +744,6 @@ declare module DevExpress { 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. */ @@ -787,7 +756,6 @@ declare module DevExpress { 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. */ @@ -835,6 +803,10 @@ declare module DevExpress { export var utils: { /** Sets parameters for the viewport meta tag. */ initMobileViewport(options: { allowZoom?: boolean; allowPan?: boolean; allowSelection?: boolean }): void; + /** Requests that the browser call a specified function to update animation before the next repaint. */ + requestAnimationFrame(callback: Function): number; + /** Cancels an animation frame request scheduled with the requestAnimationFrame method. */ + cancelAnimationFrame(requestID: number): void; }; /** An object that serves as a namespace for DevExtreme Data Visualization Widgets. */ export module viz { @@ -927,6 +899,8 @@ declare module DevExpress.ui { displayValue?: string; /** The minimum number of characters that must be entered into the text box to begin a search. */ minSearchLength?: number; + /** Specifies whether or not the widget displays unfiltered values until a user types a number of characters exceeding the minSearchLength option value. */ + showDataBeforeSearch?: boolean; /** 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. */ @@ -958,7 +932,6 @@ declare module DevExpress.ui { 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. */ @@ -982,6 +955,10 @@ declare module DevExpress.ui { type?: string; width?: any; closeOnBackButton?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user swipes it out of the screen boundaries. */ + closeOnSwipe?: boolean; + /** A Boolean value specifying whether or not the toast is closed if a user clicks it. */ + closeOnClick?: boolean; } /** The toast message widget. */ export class dxToast extends dxOverlay { @@ -991,37 +968,26 @@ declare module DevExpress.ui { 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. */ @@ -1036,9 +1002,7 @@ declare module DevExpress.ui { 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; /** The editor mask that specifies the format of the entered string. */ mask?: string; @@ -1048,6 +1012,8 @@ declare module DevExpress.ui { maskRules?: Object; /** A message displayed when the entered text does not match the specified pattern. */ maskInvalidMessage?: string; + /** Specifies whether the value option holds only characters entered by a user or prompt characters as well. */ + useMaskedValue?: boolean; } /** A base class for text editing widgets. */ export class dxTextEditor extends Editor { @@ -1100,9 +1066,14 @@ declare module DevExpress.ui { 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 Boolean value specifying if the list is scrolled by content. */ + scrollByContent?: boolean; + /** A Boolean value specifying whether to enable or disable scrolling. */ + scrollingEnabled?: boolean; + /** A Boolean value that specifies the availability of navigation buttons. */ + showNavButtons?: boolean; } /** A widget used to display a view and to switch between several views by clicking the appropriate tabs. */ export class dxTabPanel extends dxMultiView { @@ -1110,6 +1081,8 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxTabPanelOptions); } export interface dxSelectBoxOptions extends dxDropDownListOptions { + /** Specifies DOM event names that update a widget's value. */ + valueChangeEvent?: string; /** 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. */ @@ -1125,6 +1098,8 @@ declare module DevExpress.ui { export interface dxTagBoxOptions extends dxSelectBoxOptions { /** Holds the list of selected values. */ values?: Array; + /** A read-only option that holds the last selected value. */ + value?: Object; } /** A widget that allows you to select multiple items from a dropdown list. */ export class dxTagBox extends dxSelectBox { @@ -1134,14 +1109,12 @@ declare module DevExpress.ui { 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. */ @@ -1171,12 +1144,10 @@ declare module DevExpress.ui { 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. */ @@ -1220,6 +1191,7 @@ declare module DevExpress.ui { update(): void; } export interface dxRadioGroupOptions extends CollectionWidgetOptions, DataExpressionMixinOptions { + activeStateEnabled?: boolean; /** Specifies the radio group layout. */ layout?: string; } @@ -1293,12 +1265,24 @@ declare module DevExpress.ui { resizeEnabled?: boolean; /** The height of the widget in pixels. */ height?: any; + /** Specifies the maximum height the widget can reach while resizing. */ + maxHeight?: any; + /** Specifies the maximum width the widget can reach while resizing. */ + maxWidth?: any; + /** Specifies the minimum height the widget can reach while resizing. */ + minHeight?: any; + /** Specifies the minimum width the widget can reach while resizing. */ + minWidth?: any; /** A handler for the hidden event. */ onHidden?: Function; - hiddenAction?: Function; + /** A handler for the resizeStart event. */ + onResizeStart?: Function; + /** A handler for the resize event. */ + onResize?: Function; + /** A handler for the resizeEnd event. */ + onResizeEnd?: 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. */ @@ -1307,10 +1291,8 @@ declare module DevExpress.ui { 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. */ @@ -1379,7 +1361,6 @@ declare module DevExpress.ui { 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; - /** 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; @@ -1388,7 +1369,6 @@ declare module DevExpress.ui { }; /** 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. */ @@ -1404,25 +1384,20 @@ declare module DevExpress.ui { } /** 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. */ @@ -1463,7 +1438,6 @@ declare module DevExpress.ui { focusStateEnabled?: 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. */ @@ -1472,7 +1446,6 @@ declare module DevExpress.ui { 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; /** The text displayed by the widget when nothing is selected. */ @@ -1489,14 +1462,12 @@ declare module DevExpress.ui { 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. */ @@ -1520,8 +1491,6 @@ declare module DevExpress.ui { usePopover?: boolean; /** A handler for the valueChanged event. */ onValueChanged?: Function; - contentReadyAction?: Function; - titleRender?: any; /** A handler for the titleRendered event. */ onTitleRendered?: Function; /** A Boolean value specifying whether or not to display the title in the popup window. */ @@ -1568,7 +1537,6 @@ declare module DevExpress.ui { export interface dxListOptions extends CollectionWidgetOptions { /** A Boolean value specifying whether or not to display a grouped list. */ grouped?: boolean; - groupRender?: any; /** The template to be used for rendering item groups. */ groupTemplate?: any; onItemDeleting?: Function; @@ -1576,20 +1544,16 @@ declare module DevExpress.ui { onItemDeleted?: Function; /** A handler for the groupRendered event. */ onGroupRendered?: 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. */ @@ -1598,14 +1562,12 @@ declare module DevExpress.ui { 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 when the widget shows the scrollbar. */ @@ -1618,7 +1580,6 @@ declare module DevExpress.ui { 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. */ @@ -1630,6 +1591,7 @@ declare module DevExpress.ui { /** Specifies item selection mode. */ selectionMode?: string; selectAllText?: string; + onSelectAllChanged?: Function; /** 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. */ @@ -1737,17 +1699,13 @@ declare module DevExpress.ui { 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 widget content is rendered when the widget is shown or when rendering the widget. */ deferRendering?: boolean; + activeStateEnabled?: boolean; } /** A drop-down editor widget. */ export class dxDropDownEditor extends dxTextBox { @@ -1791,10 +1749,14 @@ declare module DevExpress.ui { interval?: number; /** Specifies the maximum zoom level of a calendar, which is used to pick the date. */ maxZoomLevel?: string; - /** Specifies the minimal zoom level of a calendar, which is used to pick the date. */ + /** Specifies the minimal zoom level of a calendar, which is used to pick the date. */ minZoomLevel?: string; /** Specifies the type of date/time picker. */ pickerType?: string; + /** Specifies the message displayed if the typed value is not a valid date or time. */ + invalidDateMessage?: string; + /** Specifies the message displayed if the specified date is later than the max value or earlier than the min value. */ + dateOutOfRangeMessage?: string; } /** A date box widget. */ export class dxDateBox extends dxDropDownEditor { @@ -1802,6 +1764,7 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxDateBoxOptions); } export interface dxCheckBoxOptions extends EditorOptions { + activeStateEnabled?: boolean; /** Specifies the widget state. */ value?: boolean; /** Specifies the text displayed by the check box. */ @@ -1813,6 +1776,7 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxCheckBoxOptions); } export interface dxCalendarOptions extends EditorOptions { + activeStateEnabled?: boolean; /** Specifies a date displayed on the current calendar page. */ currentDate?: Date; /** Specifies the first day of a week. */ @@ -1829,8 +1793,8 @@ declare module DevExpress.ui { maxZoomLevel?: string; /** Specifies the minimum zoom level of the calendar. */ minZoomLevel?: string; - /** The template to be used for rendering calendar cells. */ - cellTemplate?: any; + /** The template to be used for rendering calendar cells. */ + cellTemplate?: any; } /** A calendar widget. */ export class dxCalendar extends Editor { @@ -1842,7 +1806,6 @@ declare module DevExpress.ui { activeStateEnabled?: boolean; /** A handler for the click event. */ onClick?: any; - clickAction?: any; /** Specifies the icon to be displayed on the button. */ icon?: string; iconSrc?: string; @@ -2015,6 +1978,7 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxProgressBarOptions); } export interface dxSliderOptions extends dxTrackBarOptions { + activeStateEnabled?: boolean; /** The slider step size. */ step?: number; /** The current slider value. */ @@ -2060,6 +2024,135 @@ declare module DevExpress.ui { constructor(element: JQuery, options?: dxRangeSliderOptions); constructor(element: Element, options?: dxRangeSliderOptions); } + export interface dxFormItemLabel { + /** Specifies the label text. */ + text?: string; + /** Specifies whether or not the label is visible. */ + visible?: boolean; + /** Specifies whether or not a colon is displayed at the end of the current label. */ + showColon?: boolean; + /** Specifies the location of a label against the editor. */ + location?: string; + /** Specifies the label horizontal alignment. */ + alignment?: string; + } + export interface dxFormItem { + /** Specifies the type of the current item. */ + itemType?: string; + /** Specifies whether or not the current form item is visible. */ + visible?: boolean; + /** Specifies the sequence number of the item in a form, group or tab. */ + visibleIndex?: number; + /** Specifies a CSS class to be applied to the form item. */ + cssClass?: string; + /** Specifies the number of columns spanned by the item. */ + colSpan?: number; + } + export interface dxFormSimpleItem extends dxFormItem { + /** Specifies the path to the formData object field bound to the current form item. */ + dataField?: string; + /** Specifies the form item name. */ + name?: string; + /** Specifie which editor widget is used to display and edit the form item value. */ + editorType?: string; + /** Specifies configuration options for the editor widget of the current form item. */ + editorOptions?: Object; + /** A template to be used for rendering the form item. */ + template?: any; + /** Specifies the help text displayed for the current form item. */ + helpText?: string; + /** Specifies whether the current form item is required. */ + isRequired?: boolean; + /** Specifies options for the form item label. */ + label?: dxFormItemLabel; + /** An array of validation rules to be checked for the form item editor. */ + validationRules?: Array; + } + export interface dxFormGroupItem extends dxFormItem { + /** Specifies the group caption. */ + caption?: string; + /** A template to be used for rendering the group item. */ + template?: any; + /** The count of columns in the group layout. */ + colCount?: number; + /** Specifies whether or not all group item labels are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the group. */ + items?: Array; + } + export interface dxFormTab { + /** Specifies the tab title. */ + title?: string; + /** The count of columns in the tab layout. */ + colCount?: number; + /** Specifies whether or not labels of items displayed within the current tab are aligned. */ + alignItemLabels?: boolean; + /** Holds an array of form items displayed within the tab. */ + items?: Array; + } + export interface dxFormTabbedItem extends dxFormItem { + /** Holds a configuration object for the dxTabPanel widget used to display the current form item. */ + tabPanelOptions?: Object; + /** An array of tab configuration objects. */ + tabs?: Array; + } + export interface dxFormOptions extends WidgetOptions { + /** An object providing data for the form. */ + formData?: Object; + /** The count of columns in the form layout. */ + colCount?: any; + /** Specifies the location of a label against the editor. */ + labelLocation?: string; + /** Specifies whether or not all editors on the form are read-only. */ + readOnly?: boolean; + /** A handler for the fieldDataChanged event. */ + onFieldDataChanged?: (e: Object) => void; + /** A handler for the editorEnterKey event. */ + onEditorEnterKey?: (e: Object) => void; + /** Specifies a function that customizes a form item after it has been created. */ + customizeItem?: Function; + /** The minimum column width used for calculating column count in the form layout. */ + minColWidth?: number; + /** Specifies whether or not all root item labels are aligned. */ + alignItemLabels?: boolean; + /** Specifies whether or not item labels in all groups are aligned. */ + alignItemLabelsInAllGroups?: boolean; + /** Specifies whether or not a colon is displayed at the end of form labels. */ + showColonAfterLabel?: boolean; + /** Specifies whether or not the required mark is displayed for optional fields. */ + showRequiredMark?: boolean; + /** Specifies whether or not the optional mark is displayed for optional fields. */ + showOptionalMark?: boolean; + /** The text displayed for required fields. */ + requiredMark?: string; + /** The text displayed for optional fields. */ + optionalMark?: string; + /** Specifies whether or not the total validation summary is displayed on the form. */ + showValidationSummary?: boolean; + /** Holds an array of form items. */ + items?: Array; + /** A Boolean value specifying whether to enable or disable form scrolling. */ + scrollingEnabled?: boolean; + } + /** A form widget used to display and edit values of object fields. */ + export class dxForm extends Widget { + constructor(element: JQuery, options?: dxFormOptions); + constructor(element: Element, options?: dxFormOptions); + /** Updates the specified field of the formData object and the corresponding editor on the form. */ + updateData(dataField: string, value: any): void; + /** Updates the specified fields of the formData object and the corresponding editors on the form. */ + updateData(data: Object): void; + /** Updates the value of a form item option. */ + itemOption(field: string, option: string, value: any): void; + /** Updates the values of form item options. */ + itemOption(field: string, options: Object): void; + /** Returns an editor instance associated with the specified formData field. */ + getEditor(field: string): Object; + /** Updates the dimensions of the widget contents. */ + updateDimensions(): JQueryPromise; + /** Validates the values of all editors on the form against the list of the validation rules specified for each form item. */ + validate(): Object; + } } interface JQuery { dxProgressBar(): JQuery; @@ -2276,6 +2369,11 @@ interface JQuery { dxAutocomplete(options: string): any; dxAutocomplete(options: string, ...params: any[]): any; dxAutocomplete(options: DevExpress.ui.dxAutocompleteOptions): JQuery; + dxForm(): JQuery; + dxForm(options: "instance"): DevExpress.ui.dxForm; + dxForm(options: string): any; + dxForm(options: string, ...params: any[]): any; + dxForm(options: DevExpress.ui.dxForm): JQuery; } declare module DevExpress.ui { @@ -2286,6 +2384,8 @@ declare module DevExpress.ui { baseItemHeight?: number; /** Specifies the width of the base tile view item. */ baseItemWidth?: number; + /** Specifies whether tiles are placed horizontally or vertically. */ + direction?: string; /** Specifies the height of the widget. */ height?: any; /** Specifies the distance in pixels between adjacent tiles. */ @@ -2301,6 +2401,7 @@ declare module DevExpress.ui { scrollPosition(): number; } export interface dxSwitchOptions extends EditorOptions { + activeStateEnabled?: boolean; /** Text displayed when the widget is in a disabled state. */ offText?: string; /** Text displayed when the widget is in an enabled state. */ @@ -2314,6 +2415,8 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxSwitchOptions); } export interface dxSlideOutViewOptions extends WidgetOptions { + /** Specifies the current menu position. */ + menuPosition?: string; /** 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. */ @@ -2343,10 +2446,10 @@ declare module DevExpress.ui { activeStateEnabled?: boolean; /** A Boolean value specifying whether or not to display a grouped menu. */ menuGrouped?: boolean; - menuGroupRender?: any; + /** Specifies the current menu position. */ + menuPosition?: string; /** The name of the template used to display a group header. */ menuGroupTemplate?: any; - menuItemRender?: any; /** The template used to render menu items. */ menuItemTemplate?: any; /** A handler for the menuGroupRendered event. */ @@ -2409,18 +2512,15 @@ declare module DevExpress.ui { 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; - buttonIconSrc?: string; /** The text displayed in the DropDownMenu button. */ buttonText?: string; + buttonIconSrc?: 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. */ @@ -2433,7 +2533,6 @@ declare module DevExpress.ui { 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. */ @@ -2447,7 +2546,6 @@ declare module DevExpress.ui { 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. */ @@ -2540,7 +2638,7 @@ declare module DevExpress.data { 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. */ + /** Specifies how to aggregate field data. Cannot be used for the 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: { @@ -2594,18 +2692,60 @@ declare module DevExpress.data { allowExpandAll?: boolean; /** Specifies the absolute width of the field in the pivot grid. */ width?: number; + /** Specifies the summary post-processing algorithm. */ + summaryDisplayMode?: string; + /** Specifies whether to summarize each next summary value with the previous one by rows or columns. */ + runningTotal?: string; + /** Specifies whether to allow the predefined summary post-processing functions ('absoluteVariation' and 'percentVariation') and runningTotal to take values of different groups into account. */ + allowCrossGroupCalculation?: boolean; + /** Specifies a callback function that allows you to modify summary values after they are calculated. */ + calculateSummaryValue?: (e: Object) => number; + /** Specifies whether or not to display Total values for the field. */ + showTotals?: boolean; + /** Specifies whether or not to display Grand Total values for the field. */ + showGrandTotals?: boolean; + } + export class SummaryCell { + /** Gets the parent cell in a specified direction. */ + parent(direction: string): SummaryCell; + /** Gets all children cells in a specified direction. */ + children(direction: string): Array; + /** Gets a partial Grand Total cell of a row or column. */ + grandTotal(direction: string): SummaryCell; + /** Gets the Grand Total of the entire pivot grid. */ + grandTotal(): SummaryCell; + /** Gets the cell next to the current one in a specified direction. */ + next(direction: string): SummaryCell; + /** Gets the cell next to current in a specified direction. */ + next(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the cell prior to the current one in a specified direction. */ + prev(direction: string): SummaryCell; + /** Gets the cell previous to current in a specified direction. */ + prev(direction: string, allowCrossGroup: boolean): SummaryCell; + /** Gets the child cell in a specified direction. */ + child(direction: string, fieldValue: any): SummaryCell; + /** Gets the cell located by the path of the source cell with one field value changed. */ + slice(field: PivotGridField, value: any): SummaryCell; + /** Gets the header cell of a row or column field to which the current cell belongs. */ + field(area: string): PivotGridField; + /** Gets the value of the current cell. */ + value(): any; + /** Gets the value of the current cell. */ + value(isCalculatedValue: boolean): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField): any; + /** Gets the value of any field linked with the current cell. */ + value(field: PivotGridField, isCalculatedValue: boolean): any; } 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. */ + /** Specifies data filtering conditions. Cannot be used for the XmlaStore store type. */ 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. */ @@ -2618,7 +2758,9 @@ declare module DevExpress.data { /** An object that provides access to data for the dxPivotGrid widget. */ export class PivotGridDataSource implements EventsMixin { constructor(options?: PivotGridDataSource); - /** Starts loading data. */ + /** Starts reloading data from any store and updating the data source. */ + reload(): JQueryPromise; + /** Starts updating the data source. Reloads data from the XMLA store only. */ load(): JQueryPromise; /** Indicates whether or not the PivotGridDataSource is currently being loaded. */ isLoading(): boolean; @@ -2644,6 +2786,22 @@ declare module DevExpress.data { collapseAll(id: any): void; /** Disposes of all resources associated with this PivotGridDataSource. */ dispose(): void; + /** Gets the current filter expression. Cannot be used for the XmlaStore store type. */ + filter(): Object; + /** Applies a new filter expression. Cannot be used for the XmlaStore store type. */ + filter(filterExpr: Object): void; + /** Provides access to a list of records (facts) that were used to calculate a specific summary. */ + createDrillDownDataSource(options: { + columnPath?: Array; + rowPath?: Array; + dataIndex?: number; + maxRowCount?: number; + customColumns?: Array; + }): DevExpress.data.DataSource; + /** Gets the current PivotGridDataSource state (fields configuration, sorting, filters, expanded headers, etc.) */ + state(): Object; + /** Sets the PivotGridDataSource state. */ + state(state: Object): void; on(eventName: string, eventHandler: Function): PivotGridDataSource; on(events: { [eventName: string]: Function; }): PivotGridDataSource; off(eventName: string): PivotGridDataSource; @@ -2666,6 +2824,8 @@ declare module DevExpress.ui { firstDayOfWeek?: number; /** The template to be used for rendering appointments. */ appointmentTemplate?: any; + /** The template to be used for rendering an appointment tooltip. */ + appointmentTooltipTemplate?: 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. */ @@ -2674,14 +2834,36 @@ declare module DevExpress.ui { startDayHour?: number; /** Specifies an end hour in the scheduler view's time interval. */ endDayHour?: number; - /** Specifies whether the scheduler data can be edited at runtime. */ - editing?: boolean; + /** Specifies whether or not the "All-day" panel is visible. */ + showAllDayPanel?: boolean; + /** Specifies cell duration in minutes. */ + cellDuration?: number; + /** Specifies the edit mode for recurrent appointments. */ + recurrenceEditMode?: string; + /** Specifies which editing operations an end-user can perform on appointments. */ + editing?: { + /** Specifies whether or not an end-user can add appointments. */ + allowAdding?: boolean; + /** Specifies whether or not an end-user can change appointment options. */ + allowUpdating?: boolean; + /** Specifies whether or not an end-user can delete appointments. */ + allowDeleting?: boolean; + /** Specifies whether or not an end-user can change an appointment duration. */ + allowResizing?: boolean; + /** Specifies whether or not an end-user can drag appointments. */ + allowDragging?: boolean; + } /** 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. */ + /** + * Indicates whether or not resources of this kind have priority in the color identification of the appointments that have resources of different kinds assigned. + * @deprecated Use the 'useColorAsDefault' property instead + */ mainColor?: 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. */ + useColorAsDefault?: 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. */ @@ -2707,6 +2889,18 @@ declare module DevExpress.ui { onAppointmentDeleted?: Function; /** A handler for the appointmentRendered event. */ onAppointmentRendered?: Function; + /** A handler for the appointmentClick event. */ + onAppointmentClick?: any; + /** A handler for the appointmentDblClick event. */ + onAppointmentDblClick?: any; + /** A handler for the cellClick event. */ + onCellClick?: any; + /** A handler for the appointmentFormCreated event. */ + onAppointmentFormCreated?: Function; + /** Specifies whether or not an end-user can scroll the view horizontally. */ + horizontalScrollingEnabled?: boolean; + /** Specifies whether a user can switch views using tabs or a drop-down menu. */ + useDropDownViewSwitcher?: boolean; } /** A widget that displays scheduled data using different views and provides the capability to load, add and edit appointments. */ export class dxScheduler extends Widget { @@ -2720,6 +2914,8 @@ declare module DevExpress.ui { deleteAppointment(appointment: Object): void; /** Scrolls the scheduler work space to the specified time. */ scrollToTime(hours: number, minutes: number): void; + /** Displays the Appointment Details popup. */ + showAppointmentPopup(appointmentData: Object, createNewAppointment?: boolean): void; } export interface dxColorBoxOptions extends dxDropDownEditorOptions { /** Specifies the text displayed on the button that applies changes and closes the drop-down editor. */ @@ -2737,55 +2933,53 @@ declare module DevExpress.ui { 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 HierarchicalCollectionWidgetOptions extends CollectionWidgetOptions { + /** 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 used as a key. */ + keyExpr?: any; + /** Specifies the name of the data source item field whose value defines whether or not the corresponding widget items is selected. */ + selectedExpr?: 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 whose value defines whether or not the corresponding widget item is disabled. */ + disabledExpr?: 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 widget items is expanded. */ + expandedExpr?: any; + hoverStateEnabled?: boolean; + focusStateEnabled?: boolean; } - export interface dxTreeViewOptions extends CollectionWidgetOptions { + export class HierarchicalCollectionWidget extends CollectionWidget { + } + export interface dxTreeViewOptions extends HierarchicalCollectionWidgetOptions { /** 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. */ 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 the current check boxes display mode. */ + showCheckBoxesMode?: string; /** Specifies whether or not to select nodes recursively. */ selectNodesRecursive?: boolean; + /** Specifies whether or not all parent nodes of an initially expanded node are displayed expanded. */ + expandNodesRecursive?: 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; - /** 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; + /** Specifies the current value used to filter tree view items. */ + searchValue?: string; /** A string value specifying available scrolling directions. */ scrollDirection?: string; /** A handler for the itemSelected event. */ @@ -2798,11 +2992,9 @@ declare module DevExpress.ui { onItemContextMenu?: Function; onItemRendered?: Function; onItemHold?: Function; - hoverStateEnabled?: boolean; - focusStateEnabled?: boolean; } /** A widget displaying specified data items as a tree. */ - export class dxTreeView extends CollectionWidget { + export class dxTreeView extends HierarchicalCollectionWidget { constructor(element: JQuery, options?: dxTreeViewOptions); constructor(element: Element, options?: dxTreeViewOptions); /** Updates the tree view scrollbars according to the current size of the widget content. */ @@ -2822,7 +3014,7 @@ declare module DevExpress.ui { /** Unselects all widget items. */ unselectAll(): void; } - export interface dxMenuBaseOptions extends CollectionWidgetOptions { + export interface dxMenuBaseOptions extends HierarchicalCollectionWidgetOptions { /** 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. */ @@ -2847,10 +3039,8 @@ declare module DevExpress.ui { hide?: number; }; }; - /** 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 { + export class dxMenuBase extends HierarchicalCollectionWidget { constructor(element: JQuery, options?: dxMenuBaseOptions); constructor(element: Element, options?: dxMenuBaseOptions); /** Selects the specified item. */ @@ -2879,16 +3069,12 @@ declare module DevExpress.ui { 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 { @@ -2940,6 +3126,10 @@ declare module DevExpress.ui { paging?: boolean; /** Specifies whether or not sorting must be performed on the server side. */ sorting?: boolean; + /** Specifies whether or not grouping must be performed on the server side. */ + grouping?: boolean; + /** Specifies whether or not summaries calculation must be performed on the server side. */ + summary?: boolean; } export interface dxDataGridColumn { /** Specifies the content alignment within column cells. */ @@ -2948,6 +3138,8 @@ declare module DevExpress.ui { 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 and column header filtering are visible. */ allowFiltering?: boolean; + /** Specifies whether or not to allow filtering by this column using its header. */ + allowHeaderFiltering?: 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. */ @@ -2966,14 +3158,18 @@ declare module DevExpress.ui { 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 to be invoked after the cell value is edited by an end-user and before the new value is saved to the data source. */ + setCellValue?: (rowData: Object, value: any) => void; /** Specifies a callback function that defines filters for customary calculated grid cells. */ - calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string) => Array; + calculateFilterExpression?: (filterValue: any, selectedFilterOperation: string, target: 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 how to get a value to be displayed in a cell when it is not in an editing state. */ + calculateDisplayValue?: any; /** Specifies a field name or a function that returns a field name or a value to be used for grouping column cells. */ calculateGroupValue?: any; /** Specifies a field name or a function that returns a field name or a value to be used for sorting column cells. */ @@ -2986,6 +3182,8 @@ declare module DevExpress.ui { dataType?: string; /** Specifies a custom template for the cell of a grid column when it is in an editing state. */ editCellTemplate?: any; + /** Specifies configuration options for the editor widget of the current column. */ + editorOptions?: Object; /** 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. */ @@ -3021,6 +3219,13 @@ declare module DevExpress.ui { /** Specifies the expression defining the data source field whose values must be replaced. */ valueExpr?: string; }; + /** Specifies column-level options for filtering using a column header filter. */ + headerFilter?: { + /** Specifies the data source to be used for header filter. */ + dataSource?: any; + /** Specifies how header filter values should be combined into groups. */ + groupInterval?: any; + }; /** Specifies a precision for formatted values displayed in a column. */ precision?: number; /** Specifies a filter operation applied to a column. */ @@ -3047,6 +3252,8 @@ declare module DevExpress.ui { showInColumnChooser?: boolean; /** Specifies the identifier of the column. */ name?: string; + /** The form item configuration object. Used only when the editing mode is "form". */ + formItem?: DevExpress.ui.dxFormItem; } export interface dxDataGridOptions extends WidgetOptions { /** Specifies whether the outer borders of the grid are visible or not. */ @@ -3057,40 +3264,30 @@ declare module DevExpress.ui { 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; - 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; + onRowInserting?: (e: { data: Object; cancel: 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; + onRowRemoving?: (e: { data: Object; key: any; cancel: 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; + onRowUpdating?: (e: { oldData: Object; newData: Object; key: any; cancel: any }) => 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. */ @@ -3145,18 +3342,12 @@ declare module DevExpress.ui { /** 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; + /** Specifies whether or not to enable data caching. */ + cacheEnabled?: boolean; /** A handler for the editingStart event. */ onEditingStart?: (e: { data: Object; @@ -3164,27 +3355,31 @@ declare module DevExpress.ui { 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. */ + editEnabled?: boolean; insertEnabled?: boolean; - /** Specifies whether or not records can be deleted from a grid. */ removeEnabled?: boolean; + /** Specifies how grid values can be edited manually. */ + mode?: string; + /** Specifies whether or not grid records can be edited at runtime. */ + allowUpdating?: boolean; + /** Specifies whether or not new grid records can be added at runtime. */ + allowAdding?: boolean; + /** Specifies whether or not grid records can be deleted at runtime. */ + allowDeleting?: boolean; + /** The form configuration object. Used only when the editing mode is "form". */ + form?: DevExpress.ui.dxFormOptions; /** 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. */ + /** Specifies text for a cancel button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating 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; @@ -3192,15 +3387,17 @@ declare module DevExpress.ui { 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. */ + /** Specifies text for a hint that appears when a user hovers the mouse pointer over the "Cancel changes" button. Setting this option makes sense only when the editMode option is set to cell and the validation capabilities are enabled. */ + validationCancelChanges?: string; + /** Specifies text for a button that deletes a row from a grid. Setting this option makes sense only when the allowDeleting 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. */ + /** 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 allowAdding 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. */ + /** Specifies text for a button that turns a row into the editing state. Setting this option makes sense only when the allowUpdating option is set to true. */ editRow?: 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. */ + /** Specifies text for a save button displayed when a row is in the editing state. Setting this option makes sense only when the allowUpdating 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. */ + /** 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 allowDeleting option is set to true. */ undeleteRow?: string; }; }; @@ -3227,6 +3424,10 @@ declare module DevExpress.ui { resetOperationText?: string; /** Specifies text for the operation of clearing the applied filter when a select box is used. */ showAllText?: string; + /** Specifies text for the range start in the 'between' filter type. */ + betweenStartText?: string; + /** Specifies text for the range end in the 'between' filter type. */ + betweenEndText?: 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. */ @@ -3297,10 +3498,8 @@ declare module DevExpress.ui { }; /** 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. */ @@ -3311,6 +3510,14 @@ declare module DevExpress.ui { mode?: string; /** Specifies whether or not a grid must preload pages adjacent to the current page when using virtual scrolling. */ preloadEnabled?: boolean; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + /** Specifies the scrollbar display policy. */ + showScrollbar?: string; + /** Specifies whether or not the scrolling by content is enabled. */ + scrollByContent?: boolean; + /** Specifies whether or not the scrollbar thumb scrolling enabled. */ + scrollByThumb?: boolean; }; /** Specifies options of the search panel. */ searchPanel?: { @@ -3375,17 +3582,13 @@ declare module DevExpress.ui { selectedRowKeys?: Array; /** Specifies options of runtime selection. */ selection?: { + /** Specifies the checkbox row display policy in the multiple mode. */ + showCheckBoxesMode?: string; /** 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. */ @@ -3435,7 +3638,7 @@ declare module DevExpress.ui { /** 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; + customSave?: (state: 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. */ @@ -3554,10 +3757,14 @@ declare module DevExpress.ui { getKeyByRowIndex(rowIndex: number): any; /** Adds a new column to a grid. */ addColumn(columnOptions: dxDataGridColumn): void; + /** Removes the column from the grid. */ + deleteColumn(id: any): void; /** Displays the load panel. */ beginCustomLoading(messageText: string): void; /** Discards changes made in a grid. */ cancelEditData(): void; + /** Checks whether or not the grid contains unsaved changes. */ + hasEditData(): boolean; /** Clears all the filters of a specific type applied to grid records. */ clearFilter(): void; /** Deselects all grid records. */ @@ -3577,9 +3784,19 @@ declare module DevExpress.ui { /** 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; + editCell(rowIndex: number, visibleColumnIndex: number): void; + /** Sets a specific cell into the editing state. */ + editCell(rowIndex: number, dataField: string): void; /** Sets a specific row into the editing state. */ editRow(rowIndex: number): void; + /** Gets the cell value. */ + cellValue(rowIndex: number, dataField: string): any; + /** Gets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number): any; + /** Sets the cell value. */ + cellValue(rowIndex: number, dataField: string, value: any): void; + /** Sets the cell value. */ + cellValue(rowIndex: number, visibleColumnIndex: number, value: any): void; /** Hides the load panel. */ endCustomLoading(): void; /** Expands groups or master rows in a grid. */ @@ -3603,6 +3820,11 @@ declare module DevExpress.ui { /** Hides the column chooser panel. */ hideColumnChooser(): void; /** Adds a new data row to a grid. */ + addRow(): void; + /** + * Adds a new data row to a grid. + * @deprecated Use the addRow() method instead. + */ insertRow(): void; /** Returns the key corresponding to the passed data object. */ keyOf(obj: Object): any; @@ -3617,6 +3839,11 @@ declare module DevExpress.ui { /** Refreshes grid data. */ refresh(): void; /** Removes a specific row from a grid. */ + deleteRow(rowIndex: number): void; + /** + * Removes a specific row from a grid. + * @deprecated Use the deleteRow() method instead. + */ removeRow(rowIndex: number): void; /** Saves changes made in a grid. */ saveEditData(): void; @@ -3656,8 +3883,14 @@ declare module DevExpress.ui { onContentReady?: Function; /** Specifies a data source for the pivot grid. */ dataSource?: any; - /** Specifies whether or not the widget uses native scrolling. */ useNativeScrolling?: any; + /** A configuration object specifying scrolling options. */ + scrolling?: { + /** Specifies the scrolling mode. */ + mode?: string; + /** Specifies whether or not the widget uses native scrolling. */ + useNative?: any; + }; /** Allows an end-user to change sorting options. */ allowSorting?: boolean; /** Allows an end-user to sort columns by summary values. */ @@ -3674,6 +3907,12 @@ declare module DevExpress.ui { showColumnTotals?: boolean; /** Specifies whether to display the Grand Total column. */ showColumnGrandTotals?: boolean; + /** Specifies whether or not to hide rows and columns with no data. */ + hideEmptySummaryCells?: boolean; + /** Specifies where to show the total rows or columns. */ + showTotalsPrior?: string; + /** Specifies whether the outer borders of the grid are visible or not. */ + showBorders?: boolean; /** The Field Chooser configuration options. */ fieldChooser?: { /** Enables or disables the field chooser. */ @@ -3720,6 +3959,8 @@ declare module DevExpress.ui { sortRowBySummary?: string; /** The string to display as a Remove All Sorting context menu item. */ removeAllSorting?: string; + /** The string to display as an Export to Excel file context menu item. */ + exportToExcel?: string; }; /** The Load panel configuration options. */ loadPanel?: { @@ -3744,6 +3985,38 @@ declare module DevExpress.ui { onCellPrepared?: (e: any) => void; /** A handler for the contextMenuPreparing event. */ onContextMenuPreparing?: (e: Object) => void; + /** Specifies options for exporting pivot grid data. */ + export?: { + /** Indicates whether the export feature is enabled for the pivot grid. */ + enabled?: boolean; + /** Specifies a default name for the file to which grid data is exported. */ + fileName?: string; + /** 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; + }; + /** 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 configuration object specifying options related to 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; + }; } /** A data summarization widget for multi-dimensional data analysis and data mining. */ export class dxPivotGrid extends Widget { @@ -3751,8 +4024,12 @@ declare module DevExpress.ui { constructor(element: Element, options?: dxPivotGridOptions); /** Gets the PivotGridDataSource instance. */ getDataSource(): DevExpress.data.PivotGridDataSource; + /** Gets the dxPopup instance of the field chooser window. */ + getFieldChooserPopup(): DevExpress.ui.dxPopup; /** Updates the widget to the size of its content. */ updateDimensions(): void; + /** Exports pivot grid data to the Excel file. */ + exportToExcel(): void; } export interface dxPivotGridFieldChooserOptions extends WidgetOptions { /** Specifies the height of the widget. */ @@ -3847,7 +4124,6 @@ declare module DevExpress.framework { 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. */ @@ -3933,6 +4209,8 @@ declare module DevExpress.framework { viewCache?: Object; /** Specifies a limit for the views that can be cached. */ viewCacheSize?: number; + /** Specifies the current version of application templates. */ + templatesVersion?: string; /** Specifies options for the viewport meta tag of a mobile browser. */ viewPort?: JQuery; /** A custom router to be used in the application. */ @@ -3947,6 +4225,7 @@ declare module DevExpress.framework { navigating: JQueryCallback; navigatingBack: JQueryCallback; resolveLayoutController: JQueryCallback; + resolveViewCacheKey: JQueryCallback; viewDisposed: JQueryCallback; viewDisposing: JQueryCallback; viewHidden: JQueryCallback; @@ -4013,6 +4292,11 @@ declare module DevExpress.framework { layoutController: Object; availableLayoutControllers: Array; }) => void): HtmlApplication; + on(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; on(eventName: "viewDisposed", eventHandler: (e: { viewInfo: Object; }) => void): HtmlApplication; @@ -4041,6 +4325,7 @@ declare module DevExpress.framework { off(eventName: "navigating"): HtmlApplication; off(eventName: "navigatingBack"): HtmlApplication; off(eventName: "resolveLayoutController"): HtmlApplication; + off(eventName: "resolveViewCacheKey"): HtmlApplication; off(eventName: "viewDisposed"): HtmlApplication; off(eventName: "viewDisposing"): HtmlApplication; off(eventName: "viewHidden"): HtmlApplication; @@ -4076,6 +4361,11 @@ declare module DevExpress.framework { layoutController: Object; availableLayoutControllers: Array; }) => void): HtmlApplication; + off(eventName: "resolveViewCacheKey", eventHandler: (e: { + key: string; + navigationItem: Object; + routeData: Object; + }) => void): HtmlApplication; off(eventName: "viewDisposed", eventHandler: (e: { viewInfo: Object; }) => void): HtmlApplication; @@ -4169,13 +4459,13 @@ declare module DevExpress.viz.core { width?: number; } export interface Margins { - /** Specifies the legend's bottom margin in pixels. */ + /** Specifies the distance in pixels between the bottom side of the title and the surrounding widget elements. */ bottom?: number; - /** Specifies the legend's left margin in pixels. */ + /** Specifies the distance in pixels between the left side of the title and the surrounding widget elements. */ left?: number; - /** Specifies the legend's right margin in pixels. */ + /** Specifies the distance between the right side of the title and surrounding widget elements in pixels. */ right?: number; - /** Specifies the legend's bottom margin in pixels. */ + /** Specifies the distance between the top side of the title and surrounding widget elements in pixels. */ top?: number; } export interface Size { @@ -4184,6 +4474,27 @@ declare module DevExpress.viz.core { /** Specifies the height of the widget. */ height?: number; } + export interface Title { + /** Specifies font options for the title. */ + font?: viz.core.Font; + /** Specifies the widget title's horizontal position. */ + horizontalAlignment?: string; + /** Specifies the widget title's position in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the distance between the title and surrounding widget elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies text for the title. */ + text?: string; + /** Specifies a subtitle for the widget. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } + } export interface Tooltip { /** Specifies the length of the tooltip's arrow in pixels. */ arrowLength?: number; @@ -4193,6 +4504,7 @@ declare module DevExpress.viz.core { color?: string; /** Specifies the z-index for tooltips. */ zIndex?: number; + /** Specifies the container to draw tooltips inside of it. */ container?: any; /** Specifies text and appearance of a set of tooltips. */ customizeTooltip?: (arg: Object) => { color?: string; text?: string }; @@ -4283,32 +4595,23 @@ declare module DevExpress.viz.core { visible?: boolean; } export interface BaseWidgetOptions { - drawn?: (widget: Object) => void; /** A handler for the drawn event. */ onDrawn?: (e: { component: BaseWidget; element: Element; }) => void; - incidentOccured?: (incidentInfo: { + /** 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; - /** 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; @@ -4334,11 +4637,6 @@ declare module DevExpress.viz.charts { 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 - */ - 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. */ @@ -4353,6 +4651,20 @@ declare module DevExpress.viz.charts { getAllPoints(): Array; /** Returns visible series points. */ getVisiblePoints(): Array; + /** Returns the name of the series. */ + name: string; + /** Returns the tag of the series. */ + tag: string; + /** Hides a series. */ + hide(): void; + /** Provides information about the hover state of a series. */ + isHovered(): boolean; + /** Provides information about the selection state of a series. */ + isSelected(): boolean; + /** Provides information about the visibility state of a series. */ + isVisible(): boolean; + /** Makes a particular series visible. */ + show(): void; } /** This section describes the methods that can be used in code to manipulate the Point object. */ export interface BasePoint { @@ -4371,9 +4683,9 @@ declare module DevExpress.viz.charts { /** Hides the tooltip of the point. */ hideTooltip(): void; /** Provides information about the hover state of a point. */ - isHovered(): any; + isHovered(): boolean; /** Provides information about the selection state of a point. */ - isSelected(): any; + isSelected(): boolean; /** 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. */ @@ -4389,20 +4701,6 @@ declare module DevExpress.viz.charts { 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 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; @@ -4457,20 +4755,6 @@ declare module DevExpress.viz.charts { 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 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; @@ -4819,7 +5103,10 @@ declare module DevExpress.viz.charts { /** 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. */ + /** + * Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. + * @deprecated use the 'innerRadius' option instead + */ innerRadius?: number; /** An object defining the label configuration options. */ label?: PieSeriesConfigLabel; @@ -4827,7 +5114,10 @@ declare module DevExpress.viz.charts { 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. */ + /** + * Specifies the direction in which the dxPieChart series points are located. + * @deprecated use the 'segmentsDirection' option instead + */ segmentsDirection?: string; /**

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

*/ selectionMode?: string; @@ -4851,17 +5141,34 @@ declare module DevExpress.viz.charts { /** Specifies how many segments must not be grouped. */ topCount?: number; }; - /** Specifies a start angle for a pie chart in arc degrees. */ + /** + * Specifies a start angle for a pie chart in arc degrees. + * @deprecated use the 'startAngle' option instead + */ 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. */ + export interface CommonPieSeriesSettings extends CommonPieSeriesConfig { + /** + * Sets a series type for all series. + * @deprecated use the 'type' option instead + */ type?: string; } + export interface PieSeriesConfig extends CommonPieSeriesConfig { + /** + * Sets the series type. + * @deprecated use the 'type' option instead + */ + type?: string; + /** Specifies the name that identifies the series. */ + name?: string; + /** Specifies data about a series. */ + tag?: any; + } export interface SeriesTemplate { /** Specifies a callback function that returns a series object with individual series settings. */ customizeSeries?: (seriesName: string) => SeriesConfig; @@ -4980,6 +5287,10 @@ declare module DevExpress.viz.charts { opacity?: number; /** Indicates whether or not ticks are visible on an axis. */ visible?: boolean; + /** Specifies tick width. */ + width?: number; + /** Specifies tick length. */ + length?: number; }; /** Specifies the options of the minor ticks. */ minorTick?: { @@ -4989,6 +5300,10 @@ declare module DevExpress.viz.charts { opacity?: number; /** Indicates whether or not the minor ticks are displayed on an axis. */ visible?: boolean; + /** Specifies minor tick width. */ + width?: number; + /** Specifies minor tick length. */ + length?: number; }; /** Indicates whether or not the line that represents an axis in a chart is visible. */ visible?: boolean; @@ -5217,7 +5532,6 @@ declare module DevExpress.viz.charts { 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. */ @@ -5233,21 +5547,18 @@ declare module DevExpress.viz.charts { }) => 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. */ @@ -5257,20 +5568,7 @@ declare module DevExpress.viz.charts { /** Specifies the size of the widget in pixels. */ size?: viz.core.Size; /** 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; - }; + title?: viz.core.Title; /** Specifies tooltip options. */ tooltip?: BaseChartTooltip; /** A handler for the tooltipShown event. */ @@ -5285,8 +5583,6 @@ declare module DevExpress.viz.charts { element: Element; target: BasePoint; }) => 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 { @@ -5294,6 +5590,12 @@ declare module DevExpress.viz.charts { clearSelection(): void; /** Gets the current size of the widget. */ getSize(): { width: number; height: number }; + /** 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): BaseSeries; + /** Gets a series within the chart's series collection by its position number. */ + getSeriesByPos(seriesIndex: number): BaseSeries; /** Displays the loading indicator. */ showLoadingIndicator(): void; /** Conceals the loading indicator. */ @@ -5349,6 +5651,10 @@ declare module DevExpress.viz.charts { seriesSelectionMode?: string; /** Specifies how the chart must behave when series point labels overlap. */ resolveLabelOverlapping?: string; + /** Specifies whether or not 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 a common bar width as a percentage from 0 to 1. */ + barWidth?: number; } export interface Legend extends AdvancedLegend { /** Specifies whether the legend is located outside or inside the chart's plot. */ @@ -5361,8 +5667,6 @@ declare module DevExpress.viz.charts { 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; }; @@ -5374,7 +5678,6 @@ declare module DevExpress.viz.charts { 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. */ @@ -5413,7 +5716,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; @@ -5421,10 +5724,6 @@ declare module DevExpress.viz.charts { 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. */ @@ -5455,12 +5754,6 @@ declare module DevExpress.viz.charts { 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; } @@ -5480,8 +5773,6 @@ declare module DevExpress.viz.charts { 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; @@ -5512,12 +5803,6 @@ declare module DevExpress.viz.charts { 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. */ @@ -5539,17 +5824,29 @@ declare module DevExpress.viz.charts { series?: Array; /** Specifies the diameter of the pie. */ diameter?: number; + /** Specifies the direction that the pie chart segments will occupy. */ + segmentsDirection?: string; + /** Specifies the starting angle in arc degrees for the first segment in a pie chart. */ + startAngle?: number; + /** Specifies the fraction of the inner radius relative to the total radius in the series of the 'doughnut' type. The value should be between 0 and 1. */ + innerRadius?: number; /** A handler for the legendClick event. */ onLegendClick?: any; - legendClick?: any; /** Specifies how a chart must behave when series point labels overlap. */ resolveLabelOverlapping?: string; + /** An object defining the configuration options that are common for all series of the dxPieChart widget. */ + commonSeriesSettings?: CommonPieSeriesSettings; + /** Specifies the type of the pie chart series. */ + type?: 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. */ + /** + * Provides access to the dxPieChart series. + * @deprecated ..\..\BaseChart\3 Methods\getAllSeries().md + */ getSeries(): PieSeries; } } @@ -5584,13 +5881,22 @@ declare module DevExpress.viz.gauges { export interface ScaleTick { /** Specifies the color of the scale's minor ticks. */ color?: string; - /** Specifies an array of custom minor ticks. */ + /** + * Specifies an array of custom minor ticks. + * @deprecated ..\customMinorTicks.md + */ customTickValues?: Array; /** Specifies the length of the scale's minor ticks. */ length?: number; - /** Indicates whether automatically calculated minor ticks are visible or not. */ + /** + * Indicates whether automatically calculated minor ticks are visible or not. + * @deprecated This functionality in not more available + */ showCalculatedTicks?: boolean; - /** Specifies an interval between minor ticks. */ + /** + * Specifies an interval between minor ticks. + * @deprecated ..\minorTickInterval.md + */ tickInterval?: number; /** Indicates whether scale minor ticks are visible or not. */ visible?: boolean; @@ -5598,14 +5904,28 @@ declare module DevExpress.viz.gauges { width?: number; } export interface ScaleMajorTick extends ScaleTick { - /** Specifies whether or not to expand the current major tick interval if labels overlap each other. */ + /** + * Specifies whether or not to expand the current major tick interval if labels overlap each other. + * @deprecated ..\label\overlappingBehavior\useAutoArrangement.md + */ useTicksAutoArrangement?: boolean; } + export interface ScaleMinorTick extends ScaleTick { + /** Specifies the opacity of the scale's minor ticks. */ + opacity?: number; + } 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 the overlap resolving options to be applied to scale labels. */ + overlappingBehavior?: { + /** Specifies whether or not to expand the current major tick interval if labels overlap each other. */ + useAutoArrangement?: boolean; + /** Specifies what label to hide in case of overlapping. */ + hideFirstOrLast?: 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. */ @@ -5618,20 +5938,56 @@ declare module DevExpress.viz.gauges { 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. */ + /** + * Specifies whether or not to hide the first scale label. + * @deprecated This functionality in not more available + */ hideFirstLabel?: boolean; - /** Specifies whether or not to hide the first major tick on the scale. */ + /** + * Specifies whether or not to hide the first major tick on the scale. + * @deprecated This functionality in not more available + */ hideFirstTick?: boolean; - /** Specifies whether or not to hide the last scale label. */ + /** + * Specifies whether or not to hide the last scale label. + * @deprecated This functionality in not more available + */ hideLastLabel?: boolean; - /** Specifies whether or not to hide the last major tick on the scale. */ + /** + * Specifies whether or not to hide the last major tick on the scale. + * @deprecated This functionality in not more available + */ hideLastTick?: boolean; + /** Specifies an interval between major ticks. */ + tickInterval?: number; + /** Specifies an interval between minor ticks. */ + minorTickInterval?: number; + /** Specifies an array of custom major ticks. */ + customTicks?: Array; + /** Specifies an array of custom minor ticks. */ + customMinorTicks?: Array; /** Specifies common options for scale labels. */ label?: BaseScaleLabel; - /** Specifies options of the gauge's major ticks. */ + /** + * Specifies options of the gauge's major ticks. + * @deprecated ..\tick\tick.md + */ majorTick?: ScaleMajorTick; + /** Specifies options of the gauge's major ticks. */ + tick?: { + /** Specifies the color of the scale's major ticks. */ + color?: string; + /** Specifies the length of the scale's major ticks. */ + length?: number; + /** Indicates whether scale major ticks are visible or not. */ + visible?: boolean; + /** Specifies the width of the scale's major ticks. */ + width?: number; + /** Specifies the opacity of the scale's major ticks. */ + opacity?: number; + }; /** Specifies options of the gauge's minor ticks. */ - minorTick?: ScaleTick; + minorTick?: ScaleMinorTick; /** Specifies the start value for the scale of the gauge. */ startValue?: number; } @@ -5688,21 +6044,48 @@ declare module DevExpress.viz.gauges { redrawOnResize?: boolean; /** Specifies the size of the widget in pixels. */ size?: viz.core.Size; - /** Specifies a subtitle for a gauge. */ + /** + * Specifies a subtitle for the widget. + * @deprecated ..\..\..\BaseGauge\1 Configuration\title\subtitle\subtitle.md + */ subtitle?: { - /** Specifies font options for the subtitle. */ + /** + * Specifies font options for the subtitle. + * @deprecated ..\..\title\subtitle\font\font.md + */ font?: viz.core.Font; - /** Specifies a text for the subtitle. */ + /** + * Specifies a text for the subtitle. + * @deprecated ..\title\subtitle\text.md + */ text?: 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. */ + /** + * Specifies a title's position on the gauge. + * @deprecated basegaugeoptions_title_verticalAlignment and basegaugeoptions_title_horizontalAlignment + */ position?: string; - /** Specifies a text for the title. */ + /** Specifies the distance between the title and surrounding gauge elements in pixels. */ + margin?: viz.core.Margins; + /** Specifies the height of the space reserved for the title. */ + placeholderSize?: number; + /** Specifies the gauge title's position in the vertical direction. */ + verticalAlignment?: string; + /** Specifies the gauge title's horizontal position. */ + horizontalAlignment?: string; + /** Specifies text for the title. */ text?: string; + /** Specifies a subtitle for the widget. */ + subtitle?: { + /** Specifies font options for the subtitle. */ + font?: viz.core.Font; + /** Specifies text for the subtitle. */ + text?: string; + } }; /** Specifies options for gauge tooltips. */ tooltip?: viz.core.Tooltip; @@ -5911,6 +6294,8 @@ declare module DevExpress.viz.rangeSelector { /** Indicates whether or not the background (background color and/or image) is visible. */ visible?: boolean; }; + /** Specifies a title for the range selector. */ + title?: viz.core.Title; /** Specifies the dxRangeSelector's behavior options. */ behavior?: { /** Indicates whether or not you can swap sliders. */ @@ -5941,8 +6326,10 @@ declare module DevExpress.viz.rangeSelector { /** 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; + /** Specifies 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?: boolean; + /** Specifies a common bar width as a percentage from 0 to 1. */ + barWidth?: number; /** Sets the name of the palette to be used in the range selector's chart. Alternatively, an array of colors can be set as a custom palette to be used within this chart. */ palette?: any; /** An object defining the chart’s series. */ @@ -6076,7 +6463,6 @@ declare module DevExpress.viz.rangeSelector { /** Specifies range selector's right indent. */ right?: number; }; - selectedRangeChanged?: (selectedRange: { startValue: any; endValue: any; }) => void; /** A handler for the selectedRangeChanged event. */ onSelectedRangeChanged?: (e: { startValue: any; @@ -6168,145 +6554,426 @@ interface JQuery { dxRangeSelector(methodName: "instance"): DevExpress.viz.rangeSelector.dxRangeSelector; } declare module DevExpress.viz.map { - /** This section describes the fields and methods that can be used in code to manipulate the Area object. */ + /** This section describes the fields and methods that can be used in code to manipulate the Layer object. */ + export interface MapLayer { + /** The name of the layer. */ + name: string; + /** The layer index in the layers array. */ + index: number; + /** The layer type. Can be "area", "line" or "marker". */ + type: string; + /** The type of the layer elements. */ + elementType: string; + /** Gets all layer elements. */ + getElements(): Array; + /** Deselects all layer elements. */ + clearSelection(): void; + } + /** This section describes the fields and methods that can be used in code to manipulate the Layer Element object. */ + export interface MapLayerElement { + /** The parent layer of the layer element. */ + layer: MapLayer; + /** Gets the layer element coordinates. */ + coordinates(): Object; + /** Sets the value of an attribute. */ + attribute(name: string, value: any): void; + /** Gets the value of an attribute. */ + attribute(name: string): any; + /** Gets the selection state of the layer element. */ + selected(): boolean; + /** Sets the selection state of the layer element. */ + selected(state: boolean): void; + /** Applies the layer element settings and updates the element appearance. */ + applySettings(settings: any): void; + } + /** + * This section describes the fields and methods that can be used in code to manipulate the Area object. + * @deprecated Use the "Layer Element" instead + */ export interface Area { - /** Contains the element type. */ + /** + * Contains the element type. + * @deprecated ..\..\Layer\2 Fields\type.md + */ type: string; - /** Return the value of an attribute. */ + /** + * Return the value of an attribute. + * @deprecated ..\..\Layer Element\3 Methods\attribute(name_value).md + */ attribute(name: string): any; - /** Provides information about the selection state of an area. */ + /** + * Provides information about the selection state of an area. + * @deprecated Use the "selected()" method of the Layer Element + */ selected(): boolean; - /** Sets a new selection state for an area. */ + /** + * Sets a new selection state for an area. + * @deprecated Use the "selected(state)" method of the Layer Element + */ selected(state: boolean): void; - /** Applies the area settings specified as a parameter and updates the area appearance. */ + /** + * Applies the area settings specified as a parameter and updates the area appearance. + * @deprecated ..\..\Layer Element\3 Methods\applySettings(settings).md + */ applySettings(settings: any): void; } - /** This section describes the fields and methods that can be used in code to manipulate the Markers object. */ + /** + * This section describes the fields and methods that can be used in code to manipulate the Markers object. + * @deprecated Use the "Layer Element" instead + */ export interface Marker { - /** Contains the descriptive text accompanying the map marker. */ + /** + * Contains the descriptive text accompanying the map marker. + * @deprecated Get the text with the "attribute" method (using the "layers.label.dataField" value) + */ text: string; - /** Contains the type of the element. */ + /** + * Contains the type of the element. + * @deprecated ..\..\Layer\2 Fields\type.md + */ type: string; - /** Contains the URL of an image map marker. */ + /** + * Contains the URL of an image map marker. + * @deprecated Get the url with the "attribute" method (using the "layers.dataField" value) + */ url: string; - /** Contains the value of a bubble map marker. */ + /** + * Contains the value of a bubble map marker. + * @deprecated Get the value with the "attribute" method (using the "layers.dataField" value) + */ value: number; - /** Contains the values of a pie map marker. */ + /** + * Contains the values of a pie map marker. + * @deprecated Get the values with the "attribute" method (using the "layers.dataField" value) + */ values: Array; - /** Returns the value of an attribute. */ + /** + * Returns the value of an attribute. + * @deprecated ..\..\Layer Element\3 Methods\attribute(name_value).md + */ attribute(name: string): any; - /** Returns the coordinates of a specific marker. */ + /** + * Returns the coordinates of a specific marker. + * @deprecated ..\..\Layer Element\3 Methods\coordinates().md + */ coordinates(): Array; - /** Provides information about the selection state of a marker. */ + /** + * Provides information about the selection state of a marker. + * @deprecated Use the "selected()" method of the Layer Element + */ selected(): boolean; - /** Sets a new selection state for a marker. */ + /** + * Sets a new selection state for a marker. + * @deprecated Use the "selected(state)" method of the Layer Element + */ selected(state: boolean): void; - /** Applies the marker settings specified as a parameter and updates the marker appearance. */ + /** + * Applies the marker settings specified as a parameter and updates marker appearance. + * @deprecated ..\..\Layer Element\3 Methods\applySettings(settings).md + */ applySettings(settings: any): void; } - export interface AreaSettings { - /** Specifies the width of the area border in pixels. */ + export interface MapLayerSettings { + /** Specifies the layer name. */ + name?: string; + /** Specifies layer type. */ + type?: string; + /** Specifies the type of a marker element. Setting this option makes sense only if the layer type is "marker". */ + elementType?: string; + /** Specifies a data source for the layer element. */ + data?: any; + /** Specifies the width of the layer elements border in pixels. */ borderWidth?: number; - /** Specifies a color for the area border. */ + /** Specifies a color for the border of the layer elements. */ borderColor?: string; - click?: any; - /** Specifies a color for an area. */ + /** Specifies a color for layer elements. */ 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. */ + /** Specifies a color for the border of the layer element when it is hovered over. */ hoveredBorderColor?: string; - /** Specifies the pixel-measured width of the area border when the area is hovered over. */ + /** Specifies the pixel-measured width for the border of the layer element when it is hovered over. */ hoveredBorderWidth?: number; - /** Specifies a color for an area when this area is hovered over. */ + /** Specifies a color for a layer element when it is hovered over. */ hoveredColor?: string; - /** Specifies whether or not to change the appearance of an area when it is hovered over. */ + /** Specifies a pixel-measured width for the border of the layer element when it is selected. */ + selectedBorderWidth?: number; + /** Specifies a color for the border of the layer element when it is selected. */ + selectedBorderColor?: string; + /** Specifies a color for the layer element when it is selected. */ + selectedColor?: string; + /** Specifies the layer opacity (from 0 to 1). */ + opacity?: number; + /** Specifies the size of markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "dot", "pie" or "image". */ + size?: number; + /** Specifies the pixel-measured diameter of the marker that represents the smallest value. Setting this option makes sense only if the layer type is "marker". */ + minSize?: number; + /** Specifies the pixel-measured diameter of the marker that represents the biggest value. Setting this option makes sense only if the layer type is "marker". */ + maxSize?: number; + /** Specifies whether or not to change the appearance of a layer element 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. */ + /** Specifies whether single or multiple map elements can be selected on a vector map. */ + selectionMode?: string; + /** Specifies the name of the palette or a custom range of colors to be used for coloring a layer. */ palette?: any; /** Specifies the number of colors in a palette. */ paletteSize?: number; - /** Allows you to paint areas with similar attributes in the same color. */ + /** Allows you to paint layer elements with similar attributes in the same color. */ colorGroups?: Array; - /** Specifies the field that provides data to be used for coloring areas. */ + /** Specifies the field that provides data to be used for coloring of layer elements. */ 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; + /** Allows you to display bubbles with similar attributes in the same size. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroups?: Array; + /** Specifies the field that provides data to be used for sizing bubble markers. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble". */ + sizeGroupingField?: string; + /** Specifies the name of the attribute containing marker data. Setting this option makes sense only if the layer type is "marker" and the elementType is "bubble", "pie" or "image". */ + dataField?: string; + /** Specifies the function that customizes each layer element individually. */ + customize?: (eleemnts: Array) => void; /** Specifies marker label options. */ label?: { + /** The name of the data attribute containing marker texts. */ + dataField?: string; /** 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. */ + } + export interface AreaSettings { + /** + * Specifies the width of the area border in pixels. + * @deprecated ..\layers\borderWidth.md + */ + borderWidth?: number; + /** + * Specifies a color for the area border. + * @deprecated ..\layers\borderColor.md + */ + borderColor?: string; + /** + * Specifies a color for an area. + * @deprecated ..\layers\color.md + */ + color?: string; + /** + * Specifies the function that customizes each area individually. + * @deprecated ..\layers\customize.md + */ + customize?: (areaInfo: Area) => AreaSettings; + /** + * Specifies a color for the area border when the area is hovered over. + * @deprecated ..\layers\hoveredBorderColor.md + */ + hoveredBorderColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is hovered over. + * @deprecated ..\layers\hoveredBorderWidth.md + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for an area when this area is hovered over. + * @deprecated ..\layers\hoveredColor.md + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of an area when it is hovered over. + * @deprecated ..\layers\hoverEnabled.md + */ + hoverEnabled?: boolean; + /** + * Configures area labels. + * @deprecated ..\..\layers\label\label.md + */ + label?: { + /** + * Specifies the data field that provides data for area labels. + * @deprecated ..\..\layers\label\dataField.md + */ + dataField?: string; + /** + * Enables area labels. + * @deprecated ..\..\layers\label\enabled.md + */ + enabled?: boolean; + /** + * Specifies font options for area labels. + * @deprecated ..\..\..\layers\label\font\font.md + */ + font?: viz.core.Font; + }; + /** + * Specifies the name of the palette or a custom range of colors to be used for coloring a map. + * @deprecated ..\layers\palette.md + */ palette?: any; - /** Allows you to paint markers with similar attributes in the same color. */ + /** + * Specifies the number of colors in a palette. + * @deprecated ..\layers\paletteSize.md + */ + paletteSize?: number; + /** + * Allows you to paint areas with similar attributes in the same color. + * @deprecated ..\layers\colorGroups.md + */ colorGroups?: Array; - /** Specifies the field that provides data to be used for coloring markers. */ + /** + * Specifies the field that provides data to be used for coloring areas. + * @deprecated ..\layers\colorGroupingField.md + */ colorGroupingField?: string; - /** Allows you to display bubbles with similar attributes in the same size. */ + /** + * Specifies a color for the area border when the area is selected. + * @deprecated ..\layers\selectedBorderColor.md + */ + selectedBorderColor?: string; + /** + * Specifies a color for an area when this area is selected. + * @deprecated ..\layers\selectedColor.md + */ + selectedColor?: string; + /** + * Specifies the pixel-measured width of the area border when the area is selected. + * @deprecated ..\layers\selectedBorderWidth.md + */ + selectedBorderWidth?: number; + /** + * Specifies whether single or multiple areas can be selected on a vector map. + * @deprecated ..\layers\selectionMode.md + */ + selectionMode?: string; + } + export interface MarkerSettings { + /** + * Specifies a color for the marker border. + * @deprecated ..\layers\borderColor.md + */ + borderColor?: string; + /** + * Specifies the width of the marker border in pixels. + * @deprecated ..\layers\borderWidth.md + */ + borderWidth?: number; + /** + * Specifies a color for a marker of the dot or bubble type. + * @deprecated ..\layers\color.md + */ + color?: string; + /** + * Specifies the function that customizes each marker individually. + * @deprecated ..\layers\customize.md + */ + customize?: (markerInfo: Marker) => MarkerSettings; + /** + * Specifies the pixel-measured width of the marker border when the marker is hovered over. + * @deprecated ..\layers\hoveredBorderWidth.md + */ + hoveredBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is hovered over. + * @deprecated ..\layers\hoveredBorderColor.md + */ + hoveredBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is hovered over. + * @deprecated ..\layers\hoveredColor.md + */ + hoveredColor?: string; + /** + * Specifies whether or not to change the appearance of a marker when it is hovered over. + * @deprecated ..\layers\hoverEnabled.md + */ + hoverEnabled?: boolean; + /** + * Specifies marker label options. + * @deprecated ..\..\layers\label\label.md + */ + label?: { + /** + * Enables marker labels. + * @deprecated ..\..\layers\label\enabled.md + */ + enabled?: boolean; + /** + * Specifies font options for marker labels. + * @deprecated ..\..\..\layers\label\font\font.md + */ + 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. + * @deprecated ..\layers\maxSize.md + */ + 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. + * @deprecated ..\layers\minSize.md + */ + minSize?: number; + /** + * Specifies the opacity of markers. Setting this option makes sense only if you use markers of the bubble type. + * @deprecated ..\layers\opacity.md + */ + opacity?: number; + /** + * Specifies the pixel-measured width of the marker border when the marker is selected. + * @deprecated ..\layers\selectedBorderWidth.md + */ + selectedBorderWidth?: number; + /** + * Specifies a color for the marker border when the marker is selected. + * @deprecated ..\layers\selectedBorderColor.md + */ + selectedBorderColor?: string; + /** + * Specifies a color for a marker of the dot or bubble type when this marker is selected. + * @deprecated ..\layers\selectedColor.md + */ + selectedColor?: string; + /** + * Specifies whether a single or multiple markers can be selected on a vector map. + * @deprecated ..\layers\selectionMode.md + */ + selectionMode?: string; + /** + * Specifies the size of markers. Setting this option makes sense for any type of marker except bubble. + * @deprecated ..\layers\size.md + */ + size?: number; + /** + * Specifies the type of markers to be used on the map. + * @deprecated ..\layers\elementType.md + */ + type?: string; + /** + * Specifies the name of a palette or a custom set of colors to be used for coloring markers of the pie type. + * @deprecated ..\layers\palette.md + */ + palette?: any; + /** + * Allows you to paint markers with similar attributes in the same color. + * @deprecated ..\layers\colorGroups.md + */ + colorGroups?: Array; + /** + * Specifies the field that provides data to be used for coloring markers. + * @deprecated ..\layers\colorGroupingField.md + */ + colorGroupingField?: string; + /** + * Allows you to display bubbles with similar attributes in the same size. + * @deprecated ..\layers\sizeGroups.md + */ sizeGroups?: Array; - /** Specifies the field that provides data to be used for sizing bubble markers. */ + /** + * Specifies the field that provides data to be used for sizing bubble markers. + * @deprecated ..\layers\sizeGroupingField.md + */ sizeGroupingField?: string; } export interface dxVectorMapOptions extends viz.core.BaseWidgetOptions { - /** An object specifying options for the map areas. */ + /** + * An object specifying options for the map areas. + * @deprecated Use the 'layers' option instead + */ areaSettings?: AreaSettings; /** Specifies the options for the map background. */ background?: { @@ -6315,6 +6982,10 @@ declare module DevExpress.viz.map { /** Specifies a color for the background. */ color?: string; }; + /** Specifies options for dxVectorMap widget layers. */ + layers?: Array; + /** Specifies the map projection. */ + projection?: Object; /** Specifies the positioning of a map in geographical coordinates. */ bounds?: Array; /** Specifies the options of the control bar. */ @@ -6336,14 +7007,25 @@ declare module DevExpress.viz.map { }; /** Specifies the appearance of the loading indicator. */ loadingIndicator?: viz.core.LoadingIndicator; - /** Specifies a data source for the map area. */ + /** + * Specifies a data source for the map area. + * @deprecated Use the 'layers.data' option instead + */ mapData?: any; - /** Specifies a data source for the map markers. */ + /** + * Specifies a data source for the map markers. + * @deprecated Use the 'layers.data' option instead + */ markers?: any; - /** An object specifying options for the map markers. */ + /** + * An object specifying options for the map markers. + * @deprecated Use the 'layers' option instead + */ markerSettings?: MarkerSettings; /** Specifies the size of the dxVectorMap widget. */ size?: viz.core.Size; + /** Specifies a title for the vector map. */ + title?: viz.core.Title; /** Specifies tooltip options. */ tooltip?: viz.core.Tooltip; /** Configures map legends. */ @@ -6356,7 +7038,6 @@ declare module DevExpress.viz.map { 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; @@ -6379,27 +7060,43 @@ declare module DevExpress.viz.map { zoomFactor?: number; /** Specifies a map's maximum zoom factor. */ maxZoomFactor?: number; - zoomFactorChanged?: (zoomFactor: number) => void; /** A handler for the zoomFactorChanged event. */ onZoomFactorChanged?: (e: { - zoomFactor: number; component: dxVectorMap; element: Element; + zoomFactor: number; }) => void; - click?: any; /** A handler for the click event. */ onClick?: any; - /** A handler for the areaClick event. */ + /** A handler for the selectionChanged event. */ + onSelectionChanged?: (e: { + component: dxVectorMap; + element: Element; + target: MapLayerElement; + }) => void; + /** + * A handler for the areaClick event. + * @deprecated Use the 'onClick' option instead + */ onAreaClick?: any; - /** A handler for the areaSelectionChanged event. */ + /** + * A handler for the areaSelectionChanged event. + * @deprecated Use the 'onSelectionChanged' option instead + */ onAreaSelectionChanged?: (e: { target: Area; component: dxVectorMap; element: Element; }) => void; - /** A handler for the markerClick event. */ + /** + * A handler for the markerClick event. + * @deprecated Use the 'onClick' option instead + */ onMarkerClick?: any; - /** A handler for the markerSelectionChanged event. */ + /** + * A handler for the markerSelectionChanged event. + * @deprecated Use the 'onSelecitonChanged' option instead + */ onMarkerSelectionChanged?: (e: { target: Marker; component: dxVectorMap; @@ -6409,12 +7106,19 @@ declare module DevExpress.viz.map { panningEnabled?: boolean; } export interface Legend extends viz.core.BaseLegend { + /** Specifies the color of item markers in the legend. The specified color applied only when the legend uses 'size' source. */ + markerColor?: string; /** 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; + source?: { + /** Specifies a layer to which the legend belongs. */ + layer?: string; + /** Specifies the type of the legend grouping. */ + grouping?: string; + } } /** A vector map widget. */ export class dxVectorMap extends viz.core.BaseWidget { @@ -6430,17 +7134,35 @@ declare module DevExpress.viz.map { 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. */ + /** + * Deselects all the selected areas on a map. The areas are displayed in their initial style after. + * @deprecated Use the 'clearSelection' method on a layer instead + */ clearAreaSelection(): void; - /** Deselects all the selected markers on a map. The markers are displayed in their initial style after. */ + /** + * Deselects all the selected markers on a map. The markers are displayed in their initial style after. + * @deprecated Use the 'clearSelection' method on a layer instead + */ 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. */ + /** Gets all map layers. */ + getLayers(): Array; + /** Gets the layer by its index. */ + getLayerByIndex(index: number): MapLayer; + /** Gets the layer by its name. */ + getLayerByName(name: string): MapLayer; + /** + * Returns an array with all the map areas. + * @deprecated Use the 'getElements' method on a layer instead + */ getAreas(): Array; - /** Returns an array with all the map markers. */ + /** + * Returns an array with all the map markers. + * @deprecated Use the 'getElements' method on a layer instead + */ getMarkers(): Array; /** Gets the current coordinates of the map viewport. */ viewport(): Array; @@ -6451,6 +7173,19 @@ declare module DevExpress.viz.map { /** Sets the value of the map zoom factor. */ zoomFactor(zoomFactor: number): void; } + export var projection: ProjectionCreator; + export interface ProjectionCreator { + /** Creates a new projection. */ + (data: { + to?: (coordinates: Array) => Array; + from?: (coordinates: Array) => Array; + aspectRatio?: number; + }): Object; + /** Gets the default or custom projection from the projection storage. */ + get(name: string): Object; + /** Adds a new projection to the internal projections storage. */ + add(name: string, projection: Object): void; + } } interface JQuery { dxVectorMap(options?: DevExpress.viz.map.dxVectorMapOptions): JQuery; From 3ff68ab822646d166995d02c40dd9ba97586d93f Mon Sep 17 00:00:00 2001 From: Per Kastman Date: Thu, 3 Dec 2015 14:26:25 +0100 Subject: [PATCH 091/474] Added possibility to register for events --- jquery-cropbox/jquery-cropbox-tests.ts | 6 ++++++ jquery-cropbox/jquery-cropbox.d.ts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/jquery-cropbox/jquery-cropbox-tests.ts b/jquery-cropbox/jquery-cropbox-tests.ts index e8db3847c6..270802cd9c 100644 --- a/jquery-cropbox/jquery-cropbox-tests.ts +++ b/jquery-cropbox/jquery-cropbox-tests.ts @@ -37,3 +37,9 @@ cropboxWithOptions.update(); cropboxWithOptions.getDataURL(); cropboxWithOptions.getBlob(); cropboxWithOptions.remove(); + +cropboxWithOptions.on("cropbox",(e: Event, data: any, img: jQueryCropBox.Cropbox) => { + + //DoStuff + +}); \ No newline at end of file diff --git a/jquery-cropbox/jquery-cropbox.d.ts b/jquery-cropbox/jquery-cropbox.d.ts index 82b550bf30..9f91e06a26 100644 --- a/jquery-cropbox/jquery-cropbox.d.ts +++ b/jquery-cropbox/jquery-cropbox.d.ts @@ -103,7 +103,13 @@ declare module jQueryCropBox { * Remove the cropbox functionality from the image. */ remove(): void; + /** + * Attach an event handler function for one event on the Crop Box + */ + on(event: string, callback: jQueryCropBox.EventCallback): void; } + + type EventCallback = (e: Event, data: any, img: jQueryCropBox.Cropbox) => void; } interface JQuery { From 60caa355e54203f3880bbbdce05af9627ada0b5e Mon Sep 17 00:00:00 2001 From: Michael Tiller Date: Thu, 3 Dec 2015 08:29:49 -0500 Subject: [PATCH 092/474] Including types from angular-ui-router This change to the module definition allows both classic CommonJS imports as well as new ES6 style imports, e.g. import { IState } from 'angular-ui-router'; --- angular-ui-router/angular-ui-router.d.ts | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts index 014baf5ac4..257446f694 100644 --- a/angular-ui-router/angular-ui-router.d.ts +++ b/angular-ui-router/angular-ui-router.d.ts @@ -5,10 +5,27 @@ /// -// Support for AMD require +// Support for AMD require and CommonJS declare module 'angular-ui-router' { - var _: string; - export = _; + // Since angular-ui-router adds providers for a bunch of + // injectable dependencies, it doesn't really return any + // actual data except the plain string 'ui.router'. + // + // As such, I don't think anybody will ever use the actual + // default value of the module. So I've only included the + // the types. (@xogeny) + export type IState = angular.ui.IState; + export type IStateProvider = angular.ui.IStateProvider; + export type IUrlMatcher = angular.ui.IUrlMatcher; + export type IUrlRouterProvider = angular.ui.IUrlRouterProvider; + export type IStateOptions = angular.ui.IStateOptions; + export type IHrefOptions = angular.ui.IHrefOptions; + export type IStateService = angular.ui.IStateService; + export type IResolvedState = angular.ui.IResolvedState; + export type IStateParamsService = angular.ui.IStateParamsService; + export type IUrlRouterService = angular.ui.IUrlRouterService; + export type IUiViewScrollProvider = angular.ui.IUiViewScrollProvider; + export type IType = angular.ui.IType; } declare module angular.ui { From 3ec3169f642ef2970422bf38298c11cd8eaaf33e Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Thu, 3 Dec 2015 09:55:13 -0500 Subject: [PATCH 093/474] Commit / Rollback on Transaction interface should return promise --- sequelize/sequelize.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 9b5e935bff..46a0ba41a0 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -5706,12 +5706,12 @@ declare module "sequelize" { /** * Commit the transaction */ - commit() : Transaction; + commit() : Promise; /** * Rollback (abort) the transaction */ - rollback() : Transaction; + rollback() : Promise; } From 06509c824951af47ddd2853cb4fb9bbb76152eb3 Mon Sep 17 00:00:00 2001 From: brnls Date: Thu, 3 Dec 2015 09:19:21 -0800 Subject: [PATCH 094/474] Fix Observable Array sort/reverse return type --- knockout/knockout.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 8f5d6fef4a..883ed43b76 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -30,9 +30,9 @@ interface KnockoutObservableArrayFunctions { push(...items: T[]): void; shift(): T; unshift(...items: T[]): number; - reverse(): T[]; - sort(): void; - sort(compareFunction: (left: T, right: T) => number): void; + reverse(): KnockoutObservableArray; + sort(): KnockoutObservableArray; + sort(compareFunction: (left: T, right: T) => number): KnockoutObservableArray; // Ko specific [key: string]: KnockoutBindingHandler; From 7fb9bf8417f91f68c896eae9a2351493e9122aeb Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:24:06 +0200 Subject: [PATCH 095/474] google-maps definitions added --- google-maps/google-maps.d.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 google-maps/google-maps.d.ts diff --git a/google-maps/google-maps.d.ts b/google-maps/google-maps.d.ts new file mode 100644 index 0000000000..753aa4f490 --- /dev/null +++ b/google-maps/google-maps.d.ts @@ -0,0 +1,26 @@ +// Type definitions for google-maps 3.1.0 +// Project: https://www.npmjs.com/package/google-maps +// Definitions by: Deividas Bakanas , Giedrius Grabauskas +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace GoogleMapsLoader { + interface CallBack { + (google: { maps: { Map: google.maps.Map } }): void; + } + export var KEY: string; + export var CLIENT: string; + export var VERSION: string; + export var SENSO: boolean; + export var LIBRARIES: Array; + export var LANGUAGE: string; + export function release(callBack: Function): void; + export function onLoad(callBack?: CallBack): void; + export function load(callBack?: CallBack): void; + export function isLoaded(): boolean; + +} +declare module 'google-maps' { + export = GoogleMapsLoader; +} From f3dcb689eaf3fc8f903051766cdc0791e97c5783 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:30:27 +0200 Subject: [PATCH 096/474] Created google-maps-tests file. --- google-maps/google-maps-tests.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 google-maps/google-maps-tests.ts diff --git a/google-maps/google-maps-tests.ts b/google-maps/google-maps-tests.ts new file mode 100644 index 0000000000..2256b254b1 --- /dev/null +++ b/google-maps/google-maps-tests.ts @@ -0,0 +1,26 @@ +/// + +var GoogleMapsLoader = require('google-maps'); + +GoogleMapsLoader.load(function(google) { + new google.maps.Map(el, options); +}); + +GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm'; + +GoogleMapsLoader.CLIENT = 'yourclientkey'; +GoogleMapsLoader.VERSION = '3.14'; + +GoogleMapsLoader.SENSOR = true + +GoogleMapsLoader.LIBRARIES = ['geometry', 'places']; + +GoogleMapsLoader.LANGUAGE = 'fr'; + +GoogleMapsLoader.release(function() { + console.log('No google maps api around'); +}); + +GoogleMapsLoader.onLoad(function(google) { + console.log('I just loaded google maps api'); +}); From 64dc5896a52b88fbff3b793e3c71236f1692ed35 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:31:49 +0200 Subject: [PATCH 097/474] Edited authors links. --- google-maps/google-maps.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-maps/google-maps.d.ts b/google-maps/google-maps.d.ts index 753aa4f490..6c528c6efb 100644 --- a/google-maps/google-maps.d.ts +++ b/google-maps/google-maps.d.ts @@ -1,6 +1,6 @@ // Type definitions for google-maps 3.1.0 // Project: https://www.npmjs.com/package/google-maps -// Definitions by: Deividas Bakanas , Giedrius Grabauskas +// Definitions by: Deividas Bakanas , Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 50170b0b7a64cfc655177a953e71210d7f8c13c1 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:36:53 +0200 Subject: [PATCH 098/474] Fixed import. --- google-maps/google-maps-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-maps/google-maps-tests.ts b/google-maps/google-maps-tests.ts index 2256b254b1..16f917b401 100644 --- a/google-maps/google-maps-tests.ts +++ b/google-maps/google-maps-tests.ts @@ -1,6 +1,6 @@ /// -var GoogleMapsLoader = require('google-maps'); +import GoogleMapsLoader = require('google-maps'); GoogleMapsLoader.load(function(google) { new google.maps.Map(el, options); From 91f11851435d731dc7e5524b32d0064d21fa90d9 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:39:56 +0200 Subject: [PATCH 099/474] Fixed tests. --- google-maps/google-maps-tests.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/google-maps/google-maps-tests.ts b/google-maps/google-maps-tests.ts index 16f917b401..50f8489360 100644 --- a/google-maps/google-maps-tests.ts +++ b/google-maps/google-maps-tests.ts @@ -3,7 +3,7 @@ import GoogleMapsLoader = require('google-maps'); GoogleMapsLoader.load(function(google) { - new google.maps.Map(el, options); + var loadedMap = google.maps.Map; }); GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm'; @@ -11,7 +11,7 @@ GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm'; GoogleMapsLoader.CLIENT = 'yourclientkey'; GoogleMapsLoader.VERSION = '3.14'; -GoogleMapsLoader.SENSOR = true +GoogleMapsLoader.SENSOR = true; GoogleMapsLoader.LIBRARIES = ['geometry', 'places']; @@ -22,5 +22,6 @@ GoogleMapsLoader.release(function() { }); GoogleMapsLoader.onLoad(function(google) { + var loadedMap = google.maps.Map; console.log('I just loaded google maps api'); }); From c21a2d49821b1a7d882b85e72255cdcf1532d1a3 Mon Sep 17 00:00:00 2001 From: Deividas Bakanas Date: Thu, 3 Dec 2015 19:40:25 +0200 Subject: [PATCH 100/474] Fixed definition mistype. --- google-maps/google-maps.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/google-maps/google-maps.d.ts b/google-maps/google-maps.d.ts index 6c528c6efb..edc37822c8 100644 --- a/google-maps/google-maps.d.ts +++ b/google-maps/google-maps.d.ts @@ -12,7 +12,7 @@ declare namespace GoogleMapsLoader { export var KEY: string; export var CLIENT: string; export var VERSION: string; - export var SENSO: boolean; + export var SENSOR: boolean; export var LIBRARIES: Array; export var LANGUAGE: string; export function release(callBack: Function): void; From 5ff03e2f4153ba30e5418e7dcd6200fa81a108b6 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Thu, 3 Dec 2015 14:30:10 -0500 Subject: [PATCH 101/474] Changes to unify transaction support across various interfaces, especially association mixins --- sequelize/sequelize.d.ts | 166 ++++++++++++++------------------------- 1 file changed, 58 insertions(+), 108 deletions(-) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 46a0ba41a0..74f682e27e 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -19,13 +19,12 @@ declare module "sequelize" { // // https://github.com/sequelize/sequelize/tree/v3.4.1/lib/associations // - - + /** * The options for the getAssociation mixin of the belongsTo association. * @see BelongsToGetAssociationMixin */ - interface BelongsToGetAssociationMixinOptions { + interface BelongsToGetAssociationMixinOptions extends Transactable { /** * Apply a scope on the related model, or remove its default scope by passing false. */ @@ -62,7 +61,7 @@ declare module "sequelize" { * The options for the setAssociation mixin of the belongsTo association. * @see BelongsToSetAssociationMixin */ - interface BelongsToSetAssociationMixinOptions { + interface BelongsToSetAssociationMixinOptions extends Transactable { /** * Skip saving this after setting the foreign key if false. */ @@ -103,7 +102,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the belongsTo association. * @see BelongsToCreateAssociationMixin */ - interface BelongsToCreateAssociationMixinOptions { } + interface BelongsToCreateAssociationMixinOptions extends Transactable { } /** * The createAssociation mixin applied to models with belongsTo. @@ -139,7 +138,7 @@ declare module "sequelize" { * The options for the getAssociation mixin of the hasOne association. * @see HasOneGetAssociationMixin */ - interface HasOneGetAssociationMixinOptions { + interface HasOneGetAssociationMixinOptions extends Transactable { /** * Apply a scope on the related model, or remove its default scope by passing false. */ @@ -176,7 +175,7 @@ declare module "sequelize" { * The options for the setAssociation mixin of the hasOne association. * @see HasOneSetAssociationMixin */ - interface HasOneSetAssociationMixinOptions { + interface HasOneSetAssociationMixinOptions extends Transactable { /** * Skip saving this after setting the foreign key if false. */ @@ -217,7 +216,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the hasOne association. * @see HasOneCreateAssociationMixin */ - interface HasOneCreateAssociationMixinOptions { } + interface HasOneCreateAssociationMixinOptions extends Transactable { } /** * The createAssociation mixin applied to models with hasOne. @@ -253,7 +252,7 @@ declare module "sequelize" { * The options for the getAssociations mixin of the hasMany association. * @see HasManyGetAssociationsMixin */ - interface HasManyGetAssociationsMixinOptions { + interface HasManyGetAssociationsMixinOptions extends Transactable { /** * An optional where clause to limit the associated models. @@ -303,7 +302,7 @@ declare module "sequelize" { * The options for the setAssociations mixin of the hasMany association. * @see HasManySetAssociationsMixin */ - interface HasManySetAssociationsMixinOptions { + interface HasManySetAssociationsMixinOptions extends Transactable { /** * Run validation for the join model. @@ -353,7 +352,7 @@ declare module "sequelize" { * The options for the addAssociations mixin of the hasMany association. * @see HasManyAddAssociationsMixin */ - interface HasManyAddAssociationsMixinOptions { + interface HasManyAddAssociationsMixinOptions extends Transactable { /** * Run validation for the join model. @@ -402,7 +401,7 @@ declare module "sequelize" { * The options for the addAssociation mixin of the hasMany association. * @see HasManyAddAssociationMixin */ - interface HasManyAddAssociationMixinOptions { + interface HasManyAddAssociationMixinOptions extends Transactable { /** * Run validation for the join model. @@ -451,7 +450,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the hasMany association. * @see HasManyCreateAssociationMixin */ - interface HasManyCreateAssociationMixinOptions { } + interface HasManyCreateAssociationMixinOptions extends Transactable { } /** * The createAssociation mixin applied to models with hasMany. @@ -494,7 +493,7 @@ declare module "sequelize" { * The options for the removeAssociation mixin of the hasMany association. * @see HasManyRemoveAssociationMixin */ - interface HasManyRemoveAssociationMixinOptions { } + interface HasManyRemoveAssociationMixinOptions extends Transactable { } /** * The removeAssociation mixin applied to models with hasMany. @@ -537,7 +536,7 @@ declare module "sequelize" { * The options for the removeAssociations mixin of the hasMany association. * @see HasManyRemoveAssociationsMixin */ - interface HasManyRemoveAssociationsMixinOptions { } + interface HasManyRemoveAssociationsMixinOptions extends Transactable { } /** * The removeAssociations mixin applied to models with hasMany. @@ -580,7 +579,7 @@ declare module "sequelize" { * The options for the hasAssociation mixin of the hasMany association. * @see HasManyHasAssociationMixin */ - interface HasManyHasAssociationMixinOptions { } + interface HasManyHasAssociationMixinOptions extends Transactable { } /** * The hasAssociation mixin applied to models with hasMany. @@ -623,7 +622,7 @@ declare module "sequelize" { * The options for the hasAssociations mixin of the hasMany association. * @see HasManyHasAssociationsMixin */ - interface HasManyHasAssociationsMixinOptions { } + interface HasManyHasAssociationsMixinOptions extends Transactable { } /** * The removeAssociations mixin applied to models with hasMany. @@ -666,7 +665,7 @@ declare module "sequelize" { * The options for the countAssociations mixin of the hasMany association. * @see HasManyCountAssociationsMixin */ - interface HasManyCountAssociationsMixinOptions { + interface HasManyCountAssociationsMixinOptions extends Transactable { /** * An optional where clause to limit the associated models. @@ -716,7 +715,7 @@ declare module "sequelize" { * The options for the getAssociations mixin of the belongsToMany association. * @see BelongsToManyGetAssociationsMixin */ - interface BelongsToManyGetAssociationsMixinOptions { + interface BelongsToManyGetAssociationsMixinOptions extends Transactable { /** * An optional where clause to limit the associated models. @@ -766,7 +765,7 @@ declare module "sequelize" { * The options for the setAssociations mixin of the belongsToMany association. * @see BelongsToManySetAssociationsMixin */ - interface BelongsToManySetAssociationsMixinOptions { + interface BelongsToManySetAssociationsMixinOptions extends Transactable { /** * Run validation for the join model. @@ -816,7 +815,7 @@ declare module "sequelize" { * The options for the addAssociations mixin of the belongsToMany association. * @see BelongsToManyAddAssociationsMixin */ - interface BelongsToManyAddAssociationsMixinOptions { + interface BelongsToManyAddAssociationsMixinOptions extends Transactable { /** * Run validation for the join model. @@ -865,7 +864,7 @@ declare module "sequelize" { * The options for the addAssociation mixin of the belongsToMany association. * @see BelongsToManyAddAssociationMixin */ - interface BelongsToManyAddAssociationMixinOptions { + interface BelongsToManyAddAssociationMixinOptions extends Transactable { /** * Run validation for the join model. @@ -914,7 +913,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the belongsToMany association. * @see BelongsToManyCreateAssociationMixin */ - interface BelongsToManyCreateAssociationMixinOptions { } + interface BelongsToManyCreateAssociationMixinOptions extends Transactable { } /** * The createAssociation mixin applied to models with belongsToMany. @@ -957,7 +956,7 @@ declare module "sequelize" { * The options for the removeAssociation mixin of the belongsToMany association. * @see BelongsToManyRemoveAssociationMixin */ - interface BelongsToManyRemoveAssociationMixinOptions { } + interface BelongsToManyRemoveAssociationMixinOptions extends Transactable { } /** * The removeAssociation mixin applied to models with belongsToMany. @@ -1000,7 +999,7 @@ declare module "sequelize" { * The options for the removeAssociations mixin of the belongsToMany association. * @see BelongsToManyRemoveAssociationsMixin */ - interface BelongsToManyRemoveAssociationsMixinOptions { } + interface BelongsToManyRemoveAssociationsMixinOptions extends Transactable { } /** * The removeAssociations mixin applied to models with belongsToMany. @@ -1043,7 +1042,7 @@ declare module "sequelize" { * The options for the hasAssociation mixin of the belongsToMany association. * @see BelongsToManyHasAssociationMixin */ - interface BelongsToManyHasAssociationMixinOptions { } + interface BelongsToManyHasAssociationMixinOptions extends Transactable { } /** * The hasAssociation mixin applied to models with belongsToMany. @@ -1086,7 +1085,7 @@ declare module "sequelize" { * The options for the hasAssociations mixin of the belongsToMany association. * @see BelongsToManyHasAssociationsMixin */ - interface BelongsToManyHasAssociationsMixinOptions { } + interface BelongsToManyHasAssociationsMixinOptions extends Transactable { } /** * The removeAssociations mixin applied to models with belongsToMany. @@ -1129,7 +1128,7 @@ declare module "sequelize" { * The options for the countAssociations mixin of the belongsToMany association. * @see BelongsToManyCountAssociationsMixin */ - interface BelongsToManyCountAssociationsMixinOptions { + interface BelongsToManyCountAssociationsMixinOptions extends Transactable { /** * An optional where clause to limit the associated models. @@ -2538,7 +2537,7 @@ declare module "sequelize" { /** * Options used for Instance.increment method */ - interface InstanceIncrementDecrementOptions { + interface InstanceIncrementDecrementOptions extends Transactable { /** * The number to increment by @@ -2552,39 +2551,29 @@ declare module "sequelize" { */ logging? : boolean | Function; - /** - * Transaction to run query under - */ - transaction? : Transaction; - /** * A hash of attributes to describe your search. See above for examples. */ where? : WhereOptions | Array; - + } /** * Options used for Instance.restore method */ - interface InstanceRestoreOptions { + interface InstanceRestoreOptions extends Transactable { /** * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - - /** - * Transaction to run query under - */ - transaction? : Transaction; - + } /** * Options used for Instance.destroy method */ - interface InstanceDestroyOptions { + interface InstanceDestroyOptions extends Transactable { /** * If set to true, paranoid models will actually be deleted @@ -2595,12 +2584,7 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - - /** - * Transaction to run the query in - */ - transaction? : Transaction; - + } /** @@ -2635,7 +2619,7 @@ declare module "sequelize" { /** * Options used for Instance.save method */ - interface InstanceSaveOptions { + interface InstanceSaveOptions extends Transactable { /** * An optional array of strings, representing database columns. If fields is provided, only those columns @@ -2661,12 +2645,7 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - - /** - * Transaction to run the query in - */ - transaction? : Transaction; - + } /** @@ -3091,7 +3070,7 @@ declare module "sequelize" { * * A hash of options to describe the scope of the search */ - interface FindOptions { + interface FindOptions extends Transactable { /** * A hash of attributes to describe your search. See above for examples. @@ -3138,11 +3117,6 @@ declare module "sequelize" { */ offset?: number; - /** - * Transaction to run query under - */ - transaction? : Transaction; - /** * Lock the selected rows. Possible options are transaction.LOCK.UPDATE and transaction.LOCK.SHARE. * Postgres also supports transaction.LOCK.KEY_SHARE, transaction.LOCK.NO_KEY_UPDATE and specific model @@ -3170,7 +3144,7 @@ declare module "sequelize" { /** * Options for Model.count method */ - interface CountOptions { + interface CountOptions extends Transactable { /** * A hash of search attributes. @@ -3203,8 +3177,7 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - - transaction?: Transaction; + } /** @@ -3234,7 +3207,7 @@ declare module "sequelize" { /** * Options for Model.create method */ - interface CreateOptions extends BuildOptions { + interface CreateOptions extends BuildOptions, Transactable { /** * If set, only columns matching those in fields will be saved @@ -3246,11 +3219,6 @@ declare module "sequelize" { */ onDuplicate? : string; - /** - * Transaction to run query under - */ - transaction? : Transaction; - /** * A function that gets executed while running the query to log the sql. */ @@ -3259,12 +3227,13 @@ declare module "sequelize" { silent? : boolean; returning? : boolean; + } /** * Options for Model.findOrInitialize method */ - interface FindOrInitializeOptions { + interface FindOrInitializeOptions extends Transactable { /** * A hash of search attributes. @@ -3276,11 +3245,6 @@ declare module "sequelize" { */ defaults? : TAttributes; - /** - * Transaction to run query under - */ - transaction? : Transaction; - /** * A function that gets executed while running the query to log the sql. */ @@ -3313,7 +3277,7 @@ declare module "sequelize" { /** * Options for Model.bulkCreate method */ - interface BulkCreateOptions { + interface BulkCreateOptions extends Transactable { /** * Fields to insert (defaults to all fields) @@ -3350,11 +3314,6 @@ declare module "sequelize" { */ updateOnDuplicate? : Array; - /** - * Transaction to run query under - */ - transaction? : Transaction; - /** * A function that gets executed while running the query to log the sql. */ @@ -3365,12 +3324,7 @@ declare module "sequelize" { /** * The options passed to Model.destroy in addition to truncate */ - interface TruncateOptions { - - /** - * Transaction to run query under - */ - transaction? : Transaction; + interface TruncateOptions extends Transactable { /** * Only used in conjuction with TRUNCATE. Truncates all tables that have foreign-key references to the @@ -3429,7 +3383,7 @@ declare module "sequelize" { /** * Options for Model.restore */ - interface RestoreOptions { + interface RestoreOptions extends Transactable { /** * Filter the restore @@ -3457,17 +3411,12 @@ declare module "sequelize" { */ logging? : boolean | Function; - /** - * Transaction to run query under - */ - transaction? : Transaction; - } /** * Options used for Model.update */ - interface UpdateOptions { + interface UpdateOptions extends Transactable { /** * Options to describe the scope of the search. @@ -3524,11 +3473,6 @@ declare module "sequelize" { */ logging? : boolean | Function; - /** - * Transaction to run query under - */ - transaction? : Transaction; - } /** @@ -4422,7 +4366,7 @@ declare module "sequelize" { * * @see Options */ - interface QueryOptions { + interface QueryOptions extends Transactable { /** * If true, sequelize will not try to format the results of the query, or build an instance of a model from @@ -4430,11 +4374,6 @@ declare module "sequelize" { */ raw?: boolean; - /** - * The transaction that the query should be executed under - */ - transaction?: Transaction; - /** * The type of query you are executing. The query type affects how results are formatted before they are * passed back. The type is a string, but `Sequelize.QueryTypes` is provided as convenience shortcuts. @@ -5838,7 +5777,18 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging?: Function; - + } + + /** + * An interface that allows an item to support working under a transaction + * + * @param transaction Transaction The optional transaction to run under + */ + interface Transactable { + /** + * Transaction to run query under + */ + transaction?: Transaction; } // From 4f0c326e4553fc4b96d9560717e28473817699bb Mon Sep 17 00:00:00 2001 From: Vinh Tran Date: Thu, 3 Dec 2015 14:35:42 -0500 Subject: [PATCH 102/474] Update search request optional fields Update PlaceSearchRequest, RadarSearchRequest, and TextSearchRequest interfaces to better reflect their optional fields. Reference: https://developers.google.com/maps/documentation/javascript/places --- googlemaps/google.maps.d.ts | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 3ac35b0482..770151f33e 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -1917,16 +1917,16 @@ declare module google.maps { } export interface PlaceSearchRequest { - bounds: LatLngBounds; - keyword: string; - location: LatLng|LatLngLiteral; + bounds?: LatLngBounds; + keyword?: string; + location?: LatLng|LatLngLiteral; maxPriceLevel?: number; minPriceLevel?: number; - name: string; - openNow: boolean; - radius: number; - rankBy: RankBy; - types: string[]; + name?: string; + openNow?: boolean; + radius?: number; + rankBy?: RankBy; + types?: string[]; } export class PlacesService { @@ -1963,11 +1963,11 @@ declare module google.maps { export interface RadarSearchRequest { bounds?: LatLngBounds; - keyword: string; - location: LatLng|LatLngLiteral; - name: string; - radius: number; - types: string[]; + keyword?: string; + location?: LatLng|LatLngLiteral; + name?: string; + radius?: number; + types?: string[]; } export enum RankBy { @@ -1988,10 +1988,10 @@ declare module google.maps { export interface TextSearchRequest { bounds?: LatLngBounds; - location: LatLng|LatLngLiteral; + location?: LatLng|LatLngLiteral; query: string; - radius: number; - types: string[]; + radius?: number; + types?: string[]; } } From 2e5439d881f3e744175633c21c26a656fbc66763 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Thu, 3 Dec 2015 17:29:21 -0500 Subject: [PATCH 103/474] Revert "Changes to unify transaction support across various interfaces, especially association mixins" This reverts commit 5ff03e2f4153ba30e5418e7dcd6200fa81a108b6. --- sequelize/sequelize.d.ts | 166 +++++++++++++++++++++++++-------------- 1 file changed, 108 insertions(+), 58 deletions(-) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 74f682e27e..46a0ba41a0 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -19,12 +19,13 @@ declare module "sequelize" { // // https://github.com/sequelize/sequelize/tree/v3.4.1/lib/associations // - + + /** * The options for the getAssociation mixin of the belongsTo association. * @see BelongsToGetAssociationMixin */ - interface BelongsToGetAssociationMixinOptions extends Transactable { + interface BelongsToGetAssociationMixinOptions { /** * Apply a scope on the related model, or remove its default scope by passing false. */ @@ -61,7 +62,7 @@ declare module "sequelize" { * The options for the setAssociation mixin of the belongsTo association. * @see BelongsToSetAssociationMixin */ - interface BelongsToSetAssociationMixinOptions extends Transactable { + interface BelongsToSetAssociationMixinOptions { /** * Skip saving this after setting the foreign key if false. */ @@ -102,7 +103,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the belongsTo association. * @see BelongsToCreateAssociationMixin */ - interface BelongsToCreateAssociationMixinOptions extends Transactable { } + interface BelongsToCreateAssociationMixinOptions { } /** * The createAssociation mixin applied to models with belongsTo. @@ -138,7 +139,7 @@ declare module "sequelize" { * The options for the getAssociation mixin of the hasOne association. * @see HasOneGetAssociationMixin */ - interface HasOneGetAssociationMixinOptions extends Transactable { + interface HasOneGetAssociationMixinOptions { /** * Apply a scope on the related model, or remove its default scope by passing false. */ @@ -175,7 +176,7 @@ declare module "sequelize" { * The options for the setAssociation mixin of the hasOne association. * @see HasOneSetAssociationMixin */ - interface HasOneSetAssociationMixinOptions extends Transactable { + interface HasOneSetAssociationMixinOptions { /** * Skip saving this after setting the foreign key if false. */ @@ -216,7 +217,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the hasOne association. * @see HasOneCreateAssociationMixin */ - interface HasOneCreateAssociationMixinOptions extends Transactable { } + interface HasOneCreateAssociationMixinOptions { } /** * The createAssociation mixin applied to models with hasOne. @@ -252,7 +253,7 @@ declare module "sequelize" { * The options for the getAssociations mixin of the hasMany association. * @see HasManyGetAssociationsMixin */ - interface HasManyGetAssociationsMixinOptions extends Transactable { + interface HasManyGetAssociationsMixinOptions { /** * An optional where clause to limit the associated models. @@ -302,7 +303,7 @@ declare module "sequelize" { * The options for the setAssociations mixin of the hasMany association. * @see HasManySetAssociationsMixin */ - interface HasManySetAssociationsMixinOptions extends Transactable { + interface HasManySetAssociationsMixinOptions { /** * Run validation for the join model. @@ -352,7 +353,7 @@ declare module "sequelize" { * The options for the addAssociations mixin of the hasMany association. * @see HasManyAddAssociationsMixin */ - interface HasManyAddAssociationsMixinOptions extends Transactable { + interface HasManyAddAssociationsMixinOptions { /** * Run validation for the join model. @@ -401,7 +402,7 @@ declare module "sequelize" { * The options for the addAssociation mixin of the hasMany association. * @see HasManyAddAssociationMixin */ - interface HasManyAddAssociationMixinOptions extends Transactable { + interface HasManyAddAssociationMixinOptions { /** * Run validation for the join model. @@ -450,7 +451,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the hasMany association. * @see HasManyCreateAssociationMixin */ - interface HasManyCreateAssociationMixinOptions extends Transactable { } + interface HasManyCreateAssociationMixinOptions { } /** * The createAssociation mixin applied to models with hasMany. @@ -493,7 +494,7 @@ declare module "sequelize" { * The options for the removeAssociation mixin of the hasMany association. * @see HasManyRemoveAssociationMixin */ - interface HasManyRemoveAssociationMixinOptions extends Transactable { } + interface HasManyRemoveAssociationMixinOptions { } /** * The removeAssociation mixin applied to models with hasMany. @@ -536,7 +537,7 @@ declare module "sequelize" { * The options for the removeAssociations mixin of the hasMany association. * @see HasManyRemoveAssociationsMixin */ - interface HasManyRemoveAssociationsMixinOptions extends Transactable { } + interface HasManyRemoveAssociationsMixinOptions { } /** * The removeAssociations mixin applied to models with hasMany. @@ -579,7 +580,7 @@ declare module "sequelize" { * The options for the hasAssociation mixin of the hasMany association. * @see HasManyHasAssociationMixin */ - interface HasManyHasAssociationMixinOptions extends Transactable { } + interface HasManyHasAssociationMixinOptions { } /** * The hasAssociation mixin applied to models with hasMany. @@ -622,7 +623,7 @@ declare module "sequelize" { * The options for the hasAssociations mixin of the hasMany association. * @see HasManyHasAssociationsMixin */ - interface HasManyHasAssociationsMixinOptions extends Transactable { } + interface HasManyHasAssociationsMixinOptions { } /** * The removeAssociations mixin applied to models with hasMany. @@ -665,7 +666,7 @@ declare module "sequelize" { * The options for the countAssociations mixin of the hasMany association. * @see HasManyCountAssociationsMixin */ - interface HasManyCountAssociationsMixinOptions extends Transactable { + interface HasManyCountAssociationsMixinOptions { /** * An optional where clause to limit the associated models. @@ -715,7 +716,7 @@ declare module "sequelize" { * The options for the getAssociations mixin of the belongsToMany association. * @see BelongsToManyGetAssociationsMixin */ - interface BelongsToManyGetAssociationsMixinOptions extends Transactable { + interface BelongsToManyGetAssociationsMixinOptions { /** * An optional where clause to limit the associated models. @@ -765,7 +766,7 @@ declare module "sequelize" { * The options for the setAssociations mixin of the belongsToMany association. * @see BelongsToManySetAssociationsMixin */ - interface BelongsToManySetAssociationsMixinOptions extends Transactable { + interface BelongsToManySetAssociationsMixinOptions { /** * Run validation for the join model. @@ -815,7 +816,7 @@ declare module "sequelize" { * The options for the addAssociations mixin of the belongsToMany association. * @see BelongsToManyAddAssociationsMixin */ - interface BelongsToManyAddAssociationsMixinOptions extends Transactable { + interface BelongsToManyAddAssociationsMixinOptions { /** * Run validation for the join model. @@ -864,7 +865,7 @@ declare module "sequelize" { * The options for the addAssociation mixin of the belongsToMany association. * @see BelongsToManyAddAssociationMixin */ - interface BelongsToManyAddAssociationMixinOptions extends Transactable { + interface BelongsToManyAddAssociationMixinOptions { /** * Run validation for the join model. @@ -913,7 +914,7 @@ declare module "sequelize" { * The options for the createAssociation mixin of the belongsToMany association. * @see BelongsToManyCreateAssociationMixin */ - interface BelongsToManyCreateAssociationMixinOptions extends Transactable { } + interface BelongsToManyCreateAssociationMixinOptions { } /** * The createAssociation mixin applied to models with belongsToMany. @@ -956,7 +957,7 @@ declare module "sequelize" { * The options for the removeAssociation mixin of the belongsToMany association. * @see BelongsToManyRemoveAssociationMixin */ - interface BelongsToManyRemoveAssociationMixinOptions extends Transactable { } + interface BelongsToManyRemoveAssociationMixinOptions { } /** * The removeAssociation mixin applied to models with belongsToMany. @@ -999,7 +1000,7 @@ declare module "sequelize" { * The options for the removeAssociations mixin of the belongsToMany association. * @see BelongsToManyRemoveAssociationsMixin */ - interface BelongsToManyRemoveAssociationsMixinOptions extends Transactable { } + interface BelongsToManyRemoveAssociationsMixinOptions { } /** * The removeAssociations mixin applied to models with belongsToMany. @@ -1042,7 +1043,7 @@ declare module "sequelize" { * The options for the hasAssociation mixin of the belongsToMany association. * @see BelongsToManyHasAssociationMixin */ - interface BelongsToManyHasAssociationMixinOptions extends Transactable { } + interface BelongsToManyHasAssociationMixinOptions { } /** * The hasAssociation mixin applied to models with belongsToMany. @@ -1085,7 +1086,7 @@ declare module "sequelize" { * The options for the hasAssociations mixin of the belongsToMany association. * @see BelongsToManyHasAssociationsMixin */ - interface BelongsToManyHasAssociationsMixinOptions extends Transactable { } + interface BelongsToManyHasAssociationsMixinOptions { } /** * The removeAssociations mixin applied to models with belongsToMany. @@ -1128,7 +1129,7 @@ declare module "sequelize" { * The options for the countAssociations mixin of the belongsToMany association. * @see BelongsToManyCountAssociationsMixin */ - interface BelongsToManyCountAssociationsMixinOptions extends Transactable { + interface BelongsToManyCountAssociationsMixinOptions { /** * An optional where clause to limit the associated models. @@ -2537,7 +2538,7 @@ declare module "sequelize" { /** * Options used for Instance.increment method */ - interface InstanceIncrementDecrementOptions extends Transactable { + interface InstanceIncrementDecrementOptions { /** * The number to increment by @@ -2551,29 +2552,39 @@ declare module "sequelize" { */ logging? : boolean | Function; + /** + * Transaction to run query under + */ + transaction? : Transaction; + /** * A hash of attributes to describe your search. See above for examples. */ where? : WhereOptions | Array; - + } /** * Options used for Instance.restore method */ - interface InstanceRestoreOptions extends Transactable { + interface InstanceRestoreOptions { /** * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - + + /** + * Transaction to run query under + */ + transaction? : Transaction; + } /** * Options used for Instance.destroy method */ - interface InstanceDestroyOptions extends Transactable { + interface InstanceDestroyOptions { /** * If set to true, paranoid models will actually be deleted @@ -2584,7 +2595,12 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - + + /** + * Transaction to run the query in + */ + transaction? : Transaction; + } /** @@ -2619,7 +2635,7 @@ declare module "sequelize" { /** * Options used for Instance.save method */ - interface InstanceSaveOptions extends Transactable { + interface InstanceSaveOptions { /** * An optional array of strings, representing database columns. If fields is provided, only those columns @@ -2645,7 +2661,12 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - + + /** + * Transaction to run the query in + */ + transaction? : Transaction; + } /** @@ -3070,7 +3091,7 @@ declare module "sequelize" { * * A hash of options to describe the scope of the search */ - interface FindOptions extends Transactable { + interface FindOptions { /** * A hash of attributes to describe your search. See above for examples. @@ -3117,6 +3138,11 @@ declare module "sequelize" { */ offset?: number; + /** + * Transaction to run query under + */ + transaction? : Transaction; + /** * Lock the selected rows. Possible options are transaction.LOCK.UPDATE and transaction.LOCK.SHARE. * Postgres also supports transaction.LOCK.KEY_SHARE, transaction.LOCK.NO_KEY_UPDATE and specific model @@ -3144,7 +3170,7 @@ declare module "sequelize" { /** * Options for Model.count method */ - interface CountOptions extends Transactable { + interface CountOptions { /** * A hash of search attributes. @@ -3177,7 +3203,8 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging? : boolean | Function; - + + transaction?: Transaction; } /** @@ -3207,7 +3234,7 @@ declare module "sequelize" { /** * Options for Model.create method */ - interface CreateOptions extends BuildOptions, Transactable { + interface CreateOptions extends BuildOptions { /** * If set, only columns matching those in fields will be saved @@ -3219,6 +3246,11 @@ declare module "sequelize" { */ onDuplicate? : string; + /** + * Transaction to run query under + */ + transaction? : Transaction; + /** * A function that gets executed while running the query to log the sql. */ @@ -3227,13 +3259,12 @@ declare module "sequelize" { silent? : boolean; returning? : boolean; - } /** * Options for Model.findOrInitialize method */ - interface FindOrInitializeOptions extends Transactable { + interface FindOrInitializeOptions { /** * A hash of search attributes. @@ -3245,6 +3276,11 @@ declare module "sequelize" { */ defaults? : TAttributes; + /** + * Transaction to run query under + */ + transaction? : Transaction; + /** * A function that gets executed while running the query to log the sql. */ @@ -3277,7 +3313,7 @@ declare module "sequelize" { /** * Options for Model.bulkCreate method */ - interface BulkCreateOptions extends Transactable { + interface BulkCreateOptions { /** * Fields to insert (defaults to all fields) @@ -3314,6 +3350,11 @@ declare module "sequelize" { */ updateOnDuplicate? : Array; + /** + * Transaction to run query under + */ + transaction? : Transaction; + /** * A function that gets executed while running the query to log the sql. */ @@ -3324,7 +3365,12 @@ declare module "sequelize" { /** * The options passed to Model.destroy in addition to truncate */ - interface TruncateOptions extends Transactable { + interface TruncateOptions { + + /** + * Transaction to run query under + */ + transaction? : Transaction; /** * Only used in conjuction with TRUNCATE. Truncates all tables that have foreign-key references to the @@ -3383,7 +3429,7 @@ declare module "sequelize" { /** * Options for Model.restore */ - interface RestoreOptions extends Transactable { + interface RestoreOptions { /** * Filter the restore @@ -3411,12 +3457,17 @@ declare module "sequelize" { */ logging? : boolean | Function; + /** + * Transaction to run query under + */ + transaction? : Transaction; + } /** * Options used for Model.update */ - interface UpdateOptions extends Transactable { + interface UpdateOptions { /** * Options to describe the scope of the search. @@ -3473,6 +3524,11 @@ declare module "sequelize" { */ logging? : boolean | Function; + /** + * Transaction to run query under + */ + transaction? : Transaction; + } /** @@ -4366,7 +4422,7 @@ declare module "sequelize" { * * @see Options */ - interface QueryOptions extends Transactable { + interface QueryOptions { /** * If true, sequelize will not try to format the results of the query, or build an instance of a model from @@ -4374,6 +4430,11 @@ declare module "sequelize" { */ raw?: boolean; + /** + * The transaction that the query should be executed under + */ + transaction?: Transaction; + /** * The type of query you are executing. The query type affects how results are formatted before they are * passed back. The type is a string, but `Sequelize.QueryTypes` is provided as convenience shortcuts. @@ -5777,18 +5838,7 @@ declare module "sequelize" { * A function that gets executed while running the query to log the sql. */ logging?: Function; - } - - /** - * An interface that allows an item to support working under a transaction - * - * @param transaction Transaction The optional transaction to run under - */ - interface Transactable { - /** - * Transaction to run query under - */ - transaction?: Transaction; + } // From 3b74f5ae2ca561aea50be0cf7aec6723fa37c64a Mon Sep 17 00:00:00 2001 From: rhysd Date: Fri, 4 Dec 2015 09:57:43 +0900 Subject: [PATCH 104/474] github-electron: Add missing menu item option 'role' --- github-electron/github-electron-main-tests.ts | 35 ++++++++++++++++++- github-electron/github-electron.d.ts | 4 +++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index bafbaa49f7..a60e326111 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -125,7 +125,40 @@ var dockMenu = Menu.buildFromTemplate([ { label: 'Pro' } ] }, - { label: 'New Command...' } + { label: 'New Command...' }, + { + label: 'Edit', + submenu: [ + { + label: 'Undo', + accelerator: 'CmdOrCtrl+Z', + role: 'undo' + }, + { + label: 'Redo', + accelerator: 'Shift+CmdOrCtrl+Z', + role: 'redo' + }, + { + type: 'separator' + }, + { + label: 'Cut', + accelerator: 'CmdOrCtrl+X', + role: 'cut' + }, + { + label: 'Copy', + accelerator: 'CmdOrCtrl+C', + role: 'copy' + }, + { + label: 'Paste', + accelerator: 'CmdOrCtrl+V', + role: 'paste' + }, + ] + }, ]); app.dock.setMenu(dockMenu); diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index d4ab0099f0..679cc6700d 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -880,6 +880,10 @@ declare module GitHubElectron { * a given menu. */ position?: string; + /** + * Define the action of the menu item, when specified the click property will be ignored + */ + role?: string; } class BrowserWindowProxy { From cb5206a8ac1c9a3ddfd126f5ecea6729b2361452 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Thu, 3 Dec 2015 20:34:58 -0600 Subject: [PATCH 105/474] Add default_type --- mime/mime.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/mime/mime.d.ts b/mime/mime.d.ts index bfaa7a51f1..1009f006c0 100644 --- a/mime/mime.d.ts +++ b/mime/mime.d.ts @@ -16,4 +16,5 @@ declare module "mime" { } export var charsets: Charsets; + export var default_type: string; } From 380e701b39abbd48a435971bb7560974ad43b33e Mon Sep 17 00:00:00 2001 From: Valentyn Shybanov Date: Fri, 4 Dec 2015 13:31:52 +0100 Subject: [PATCH 106/474] Added missing updateParams method According to documentation, `updateParams` method existed even in 1.3 but it was missing in `IRouteService`. Added this missing method. --- angularjs/angular-route.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 662b2c11d3..63bc75594e 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -35,6 +35,16 @@ declare module angular.route { // May not always be available. For instance, current will not be available // to a controller that was not initialized as a result of a route maching. current?: ICurrentRoute; + + /** + * Causes $route service to update the current URL, replacing current route parameters with those specified in newParams. + * Provided property names that match the route's path segment definitions will be interpolated into the + * location's path, while remaining properties will be treated as query params. + * + * @param newParams Object. mapping of URL parameter names to values + */ + updateParams(newParams:{[key:string]:string}); + } From 7610dacad225bc62f0965b8e8af18eaecd69fda0 Mon Sep 17 00:00:00 2001 From: Valentyn Shybanov Date: Fri, 4 Dec 2015 13:36:19 +0100 Subject: [PATCH 107/474] Added return type of updateParams Added required return type of updateParams --- angularjs/angular-route.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 63bc75594e..5f426d51c8 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -43,7 +43,7 @@ declare module angular.route { * * @param newParams Object. mapping of URL parameter names to values */ - updateParams(newParams:{[key:string]:string}); + updateParams(newParams:{[key:string]:string}): void; } From 320f9c0475d523016d8e3a10fa8705e229185897 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 4 Dec 2015 23:37:10 +0500 Subject: [PATCH 108/474] lodash: signatures of _.flow have been changed --- lodash/lodash-tests.ts | 32 ++++++++++++++++++++++++++++---- lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9cae2a8721..9750fbd5ea 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4822,10 +4822,34 @@ module TestDelay { } // _.flow -var testFlowSquareFn = (n: number) => n * n; -var testFlowAddFn = (n: number, m: number) => n + m; -result = _.flow<(n: number, m: number) => number>(testFlowAddFn, testFlowSquareFn)(1, 2); -result = _(testFlowAddFn).flow<(n: number, m: number) => number>(testFlowSquareFn).value()(1, 2); +module TestFlow { + let Fn1: (n: number) => number; + let Fn2: (m: number, n: number) => number; + + { + let result: (m: number, n: number) => number; + + result = _.flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + result = _.flow<(m: number, n: number) => number>(Fn1, Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashImplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).flow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } + + { + let result: _.LoDashExplicitObjectWrapper<(m: number, n: number) => number>; + + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn2); + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn2); + result = _(Fn1).chain().flow<(m: number, n: number) => number>(Fn1, Fn1, Fn2); + } +} // _.flowRight module TestFlowRight { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ed8d72443a..3aaf4a68b0 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8340,6 +8340,7 @@ declare module _ { /** * Creates a function that returns the result of invoking the provided functions with the this binding of the * created function, where each successive invocation is supplied the return value of the previous. + * * @param funcs Functions to invoke. * @return Returns the new function. */ @@ -8349,10 +8350,17 @@ declare module _ { interface LoDashImplicitObjectWrapper { /** * @see _.flow - **/ + */ flow(...funcs: Function[]): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.flow + */ + flow(...funcs: Function[]): LoDashExplicitObjectWrapper; + } + //_.flowRight interface LoDashStatic { /** From b545524610b8dffbe787b8d7e001ee2bcfa6b69f Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 4 Dec 2015 14:04:52 -0500 Subject: [PATCH 109/474] RequestPromise to extend Promise The current then/catch/finally in RequestPromise don't have proper definition. As a result `await` in Typescript 1.7 fails during compilation blaming that there's no proper `then` implementation. --- request-promise/request-promise.d.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/request-promise/request-promise.d.ts b/request-promise/request-promise.d.ts index d442e527fc..b35856277e 100644 --- a/request-promise/request-promise.d.ts +++ b/request-promise/request-promise.d.ts @@ -12,10 +12,7 @@ declare module 'request-promise' { import request = require('request'); import http = require('http'); - interface RequestPromise extends request.Request { - then(onFulfilled: Function, onRejected?: Function): Promise; - catch(onRejected: Function): Promise; - finally(onFinished: Function): Promise; + interface RequestPromise extends request.Request, Promise { promise(): Promise; } From 90d18f6f484c05bf0f80de42bcb25657401393e0 Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Fri, 4 Dec 2015 07:30:48 -0500 Subject: [PATCH 110/474] simple-mock.d.ts Fix bug with uppercase --- simple-mock/simple-mock-tests.ts | 1024 ++++++++++++++++++++++++++++++ simple-mock/simple-mock.d.ts | 194 ++++++ 2 files changed, 1218 insertions(+) create mode 100644 simple-mock/simple-mock-tests.ts create mode 100644 simple-mock/simple-mock.d.ts diff --git a/simple-mock/simple-mock-tests.ts b/simple-mock/simple-mock-tests.ts new file mode 100644 index 0000000000..e83b22affb --- /dev/null +++ b/simple-mock/simple-mock-tests.ts @@ -0,0 +1,1024 @@ +/// +/// +/// + +/// + +'use strict' + +import simple = require('simple-mock'); +import assert = require('assert'); + +import Bluebird = require('bluebird'); + +// Following code is a TypeScript convertion of the test suite bundled with simple-mock. +// Original test in MIT license + +describe('simple', function () { + describe('spy()', function () { + describe('for noop function', function () { + let spyFn: Simple.Spy; + + beforeEach(function () { + spyFn = simple.spy(function () {}) + }) + + it('can be queried without having been called', function () { + assert.equal(spyFn.callCount, 0) + assert.deepEqual(spyFn.calls, []) + assert(spyFn.lastCall) + assert.deepEqual(spyFn.lastCall.args, []) + }) + + it('can be queried for arguments on a single call', function () { + let context = { + spyFn: spyFn + } + + context.spyFn('with', 'args') + + assert(spyFn.called) + assert.equal(spyFn.callCount, 1) + assert(spyFn.calls) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall, spyFn.lastCall) + assert.equal(spyFn.firstCall, spyFn.calls[0]) + assert.deepEqual(spyFn.lastCall.args, ['with', 'args']) + assert.equal(spyFn.lastCall.context, context) + }) + + it('can be queried for arguments over multiple calls', function () { + let context = { + spyFn: spyFn + } + + spyFn('with', 'args') + spyFn('and') + context.spyFn('more', 'args') + + assert(spyFn.called) + assert.equal(spyFn.callCount, 3) + assert(spyFn.calls) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall, spyFn.calls[0]) + assert.deepEqual(spyFn.firstCall.args, ['with', 'args']) + assert(spyFn.calls[1]) + assert.deepEqual(spyFn.calls[1].args, ['and']) + assert(spyFn.lastCall) + assert.equal(spyFn.lastCall, spyFn.calls[2]) + assert.deepEqual(spyFn.lastCall.args, ['more', 'args']) + assert.equal(spyFn.lastCall.context, context) + }) + }) + + describe('for a throwing function', function () { + let originalFn: () => void; + let spyFn: Simple.Spy; + beforeEach(function () { + let i = 0 + + originalFn = function () { + throw new Error(`${i++}`) + } + + spyFn = simple.spy(originalFn) + }) + + it('can be queried without having been called', function () { + assert(!spyFn.called) + assert.equal(spyFn.callCount, 0) + assert.deepEqual(spyFn.calls, []) + assert(spyFn.lastCall) + assert.equal(spyFn.lastCall.threw, undefined) + }) + + it('can be queried for what it threw on a single call', function () { + let threw: Error; + try { + spyFn() + } catch (e) { + threw = e + } + + assert(threw) + assert(spyFn.called) + assert.equal(spyFn.callCount, 1) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall.threw, threw) + }) + + it('can be queried for what it threw over multiple calls', function () { + let threw: Error[] = [] + try { + spyFn() + } catch (e) { + threw.push(e) + } + try { + spyFn() + } catch (e) { + threw.push(e) + } + try { + spyFn() + } catch (e) { + threw.push(e) + } + + assert.equal(threw.length, 3) + assert(spyFn.called) + assert.equal(spyFn.callCount, 3) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall.threw, threw[0]) + assert.equal(spyFn.calls[1].threw, threw[1]) + assert.equal(spyFn.lastCall.threw, threw[2]) + }) + }) + + describe('for a returning function', function () { + let originalFn: () => number; + let spyFn: Simple.Spy; + beforeEach(function () { + let i = 1 + + originalFn = () => { + return i++ + } + + spyFn = simple.spy(originalFn) + }) + + it('can be queried without having been called', function () { + assert(!spyFn.called) + assert.equal(spyFn.callCount, 0) + assert.deepEqual(spyFn.calls, []) + assert(spyFn.lastCall) + assert.equal(spyFn.lastCall.returned, undefined) + }) + + it('can be queried for what it threw on a single call', function () { + let returned: number + + returned = spyFn() + + assert(returned) + assert.equal(spyFn.callCount, 1) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall.returned, returned) + }) + + it('can be queried for what it threw over multiple calls', function () { + let returned: number[] = [] + + returned.push(spyFn()) + returned.push(spyFn()) + returned.push(spyFn()) + + assert.equal(returned.length, 3) + assert(spyFn.called) + assert.equal(spyFn.callCount, 3) + assert(spyFn.firstCall) + assert.equal(spyFn.firstCall.returned, returned[0]) + assert.equal(spyFn.calls[1].returned, returned[1]) + assert.equal(spyFn.lastCall.returned, returned[2]) + }) + }) + + describe('calls of multiple spies', function () { + it('can be compared to determine the order they were called in', function () { + let spy1 = simple.spy(function () {}) + let spy2 = simple.spy(function () {}) + let spy3 = simple.spy(function () {}) + + spy1() + spy3() + spy2() + spy1() + + assert(spy1.lastCall.k > spy2.lastCall.k) + assert(spy1.lastCall.k > spy3.lastCall.k) + assert(spy2.lastCall.k > spy3.lastCall.k) + assert(spy3.lastCall.k > spy1.calls[0].k) + }) + }) + }) + + describe('stub()', function () { + describe('with no configuration', function () { + let stubFn: Simple.Stub; + it('is also a spy', function () { + stubFn = simple.stub() + + stubFn('etc') + assert(stubFn.called) + assert(stubFn.lastCall.args[0], 'etc') + }) + }) + + describe('for a single callback configuration', function () { + let stubFn: Simple.Stub; + describe('with default index', function () { + beforeEach(function () { + stubFn = simple.stub().callbackWith(1, 2, 3) + }) + + it('can call back with arguments', function () { + stubFn('a', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 1) + assert.equal(stubFn.lastCall.args[0], 'a') + assert.equal(arguments.length, 3) + assert.equal(arguments[0], 1) + assert.equal(arguments[1], 2) + assert.equal(arguments[2], 3) + }) + }) + + it('can call back with arguments, over multiple calls', function () { + stubFn('a', function () {}) + stubFn('b', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 2) + assert.equal(stubFn.lastCall.args[0], 'b') + assert.equal(arguments.length, 3) + assert.equal(arguments[0], 1) + assert.equal(arguments[1], 2) + assert.equal(arguments[2], 3) + }) + }) + }) + + describe('with specified index', function () { + beforeEach(function () { + stubFn = simple.stub().callbackArgWith(1, 2, 3) + }) + + it('can call back with arguments', function () { + stubFn('a', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 1) + assert.equal(stubFn.lastCall.args[0], 'a') + assert.equal(arguments.length, 2) + assert.equal(arguments[0], 2) + assert.equal(arguments[1], 3) + }) + }) + + it('can call back with arguments, over multiple calls', function () { + stubFn('a', function () {}) + stubFn('b', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 2) + assert.equal(stubFn.lastCall.args[0], 'b') + assert.equal(arguments.length, 2) + assert.equal(arguments[0], 2) + assert.equal(arguments[1], 3) + }) + }) + }) + + describe('with context specified', function () { + beforeEach(function () { + stubFn = simple.stub().callback().inThisContext({ a: 'a' }) + }) + + it('should do what...', function (done) { + stubFn(function () { + assert.equal(this.a, 'a') + done() + }) + }) + }) + }) + + describe('for a multiple callback configurations', function () { + let stubFn: Simple.Stub; + beforeEach(function () { + stubFn = simple.stub().callbackWith(1).callbackWith(2).callbackWith(3) + }) + + it('can call back once with arguments', function () { + stubFn('a', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 1) + assert.equal(stubFn.lastCall.args[0], 'a') + assert.equal(arguments[0], 1) + }) + }) + + it('can call back with arguments, over multiple calls, looping per default', function () { + stubFn('a', function () {}) + stubFn('b', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 2) + assert.equal(stubFn.lastCall.args[0], 'b') + assert.equal(arguments[0], 2) + }) + stubFn('c', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(stubFn.lastCall.args[0], 'c') + assert.equal(arguments[0], 3) + }) + stubFn('d', function () { + assert.equal(stubFn.callCount, 4) + assert.equal(stubFn.lastCall.args[0], 'd') + assert.equal(arguments[0], 1) + }) + }) + + it('can call back with arguments, over multiple calls, looping turned off', function () { + stubFn.loop = false + stubFn('a', function () {}) + stubFn('b', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 2) + assert.equal(stubFn.lastCall.args[0], 'b') + assert.equal(arguments[0], 2) + }) + stubFn('c', function () { + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(stubFn.lastCall.args[0], 'c') + assert.equal(arguments[0], 3) + }) + let neverCalled = true + stubFn('d', function () { + neverCalled = false + }) + assert(neverCalled) + }) + }) + + describe('for a single throwing configuration', function () { + let stubFn: Simple.Stub; + beforeEach(function () { + stubFn = simple.stub().throwWith(new Error('example')) + }) + + it('can throw', function () { + let threw: Error + try { + stubFn() + } catch (e) { + threw = e + } + + assert(threw) + assert(stubFn.called) + assert.equal(stubFn.callCount, 1) + assert.equal(threw.message, 'example') + }) + + it('can throw over multiple calls, looping per default', function () { + let threw: Error[] = [] + try { + stubFn() + } catch (e) { + threw.push(e) + } + try { + stubFn() + } catch (e) { + threw.push(e) + } + + assert.equal(threw.length, 2) + assert(stubFn.called) + assert.equal(stubFn.callCount, 2) + assert.equal(threw[0], threw[1]) + assert.equal(threw[0].message, 'example') + }) + }) + + describe('for a multiple throwing configurations', function () { + let stubFn: Simple.Stub; + beforeEach(function () { + stubFn = simple.stub().throwWith(new Error('a')).throwWith(new Error('b')) + }) + + it('can throw', function () { + let threw: Error + try { + stubFn() + } catch (e) { + threw = e + } + + assert(threw) + assert(stubFn.called) + assert.equal(stubFn.callCount, 1) + assert.equal(threw.message, 'a') + }) + + it('can throw over multiple calls, looping per default', function () { + let threw: Error[] = [] + try { + stubFn() + } catch (e) { + threw.push(e) + } + try { + stubFn() + } catch (e) { + threw.push(e) + } + try { + stubFn() + } catch (e) { + threw.push(e) + } + + assert.equal(threw.length, 3) + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(threw[0].message, 'a') + assert.equal(threw[1].message, 'b') + assert.equal(threw[2].message, 'a') + }) + + it('can throw over multiple calls, looping turned off', function () { + stubFn.loop = false + + let threw: Error[] = [] + try { + stubFn() + } catch (e) { + threw.push(e) + } + try { + stubFn() + } catch (e) { + threw.push(e) + } + try { + stubFn() + } catch (e) { + threw.push(e) + } + + assert.equal(threw.length, 2) + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(threw[0].message, 'a') + assert.equal(threw[1].message, 'b') + }) + }) + + describe('for a single returning configuration', function () { + let stubFn: Simple.Stub; + beforeEach(function () { + stubFn = simple.stub() + }) + + it('can return', function () { + stubFn.returnWith('example') + + let returned: string + returned = stubFn() + + assert(returned) + assert.equal(stubFn.callCount, 1) + assert.equal(returned, 'example') + }) + + it('can return an empty string', function () { + stubFn.returnWith('') + + let returned: string + returned = stubFn() + + assert.equal(stubFn.callCount, 1) + assert.equal(returned, '') + }) + + it('can return over multiple calls, looping per default', function () { + stubFn.returnWith('example-a') + stubFn.returnWith('example-b') + + let returned: string[] = [] + returned.push(stubFn()) + returned.push(stubFn()) + returned.push(stubFn()) + returned.push(stubFn()) + + assert.equal(returned.length, 4) + assert(stubFn.called) + assert.equal(stubFn.callCount, 4) + assert.equal(returned[0], returned[2]) + assert.equal(returned[0], 'example-a') + assert.equal(returned[1], returned[3]) + assert.equal(returned[1], 'example-b') + }) + }) + + describe('for a multiple returning configurations', function () { + let stubFn: Simple.Stub; + beforeEach(function () { + stubFn = simple.stub().returnWith('a').returnWith('b') + }) + + it('can return', function () { + let returned: string + returned = stubFn() + + assert(returned) + assert.equal(stubFn.callCount, 1) + assert.equal(returned, 'a') + }) + + it('can return over multiple calls, looping per default', function () { + let returned: string[] = [] + returned.push(stubFn()) + returned.push(stubFn()) + returned.push(stubFn()) + + assert.equal(returned.length, 3) + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(returned[0], 'a') + assert.equal(returned[1], 'b') + assert.equal(returned[2], 'a') + }) + + it('can return over multiple calls, looping turned off', function () { + stubFn.loop = false + + let returned: string[] = [] + returned.push(stubFn()) + returned.push(stubFn()) + returned.push(stubFn()) + + assert.equal(returned.length, 3) + assert(stubFn.called) + assert.equal(stubFn.callCount, 3) + assert.equal(returned[0], 'a') + assert.equal(returned[1], 'b') + assert.equal(returned[2], undefined) + }) + }) + + describe('for a specified function to call', function () { + it('should be called with arguments and return', function () { + let stubFn = simple.stub().callFn(function () { + return arguments + }) + + let returned = stubFn('z', 'x') + + assert.equal(stubFn.callCount, 1) + assert.equal(returned[0], 'z') + assert.equal(returned[1], 'x') + }) + + it('should be able to throw', function () { + let stubFn = simple.stub().callFn(function () { + throw new Error('my message') + }) + + try { + stubFn() + } catch(e) { + assert(e instanceof Error) + assert.equal(e.message, 'my message') + } + }) + + it('should be called in context', function () { + let mockObj = { + stubFn: simple.stub().callFn(function () { + return this + }) + } + + let returned = mockObj.stubFn() + + assert.equal(returned, mockObj) + }) + + it('can be called in specified context', function () { + let anotherMockObj = {} + + let mockObj = { + stubFn: simple.stub().callFn(function () { + return this + }).inThisContext(anotherMockObj) + } + + let returned = mockObj.stubFn() + + assert.equal(returned, anotherMockObj) + }) + }) + + describe('for custom/when-conforming promises', function () { + let fulfilledStub: Simple.Stub + let rejectedStub: Simple.Stub + + beforeEach(function () { + fulfilledStub = simple.stub().returnWith(true) + rejectedStub = simple.stub().returnWith(true) + + interface MockPromise { + resolveValue: T, + rejectValue: T, + then(fulfilledFn: (value: any) => T, rejectedFn: (error: any) => T): void; + } + + let mockPromise: MockPromise = { + resolveValue: null as boolean, + rejectValue: null as boolean, + then: function (fulfilledFn: (value: any) => boolean, rejectedFn: (error: any) => boolean) { + let self = this + process.nextTick(function () { + if (self.resolveValue) return fulfilledFn(self.resolveValue) + if (self.rejectValue) return rejectedFn(self.rejectValue) + }) + } + } + + simple.mock(simple, 'Promise', { + when: function(value: T) { + let promise: MockPromise = Object.create(mockPromise) + promise.resolveValue = value + return promise + }, + reject: function(value: T) { + let promise: MockPromise = Object.create(mockPromise) + promise.rejectValue = value + return promise + } + }) + }) + + describe('with a single resolving configuration', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().resolveWith('example') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 1) + assert.equal(fulfilledStub.lastCall.arg, 'example') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + }) + + describe('with a multiple resolving configurations', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().resolveWith('a').resolveWith('b') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 1) + assert.equal(fulfilledStub.lastCall.arg, 'a') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + + it('can return over multiple calls, looping per default', function (done) { + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 3) + assert.equal(fulfilledStub.calls[0].arg, 'a') + assert.equal(fulfilledStub.calls[1].arg, 'b') + assert.equal(fulfilledStub.calls[2].arg, 'a') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + }) + + describe('with a single rejecting configuration', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().rejectWith('example') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 1) + assert.equal(rejectedStub.lastCall.arg, 'example') + done() + }, 0) + }) + }) + + describe('with a multiple rejecting configurations', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().rejectWith('a').rejectWith('b') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 1) + assert.equal(rejectedStub.lastCall.arg, 'a') + done() + }, 0) + }) + + it('can return over multiple calls, looping per default', function (done) { + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 3) + assert.equal(rejectedStub.calls[0].arg, 'a') + assert.equal(rejectedStub.calls[1].arg, 'b') + assert.equal(rejectedStub.calls[2].arg, 'a') + done() + }, 0) + }) + }) + }) + + describe('for native/conforming promises', function () { + let fulfilledStub: Simple.Stub + let rejectedStub: Simple.Stub + + beforeEach(function () { + fulfilledStub = simple.stub().returnWith(true) + rejectedStub = simple.stub().returnWith(true) + }) + + describe('with a single resolving configuration', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().resolveWith('example') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 1) + assert.equal(fulfilledStub.lastCall.arg, 'example') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + }) + + describe('with a multiple resolving configurations', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().resolveWith('a').resolveWith('b') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 1) + assert.equal(fulfilledStub.lastCall.arg, 'a') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + + it('can return over multiple calls, looping per default', function (done) { + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 3) + assert.equal(fulfilledStub.calls[0].arg, 'a') + assert.equal(fulfilledStub.calls[1].arg, 'b') + assert.equal(fulfilledStub.calls[2].arg, 'a') + assert.equal(rejectedStub.callCount, 0) + done() + }, 0) + }) + }) + + describe('with a single rejecting configuration', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().rejectWith('example') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 1) + assert.equal(rejectedStub.lastCall.arg, 'example') + done() + }, 0) + }) + }) + + describe('with a multiple rejecting configurations', function () { + let stubFn: Simple.Stub>; + beforeEach(function () { + stubFn = simple.stub().rejectWith('a').rejectWith('b') + }) + + it('can return a promise', function (done) { + let returned = stubFn() + + assert(returned) + + returned.then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 1) + assert.equal(rejectedStub.lastCall.arg, 'a') + done() + }, 0) + }) + + it('can return over multiple calls, looping per default', function (done) { + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + stubFn().then(fulfilledStub, rejectedStub) + + setTimeout(function () { + assert.equal(fulfilledStub.callCount, 0) + assert.equal(rejectedStub.callCount, 3) + assert.equal(rejectedStub.calls[0].arg, 'a') + assert.equal(rejectedStub.calls[1].arg, 'b') + assert.equal(rejectedStub.calls[2].arg, 'a') + done() + }, 0) + }) + }) + }) + }) + + describe('mock()', function () { + describe('on a object with prototype', function () { + class ProtoKlass { + protoValue: string = 'x' + protoFn() { + return 'x' + } + } + + let obj: any + + before(function () { + }) + + beforeEach(function () { + obj = new ProtoKlass() + }) + + it('can mock instance values over its prototype\'s and restore', function () { + simple.mock(obj, 'protoValue', 'y') + assert.equal(obj.protoValue, 'y') + simple.restore() + assert.equal(obj.protoValue, 'x') + }) + + it('can mock with custom instance functions over its prototype\'s and restore', function () { + simple.mock(obj, 'protoFn', function () { + return 'y' + }) + assert.equal(obj.protoFn(), 'y') + assert(obj.protoFn.called) + simple.restore() + assert.equal(obj.protoFn(), 'x') + }) + + it('can mock with stubbed functions over its prototype\'s and restore', function () { + simple.mock(obj, 'protoFn').returnWith('y') + assert.equal(obj.protoFn(), 'y') + assert(obj.protoFn.called) + simple.restore() + assert.equal(obj.protoFn(), 'x') + }) + + it('can mock with stubbed functions and prototype\'s original over its prototype\'s and restore', function () { + simple.mock(obj, 'protoFn').returnWith('y').callOriginal().returnWith('z') + assert.equal(obj.protoFn(), 'y') + assert.equal(obj.protoFn(), 'x') + assert.equal(obj.protoFn(), 'z') + assert.equal(obj.protoFn.callCount, 3) + simple.restore() + assert.equal(obj.protoFn(), 'x') + }) + }) + + describe('on an anonymous object', function () { + let obj: any + beforeEach(function () { + obj = { + a: 'a', + b: 'b', + c: 'c', + fnD: function () { + return 'd' + } + } + }) + + it('can mock instance values and restore', function () { + let beforeKeys = Object.keys(obj) + simple.mock(obj, 'a', 'd') + simple.mock(obj, 'd', 'a') + assert.equal(obj.a, 'd') + assert.equal(obj.d, 'a') + simple.restore() + assert.equal(obj.a, 'a') + assert.equal(obj.d, undefined) + assert.deepEqual(Object.keys(obj), beforeKeys) + }) + + it('can mock with spy on pre-existing functions and restore', function () { + simple.mock(obj, 'fnD').returnWith('a') + assert.equal(obj.fnD(), 'a') + assert(obj.fnD.called) + simple.restore() + assert.equal(obj.fnD(), 'd') + }) + + it('can mock with newly stubbed functions and restore', function () { + simple.mock(obj, 'fnA').returnWith('a') + assert.equal(obj.fnA(), 'a') + assert(obj.fnA.called) + simple.restore() + assert.equal(obj.fnA, undefined) + }) + }) + + describe('with one argument', function () { + it('returns a spy', function () { + let called = 0 + + let spy = simple.mock(function () { + called++ + }) + + spy() + assert.equal(called, 1) + assert(spy.called) + }) + }) + + describe('with no arguments', function () { + it('returns a stub', function () { + let stub = simple.mock().returnWith('x') + + let x = stub() + assert(stub.called) + assert(x, 'x') + }) + }) + }) +}) + +simple.Promise = Bluebird; diff --git a/simple-mock/simple-mock.d.ts b/simple-mock/simple-mock.d.ts new file mode 100644 index 0000000000..760ef67b46 --- /dev/null +++ b/simple-mock/simple-mock.d.ts @@ -0,0 +1,194 @@ +// Type definitions for simple-mock +// Project: https://github.com/jupiter/simple-mock +// Definitions by: Leon Yu +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace Simple { + type Fn = { + (...args: any[]): T + } + + export interface Static { + /** + * Restores all current mocks. + */ + restore(): void; + + /** + * Wraps fn in a spy and sets this on the obj, restorable with all mocks. + */ + mock(obj: any, key: string, fn: Fn): Stub; + + /** + * Sets the value on this object. E.g. mock(config, 'title', 'test') is the same as config.title = 'test', but restorable with all mocks. + */ + mock(obj: any, key: string, mockValue: T): T; + + /** + * If obj has already has this function, it is wrapped in a spy. The resulting spy can be turned into a stub by further configuration. Restores with all mocks. + */ + mock(obj: any, key: string): Stub; + mock(obj: any, key: string): Stub; + + /** + * Wraps fn in a spy. + */ + spy(fn: Fn): Spy; + /** + * Wraps fn in a spy. + */ + mock(fn: Fn): Spy; + + /** + * Returns a stub function that is also a spy. + */ + stub(): Stub; + stub(): Stub; + + /** + * Returns a stub function that is also a spy. + */ + mock(): Stub; + mock(): Stub; + + Promise?: PromiseConstructorLike; + } + + interface Calls { + /** + * an array of arguments received on the call + */ + args: any[]; + /** + * first argument + */ + arg: any; + /** + * the context (this) of the call + */ + context: any; + /** + * the value returned by the wrapped function + */ + returned: T; + /** + * the error thrown by the wrapped function + */ + threw: Error; + /** + * autoincrementing number, can be compared to evaluate call order + */ + k: number; + } + + export interface Spy{ + (...args: any[]): T; + + called: boolean; + /** + * Number of times the function was called. + */ + callCount: number; + calls: Calls[]; + firstCall: Calls; + /** + * The last call object. (This is often also the first and only call.) + */ + lastCall: Calls; + /** + * Resets all counts and properties to the original state. + */ + reset(): void; + } + + interface Action { + /** + * arguments to call back with + */ + cbArgs: ArrayLike; + returnValue: T; + throwError: Error; + } + + export interface Stub extends Spy { + /** + * Configures this stub to call this function, returning its return value. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callFn(fn: Fn): Stub; + + /** + * Configures this stub to call the original, unstubbed function, returning its return value. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callOriginal(): Stub; + + /** + * Configures this stub to return with this value. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + returnWith(val: R): Stub; + + /** + * Configures this stub to throw this error. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + throwWith(err: Error): Stub; + + /** + * Configures this stub to call back with the arguments passed. It will use either the last argument as callback, or the argument at cbArgumentIndex. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callback(...args: any[]): Stub; + /** + * Configures this stub to call back with the arguments passed. It will use either the last argument as callback, or the argument at cbArgumentIndex. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callbackWith(...args: any[]): Stub; + + /** + * Configures this stub to call back with the arguments passed. It will use either the last argument as callback, or the argument at cbArgumentIndex. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callbackAtIndex(cbArgumentIndex: number, ...args: any[]): Stub; + /** + * Configures this stub to call back with the arguments passed. It will use either the last argument as callback, or the argument at cbArgumentIndex. + * Subsequent calls of this on the same stub (chainable) will queue up different behaviours for each subsequent call of the stub. + */ + callbackArgWith(cbArgumentIndex: number, ...args: any[]): Stub; + + + /** + * Configures the last configured function or callback to be called in this context, i.e. this will be obj. + */ + inThisContext(obj: any): Stub; + + /** + * Configures the stub to return a Promise (where available] resolving to this value. Same as stub.returnWith(Promise.resolve(val)). + * You can use a custom Promise-conforming library, i.e. simple.Promise = require('bluebird') or simple.Promise = $q. + */ + resolveWith(val: V): Stub>; + + /** + * Configures the stub to return a Promise (where available) rejecting with this error. Same as stub.returnWith(Promise.reject(val)). + * You can use a custom Promise-conforming library, i.e. simple.Promise = require('bluebird') or simple.Promise = $q. + */ + rejectWith(val: V): Stub>; + + /** + * An array of behaviours, each having one of these properties: + */ + actions: Action[]; + + /** + * setting whether the queue of actions for this stub should repeat. + * @default true + */ + loop: boolean; + } +} + +declare module "simple-mock" { + var simple: Simple.Static; + export = simple; +} From 4b57196684aa30d44373ab385104cab303041ded Mon Sep 17 00:00:00 2001 From: tlein Date: Fri, 4 Dec 2015 21:40:29 -0600 Subject: [PATCH 111/474] Add setStrokeDash to easeljs --- easeljs/easeljs-tests.ts | 1 + easeljs/easeljs.d.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/easeljs/easeljs-tests.ts b/easeljs/easeljs-tests.ts index b036ae5702..c517dba2fb 100644 --- a/easeljs/easeljs-tests.ts +++ b/easeljs/easeljs-tests.ts @@ -42,6 +42,7 @@ function test_animation() { function test_graphics() { var g = new createjs.Graphics(); g.setStrokeStyle(1); + g.setStrokeDash([20, 10], 20); g.beginStroke(createjs.Graphics.getRGB(0, 0, 0)); g.beginFill(createjs.Graphics.getRGB(255, 0, 0)); g.drawCircle(0, 0, 3); diff --git a/easeljs/easeljs.d.ts b/easeljs/easeljs.d.ts index 73b45b8108..947c760e10 100644 --- a/easeljs/easeljs.d.ts +++ b/easeljs/easeljs.d.ts @@ -344,6 +344,7 @@ declare module createjs { quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): Graphics; rect(x: number, y: number, w: number, h: number): Graphics; setStrokeStyle(thickness: number, caps?: string | number, joints?: string | number, miterLimit?: number, ignoreScale?: boolean): Graphics; + setStrokeDash(segments?: number[], offset?: number): Graphics; store(): Graphics; toString(): string; unstore(): Graphics; @@ -377,6 +378,7 @@ declare module createjs { qt(cpx: number, cpy: number, x: number, y: number): Graphics; r(x: number, y: number, w: number, h: number): Graphics; ss(thickness: number, caps?: string | number, joints?: string | number, miterLimit?: number, ignoreScale?: boolean): Graphics; + sd(segments?: number[], offset?: number): Graphics; } From 2cecb066cea5029e3090f810d588e33fac5ca1dd Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Sat, 5 Dec 2015 00:05:30 -0500 Subject: [PATCH 112/474] Add react-bootstrap-daterangepicker definitions --- .../react-bootstrap-daterangepicker-tests.tsx | 7 +++++ .../react-bootstrap-daterangepicker.d.tsx | 29 +++++++++++++++++++ ...ct-bootstrap-daterangepicker.tsx.tscparams | 1 + 3 files changed, 37 insertions(+) create mode 100644 react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx create mode 100644 react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.d.tsx create mode 100644 react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.tsx.tscparams diff --git a/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx new file mode 100644 index 0000000000..a18e430130 --- /dev/null +++ b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx @@ -0,0 +1,7 @@ +/// +/// + +import * as DateRangePicker from "react-bootstrap-daterangepicker"; +import * as React from "react"; + +let pickerCoponent = true} />; diff --git a/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.d.tsx b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.d.tsx new file mode 100644 index 0000000000..e80a258a46 --- /dev/null +++ b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.d.tsx @@ -0,0 +1,29 @@ +// Type definitions for react-bootstrap-daterangepicker +// Project: https://github.com/skratchdot/react-bootstrap-daterangepicker +// Definitions by: Ian Ker-Seymer https://github.com/ianks +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module ReactBootstrapDaterangepicker { + export interface EventHandler { (event?: any, picker?: any): any; } + + export interface Props extends DatepickerOptions { + onShow?: EventHandler; + onHide?: EventHandler; + onShowCalendar?: EventHandler; + onHideCalendar?: EventHandler; + onApply?: EventHandler; + onCancel?: EventHandler; + onEvent?: EventHandler; + } + + export class DateRangePicker extends __React.Component {} +} + +declare var DateRangePicker: typeof ReactBootstrapDaterangepicker.DateRangePicker; + +declare module "react-bootstrap-daterangepicker" { + export = DateRangePicker; +} diff --git a/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.tsx.tscparams b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.tsx.tscparams new file mode 100644 index 0000000000..36c3b9323c --- /dev/null +++ b/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker.tsx.tscparams @@ -0,0 +1 @@ +--noImplicitAny --module commonjs --jsx react From d2e216ec4fd6725fed01b72bd30635340b92dd9a Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 5 Dec 2015 16:07:17 +0500 Subject: [PATCH 113/474] node: signatures of module "os" have been changed --- node/node-tests.ts | 47 ++++++++++++++++++++++++++++++++++++++++++++++ node/node.d.ts | 26 +++++++++++++++++++++++-- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index 930bd1a71e..4ca651b333 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -14,6 +14,7 @@ import * as querystring from "querystring"; import * as path from "path"; import * as readline from "readline"; import * as childProcess from "child_process"; +import * as os from "os"; assert(1 + 1 - 2 === 0, "The universe isn't how it should."); @@ -411,3 +412,49 @@ rl.question("do you like typescript?", function(answer: string) { childProcess.exec("echo test"); childProcess.spawnSync("echo test"); + +//////////////////////////////////////////////////// +/// os tests : https://nodejs.org/api/os.html +//////////////////////////////////////////////////// + +module os_tests { + { + let result: string; + + result = os.tmpdir(); + result = os.homedir(); + result = os.endianness(); + result = os.hostname(); + result = os.type(); + result = os.platform(); + result = os.arch(); + result = os.release(); + result = os.EOL; + } + + { + let result: number; + + result = os.uptime(); + result = os.totalmem(); + result = os.freemem(); + } + + { + let result: number[]; + + result = os.loadavg(); + } + + { + let result: os.CpuInfo[]; + + result = os.cpus(); + } + + { + let result: {[index: string]: os.NetworkInterfaceInfo[]}; + + result = os.networkInterfaces(); + } +} diff --git a/node/node.d.ts b/node/node.d.ts index 017ca8e6b9..39be040a49 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -698,7 +698,29 @@ declare module "zlib" { } declare module "os" { + export interface CpuInfo { + model: string; + speed: number; + times: { + user: number; + nice: number; + sys: number; + idle: number; + irq: number; + } + } + + export interface NetworkInterfaceInfo { + address: string; + netmask: string; + family: string; + mac: string; + internal: boolean; + } + export function tmpdir(): string; + export function homedir(): string; + export function endianness(): string; export function hostname(): string; export function type(): string; export function platform(): string; @@ -708,8 +730,8 @@ declare module "os" { export function loadavg(): number[]; export function totalmem(): number; export function freemem(): number; - export function cpus(): { model: string; speed: number; times: { user: number; nice: number; sys: number; idle: number; irq: number; }; }[]; - export function networkInterfaces(): any; + export function cpus(): CpuInfo[]; + export function networkInterfaces(): {[index: string]: NetworkInterfaceInfo[]}; export var EOL: string; } From 14cc56099a4c90926839e406a87d36596d093708 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 5 Dec 2015 07:16:13 -0500 Subject: [PATCH 114/474] Overload then, catch, finally definitions --- request-promise/request-promise.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/request-promise/request-promise.d.ts b/request-promise/request-promise.d.ts index b35856277e..6b5f23fd46 100644 --- a/request-promise/request-promise.d.ts +++ b/request-promise/request-promise.d.ts @@ -12,7 +12,13 @@ declare module 'request-promise' { import request = require('request'); import http = require('http'); - interface RequestPromise extends request.Request, Promise { + interface RequestPromise extends request.Request { + then(onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: any) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + catch(onrejected?: (reason: any) => any | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; + finally(handler: () => PromiseLike): Promise; + finally(handler: () => TResult): Promise; promise(): Promise; } From 31def508ff755427b854e5b59a739fbb19cd15ff Mon Sep 17 00:00:00 2001 From: Sam Herrmann Date: Sat, 27 Jun 2015 16:41:10 -0400 Subject: [PATCH 115/474] Add AngularStrap type definitions As documented on the AngularStrap website: http://mgcrea.github.io/angular-strap/ --- angular-strap/angular-strap-tests.ts | 378 +++++++++++++++++ angular-strap/angular-strap.d.ts | 600 +++++++++++++++++++++++++++ 2 files changed, 978 insertions(+) create mode 100644 angular-strap/angular-strap-tests.ts create mode 100644 angular-strap/angular-strap.d.ts diff --git a/angular-strap/angular-strap-tests.ts b/angular-strap/angular-strap-tests.ts new file mode 100644 index 0000000000..90c7a2bdea --- /dev/null +++ b/angular-strap/angular-strap-tests.ts @@ -0,0 +1,378 @@ +/// +/// + +module angularStrapTests { + + import ngStrap = mgcrea.ngStrap; + + /////////////////////////////////////////////////////////////////////////// + // Modal + /////////////////////////////////////////////////////////////////////////// + + module modalTests { + + interface IDemoCtrlScope extends ngStrap.modal.IModalScope { + showModal: () => void; + } + + angular.module('demoApp') + .config($modalConfig) + .controller('demoCtrl', demoCtrl); + + function demoCtrl($scope: IDemoCtrlScope, + $modal: ngStrap.modal.IModalService): void { + + var myModalOptions: ngStrap.modal.IModalOptions = {}; + myModalOptions.title = 'My Title'; + myModalOptions.content = 'Hello Modal
This is a multiline message!'; + myModalOptions.show = true; + + var myModal = $modal(myModalOptions); + + var myOtherModalOptions: ngStrap.modal.IModalOptions = {}; + myOtherModalOptions.scope = $scope; + myOtherModalOptions.template = 'modal/docs/modal.demo.tpl.html'; + myOtherModalOptions.show = false; + + var myOtherModal = $modal(myOtherModalOptions); + + $scope.showModal = (): void => { + myOtherModal.$promise.then(myOtherModal.show); + }; + } + + function $modalConfig($modalProvider: ngStrap.modal.IModalProvider): void { + var defaults: ngStrap.modal.IModalOptions = { + animation: 'am-flip-x' + } + angular.extend($modalProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Aside + /////////////////////////////////////////////////////////////////////////// + + module asideTests { + + angular.module('demoApp') + .config($asideConfig) + .controller('demoCtrl', demoCtrl); + + function demoCtrl($scope: ngStrap.aside.IAsideScope, + $aside: ngStrap.aside.IAsideService): void { + + var myAsideOptions: ngStrap.aside.IAsideOptions = {}; + myAsideOptions.title = 'My Title'; + myAsideOptions.content = 'My content'; + myAsideOptions.show = true; + + var myAside = $aside(myAsideOptions); + + var myOtherAsideOptions: ngStrap.aside.IAsideOptions = {}; + myOtherAsideOptions.scope = $scope; + myOtherAsideOptions.template = 'aside/docs/aside.demo.tpl.html'; + + var myOtherAside = $aside(); + + myOtherAside.$promise.then(() => { + myOtherAside.show(); + }); + } + + function $asideConfig($asideProvider: ngStrap.aside.IAsideProvider): void { + var defaults: ngStrap.aside.IAsideOptions = {}; + defaults.animation = 'am-fadeAndSlideLeft'; + defaults.placement = 'left'; + + angular.extend($asideProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Alert + /////////////////////////////////////////////////////////////////////////// + + module alertTests { + + angular.module('demoApp') + .config($alertConfig) + .controller('demoCtrl', demoCtrl); + + function demoCtrl($scope: ngStrap.alert.IAlertScope, + $alert: ngStrap.alert.IAlertService): void { + + var options: ngStrap.alert.IAlertOptions = {}; + options.title = 'Holy guacamole!'; + options.content = 'Best check yo self, you\'re not looking too good.'; + options.placement = 'top'; + options.type = 'info'; + options.show = true; + + var myAlert = $alert(); + } + + function $alertConfig($alertProvider: ngStrap.alert.IAlertProvider): void { + var defaults: ngStrap.alert.IAlertOptions = {}; + defaults.animation = 'am-fade-and-slide-top'; + defaults.placement = 'top'; + + angular.extend($alertProvider.defaults, defaults); + }; + } + + + /////////////////////////////////////////////////////////////////////////// + // Tooltip + /////////////////////////////////////////////////////////////////////////// + + module tooltipTests { + + angular.module('demoApp') + .config($tooltipConfig) + .controller('demoDrct', demoDrct); + + function demoDrct($tooltip: ngStrap.tooltip.ITooltipService): ng.IDirective { + var drct: ng.IDirective = {}; + drct.restrict = 'EA'; + drct.link = link; + return drct; + + function link(scope: ng.IScope, elem: ng.IAugmentedJQuery, attrs: ng.IAttributes): void { + var options: ngStrap.tooltip.ITooltipOptions = {}; + options.title = 'My Title'; + $tooltip(elem, options); + } + } + + function $tooltipConfig($tooltipProvider: ngStrap.tooltip.ITooltipProvider): void { + var defaults: ngStrap.tooltip.ITooltipOptions = {}; + defaults.animation = 'am-flip-x'; + defaults.trigger = 'hover'; + + angular.extend($tooltipProvider.defaults, defaults); + }; + } + + + /////////////////////////////////////////////////////////////////////////// + // Popover + /////////////////////////////////////////////////////////////////////////// + + module popoverTests { + + angular.module('demoApp') + .config($popoverConfig) + .controller('demoDrct', demoDrct); + + function demoDrct($popover: ngStrap.popover.IPopoverService): ng.IDirective { + var drct: ng.IDirective = {}; + drct.restrict = 'EA'; + drct.link = link; + return drct; + + function link(scope: ng.IScope, elem: ng.IAugmentedJQuery, attrs: ng.IAttributes): void { + var options: ngStrap.tooltip.ITooltipOptions = {}; + options.title = 'My Title'; + + $popover(elem, options); + } + } + + function $popoverConfig($popoverProvider: ngStrap.popover.IPopoverProvider): void { + var defaults: ngStrap.tooltip.ITooltipOptions = {} + defaults.animation = 'am-flip-x'; + defaults.trigger = 'hover'; + + angular.extend($popoverProvider.defaults, defaults); + }; + } + + + /////////////////////////////////////////////////////////////////////////// + // Typeahead + /////////////////////////////////////////////////////////////////////////// + + module typeaheadTests { + + angular.module('myApp') + .config($typeaheadConfig); + + function $typeaheadConfig($typeaheadProvider: ngStrap.typeahead.ITypeaheadProvider) { + var defaults: ngStrap.typeahead.ITypeaheadOptions = {} + defaults.animation = 'am-flip-x'; + defaults.minLength = 2; + defaults.limit = 8; + + angular.extend($typeaheadProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Datepicker + /////////////////////////////////////////////////////////////////////////// + + module datepickerTests { + + angular.module('myApp') + .config($datepickerConfig); + + function $datepickerConfig($datepickerProvider: ngStrap.datepicker.IDatepickerProvider): void { + var defaults: ngStrap.datepicker.IDatepickerOptions = {}; + defaults.dateFormat = 'dd/MM/yyyy'; + defaults.startWeek = 1; + + angular.extend($datepickerProvider.defaults, defaults); + }; + } + + + /////////////////////////////////////////////////////////////////////////// + // Timepicker + /////////////////////////////////////////////////////////////////////////// + + module timepickerTests { + + angular.module('myApp') + .config($timepickerConfig); + + function $timepickerConfig($timepickerProvider: ngStrap.timepicker.ITimepickerProvider): void { + var defaults: ngStrap.timepicker.ITimepickerOptions = {}; + defaults.timeFormat = 'HH:mm'; + defaults.length = 7; + + angular.extend($timepickerProvider.defaults, defaults); + }; + } + + + /////////////////////////////////////////////////////////////////////////// + // Select + /////////////////////////////////////////////////////////////////////////// + + module selectTests { + + angular.module('myApp') + .config($selectConfig); + + function $selectConfig($selectProvider: ngStrap.select.ISelectProvider): void { + var defaults: ngStrap.select.ISelectOptions = {}; + defaults.animation = 'am-flip-x'; + defaults.sort = false; + + angular.extend($selectProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Tabs + /////////////////////////////////////////////////////////////////////////// + + module tabTests { + + angular.module('myApp') + .config($tabConfig); + + function $tabConfig($tabProvider: ngStrap.tab.ITabProvider) { + var defaults: ngStrap.tab.ITabOptions = {}; + defaults.animation = 'am-flip-x'; + + angular.extend($tabProvider.defaults, defaults); + } + } + + /////////////////////////////////////////////////////////////////////////// + // Collapse + /////////////////////////////////////////////////////////////////////////// + + module collapseTests { + + angular.module('myApp') + .config($collapseConfig); + + function $collapseConfig($collapseProvider: ngStrap.collapse.ICollapseProvider):void { + var defaults: ngStrap.collapse.ICollapseOptions = {}; + defaults.animation = 'am-flip-x'; + + angular.extend($collapseProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Dropdown + /////////////////////////////////////////////////////////////////////////// + + module dropdownTests { + + angular.module('myApp') + .config($dropdownConfig); + + function $dropdownConfig($dropdownProvider: ngStrap.dropdown.IDropdownProvider):void { + var defaults: ngStrap.dropdown.IDropdownOptions = {}; + defaults.animation = 'am-flip-x'; + defaults.trigger = 'hover'; + + angular.extend($dropdownProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Navbar + /////////////////////////////////////////////////////////////////////////// + + module navbarTests { + + angular.module('myApp') + .config($navbarConfig); + + function $navbarConfig($navbarProvider: ngStrap.navbar.INavbarProvider):void { + var defaults: ngStrap.navbar.INavbarOptions = {}; + defaults.activeClass = 'in'; + + angular.extend($navbarProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Scrollspy + /////////////////////////////////////////////////////////////////////////// + + module scrollspyTests { + + angular.module('myApp') + .config($scrollspyConfig); + + function $scrollspyConfig($scrollspyProvider: ngStrap.scrollspy.IScrollspyProvider):void { + var defaults: ngStrap.scrollspy.IScrollspyOptions = {}; + defaults.offset = 0; + defaults.target = 'my-selector'; + + angular.extend($scrollspyProvider.defaults, defaults); + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Affix + /////////////////////////////////////////////////////////////////////////// + + module affixTests { + + angular.module('myApp') + .config($affixConfig); + + function $affixConfig($affixProvider: ngStrap.affix.IAffixProvider):void { + var defaults: ngStrap.affix.IAffixOptions = {}; + defaults.offsetTop = 100; + + angular.extend($affixProvider.defaults, defaults); + } + } +} \ No newline at end of file diff --git a/angular-strap/angular-strap.d.ts b/angular-strap/angular-strap.d.ts new file mode 100644 index 0000000000..10e46bc1c1 --- /dev/null +++ b/angular-strap/angular-strap.d.ts @@ -0,0 +1,600 @@ +// Type definitions for angular-strap v2.2.x +// Project: http://mgcrea.github.io/angular-strap/ +// Definitions by: Sam Herrmann +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare module mgcrea.ngStrap { + + /////////////////////////////////////////////////////////////////////////// + // Modal + // see http://mgcrea.github.io/angular-strap/#/modals + /////////////////////////////////////////////////////////////////////////// + + module modal { + + interface IModalService { + (config?: IModalOptions): IModal; + } + + interface IModalProvider { + defaults: IModalOptions; + } + + interface IModal { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface IModalOptions { + animation?: string; + backdropAnimation?: string; + placement?: string; + title?: string; + content?: string; + html?: boolean; + backdrop?: boolean | string; + keyboard?: boolean; + show?: boolean; + container?: string | boolean; + template?: string; + contentTemplate?: string; + prefixEvent?: string; + id?: string; + scope?: ng.IScope; + } + + interface IModalScope extends ng.IScope { + $show: () => void; + $hide: () => void; + $toggle: () => void; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Aside + // see http://mgcrea.github.io/angular-strap/#/asides + /////////////////////////////////////////////////////////////////////////// + + module aside { + + interface IAsideService { + (config?: IAsideOptions): IAside; + } + + interface IAsideProvider { + defaults: IAsideOptions; + } + + interface IAside { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface IAsideOptions { + animation?: string; + placement?: string; + title?: string; + content?: string; + html?: boolean; + backdrop?: boolean | string; + keyboard?: boolean; + show?: boolean; + container?: string | boolean; + template?: string; + contentTemplate?: string; + scope?: ng.IScope; + } + + interface IAsideScope extends ng.IScope { + $show: () => void; + $hide: () => void; + $toggle: () => void; + } + } + + + + /////////////////////////////////////////////////////////////////////////// + // Alert + // see http://mgcrea.github.io/angular-strap/#/alerts + /////////////////////////////////////////////////////////////////////////// + + module alert { + + interface IAlertService { + (config?: IAlertOptions): IAlert; + } + + interface IAlertProvider { + defaults: IAlertOptions; + } + + interface IAlert { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface IAlertOptions { + animation?: string; + placement?: string; + title?: string; + content?: string; + type?: string; + keyboard?: boolean; + show?: boolean; + container?: string | boolean; + template?: string; + duration?: number | boolean; + dismissable?: boolean; + } + + interface IAlertScope extends ng.IScope { + $show: () => void; + $hide: () => void; + $toggle: () => void; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Tooltip + // see http://mgcrea.github.io/angular-strap/#/tooltips + /////////////////////////////////////////////////////////////////////////// + + module tooltip { + + interface ITooltipService { + (element: ng.IAugmentedJQuery, config?: ITooltipOptions): ITooltip; + } + + interface ITooltipProvider { + defaults: ITooltipOptions; + } + + interface ITooltip { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface ITooltipOptions { + animation?: string; + placement?: string; + trigger?: string; + title?: string; + html?: boolean; + delay?: number | { show: number; hide: number}; + container?: string | boolean; + target?: string | ng.IAugmentedJQuery | boolean; + template?: string; + contentTemplate?: string; + prefixEvent?: string; + id?: string; + viewport?: string | { selector: string; padding: string | number }; + } + + interface ITooltipScope extends ng.IScope { + $show: () => void; + $hide: () => void; + $toggle: () => void; + $setEnabled: (isEnabled: boolean) => void; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Popover + // see http://mgcrea.github.io/angular-strap/#/popovers + /////////////////////////////////////////////////////////////////////////// + + module popover { + + interface IPopoverService { + (element: ng.IAugmentedJQuery, config?: IPopoverOptions): IPopover; + } + + interface IPopoverProvider { + defaults: IPopoverOptions; + } + + interface IPopover { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface IPopoverOptions { + animation?: string; + placement?: string; + trigger?: string; + title?: string; + content?: string; + html?: boolean; + delay?: number | { show: number; hide: number }; + container?: string | boolean; + target?: string | ng.IAugmentedJQuery | boolean; + template?: string; + contentTemplate?: string; + autoClose?: boolean; + id?: string; + viewport?: string | { selector: string; padding: string | number }; + } + + interface IPopoverScope extends ng.IScope { + $show: () => void; + $hide: () => void; + $toggle: () => void; + } + } + + + + /////////////////////////////////////////////////////////////////////////// + // Typeahead + // see http://mgcrea.github.io/angular-strap/#/typeaheads + /////////////////////////////////////////////////////////////////////////// + + module typeahead { + + interface ITypeaheadService { + (element: ng.IAugmentedJQuery, controller: any, config?: ITypeaheadOptions): ITypeahead; + } + + interface ITypeaheadProvider { + defaults: ITypeaheadOptions; + } + + interface ITypeahead { + $promise: ng.IPromise; + show: () => void; + hide: () => void; + toggle: () => void; + } + + interface ITypeaheadOptions { + animation?: string; + placement?: string; + trigger?: string; + html?: boolean; + delay?: number | { show: number; hide: number }; + container?: string | boolean; + template?: string; + limit?: number; + minLength?: number; + autoSelect?: boolean; + comparator?: string; + id?: string; + watchOptions?: boolean; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Datepicker + // see http://mgcrea.github.io/angular-strap/#/datepickers + /////////////////////////////////////////////////////////////////////////// + + module datepicker { + + interface IDatepickerService { + (element: ng.IAugmentedJQuery, controller: any, config?: IDatepickerOptions): IDatepicker; + } + + interface IDatepickerProvider { + defaults: IDatepickerOptions; + } + + interface IDatepicker { + update: (date: Date) => void; + updateDisabledDates: (dateRanges: IDatepickerDateRange[]) => void; + select: (dateConstructorArg: string | number | number[], keep: boolean) => void; + setMode: (mode: any) => void; + int: () => void; + destroy: () => void; + show: () => void; + hide: () => void; + } + + interface IDatepickerDateRange { + start: Date; + end: Date; + } + + interface IDatepickerOptions { + animation?: string; + placement?: string; + trigger?: string; + html?: boolean; + delay?: number | { show: number; hide: number }; + container?: string | boolean; + template?: string; + dateFormat?: string; + modelDateFormat?: string; + dateType?: string; + timezone?: string; + autoclose?: boolean; + useNative?: boolean; + minDate?: Date; + maxDate?: Date; + startView?: number; + minView?: number; + startWeek?: number; + startDate?: Date; + iconLeft?: string; + iconRight?: string; + daysOfWeekDisabled?: string; + disabledDates?: IDatepickerDateRange[]; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Timepicker + // see http://mgcrea.github.io/angular-strap/#/timepickers + /////////////////////////////////////////////////////////////////////////// + + module timepicker { + + interface ITimepickerService { + (element: ng.IAugmentedJQuery, controller: any, config?: ITimepickerOptions): ITimepicker; + } + + interface ITimepickerProvider { + defaults: ITimepickerOptions; + } + + interface ITimepicker { + + } + + interface ITimepickerOptions { + animation?: string; + placement?: string; + trigger?: string; + html?: boolean; + delay?: number | { show: number; hide: number; }; + container?: string | boolean; + template?: string; + timeFormat?: string; + modelTimeFormat?: string; + timeType?: string; + autoclose?: boolean; + useNative?: boolean; + minTime?: Date; // TODO + maxTime?: Date; // TODO + length?: number; + hourStep?: number; + minuteStep?: number; + secondStep?: number; + roundDisplay?: boolean; + iconUp?: string; + iconDown?: string; + arrowBehaviour?: string; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Button + // see http://mgcrea.github.io/angular-strap/#/buttons + /////////////////////////////////////////////////////////////////////////// + + // No definitions for this module + + + /////////////////////////////////////////////////////////////////////////// + // Select + // see http://mgcrea.github.io/angular-strap/#/selects + /////////////////////////////////////////////////////////////////////////// + + module select { + + interface ISelectService { + (element: ng.IAugmentedJQuery, controller: any, config: ISelectOptions): ISelect; + } + + interface ISelectProvider { + defaults: ISelectOptions; + } + + interface ISelect { + update: (matches: any) => void; + active: (index: number) => number; + select: (index: number) => void; + show: () => void; + hide: () => void; + } + + interface ISelectOptions { + animation?: string; + placement?: string; + trigger?: string; + html?: boolean; + delay?: number | { show: number; hide: number; }; + container?: string | boolean; + template?: string; + multiple?: boolean; + allNoneButtons?: boolean; + allText?: string; + noneText?: string; + maxLength?: number; + maxLengthHtml?: string; + sort?: boolean; + placeholder?: string; + iconCheckmark?: string; + id?: string; + } + } + + /////////////////////////////////////////////////////////////////////////// + // Tabs + // see http://mgcrea.github.io/angular-strap/#/tabs + /////////////////////////////////////////////////////////////////////////// + + module tab { + + interface ITabProvider { + defaults: ITabOptions; + } + + interface ITabService { + defaults: ITabOptions; + controller: any; + } + + interface ITabOptions { + animation?: string; + template?: string; + navClass?: string; + activeClass?: string; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Collapses + // see http://mgcrea.github.io/angular-strap/#/collapses + /////////////////////////////////////////////////////////////////////////// + + module collapse { + + interface ICollapseProvider { + defaults: ICollapseOptions; + } + + interface ICollapseOptions { + animation?: string; + activeClass?: string; + disallowToggle?: boolean; + startCollapsed?: boolean; + allowMultiple?: boolean; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Dropdowsn + // see http://mgcrea.github.io/angular-strap/#/dropdowns + /////////////////////////////////////////////////////////////////////////// + + module dropdown { + + interface IDropdownProvider { + defaults: IDropdownOptions; + } + + interface IDropdownService { + (element: ng.IAugmentedJQuery, config: IDropdownOptions): IDropdown; + } + + interface IDropdown { + show: () => void; + hide: () => void; + destroy: () => void; + } + + interface IDropdownOptions { + animation?: string; + placement?: string; + trigger?: string; + html?: boolean; + delay?: number | { show: number; hide: number; }; + container?: string | boolean; + template?: string; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Navbar + // see http://mgcrea.github.io/angular-strap/#/navbars + /////////////////////////////////////////////////////////////////////////// + + module navbar { + + interface INavbarProvider { + defaults: INavbarOptions; + } + + interface INavbarOptions { + activeClass?: string; + routeAttr?: string; + } + + interface INavbarService { + defaults: INavbarOptions; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Scrollspy + // see http://mgcrea.github.io/angular-strap/#/scrollspy + /////////////////////////////////////////////////////////////////////////// + + module scrollspy { + + interface IScrollspyProvider { + defaults: IScrollspyOptions; + } + + interface IScrollspyService { + (element: ng.IAugmentedJQuery, options: IScrollspyOptions): IScrollspy; + } + + interface IScrollspy { + checkOffsets: () => void; + trackElement: (target: any, source: any) => void; + untrackElement: (target: any, source: any) => void; + activate: (index: number) => void; + } + + interface IScrollspyOptions { + target?: string; + offset?: number; + } + } + + + /////////////////////////////////////////////////////////////////////////// + // Affix + // see http://mgcrea.github.io/angular-strap/#/affix + /////////////////////////////////////////////////////////////////////////// + + module affix { + + interface IAffixProvider { + defaults: IAffixOptions; + } + + interface IAffixService { + (element: ng.IAugmentedJQuery, options: IAffixOptions): IAffix; + } + + interface IAffix { + init: () => void; + destroy: () => void; + checkPositionWithEventLoop: () => void; + checkPosition: () => void; + } + + interface IAffixOptions { + offsetTop?: number; + offsetBottom?: number; + offsetParent?: number; + offsetUnpin?: number; + } + } +} From f913f681ac646953c312343d8c0a2c76105fb409 Mon Sep 17 00:00:00 2001 From: Ahto Jussila Date: Sat, 5 Dec 2015 17:55:44 +0200 Subject: [PATCH 116/474] allow arbitrary key names when setting defaults --- nconf/nconf-tests.ts | 2 ++ nconf/nconf.d.ts | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nconf/nconf-tests.ts b/nconf/nconf-tests.ts index 7037abfb60..673c05dca1 100644 --- a/nconf/nconf-tests.ts +++ b/nconf/nconf-tests.ts @@ -48,6 +48,8 @@ p = nconf.use(str, opts); p = nconf.defaults(); p = nconf.defaults(opts); +p = nconf.defaults({foo: 'bar'}); + nconf.init(); nconf.init(opts); diff --git a/nconf/nconf.d.ts b/nconf/nconf.d.ts index ee59591fd8..8453bfca80 100644 --- a/nconf/nconf.d.ts +++ b/nconf/nconf.d.ts @@ -48,11 +48,12 @@ declare module "nconf" { parse: (str: string) => any; } - export interface IOptions { - type?: string; + export interface IOptions { + [index: string]: any; } - export interface IFileOptions extends IOptions { + export interface IFileOptions { + type?: string; file?: string; dir?: string; search?: boolean; From d54b18e0ac3277376700b6026ef9e9e3f380df50 Mon Sep 17 00:00:00 2001 From: Peter Burns Date: Sat, 5 Dec 2015 10:39:59 -0800 Subject: [PATCH 117/474] ProgressBar should also be a module, for ES6 importing --- progress/progress.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/progress/progress.d.ts b/progress/progress.d.ts index 2c7e683ec4..afb8ccf732 100644 --- a/progress/progress.d.ts +++ b/progress/progress.d.ts @@ -115,7 +115,7 @@ declare module "progress" */ terminate():void; } - + module ProgressBar { } export = ProgressBar; } From d4c62f32974272b0133a2b45fd1b1585a2531b71 Mon Sep 17 00:00:00 2001 From: Vinh Tran Date: Sat, 5 Dec 2015 15:15:10 -0500 Subject: [PATCH 118/474] Update interface DirectionRequest Added ```LatLngLiteral``` as an option type for ```origin``` and ```destination``` fields for DirectionRequest. Reference: [https://developers.google.com/maps/documentation/javascript/reference#Place](https://developers.google.com/maps/documentation/javascript/reference#Place) --- googlemaps/google.maps.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 770151f33e..87b10991e8 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -911,10 +911,10 @@ declare module google.maps { avoidFerries?: boolean; avoidHighways?: boolean; avoidTolls?: boolean; - destination?: LatLng|string; + destination?: LatLng|LatLngLiteral|string; durationInTraffic?: boolean; optimizeWaypoints?: boolean; - origin?: LatLng|string; + origin?: LatLng|LatLngLiteral|string; provideRouteAlternatives?: boolean; region?: string; transitOptions?: TransitOptions; From 4f1c2d48e09fb33d65c7b4241ba09453f1ce7820 Mon Sep 17 00:00:00 2001 From: Vinh Tran Date: Sat, 5 Dec 2015 15:52:10 -0500 Subject: [PATCH 119/474] Update DirectionsWaypoint's location field optional types --- googlemaps/google.maps.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 87b10991e8..699115473b 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -959,7 +959,7 @@ declare module google.maps { export interface TransitFare { } export interface DirectionsWaypoint { - location: LatLng|string; + location: LatLng|LatLngLiteral|string; stopover: boolean; } From f08f279bd095ac9a197fea3ce4767de3e5dce493 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Sun, 6 Dec 2015 01:25:08 +0100 Subject: [PATCH 120/474] Add more detailed types to Chrome storage callbacks --- chrome/chrome-tests.ts | 8 ++ chrome/chrome.d.ts | 255 +++++++++++++++++++++-------------------- 2 files changed, 136 insertions(+), 127 deletions(-) diff --git a/chrome/chrome-tests.ts b/chrome/chrome-tests.ts index 3417384358..e184a82167 100644 --- a/chrome/chrome-tests.ts +++ b/chrome/chrome-tests.ts @@ -254,3 +254,11 @@ function testOptionsPage() { }); } +chrome.storage.sync.get("myKey", function (loadedData) { + var myValue: { x: number } = loadedData["myKey"]; +}); + +chrome.storage.onChanged.addListener(function (changes) { + var myNewValue: { x: number } = changes["myKey"].newValue; + var myOldValue: { x: number } = changes["myKey"].oldValue; +}); diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index b278917047..3d8039fc15 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -5866,139 +5866,140 @@ declare module chrome.sessions { * @since Chrome 20. */ declare module chrome.storage { - interface StorageArea { - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(callback: (bytesInUse: number) => void): void; - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param key A single key to get the total usage for. Pass in null to get the total usage of all of storage. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(key: string, callback: (bytesInUse: number) => void): void; - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param keys A list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(keys: string[], callback: (bytesInUse: number) => void): void; - /** - * Removes all items from storage. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - clear(callback?: () => void): void; - /** - * Sets multiple items. - * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. - * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation). - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - set(items: Object, callback?: () => void): void; - /** - * Removes one item from storage. - * @param key A single key for items to remove. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - remove(key: string, callback?: () => void): void; - /** - * Removes items from storage. - * @param keys A list of keys for items to remove. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - remove(keys: string[], callback?: () => void): void; - /** - * Gets one or more items from storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(callback: (items: Object) => void): void; - /** - * Gets one or more items from storage. - * @param key A single key to get. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(key: string, callback: (items: Object) => void): void; - /** - * Gets one or more items from storage. - * @param keys A list of keys to get. An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(keys: string[], callback: (items: Object) => void): void; - /** - * Gets one or more items from storage. - * @param keys A dictionary specifying default values. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(keys: Object, callback: (items: Object) => void): void; - } + interface StorageArea { + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(callback: (bytesInUse: number) => void): void; + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param key A single key to get the total usage for. Pass in null to get the total usage of all of storage. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(key: string, callback: (bytesInUse: number) => void): void; + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param keys A list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(keys: string[], callback: (bytesInUse: number) => void): void; + /** + * Removes all items from storage. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + clear(callback?: () => void): void; + /** + * Sets multiple items. + * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. + * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation). + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + set(items: Object, callback?: () => void): void; + /** + * Removes one item from storage. + * @param key A single key for items to remove. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + remove(key: string, callback?: () => void): void; + /** + * Removes items from storage. + * @param keys A list of keys for items to remove. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + remove(keys: string[], callback?: () => void): void; + /** + * Gets one or more items from storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param key A single key to get. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(key: string, callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param keys A list of keys to get. An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(keys: string[], callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param keys A dictionary specifying default values. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(keys: Object, callback: (items: { [key: string]: any }) => void): void; + } - interface StorageChange { - /** Optional. The new value of the item, if there is a new value. */ - newValue?: any; - /** Optional. The old value of the item, if there was an old value. */ - oldValue?: any; - } + interface StorageChange { + /** Optional. The new value of the item, if there is a new value. */ + newValue?: any; + /** Optional. The old value of the item, if there was an old value. */ + oldValue?: any; + } - interface LocalStorageArea extends StorageArea { - /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ - QUOTA_BYTES: number; - } + interface LocalStorageArea extends StorageArea { + /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ + QUOTA_BYTES: number; + } - interface SyncStorageArea extends StorageArea { - /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */ - MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; - /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ - QUOTA_BYTES: number; - /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */ - QUOTA_BYTES_PER_ITEM: number; - /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */ - MAX_ITEMS: number; - /** - * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit. - * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. - */ - MAX_WRITE_OPERATIONS_PER_HOUR: number; - /** - * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time. - * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. - * @since Chrome 40. - */ - MAX_WRITE_OPERATIONS_PER_MINUTE: number; - } + interface SyncStorageArea extends StorageArea { + /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */ + MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; + /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ + QUOTA_BYTES: number; + /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */ + QUOTA_BYTES_PER_ITEM: number; + /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */ + MAX_ITEMS: number; + /** + * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit. + * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. + */ + MAX_WRITE_OPERATIONS_PER_HOUR: number; + /** + * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time. + * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. + * @since Chrome 40. + */ + MAX_WRITE_OPERATIONS_PER_MINUTE: number; + } - interface StorageChangedEvent extends chrome.events.Event { - /** - * @param callback - * Parameter changes: Object mapping each key that changed to its corresponding storage.StorageChange for that item. - * Parameter areaName: Since Chrome 22. The name of the storage area ("sync", "local" or "managed") the changes are for. - */ - addListener(callback: (changes: Object, areaName: string) => void): void; - } + interface StorageChangedEvent extends chrome.events.Event { + /** + * @param callback + * Parameter changes: Object mapping each key that changed to its corresponding storage.StorageChange for that item. + * Parameter areaName: Since Chrome 22. The name of the storage area ("sync", "local" or "managed") the changes are for. + */ + addListener(callback: (changes: { [key: string]: StorageChange }, areaName: string) => void): void; + } - /** Items in the local storage area are local to each machine. */ - var local: LocalStorageArea; - /** Items in the sync storage area are synced using Chrome Sync. */ - var sync: SyncStorageArea; - /** - * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. - * @since Chrome 33. - */ - var managed: StorageArea; + /** Items in the local storage area are local to each machine. */ + var local: LocalStorageArea; + /** Items in the sync storage area are synced using Chrome Sync. */ + var sync: SyncStorageArea; - /** Fired when one or more items change. */ - var onChanged: StorageChangedEvent; + /** + * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. + * @since Chrome 33. + */ + var managed: StorageArea; + + /** Fired when one or more items change. */ + var onChanged: StorageChangedEvent; } //////////////////// From efd7d6ca8a4da4a9c89d28dd0d95a2f2a9830be2 Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Sun, 6 Dec 2015 01:34:49 +0100 Subject: [PATCH 121/474] Fix up chrome storage indentation properly while I'm here --- chrome/chrome.d.ts | 254 ++++++++++++++++++++++----------------------- 1 file changed, 127 insertions(+), 127 deletions(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 3d8039fc15..7db591be27 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -5866,140 +5866,140 @@ declare module chrome.sessions { * @since Chrome 20. */ declare module chrome.storage { - interface StorageArea { - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(callback: (bytesInUse: number) => void): void; - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param key A single key to get the total usage for. Pass in null to get the total usage of all of storage. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(key: string, callback: (bytesInUse: number) => void): void; - /** - * Gets the amount of space (in bytes) being used by one or more items. - * @param keys A list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage. - * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). - * Parameter bytesInUse: Amount of space being used in storage, in bytes. - */ - getBytesInUse(keys: string[], callback: (bytesInUse: number) => void): void; - /** - * Removes all items from storage. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - clear(callback?: () => void): void; - /** - * Sets multiple items. - * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. - * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation). - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - set(items: Object, callback?: () => void): void; - /** - * Removes one item from storage. - * @param key A single key for items to remove. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - remove(key: string, callback?: () => void): void; - /** - * Removes items from storage. - * @param keys A list of keys for items to remove. - * @param callback Optional. - * Callback on success, or on failure (in which case runtime.lastError will be set). - */ - remove(keys: string[], callback?: () => void): void; - /** - * Gets one or more items from storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(callback: (items: { [key: string]: any }) => void): void; - /** - * Gets one or more items from storage. - * @param key A single key to get. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(key: string, callback: (items: { [key: string]: any }) => void): void; - /** - * Gets one or more items from storage. - * @param keys A list of keys to get. An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(keys: string[], callback: (items: { [key: string]: any }) => void): void; - /** - * Gets one or more items from storage. - * @param keys A dictionary specifying default values. Pass in null to get the entire contents of storage. - * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). - * Parameter items: Object with items in their key-value mappings. - */ - get(keys: Object, callback: (items: { [key: string]: any }) => void): void; - } + interface StorageArea { + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(callback: (bytesInUse: number) => void): void; + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param key A single key to get the total usage for. Pass in null to get the total usage of all of storage. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(key: string, callback: (bytesInUse: number) => void): void; + /** + * Gets the amount of space (in bytes) being used by one or more items. + * @param keys A list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage. + * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set). + * Parameter bytesInUse: Amount of space being used in storage, in bytes. + */ + getBytesInUse(keys: string[], callback: (bytesInUse: number) => void): void; + /** + * Removes all items from storage. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + clear(callback?: () => void): void; + /** + * Sets multiple items. + * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected. + * Primitive values such as numbers will serialize as expected. Values with a typeof "object" and "function" will typically serialize to {}, with the exception of Array (serializes as expected), Date, and Regex (serialize using their String representation). + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + set(items: Object, callback?: () => void): void; + /** + * Removes one item from storage. + * @param key A single key for items to remove. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + remove(key: string, callback?: () => void): void; + /** + * Removes items from storage. + * @param keys A list of keys for items to remove. + * @param callback Optional. + * Callback on success, or on failure (in which case runtime.lastError will be set). + */ + remove(keys: string[], callback?: () => void): void; + /** + * Gets one or more items from storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param key A single key to get. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(key: string, callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param keys A list of keys to get. An empty list or object will return an empty result object. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(keys: string[], callback: (items: { [key: string]: any }) => void): void; + /** + * Gets one or more items from storage. + * @param keys A dictionary specifying default values. Pass in null to get the entire contents of storage. + * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set). + * Parameter items: Object with items in their key-value mappings. + */ + get(keys: Object, callback: (items: { [key: string]: any }) => void): void; + } - interface StorageChange { - /** Optional. The new value of the item, if there is a new value. */ - newValue?: any; - /** Optional. The old value of the item, if there was an old value. */ - oldValue?: any; - } + interface StorageChange { + /** Optional. The new value of the item, if there is a new value. */ + newValue?: any; + /** Optional. The old value of the item, if there was an old value. */ + oldValue?: any; + } - interface LocalStorageArea extends StorageArea { - /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ - QUOTA_BYTES: number; - } + interface LocalStorageArea extends StorageArea { + /** The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the unlimitedStorage permission. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ + QUOTA_BYTES: number; + } - interface SyncStorageArea extends StorageArea { - /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */ - MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; - /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ - QUOTA_BYTES: number; - /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */ - QUOTA_BYTES_PER_ITEM: number; - /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */ - MAX_ITEMS: number; - /** - * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit. - * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. - */ - MAX_WRITE_OPERATIONS_PER_HOUR: number; - /** - * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time. - * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. - * @since Chrome 40. - */ - MAX_WRITE_OPERATIONS_PER_MINUTE: number; - } + interface SyncStorageArea extends StorageArea { + /** @deprecated since Chrome 40. The storage.sync API no longer has a sustained write operation quota. */ + MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE: number; + /** The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. */ + QUOTA_BYTES: number; + /** The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set runtime.lastError. */ + QUOTA_BYTES_PER_ITEM: number; + /** The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set runtime.lastError. */ + MAX_ITEMS: number; + /** + * The maximum number of set, remove, or clear operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit. + * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. + */ + MAX_WRITE_OPERATIONS_PER_HOUR: number; + /** + * The maximum number of set, remove, or clear operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time. + * Updates that would cause this limit to be exceeded fail immediately and set runtime.lastError. + * @since Chrome 40. + */ + MAX_WRITE_OPERATIONS_PER_MINUTE: number; + } - interface StorageChangedEvent extends chrome.events.Event { - /** - * @param callback - * Parameter changes: Object mapping each key that changed to its corresponding storage.StorageChange for that item. - * Parameter areaName: Since Chrome 22. The name of the storage area ("sync", "local" or "managed") the changes are for. - */ - addListener(callback: (changes: { [key: string]: StorageChange }, areaName: string) => void): void; - } + interface StorageChangedEvent extends chrome.events.Event { + /** + * @param callback + * Parameter changes: Object mapping each key that changed to its corresponding storage.StorageChange for that item. + * Parameter areaName: Since Chrome 22. The name of the storage area ("sync", "local" or "managed") the changes are for. + */ + addListener(callback: (changes: { [key: string]: StorageChange }, areaName: string) => void): void; + } - /** Items in the local storage area are local to each machine. */ - var local: LocalStorageArea; - /** Items in the sync storage area are synced using Chrome Sync. */ - var sync: SyncStorageArea; + /** Items in the local storage area are local to each machine. */ + var local: LocalStorageArea; + /** Items in the sync storage area are synced using Chrome Sync. */ + var sync: SyncStorageArea; - /** - * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. - * @since Chrome 33. - */ - var managed: StorageArea; + /** + * Items in the managed storage area are set by the domain administrator, and are read-only for the extension; trying to modify this namespace results in an error. + * @since Chrome 33. + */ + var managed: StorageArea; - /** Fired when one or more items change. */ - var onChanged: StorageChangedEvent; + /** Fired when one or more items change. */ + var onChanged: StorageChangedEvent; } //////////////////// From 791ab3bf260e1626ff7fa4df5eb1bda93ae03faa Mon Sep 17 00:00:00 2001 From: Nina Chaubal Date: Sat, 5 Dec 2015 21:23:17 -0600 Subject: [PATCH 122/474] FirebaseQuery.equalTo can take boolean values. See https://www.firebase.com/docs/web/api/query/equalto.html --- firebase/firebase.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/firebase/firebase.d.ts b/firebase/firebase.d.ts index df792c7134..744411ab2e 100644 --- a/firebase/firebase.d.ts +++ b/firebase/firebase.d.ts @@ -143,6 +143,7 @@ interface FirebaseQuery { */ equalTo(value: string, key?: string): FirebaseQuery; equalTo(value: number, key?: string): FirebaseQuery; + equalTo(value: boolean, key?: string): FirebaseQuery; /** * Generates a new Query object limited to the first certain number of children. */ From 01efb63365676e6db39bdc7b3891121b172b6b45 Mon Sep 17 00:00:00 2001 From: sodatea Date: Sun, 29 Nov 2015 01:27:37 +0800 Subject: [PATCH 123/474] Update tape.d.ts for tape v4.2.2 --- tape/tape-tests.ts | 2 +- tape/tape.d.ts | 63 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/tape/tape-tests.ts b/tape/tape-tests.ts index 85bb19a6ec..919da38808 100644 --- a/tape/tape-tests.ts +++ b/tape/tape-tests.ts @@ -2,7 +2,7 @@ /// -import tape = require('tape'); +import tape = require("tape"); var name: string; var cb: tape.TestCase; diff --git a/tape/tape.d.ts b/tape/tape.d.ts index 4746e148a0..39ab43176c 100644 --- a/tape/tape.d.ts +++ b/tape/tape.d.ts @@ -1,6 +1,6 @@ -// Type definitions for tape v2.12.3 +// Type definitions for tape v4.2.2 // Project: https://github.com/substack/tape -// Definitions by: Bart van der Schoor +// Definitions by: Bart van der Schoor , Haoqun Jiang // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -9,22 +9,43 @@ declare module 'tape' { export = tape; /** - * Create a new test with an optional name string. cb(t) fires with the new test object t once all preceeding tests have finished. Tests execute serially. + * Create a new test with an optional name string and optional opts object. + * cb(t) fires with the new test object t once all preceeding tests have finished. + * Tests execute serially. */ function tape(name: string, cb: tape.TestCase): void; + function tape(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; + function tape(cb: tape.TestCase): void; + function tape(opts: tape.TestOptions, cb: tape.TestCase): void; + module tape { interface TestCase { (test: Test): void; } + /** + * Available opts options for the tape function. + */ + interface TestOptions { + skip?: boolean; // See tape.skip. + timeout?: number; // Set a timeout for the test, after which it will fail. See tape.timeoutAfter. + } + + /** + * Options for the createStream function. + */ + interface StreamOptions { + objectMode?: boolean; + } + /** * Generate a new test that will be skipped over. */ export function skip(name: string, cb: tape.TestCase): void; /** - * Like test(name, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored + * Like test(name, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored. */ export function only(name: string, cb: tape.TestCase): void; @@ -34,24 +55,29 @@ declare module 'tape' { export function createHarness(): typeof tape; /** * Create a stream of output, bypassing the default output stream that writes messages to console.log(). + * By default stream will be a text stream of TAP output, but you can get an object stream instead by setting opts.objectMode to true. */ - export function createStream(opts?: any): NodeJS.ReadableStream; + export function createStream(opts?: tape.StreamOptions): NodeJS.ReadableStream; interface Test { /** - * Create a subtest with a new test handle st from cb(st) inside the current test cb(st) will only fire when t finishes. Additional tests queued up after t will not be run until all subtests finish. + * Create a subtest with a new test handle st from cb(st) inside the current test. + * cb(st) will only fire when t finishes. + * Additional tests queued up after t will not be run until all subtests finish. */ test(name: string, cb: tape.TestCase): void; /** - * Declare that n assertions should be run. end() will be called automatically after the nth assertion. If there are any more assertions after the nth, or after end() is called, they will generate errors. + * Declare that n assertions should be run. end() will be called automatically after the nth assertion. + * If there are any more assertions after the nth, or after end() is called, they will generate errors. */ plan(n: number): void; /** * Declare the end of a test explicitly. + * If err is passed in t.end will assert that it is falsey. */ - end(): void; + end(err?: any): void; /** * Generate a failing assertion with a message msg. @@ -63,6 +89,11 @@ declare module 'tape' { */ pass(msg?: string): void; + /** + * Automatically timeout the test after X ms. + */ + timeoutAfter(ms: number): void; + /** * Generate an assertion that will be skipped over. */ @@ -83,7 +114,8 @@ declare module 'tape' { notok(value: any, msg?: string): void; /** - * Assert that err is falsy. If err is non-falsy, use its err.message as the description message. + * Assert that err is falsy. + * If err is non-falsy, use its err.message as the description message. */ error(err: any, msg?: string): void; ifError(err: any, msg?: string): void; @@ -149,13 +181,22 @@ declare module 'tape' { /** * Assert that the function call fn() throws an exception. + * expected, if present, must be a RegExp or Function, which is used to test the exception object. */ - throws(fn: () => void, expected: any, msg?: string): void; + throws(fn: () => void, msg?: string): void; + throws(fn: () => void, exceptionExpected: RegExp | (() => void), msg?: string): void; /** * Assert that the function call fn() does not throw an exception. */ - doesNotThrow(fn: () => void, expected: any, msg?: string): void; + doesNotThrow(fn: () => void, msg?: string): void; + doesNotThrow(fn: () => void, exceptionExpected: RegExp | (() => void), msg?: string): void; + + /** + * Print a message without breaking the tap output. + * (Useful when using e.g. tap-colorize where output is buffered & console.log will print in incorrect order vis-a-vis tap output.) + */ + comment(msg: string): void; } } } From a900641acedbaa2c647513f353ca5850aac33980 Mon Sep 17 00:00:00 2001 From: Kaoru Hagihara Date: Sun, 6 Dec 2015 16:55:24 +0900 Subject: [PATCH 124/474] update vue.js --- vue/vue-tests.ts | 240 ++++++++++++++++++++++++++-- vue/vue.d.ts | 406 +++++++++++++++++++++++++++++------------------ 2 files changed, 476 insertions(+), 170 deletions(-) diff --git a/vue/vue-tests.ts b/vue/vue-tests.ts index 297379bbb1..03c3e684f1 100644 --- a/vue/vue-tests.ts +++ b/vue/vue-tests.ts @@ -1,33 +1,241 @@ /// -module myapp { + +namespace TestConfig { "use strict"; + + Vue.config.debug = true; + Vue.config.delimiters = ["${", "}"]; + Vue.config.unsafeDelimiters = ['{!!', '!!}']; + Vue.config.silent = true; + Vue.config.async = false; + Vue.config.convertAllProperties = true; +} + +namespace TestGlobalAPI { + "use strict"; + + var AppConstructor = Vue.extend({}); + var extendedApp = new AppConstructor(); + Vue.nextTick(() => {}); + Vue.set({}, "key", "value"); + Vue.delete({}, "key"); + Vue.directive("directive", { + bind: function() {}, + update: function(val: any, oldVal: any) {}, + unbind: function() {}, + params: ['a'], + paramWatchers: { + a: function(val: any, oldVal: any) {} + }, + twoWay: true, + acceptStatement: true, + priority: 1, + count: 30 + }); + Vue.directive("my-directive", () => {}); + var myDirective = Vue.directive("my-directive"); + var elementDirective = Vue.elementDirective("element-directive"); + Vue.elementDirective("element-directive", elementDirective); + Vue.elementDirective("element-directive", { + bind: function() {}, + unbind: function() {} + }); + var filter = Vue.filter("filter"); + Vue.filter("filter", filter); + Vue.filter("filter", function(val: any) { + return val; + }); + Vue.filter("filter", { + read: function(val: any) {}, + write: function(val: any, oldVal: any) {} + }); + var Component = Vue.component("component"); + Vue.component("component", Component); + Vue.component("component", { + data: function() { + return { d: 0 } + }, + methods: { + action: function() {} + }, + props: ["a", "b"], + computed: { + a: function() { return this.d; }, + b: { + get: function() { return this.a; }, + set: function(val: number) { this.d = val; } + } + } + }); + var transition = Vue.transition("transition"); + Vue.transition("transition", transition); + Vue.transition("transition", { + css: false, + stagger: function(index) { + return index; + }, + beforeEnter: function(el) { + el.textContent = 'beforeEnter'; + }, + enter: function(el, done) { + el.textContent = 'enter'; + setTimeout(function() { + done(); + }, 1000); + }, + afterEnter: function(el) { + el.textContent = 'afterEnter'; + }, + enterCancelled: function(el) { + el.textContent = 'enterCancelled'; + }, + beforeLeave: function (el) { + el.textContent = 'beforeLeave'; + }, + leave: function (el, done) { + el.textContent = 'leave'; + done(); + }, + afterLeave: function (el) { + el.textContent = 'afterLeave'; + }, + leaveCancelled: function (el) { + el.textContent = 'leaveCancelled'; + } + }); + var myPartial: string = Vue.partial("my-partial", "
Hello
"); + myPartial = Vue.partial("my-partial"); + Vue.use(() => {}, {}); + Vue.use({install: () => {}, option: () => {}}); + Vue.mixin({ready() {}}); +} + +namespace TestInstanceProperty { + "use strict"; + + var vm = new Vue({el: '#app'}); + var data: any = vm.$data; + var el: HTMLElement = vm.$el; + var options: any = vm.$options; + var parent: any = vm.$parent; + var root: any = vm.$root; + var children: any[] = vm.$children; + var refs: any = vm.$refs; + var els: any = vm.$els; +} + +namespace TestInscanceMethods { + "use strict"; + + var vm = new Vue({el: '#app'}); + vm.$watch('a.b.c', function(newVal: string, oldVal: number) {}); + vm.$watch(function() {return this.a + this.b}, function(newVal: string, oldVal: string) {}); + var unwatch = vm.$watch('a', (value: any) => {}); + unwatch(); + vm.$watch('someObject', (value: any) => {}, {deep: true}); + vm.$watch('a', (value: any) => {}, {immidiate: true}); + vm.$get('a.b'); + vm.$set('a.b', 2); + vm.$delete('a'); + var s: string = vm.$eval('msg | uppercase'); + s = vm.$interpolate('{{msg}} world!'); + vm.$log(); + vm.$log('item'); + + vm + .$on('test', (msg: any) => {}) + .$once('testOnce', (msg: any) => {}) + .$off("event", () => {}) + .$emit("event", 1, 2) + .$dispatch("event", 1, 2, 3) + .$broadcast("event", 1, 2, 3, 4) + + .$appendTo(document.createElement("div"), () => {}) + .$before('#app', () => {}) + .$after(document.getElementById('app')) + .$remove(() => {}) + .$nextTick(() => {}); + + vm + .$mount('#app') + .$destroy(false); +} + +namespace TestVueUtil { + "use strict"; + + var _ = Vue.util; + var target = document.createElement('div'); + var child = document.createElement('div'); + var parent = document.createElement('div'); + var a: any[]; + var b: boolean; + var f: Function; + var n: number; + var s: string; + var o: any; + o = _.checkComponentAttr(target, {}); + _.warn('oops', new Error()); + b = _.inDoc(target); + s = _.getAttr(target, 'v-test'); + _.before(target, child); + _.after(target, child); + _.remove(target); + _.prepend(target, parent); + _.replace(child, target); + _.on(target, 'click', () => {}); + _.off(target, 'click', () => {}); + _.removeClass(target, 'header'); + _.addClass(target, 'header'); + _.nextTick(() => {}, {}); + b = _.isLiteral('123'); + s = _._toString('hi'); + var ns: number | string = _.toNumber('12'); + s = _.stripQuotes('"123"'); + s = _.camelize('abc'); + s = _.hyphenate('whatsUp'); + s = _.classify('abc'); + f = _.bind(() => {}, {}); + a = _.toAarray(document.getElementsByClassName('target')); + o = _.extend({}, {a: 1, b: 2}); + b = _.isObject({}); + b = _.isPlainObject({}); + b = _.isArray([]); + _.def({}, 'test', 123); + _.def({}, 'test2', 123, true); + f = _.debounce(() => {}, 100); + b = _.looseEqual(1, '1'); +} + +namespace TestExplicitExtend { + "use strict"; + export class Application extends Vue { + text: string; constructor() { super(); - Vue.config.debug = true; this._init({ // data is necessary to always write in init() data: { text: "hello world." - // }, - // methods : { - // action : this.action - /* same as unser */ + }, + methods: { + action: this.action } }); - this.methods = { - action: this.action - }; } action(): void { console.log("action"); + this.$on("event", (value: any) => {}).anotherAction(); + } + anotherAction(): void { + this.$emit("event"); + } + $els: { + target: HTMLDivElement; } } + + var app = new Application(); + app.$mount("#main").$destroy(); } - -var app = new myapp.Application(); -app.$mount("#main"); - -var AppConstructor = Vue.extend({}); -var extendedApp = new AppConstructor(); -app.$mount("#main"); diff --git a/vue/vue.d.ts b/vue/vue.d.ts index cb707348a9..4af732579e 100644 --- a/vue/vue.d.ts +++ b/vue/vue.d.ts @@ -1,171 +1,269 @@ -// Type definitions for vuejs 0.11.0 -// Project: https://github.com/yyx990803/vue -// Definitions by: odangosan +// Type definitions for vuejs 1.0.10 +// Project: https://github.com/vuejs/vue +// Definitions by: odangosan , kaorun343 // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module vuejs { - export class Vue { - /** - * The Vue Constructor - * http://vuejs.org/api/index.html - */ - constructor(options?: {}); +interface Array { + $remove(item: T): Array; + $set(index: number, val: T): T; +} - /** - * Options - * http://vuejs.org/api/options.html - */ - /** - * Data - * http://vuejs.org/api/options.html#Data - */ - data: {}; - methods: {}; - computed: {}; - paramAttributes:{}[]; - /** - * DOM - * http://vuejs.org/api/options.html#DOM - */ - el: {}; - template: string; - replace: boolean; - /** - * Lifecycle - * http://vuejs.org/api/options.html#Lifecycle - */ - created: VueCallback; - beforeCompile: VueCallback; - compiled: VueCallback; - ready: VueCallback; - attached: VueCallback; - detached: VueCallback; - beforeDestroy: VueCallback; - destroyed: VueCallback; - /** - * Assets - * http://vuejs.org/api/options.html#Assets - */ - directives: {}; - filters: {}; - components: {}; - partials: {}; - transitions: {}; - /** - * Others - * http://vuejs.org/api/options.html#Others - */ - inherit: boolean; - events: {}; - watch: {}; - mixins:{}[]; - name: string; - /** - * Instance Properties - * http://vuejs.org/api/instance-properties.html - */ - $el: HTMLElement; - $data: any; - $options: any; - $parent: Vue; - $root: Vue; - $: {}; - $$: {}; - - /** - * Instance Methods - * http://vuejs.org/api/instance-methods.html - */ - /** - * Data - */ - $watch(expression: string, callback: ValueCallback, deep?: boolean, immediate?: boolean): void; - $get(expression: string): any; - $set(keypath: string, value: any): void; - $add(keypath: string, value: any): void; - $delete(keypath: string): void; - $eval(expression: string): any; - $interpolate(templateString: string): string; - $log(keypath?: string): void; - - /** - * Events - */ - $dispatch(event: string, ...args: any[]): Vue; - $broadcast(event: string, ...args: any[]): Vue; - $emit(event: string, ...args: any[]): Vue; - $on(event: string, callback: Function): Vue; - $once(event: string, callback: Function): Vue; - $off(event?: string, callback?: Function): Vue; - - /** - * DOM - */ - $appendTo(element: any, callback?: Function): Vue;// element or selector - $prependTo(element: any, callback?: Function): Vue;// element or selector - $before(element: any, callback?: Function): Vue;// element or selector - $after(element: any, callback?: Function): Vue;// element or selector - $remove(callback?: Function): Vue; - - /** - * Lifecycle - */ - $mount(element?: any): Vue;// element or selector - $destroy(remove?: boolean): void; - $compile(element: HTMLElement): VueCallback;// returns a decompile function - $addChild(options?: {}, constructor?: Function): Vue; - - /** - * Global Api - * http://vuejs.org/api/global-api.html - */ - static config: VueConfig; - static extend(options: {}): typeof Vue; - static directive(id: string, definition?: {}): void; - static directive(id: string, definition?: VueCallback): void; - static filter(id: string, definition?: FilterCallback): void; - static component(id: string, definition: Vue): void; - static component(id: string, definition?: {}): void; - static transition(id: string, definition?: {}): void; - static partial(id: string, definition?: string): void; - static partial(id: string, definition?: HTMLElement): void; - static nextTick(callback: VueCallback): void; - static require(module: string): void; - static use(plugin: {}, ...args: any[]): Vue; - static use(plugin: VueCallback, ...args: any[]): Vue; - - /** - * exports members. - */ - _init(options: {}): void; - _cleanup(): void; - // static require(module:string) : void; +declare namespace vuejs { + + interface PropOption { + type?: any; + required?: boolean; + default?: boolean; + twoWay?: boolean; + validator?(value: any): boolean; + } + + interface ComputedOption { + get(): any; + set(value: any): void; + } + + interface WatchOption { + handler(val: any, oldVal: any): void; + deep?: boolean; + immidiate?: boolean; + } + + interface DirectiveOption { + bind?(): any; + update?(newVal?: any, oldVal?: any): any; + unbind?(): any; + params?: string[]; + deep?: boolean; + twoWay?: boolean; + acceptStatement?: boolean; + priority?: number; + [key: string]: any; + } + + interface FilterOption { + read: Function; + write: Function; + } + + interface TransitionOption { + css?: boolean; + beforeEnter?(el: HTMLElement): void; + enter?(el: HTMLElement, done?: () => void): void; + afterEnter?(el: HTMLElement): void; + enterCancelled?(el: HTMLElement): void; + beforeLeave?(el: HTMLElement): void; + leave?(el: HTMLElement, done?: () => void): void; + afterLeave?(el: HTMLElement): void; + leaveCancelled?(el: HTMLElement): void; + stagger?(index: number): number; + } + + interface ComponentOption { + data?: {[key: string]: any } | Function; + props?: string[] | { [key: string]: PropOption }; + computed?: { [key: string]: ( Function | ComputedOption ) }; + methods?: { [key: string]: Function }; + watch?: { [key: string]: ( (val: any, oldVal: any) => void | string | WatchOption )}; + el?: string | HTMLElement | ( () => HTMLElement ); + template?: string; + replace?: boolean; + created?(): void; + beforeCompile?(): void; + compiled?(): void; + ready?(): void; + attached?(): void; + detached?(): void; + beforeDestroy?(): void; + destroyed?(): void; + directives?: { [key: string]: ( DirectiveOption | Function ) }; + elementDirectives?: { [key: string]: ( DirectiveOption | Function ) }; + filters?: { [key: string]: ( Function | FilterOption ) }; + components?: { [key: string]: ComponentOption }; + transitions?: { [key: string]: TransitionOption }; + partials?: { [key: string]: string }; + parent?: Vue; + events?: { [key: string]: ( (...args: any[]) => (boolean | void) ) | string }; + mixins?: ComponentOption[]; + name?: string; + [key: string]: any; } - class VueConfig { - prefix: string; + // instance/api/data.js + interface $get { ( exp: string, asStatement?: boolean ): any; } + interface $set { ( key: string | number, value: any ): void; } + interface $delete { ( key: string) : void; } + interface $watch { ( expOrFn: string | Function, callback: ( (newVal: any, oldVal?: any) => any ) | string, options?: { deep?: boolean, immidiate?: boolean } ): Function; } + interface $eval { ( expression: string ): string; } + interface $interpolate { ( expression: string ): string; } + interface $log { ( keypath?: string ): void; } + // instance/api/dom.js + interface $nextTick { ( callback: Function ): void; } + interface $appendTo { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } + interface $prependTo { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } + interface $before { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } + interface $after { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } + interface $remove { ( callback?: Function ): V; } + // instance/api/events.js + interface $on { (event: string, callback: Function): V; } + interface $once { (event: string, callback: Function): V; } + interface $off { (event?: string, callback?: Function): V; } + interface $emit { (event: string, ...args: any[]): V; } + interface $broadcast { (event: string, ...args: any[]): V; } + interface $dispatch { (event: string, ...args: any[]): V; } + // instance/api/lifecycle.js + interface $mount { ( elementOrSelector?: ( HTMLElement | string ) ): V; } + interface $destroy { (remove?: boolean): void; } + interface $compile { (el: Element | DocumentFragment, host?: Vue): Function; } + + interface Vue { + $data?: any; + $el?: HTMLElement; + $options?: Object; + $parent?: Vue; + $root?: Vue; + $children?: Vue[]; + $refs?: Object; + $els?: Object; + + $get?: $get; + $set?: $set; + $delete?: $delete; + $eval?: $eval; + $interpolate?: $interpolate; + $log?: $log; + $watch?: $watch; + $on?: $on; + $once?: $once; + $off?: $off; + $emit?: $emit; + $dispatch?: $dispatch; + $broadcast?: $broadcast; + $appendTo?: $appendTo; + $before?: $before; + $after?: $after; + $remove?: $remove; + $nextTick?: $nextTick; + $mount?: $mount; + $destroy?: $destroy; + $compile?: $compile; + + _init?(options?: ComponentOption): void; + } + + interface VueConfig { debug: boolean; + delimiters: [string, string]; + unsafeDelimiters: [string, string]; silent: boolean; - proto: boolean; - interpolate: boolean; async: boolean; - delimiters: string[]; + convertAllProperties: boolean; } - interface ValueCallback { - (newValue: {}, oldValue: {}): void; + interface VueUtil { + // util/lang.js + set(obj: Object, key: string, value: any): void; + del(obj: Object, key: string): void; + hasOwn(obj: Object, key: string): boolean; + isLiteral(exp: string): boolean; + isReserved(str: string): boolean; + _toString(value: any): string; + toNumber(value: T): T | number; + toBoolean(value: T): T | boolean; + stripQuotes(str: string): string; + camelize(str: string): string; + hyphenate(str: string): string; + classify(str: string): string; + bind(fn: Function, ctx: Object): Function; + toAarray(list: ArrayLike, start?: number): Array; + extend(to: T, from: F): ( T & F ); + isObject(obj: any): boolean; + isPlainObject(obj: any): boolean; + isArray: typeof Array.isArray; + def(obj: Object, key: string, value: any, enumerable?: boolean): void; + debounce(func: Function, wait: number): Function; + indexOf(arr: Array, obj: T): number; + cancellable(fn: Function): Function; + looseEqual(a: any, b: any): boolean; + // util/env.js + hasProto: boolean; + inBrowser: boolean; + isIE9: boolean; + isAndroid: boolean; + transitionProp: string; + transitionEndEvent: string; + animationProp: string; + animationEndEvent: string; + nextTick(cb: Function, ctx?: Object): void; + // util/dom.js + query(el: string | Element): Element; + inDoc(node: Node): boolean; + getAttr(node: Node, _attr: string): string; + getBindAttr(node: Node, name: string): string; + before(el: Element, target: Element): void; + after(el: Element, target: Element): void; + remove(el: Element): void; + prepend(el: Element, target: Element): void; + replace(target: Element, el: Element): void; + on(el: Element, event: string, cb: Function): void; + off(el: Element, event: string, cb: Function): void; + addClass(el: Element, cls: string): void; + removeClass(el: Element, cls: string): void; + extractContent(el: Element, asFragment: boolean): ( HTMLDivElement | DocumentFragment ); + trimNode(node: Node): void; + isTemplate(el: Element): boolean; + createAnchor(content: string, persist: boolean): ( Comment | Text ); + findRef(node: Element): string; + mapNodeRange(node: Node, end: Node, op: Function): void; + removeNodeRange(start: Node, end: Node, vm: any, frag: DocumentFragment, cb: Function): void; + // util/options.js + mergeOptions(parent: P, child: C, vm?: any): ( P & C ); + resolveAsset(options: Object, type: string, id: string): ( Object | Function ); + assertAsset(val: any, type: string, id: string): void; + // util/component.js + commonTagRE: RegExp; + checkComponentAttr(el: Element, options?: Object): Object; + initProp(vm: Vue, prop: Object, value: any): void; + assertProp(prop: Object, value: any): boolean; + // util/debug.js + warn(msg: string, e?: Error): void; + // observer/index.js + defineReactive(obj: Object, key: string, val: any): void; } - interface VueCallback { - (): void; - } - interface FilterCallback { - (value:{},begin?:{},end?:{}): {}; + // instance/api/global.js + interface VueStatic { + new(options?: any): Vue; + prototype: Vue; + util: VueUtil; + config: VueConfig; + set(object: Object, key: string, value: any): void; + delete(object: Object, key: string): void; + nextTick(callback: Function): any; + + cid: number; + + extend(options?: ComponentOption): VueStatic; + use(callback: Function | {install: Function, [key: string]: any}, option?: Object): VueStatic; + mixin(mixin: Object): void; + + directive(id: string, definition: T): T; + directive(id: string): any; + elementDirective(id: string, definition: T): T; + elementDirective(id: string): any; + filter(id: string, definition: T): T; + filter(id: string): any; + component(id: string, definition: ComponentOption): any; + component(id: string): any; + transition(id: string, hooks: T): T; + transition(id: string): TransitionOption; + partial(id: string, partial: string): string; + partial(id: string): string; } } -import Vue = vuejs.Vue; + +declare var Vue: vuejs.VueStatic; declare module "vue" { - import vue = vuejs.Vue; - export = vue; + export default Vue; } From fad091f943a06f81f06c0d174d657fdf8c476657 Mon Sep 17 00:00:00 2001 From: Artem Berezin Date: Sun, 6 Dec 2015 17:45:33 +0900 Subject: [PATCH 125/474] Update angular-resource.d.ts fix IResourceArray. It is of array of IResource, not array of just T --- angularjs/angular-resource.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 76930196ba..442d8fa608 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -141,7 +141,7 @@ declare module angular.resource { /** * Really just a regular Array object with $promise and $resolve attached to it */ - interface IResourceArray extends Array { + interface IResourceArray extends Array> { /** the promise of the original server interaction that created this collection. **/ $promise : angular.IPromise>; $resolved : boolean; From 8d8abe471b822ec9d84fd3c8c221f3288ae2e773 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 6 Dec 2015 14:43:21 +0500 Subject: [PATCH 126/474] lodash: signatures of _.negate have been changed --- lodash/lodash-tests.ts | 41 +++++++++++++++++++++++++++++++---------- lodash/lodash.d.ts | 13 +++++++++++++ 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9cae2a8721..6cc7205038 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4925,17 +4925,38 @@ module TestModArgs { } // _.negate -interface TestNegatePredicate { - (a1: number, a2: number): boolean; +module TestNegate { + interface PredicateFn { + (a1: number, a2: number): boolean; + } + + interface ResultFn { + (a1: number, a2: number): boolean; + } + + var predicate = (a1: number, a2: number) => a1 > a2; + + { + let result: ResultFn; + + result = _.negate(predicate); + result = _.negate(predicate); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(predicate).negate(); + result = _(predicate).negate(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(predicate).chain().negate(); + result = _(predicate).chain().negate(); + } } -interface TestNegateResult { - (a1: number, a2: number): boolean; -} -var testNegatePredicate = (a1: number, a2: number) => a1 > a2; -result = _.negate(testNegatePredicate); -result = _.negate(testNegatePredicate); -result = _(testNegatePredicate).negate().value(); -result = _(testNegatePredicate).negate().value(); // _.once module TestOnce { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ed8d72443a..66e49e5f52 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8462,6 +8462,7 @@ declare module _ { /** * Creates a function that negates the result of the predicate func. The func predicate is invoked with * the this binding and arguments of the created function. + * * @param predicate The predicate to negate. * @return Returns the new function. */ @@ -8485,6 +8486,18 @@ declare module _ { negate(): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper<(...args: any[]) => boolean>; + + /** + * @see _.negate + */ + negate(): LoDashExplicitObjectWrapper; + } + //_.once interface LoDashStatic { /** From 8ca6bc3f619666c4a56bf1b5db54851ddcb24f9e Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 6 Dec 2015 22:54:48 +0900 Subject: [PATCH 127/474] Add type definitions of shuffle-array package --- shuffle-array/shuffle-array-tests.ts | 20 +++++++++++++ shuffle-array/shuffle-array.d.ts | 42 ++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 shuffle-array/shuffle-array-tests.ts create mode 100644 shuffle-array/shuffle-array.d.ts diff --git a/shuffle-array/shuffle-array-tests.ts b/shuffle-array/shuffle-array-tests.ts new file mode 100644 index 0000000000..9b799bb6ed --- /dev/null +++ b/shuffle-array/shuffle-array-tests.ts @@ -0,0 +1,20 @@ +/// + +import shuffle = require('shuffle-array'); + +// shuffle() +var a = [1, 2, 3, 4, 5]; +var result: number[]; +result = shuffle(a); +result = shuffle(a, {}); +result = shuffle(a, {copy: true}); +result = shuffle(a, {rng: () => 0}); +result = shuffle(a, {copy: true, rng: () => 0}); + +var b = ['aaa', 'bbb', 'ccc'] +var result2: string[]; +result2 = shuffle.pick(b); +result2 = shuffle.pick(b, {}); +result2 = shuffle.pick(b, {picks: 3}); +result2 = shuffle.pick(b, {rng: () => 0}); +result2 = shuffle.pick(b, {picks: 3, rng: () => 0}); diff --git a/shuffle-array/shuffle-array.d.ts b/shuffle-array/shuffle-array.d.ts new file mode 100644 index 0000000000..880396c4a0 --- /dev/null +++ b/shuffle-array/shuffle-array.d.ts @@ -0,0 +1,42 @@ +// Type definitions for shuffle-array +// Project: https://github.com/pazguille/shuffle-array +// Definitions by: rhysd +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "shuffle-array" { + /** + * copy - Sets if should return a shuffled copy of the given array. By default it's a falsy value. + * rng - Specifies a custom random number generator. + */ + interface ShuffleOption { + copy?: boolean; + rng?: () => number; + } + /** + * picks - Specifies how many random elements you want to pick. By default it picks 1. + * rng - Specifies a custom random number generator. + */ + interface PickOption { + picks?: number; + rng?: () => number; + } + interface ShuffleArray { + /** + * Randomizes the order of the elements in a given array. + * + * arr - The given array. + * options - Optional configuration options. + */ + (arr: T[], options?: ShuffleOption): T[]; + /** + * Pick one or more random elements from the given array. + * + * arr - The given array. + * options - Optional configuration options. + */ + pick(arr: T[], options?: Object): T[]; + } + var shuffle: ShuffleArray; + export = shuffle; +} + From 19053aa84e473fab046938bf2648cf7ee5090111 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 7 Dec 2015 04:31:43 +0500 Subject: [PATCH 128/474] lodash: signatures of _.pick have been changed --- lodash/lodash-tests.ts | 47 +++++++++++++++++++++++++++++++----------- lodash/lodash.d.ts | 31 +++++++++++++++++++++------- 2 files changed, 59 insertions(+), 19 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9cae2a8721..3ad1c37e58 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7047,18 +7047,41 @@ module TestPairs { } // _.pick -interface TestPickFn { - (element: any, key: string, collection: any): boolean; -} -{ - let testPickFn: TestPickFn; - let result: TResult; - result = _.pick({}, 0, '1', true, [2], ['3'], [true], [4, '5', true]); - result = _.pick({}, testPickFn); - result = _.pick({}, testPickFn, any); - result = _({}).pick(0, '1', true, [2], ['3'], [true], [4, '5', true]).value(); - result = _({}).pick(testPickFn).value(); - result = _({}).pick(testPickFn, any).value(); +module TestPick { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.pick({}, 'a'); + result = _.pick({}, 0, 'a'); + result = _.pick({}, true, 0, 'a'); + result = _.pick({}, ['b', 1, false], true, 0, 'a'); + result = _.pick({}, predicate); + result = _.pick({}, predicate, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).pick('a'); + result = _({}).pick(0, 'a'); + result = _({}).pick(true, 0, 'a'); + result = _({}).pick(['b', 1, false], true, 0, 'a'); + result = _({}).pick(predicate); + result = _({}).pick(predicate, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().pick('a'); + result = _({}).chain().pick(0, 'a'); + result = _({}).chain().pick(true, 0, 'a'); + result = _({}).chain().pick(['b', 1, false], true, 0, 'a'); + result = _({}).chain().pick(predicate); + result = _({}).chain().pick(predicate, any); + } } // _.result diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ed8d72443a..9c11aedacc 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11771,9 +11771,9 @@ declare module _ { * @param predicate The function invoked per iteration or property names to pick, specified as individual * property names or arrays of property names. * @param thisArg The this binding of predicate. - * @return An object composed of the picked properties. + * @return Returns the new object. */ - pick( + pick( object: T, predicate: ObjectIterator, thisArg?: any @@ -11782,9 +11782,9 @@ declare module _ { /** * @see _.pick */ - pick( + pick( object: T, - ...predicate: Array> + ...predicate: (StringRepresentable|StringRepresentable[])[] ): TResult; } @@ -11792,7 +11792,7 @@ declare module _ { /** * @see _.pick */ - pick( + pick( predicate: ObjectIterator, thisArg?: any ): LoDashImplicitObjectWrapper; @@ -11800,11 +11800,28 @@ declare module _ { /** * @see _.pick */ - pick( - ...predicate: Array> + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] ): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.pick + */ + pick( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; + + /** + * @see _.pick + */ + pick( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; + } + //_.result interface LoDashStatic { /** From eb48b34846b3f336e02afc6facf614c6ad6f70e1 Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Sun, 6 Dec 2015 20:08:00 -0600 Subject: [PATCH 129/474] Move //-comments above the corresponding line and use /** */ syntax so that TypeScript tooling will read it. Standardize formatting. --- imap/imap.d.ts | 313 +++++++++++++++++++++++++++---------------------- 1 file changed, 172 insertions(+), 141 deletions(-) diff --git a/imap/imap.d.ts b/imap/imap.d.ts index 1284919556..ce9fd72233 100644 --- a/imap/imap.d.ts +++ b/imap/imap.d.ts @@ -5,32 +5,46 @@ /// - declare module IMAP { - + // The property names of these interfaces match the documentation (where type names were given). export interface Config { - user: string; // Username for plain-text authentication. - password: string; // Password for plain-text authentication. - xoauth?: string; // Base64-encoded OAuth token for OAuth authentication for servers that support it (See Andris Reinman's xoauth.js module to help generate this string). - xoauth2?: string; // Base64-encoded OAuth2 token for The SASL XOAUTH2 Mechanism for servers that support it (See Andris Reinman's xoauth2 module to help generate this string). - host?: string; // Hostname or IP address of the IMAP server. Default: "localhost" - port?: number; // Port number of the IMAP server. Default: 143 - tls?: boolean; // Perform implicit TLS connection? Default: false - tlsOptions?: Object; // Options object to pass to tls.connect() Default: (none) - autotls?: string; // Set to 'always' to always attempt connection upgrades via STARTTLS, 'required' only if upgrading is required, or 'never' to never attempt upgrading. Default: 'never' - connTimeout?: number; // Number of milliseconds to wait for a connection to be established. Default: 10000 - authTimeout?: number; // Number of milliseconds to wait to be authenticated after a connection has been established. Default: 5000 - keepalive?: any; /* boolean|KeepAlive */ // Configures the keepalive mechanism. Set to true to enable keepalive with defaults or set to object to enable and configure keepalive behavior: Default: true - debug?: Function; // If set, the function will be called with one argument, a string containing some debug info Default: (no debug output) + /** Username for plain-text authentication. */ + user: string; + /** Password for plain-text authentication. */ + password: string; + /** Base64-encoded OAuth token for OAuth authentication for servers that support it (See Andris Reinman's xoauth.js module to help generate this string). */ + xoauth?: string; + /** Base64-encoded OAuth2 token for The SASL XOAUTH2 Mechanism for servers that support it (See Andris Reinman's xoauth2 module to help generate this string). */ + xoauth2?: string; + /** Hostname or IP address of the IMAP server. Default: "localhost" */ + host?: string; + /** Port number of the IMAP server. Default: 143 */ + port?: number; + /** Perform implicit TLS connection? Default: false */ + tls?: boolean; + /** Options object to pass to tls.connect() Default: (none) */ + tlsOptions?: Object; + /** Set to 'always' to always attempt connection upgrades via STARTTLS, 'required' only if upgrading is required, or 'never' to never attempt upgrading. Default: 'never' */ + autotls?: string; + /** Number of milliseconds to wait for a connection to be established. Default: 10000 */ + connTimeout?: number; + /** Number of milliseconds to wait to be authenticated after a connection has been established. Default: 5000 */ + authTimeout?: number; + /** Configures the keepalive mechanism. Set to true to enable keepalive with defaults or set to object to enable and configure keepalive behavior: Default: true */ + keepalive?: any; /* boolean|KeepAlive */ + /** If set, the function will be called with one argument, a string containing some debug info Default: (no debug output) */ + debug?: Function; } - export interface KeepAlive { - interval?: number; // This is the interval (in milliseconds) at which NOOPs are sent and the interval at which idleInterval is checked. Default: 10000 - idleInterval?: number; // This is the interval (in milliseconds) at which an IDLE command (for servers that support IDLE) is re-sent. Default: 300000 (5 mins) - forceNoop?: boolean; // Set to true to force use of NOOP keepalive on servers also support IDLE. Default: false + /** This is the interval (in milliseconds) at which NOOPs are sent and the interval at which idleInterval is checked. Default: 10000 */ + interval?: number; + /** This is the interval (in milliseconds) at which an IDLE command (for servers that support IDLE) is re-sent. Default: 300000 (5 mins) */ + idleInterval?: number; + /** Set to true to force use of NOOP keepalive on servers also support IDLE. Default: false */ + forceNoop?: boolean; } // One of: @@ -41,63 +55,78 @@ declare module IMAP { // type MessageSource = string | string[] - - - export interface Box { - name: string; // The name of this mailbox. - readOnly?: boolean; // True if this mailbox was opened in read-only mode. (Only available with openBox() calls) - newKeywords: boolean; //True if new keywords can be added to messages in this mailbox. - uidvalidity: number; // A 32-bit number that can be used to determine if UIDs in this mailbox have changed since the last time this mailbox was opened. - uidnext: number; // The uid that will be assigned to the next message that arrives at this mailbox. - flags: string[]; // array - A list of system-defined flags applicable for this mailbox. Flags in this list but not in permFlags may be stored for the current session only. Additional server implementation-specific flags may also be available. - permFlags: string[]; // A list of flags that can be permanently added/removed to/from messages in this mailbox. - persistentUIDs: boolean; // Whether or not this mailbox has persistent UIDs. This should almost always be true for modern mailboxes and should only be false for legacy mail stores where supporting persistent UIDs was not technically feasible. - messages: { //Contains various message counts for this mailbox: - total: number; // Total number of messages in this mailbox. - new: number; // Number of messages in this mailbox having the Recent flag (this IMAP session is the first to see these messages). - unseen: number; // (Only available with status() calls) Number of messages in this mailbox not having the Seen flag (marked as not having been read). + /** The name of this mailbox. */ + name: string; + /** True if this mailbox was opened in read-only mode. (Only available with openBox() calls) */ + readOnly?: boolean; + /** True if new keywords can be added to messages in this mailbox. */ + newKeywords: boolean; + /** A 32-bit number that can be used to determine if UIDs in this mailbox have changed since the last time this mailbox was opened. */ + uidvalidity: number; + /** The uid that will be assigned to the next message that arrives at this mailbox. */ + uidnext: number; + /** array - A list of system-defined flags applicable for this mailbox. Flags in this list but not in permFlags may be stored for the current session only. Additional server implementation-specific flags may also be available. */ + flags: string[]; + /** A list of flags that can be permanently added/removed to/from messages in this mailbox. */ + permFlags: string[]; + /** Whether or not this mailbox has persistent UIDs. This should almost always be true for modern mailboxes and should only be false for legacy mail stores where supporting persistent UIDs was not technically feasible. */ + persistentUIDs: boolean; + /** Contains various message counts for this mailbox: */ + messages: { + /** Total number of messages in this mailbox. */ + total: number; + /** Number of messages in this mailbox having the Recent flag (this IMAP session is the first to see these messages). */ + new: number; + /** (Only available with status() calls) Number of messages in this mailbox not having the Seen flag (marked as not having been read). */ + unseen: number; }; } - // Given in a 'message' event from ImapFetch - export interface ImapMessage extends NodeJS.EventEmitter { - } - + /** Given in a 'message' event from ImapFetch */ + export interface ImapMessage extends NodeJS.EventEmitter { } export interface FetchOptions { - markSeen?: boolean; // Mark message(s) as read when fetched. Default: false - struct?: boolean; // Fetch the message structure. Default: false - envelope?: boolean; // Fetch the message envelope. Default: false - size?: boolean; // Fetch the RFC822 size. Default: false - modifiers?: Object; // Fetch modifiers defined by IMAP extensions. Default: (none) - bodies?: any; /* string|string[] */ // A string or Array of strings containing the body part section to fetch. Default: (none) Example sections: + /** Mark message(s) as read when fetched. Default: false */ + markSeen?: boolean; + /** Fetch the message structure. Default: false */ + struct?: boolean; + /** Fetch the message envelope. Default: false */ + envelope?: boolean; + /** Fetch the RFC822 size. Default: false */ + size?: boolean; + /** Fetch modifiers defined by IMAP extensions. Default: (none) */ + modifiers?: Object; + /** A string or Array of strings containing the body part section to fetch. Default: (none) Example sections: */ + bodies?: any; /* string|string[] */ } - // Returned from fetch() - export interface ImapFetch extends NodeJS.EventEmitter { - } - + /** Returned from fetch() */ + export interface ImapFetch extends NodeJS.EventEmitter { } + export interface Folder { - attribs: string[]; - delimiter: string; - children: Folder[]; - parent: Folder; + attribs: string[]; + delimiter: string; + children: Folder[]; + parent: Folder; } export interface MailBoxes { - [name: string] : Folder; + [name: string]: Folder; } export interface AppendOptions { - mailbox?: string; // The name of the mailbox to append the message to. Default: the currently open mailbox - flags?: any; /* string|string[] */ // A single flag (e.g. 'Seen') or an array of flags (e.g. ['Seen', 'Flagged']) to append to the message. Default: (no flags) - date?: Date; // What to use for message arrival date/time. Default: (current date/time) + /** The name of the mailbox to append the message to. Default: the currently open mailbox */ + mailbox?: string; + /** A single flag (e.g. 'Seen') or an array of flags (e.g. ['Seen', 'Flagged']) to append to the message. Default: (no flags) */ + flags?: any; /* string|string[] */ + /** What to use for message arrival date/time. Default: (current date/time) */ + date?: Date; } @@ -118,7 +147,7 @@ declare module IMAP { UNDRAFT: void; // Messages that do not have the Draft flag set. UNFLAGGED: void; // Messages that do not have the Flagged flag set. UNSEEN: void; // Messages that do not have the Seen flag set. - + // The following are valid types that require string value(s): BCC: any; // Messages that contain the specified string in the BCC field. @@ -146,28 +175,28 @@ declare module IMAP { export interface MessageFunctions { - // Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. - search(criteria : any[], callback : (error : Error, uids : string[]) => void) : void; - // Fetches message(s) in the currently open mailbox. - fetch(source : any /* MessageSource */, options : FetchOptions) : ImapFetch; - // Copies message(s) in the currently open mailbox to another mailbox. - copy(source : any /* MessageSource */, mailboxName : string, callback : (error : Error) => void) : void; - // Moves message(s) in the currently open mailbox to another mailbox. Note: The message(s) in the destination mailbox will have a new message UID. - move(source : any /* MessageSource */, mailboxName : string, callback : (error : Error) => void) : void; - // Adds flag(s) to message(s). - addFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Removes flag(s) from message(s). - delFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Sets the flag(s) for message(s). - setFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Adds keyword(s) to message(s). keywords is either a single keyword or an array of keywords. - addKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - //Removes keyword(s) from message(s). keywords is either a single keyword or an array of keywords. - delKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - // Sets keyword(s) for message(s). keywords is either a single keyword or an array of keywords. - setKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - // Checks if the server supports the specified capability. - serverSupports(capability : string) : boolean; + /** Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. */ + search(criteria: any[], callback: (error: Error, uids: string[]) => void): void; + /** Fetches message(s) in the currently open mailbox. */ + fetch(source: any /* MessageSource */, options: FetchOptions): ImapFetch; + /** Copies message(s) in the currently open mailbox to another mailbox. */ + copy(source: any /* MessageSource */, mailboxName: string, callback: (error: Error) => void): void; + /** Moves message(s) in the currently open mailbox to another mailbox. Note: The message(s) in the destination mailbox will have a new message UID. */ + move(source: any /* MessageSource */, mailboxName: string, callback: (error: Error) => void): void; + /** Adds flag(s) to message(s). */ + addFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Removes flag(s) from message(s). */ + delFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Sets the flag(s) for message(s). */ + setFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Adds keyword(s) to message(s). keywords is either a single keyword or an array of keywords. */ + addKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Removes keyword(s) from message(s). keywords is either a single keyword or an array of keywords. */ + delKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Sets keyword(s) for message(s). keywords is either a single keyword or an array of keywords. */ + setKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Checks if the server supports the specified capability. */ + serverSupports(capability: string): boolean; } @@ -175,8 +204,8 @@ declare module IMAP { export class Connection implements NodeJS.EventEmitter, MessageFunctions { /** @constructor */ - constructor(config : Config); - + constructor(config: Config); + // from NodeJS.EventEmitter addListener(event: string, listener: Function): NodeJS.EventEmitter; on(event: string, listener: Function): NodeJS.EventEmitter; @@ -186,87 +215,89 @@ declare module IMAP { setMaxListeners(n: number): void; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; - + // from MessageFunctions - // Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. - search(criteria : any[], callback : (error : Error, uids : string[]) => void) : void; - // Fetches message(s) in the currently open mailbox. - fetch(source : any /* MessageSource */, options : FetchOptions) : ImapFetch; - // Copies message(s) in the currently open mailbox to another mailbox. - copy(source : any /* MessageSource */, mailboxName : string, callback : (error : Error) => void) : void; - // Moves message(s) in the currently open mailbox to another mailbox. Note: The message(s) in the destination mailbox will have a new message UID. - move(source : any /* MessageSource */, mailboxName : string, callback : (error : Error) => void) : void; - // Adds flag(s) to message(s). - addFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Removes flag(s) from message(s). - delFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Sets the flag(s) for message(s). - setFlags(source : any /* MessageSource */, flags : any, callback : (error : Error) => void) : void; - // Adds keyword(s) to message(s). keywords is either a single keyword or an array of keywords. - addKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - //Removes keyword(s) from message(s). keywords is either a single keyword or an array of keywords. - delKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - // Sets keyword(s) for message(s). keywords is either a single keyword or an array of keywords. - setKeywords(source : any /* MessageSource */, keywords : any /* string|string[] */, callback : (error : Error) => void) : void; - // Checks if the server supports the specified capability. - serverSupports(capability : string) : boolean; - - // Parses a raw header and returns an object keyed on header fields and the values are Arrays of header field values. Set disableAutoDecode to true to disable automatic decoding of MIME encoded-words that may exist in header field values. - static parseHeader(rawHeader: string, disableAutoDecode? : boolean) : any; - - state: string; // The current state of the connection (e.g. 'disconnected', 'connected', 'authenticated'). - delimiter: string; // The (top-level) mailbox hierarchy delimiter. If the server does not support mailbox hierarchies and only a flat list, this value will be falsey. - namespaces: { // Contains information about each namespace type (if supported by the server) with the following properties: - personal: any[]; // Mailboxes that belong to the logged in user. - other: any[]; // Mailboxes that belong to other users that the logged in user has access to. - shared: any[]; // Mailboxes that are accessible by any logged in user. + /** Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. */ + search(criteria: any[], callback: (error: Error, uids: string[]) => void): void; + /** Fetches message(s) in the currently open mailbox. */ + fetch(source: any /* MessageSource */, options: FetchOptions): ImapFetch; + /** Copies message(s) in the currently open mailbox to another mailbox. */ + copy(source: any /* MessageSource */, mailboxName: string, callback: (error: Error) => void): void; + /** Moves message(s) in the currently open mailbox to another mailbox. Note: The message(s) in the destination mailbox will have a new message UID. */ + move(source: any /* MessageSource */, mailboxName: string, callback: (error: Error) => void): void; + /** Adds flag(s) to message(s). */ + addFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Removes flag(s) from message(s). */ + delFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Sets the flag(s) for message(s). */ + setFlags(source: any /* MessageSource */, flags: any, callback: (error: Error) => void): void; + /** Adds keyword(s) to message(s). keywords is either a single keyword or an array of keywords. */ + addKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Removes keyword(s) from message(s). keywords is either a single keyword or an array of keywords. */ + delKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Sets keyword(s) for message(s). keywords is either a single keyword or an array of keywords. */ + setKeywords(source: any /* MessageSource */, keywords: any /* string|string[] */, callback: (error: Error) => void): void; + /** Checks if the server supports the specified capability. */ + serverSupports(capability: string): boolean; + + /** Parses a raw header and returns an object keyed on header fields and the values are Arrays of header field values. Set disableAutoDecode to true to disable automatic decoding of MIME encoded-words that may exist in header field values. */ + static parseHeader(rawHeader: string, disableAutoDecode?: boolean): any; + + /** The current state of the connection (e.g. 'disconnected', 'connected', 'authenticated'). */ + state: string; + /** The (top-level) mailbox hierarchy delimiter. If the server does not support mailbox hierarchies and only a flat list, this value will be falsey. */ + delimiter: string; + /** Contains information about each namespace type (if supported by the server) with the following properties: */ + namespaces: { + /** Mailboxes that belong to the logged in user. */ + personal: any[]; + /** Mailboxes that belong to other users that the logged in user has access to. */ + other: any[]; + /** Mailboxes that are accessible by any logged in user. */ + shared: any[]; }; seq: MessageFunctions; /** Attempts to connect and authenticate with the IMAP server. */ - connect() : void; + connect(): void; /** Closes the connection to the server after all requests in the queue have been sent. */ - end() : void; + end(): void; /** Immediately destroys the connection to the server. */ - destroy() : void; + destroy(): void; /** Opens a specific mailbox that exists on the server. mailboxName should include any necessary prefix/path. modifiers is used by IMAP extensions. */ - openBox(mailboxName : string, callback : (error : Error, mailbox: Box) => void) : void; - openBox(mailboxName : string, openReadOnly : boolean, callback : (error : Error, mailbox: Box) => void) : void; - openBox(mailboxName : string, openReadOnly : boolean, modifiers : Object, callback : (error : Error, mailbox: Box) => void) : void; + openBox(mailboxName: string, callback: (error: Error, mailbox: Box) => void): void; + openBox(mailboxName: string, openReadOnly: boolean, callback: (error: Error, mailbox: Box) => void): void; + openBox(mailboxName: string, openReadOnly: boolean, modifiers: Object, callback: (error: Error, mailbox: Box) => void): void; /** Closes the currently open mailbox. If autoExpunge is true, any messages marked as Deleted in the currently open mailbox will be removed if the mailbox was NOT opened in read-only mode. If autoExpunge is false, you disconnect, or you open another mailbox, messages marked as Deleted will NOT be removed from the currently open mailbox. */ - closeBox(callback : (error : Error) => void) : void; - closeBox(autoExpunge : boolean, callback : (error : Error) => void) : void; + closeBox(callback: (error: Error) => void): void; + closeBox(autoExpunge: boolean, callback: (error: Error) => void): void; /** Creates a new mailbox on the server. mailboxName should include any necessary prefix/path. */ - addBox(mailboxName : string, callback : (error : Error) => void) : void; + addBox(mailboxName: string, callback: (error: Error) => void): void; /** Removes a specific mailbox that exists on the server. mailboxName should including any necessary prefix/path. */ - delBox(mailboxName : string, callback : (error : Error, uids : string[]) => void) : void; + delBox(mailboxName: string, callback: (error: Error, uids: string[]) => void): void; /** Renames a specific mailbox that exists on the server. Both oldMailboxName and newMailboxName should include any necessary prefix/path. Note: Renaming the 'INBOX' mailbox will instead cause all messages in 'INBOX' to be moved to the new mailbox. */ - renameBox(oldMailboxName : string, newMailboxName : string, callback : (error : Error, mailbox: Box) => void) : void; + renameBox(oldMailboxName: string, newMailboxName: string, callback: (error: Error, mailbox: Box) => void): void; /** Subscribes to a specific mailbox that exists on the server. mailboxName should include any necessary prefix/path. */ - subscribeBox(mailboxName : string, callback : (error : Error) => void) : void; + subscribeBox(mailboxName: string, callback: (error: Error) => void): void; /** Unsubscribes from a specific mailbox that exists on the server. mailboxName should include any necessary prefix/path. */ - unsubscribeBox(mailboxName : string, callback : (error : Error) => void) : void; + unsubscribeBox(mailboxName: string, callback: (error: Error) => void): void; /** Fetches information about a mailbox other than the one currently open. Note: There is no guarantee that this will be a fast operation on the server. Also, do not call this on the currently open mailbox. */ - status(mailboxName : string, callback : (error : Error, mailbox: Box) => void) : void; + status(mailboxName: string, callback: (error: Error, mailbox: Box) => void): void; /** Obtains the full list of mailboxes. If nsPrefix is not specified, the main personal namespace is used. */ - getBoxes(callback : (error : Error, mailboxes: MailBoxes) => void) : void; - getBoxes(nsPrefix : string, callback : (error : Error, mailboxes: MailBoxes) => void) : void; + getBoxes(callback: (error: Error, mailboxes: MailBoxes) => void): void; + getBoxes(nsPrefix: string, callback: (error: Error, mailboxes: MailBoxes) => void): void; /** Obtains the full list of subscribed mailboxes. If nsPrefix is not specified, the main personal namespace is used. */ - getSubscribedBoxes(callback : (error : Error, mailboxes: MailBoxes) => void) : void; - getSubscribedBoxes(nsPrefix : string, callback : (error : Error, mailboxes: MailBoxes) => void) : void; + getSubscribedBoxes(callback: (error: Error, mailboxes: MailBoxes) => void): void; + getSubscribedBoxes(nsPrefix: string, callback: (error: Error, mailboxes: MailBoxes) => void): void; /** Permanently removes all messages flagged as Deleted in the currently open mailbox. If the server supports the 'UIDPLUS' capability, uids can be supplied to only remove messages that both have their uid in uids and have the \Deleted flag set. Note: At least on Gmail, performing this operation with any currently open mailbox that is not the Spam or Trash mailbox will merely archive any messages marked as Deleted (by moving them to the 'All Mail' mailbox). */ - expunge(callback : (error : Error) => void) : void; - expunge(uids : any /* MessageSource */, callback : (error : Error) => void) : void; - // Appends a message to selected mailbox. msgData is a string or Buffer containing an RFC-822 compatible MIME message. Valid options properties are: - append(msgData : any, callback : (error : Error) => void) : void; - append(msgData : any, options : AppendOptions, callback : (error : Error) => void) : void; + expunge(callback: (error: Error) => void): void; + expunge(uids: any /* MessageSource */, callback: (error: Error) => void): void; + /** Appends a message to selected mailbox. msgData is a string or Buffer containing an RFC-822 compatible MIME message. Valid options properties are: */ + append(msgData: any, callback: (error: Error) => void): void; + append(msgData: any, options: AppendOptions, callback: (error: Error) => void): void; } - } - declare module "imap" { - var out: typeof IMAP.Connection; - export = out; } From ec0ee97259280fa893398c61688ad031c9de77a6 Mon Sep 17 00:00:00 2001 From: Jacob Eggers Date: Sun, 6 Dec 2015 21:58:46 -0800 Subject: [PATCH 130/474] Fixing rx-lite module name --- rx/rx.lite.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rx/rx.lite.d.ts b/rx/rx.lite.d.ts index 66ec678498..6192f13ca6 100644 --- a/rx/rx.lite.d.ts +++ b/rx/rx.lite.d.ts @@ -10,6 +10,6 @@ /// /// -declare module "rx.lite" { +declare module "rx-lite" { export = Rx; } From 7f14ac023aee0836218cc32278882de14559372a Mon Sep 17 00:00:00 2001 From: Dave Keen Date: Mon, 7 Dec 2015 12:28:15 +0100 Subject: [PATCH 131/474] strokeMiterlimit was left out of the React 0.14 typings --- react/react.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react/react.d.ts b/react/react.d.ts index fb04cf0f53..bd35811119 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -1864,6 +1864,7 @@ declare namespace __React { stroke?: string; strokeDasharray?: string; strokeLinecap?: string; + strokeMiterlimit?: string; strokeOpacity?: number | string; strokeWidth?: number | string; textAnchor?: string; From 9e91f2a6c21d668479629c1e708e677176f9a973 Mon Sep 17 00:00:00 2001 From: Sascha Thiel Date: Mon, 7 Dec 2015 14:31:10 +0100 Subject: [PATCH 132/474] PesistenceOptions is actually JQueryAjaxSettings. backbone.js:Backbone.sync > // Make the request, allowing the user to override any Ajax options. > var xhr = options.xhr = Backbone.ajax(_.extend(params, options)); --- backbone/backbone-global.d.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/backbone/backbone-global.d.ts b/backbone/backbone-global.d.ts index 764aa83d75..192377f5f8 100644 --- a/backbone/backbone-global.d.ts +++ b/backbone/backbone-global.d.ts @@ -41,11 +41,7 @@ declare module Backbone { parse?: any; } - interface PersistenceOptions { - url?: string; - beforeSend?: (jqxhr: JQueryXHR) => void; - success?: (modelOrCollection?: any, response?: any, options?: any) => void; - error?: (modelOrCollection?: any, jqxhr?: JQueryXHR, options?: any) => void; + interface PersistenceOptions extends JQueryAjaxSettings { } interface ModelSetOptions extends Silenceable, Validable { From e120044c7b8821d0da3aba2e18c4494e99688cdb Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Mon, 7 Dec 2015 14:57:49 +0100 Subject: [PATCH 133/474] Update README build status badge to correct URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 82833752d7..7e1d60d874 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DefinitelyTyped [![Build Status](https://travis-ci.org/borisyankov/DefinitelyTyped.png?branch=master)](https://travis-ci.org/borisyankov/DefinitelyTyped) +# DefinitelyTyped [![Build Status](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped.png?branch=master)](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped) [![Join the chat at https://gitter.im/borisyankov/DefinitelyTyped](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) From 2f5765d6be3f8f5a0236a841b352d231e0cd257b Mon Sep 17 00:00:00 2001 From: Sascha Thiel Date: Mon, 7 Dec 2015 15:08:00 +0100 Subject: [PATCH 134/474] isn't the same, so just added the "data" attribute. --- backbone/backbone-global.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backbone/backbone-global.d.ts b/backbone/backbone-global.d.ts index 192377f5f8..c16e1a59e3 100644 --- a/backbone/backbone-global.d.ts +++ b/backbone/backbone-global.d.ts @@ -41,7 +41,12 @@ declare module Backbone { parse?: any; } - interface PersistenceOptions extends JQueryAjaxSettings { + interface PersistenceOptions { + url?: string; + data?: any; + beforeSend?: (jqxhr: JQueryXHR) => void; + success?: (modelOrCollection?: any, response?: any, options?: any) => void; + error?: (modelOrCollection?: any, jqxhr?: JQueryXHR, options?: any) => void; } interface ModelSetOptions extends Silenceable, Validable { From caa3cf3634551dfa745272e02dcdb78bce83a329 Mon Sep 17 00:00:00 2001 From: Lars Michaelis Date: Mon, 7 Dec 2015 16:21:26 +0100 Subject: [PATCH 135/474] rename folder from jsf to jee-jsf --- {jsf => jee-jsf}/jsf-tests.ts | 0 {jsf => jee-jsf}/jsf.d.ts | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {jsf => jee-jsf}/jsf-tests.ts (100%) rename {jsf => jee-jsf}/jsf.d.ts (100%) diff --git a/jsf/jsf-tests.ts b/jee-jsf/jsf-tests.ts similarity index 100% rename from jsf/jsf-tests.ts rename to jee-jsf/jsf-tests.ts diff --git a/jsf/jsf.d.ts b/jee-jsf/jsf.d.ts similarity index 100% rename from jsf/jsf.d.ts rename to jee-jsf/jsf.d.ts From 1c3380ab16cd81b52c3ad8b50cf97da60ab26066 Mon Sep 17 00:00:00 2001 From: David Broder-Rodgers Date: Mon, 7 Dec 2015 15:11:58 +0000 Subject: [PATCH 136/474] Added typings for chai-things --- chai-things/chai-things-tests.ts | 59 ++++++++++++++++++++++++++++++++ chai-things/chai-things.d.ts | 55 +++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 chai-things/chai-things-tests.ts create mode 100644 chai-things/chai-things.d.ts diff --git a/chai-things/chai-things-tests.ts b/chai-things/chai-things-tests.ts new file mode 100644 index 0000000000..de6a4c3ffe --- /dev/null +++ b/chai-things/chai-things-tests.ts @@ -0,0 +1,59 @@ +/// + +import chai = require('chai'); +import chaiThings = require('chai-things'); + +chai.use(chaiThings); + +function test_somethingSyntax() { + [].should.not.include.something(); + [].should.not.include.something.that.equals(1); + + var array = [{ a: 1 }, { b: 2 }]; + array.should.include.something(); + array.should.include.something.that.deep.equals({ b: 2 }); + array.should.include.something.that.not.deep.equals({ b: 2 }); + array.should.not.include.something.that.deep.equals({ c: 3 }); + array.should.include.something.that.not.deep.equals({ c: 3 }); + array.should.include.something.with.property('b', 2); + array.should.not.include.something.with.property('b', 3); + + var array2 = [{ a: 'b' }, { a: 'b' }]; + array2.should.include.something.that.have.property("a"); + array2.should.include.something.that.have.property("a").not.equal("d"); +} + +function test_somethingVariantsSyntax() { + [].should.not.include.any(); + [].should.not.include.any.that.deep.equal({ b: 2 }); + + var array = [{ a: 1 }, { b: 2 }]; + array.should.include.a.thing(); + array.should.include.a.thing.that.deep.equals({ b: 2 }); + array.should.include.an.item(); + array.should.include.an.item.that.deep.equals({ b: 2 }); + array.should.include.one.that.deep.equals({ b: 2 }); + array.should.include.some(); + array.should.include.some.that.deep.equal({ b: 2 }); +} + +function test_allSyntax() { + [].should.all.equal(1); + [].should.all.not.equal(1); + + var array = [1, 1]; + array.should.all.equal(1); + array.should.all.not.equal(2); + array.should.not.all.equal(2); + array.should.not.all.not.equal(1); + + var array2 = [1, 2]; + array2.should.not.all.equal(1); + array2.should.not.all.equal(2); + array2.should.not.all.not.equal(1); + array2.should.not.all.not.equal(2); + + var array3 = [{ a: 'b' }, { a: 'c' }]; + array3.should.all.have.property("a"); + array3.should.all.have.property("a").not.equal("d"); +} \ No newline at end of file diff --git a/chai-things/chai-things.d.ts b/chai-things/chai-things.d.ts new file mode 100644 index 0000000000..bc2b89c46f --- /dev/null +++ b/chai-things/chai-things.d.ts @@ -0,0 +1,55 @@ +// Type definitions for chai-things +// Project: https://github.com/chaijs/chai-things +// Definitions by: David Broder-Rodgers +// Definitions: https://github.com/DavidBR-SW/DefinitelyTyped + +/// + +declare module Chai { + interface ArrayAssertion { + include: ArrayInclude; + contain: ArrayInclude; + not: ArrayAssertion; + all: Assertion; + } + + interface ArrayInclude { + (item: any): any; + a: Item; + an: Item; + one: Something; + some: Something; + something: Something; + any: Anything; + } + + interface Anything extends Assertion { + (): any; + that: Assertion + with: Assertion + } + + interface Something extends Assertion { + (): any; + that: Assertion + with: Assertion + } + + interface Item { + item: Something; + thing: Something; + } + + interface Deep { + equals: Equal; + } +} + +interface Array { + should: Chai.ArrayAssertion; +} + +declare module "chai-things" { + function chaiThings(chai: any, utils: any): void; + export = chaiThings; +} From f67852cbc81823e9d0178e9cdc89aea4a5e3c40c Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 7 Dec 2015 18:29:53 +0100 Subject: [PATCH 137/474] Update validator: add "isMACAddress" function. --- validator/validator-tests.ts | 2 ++ validator/validator.d.ts | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/validator/validator-tests.ts b/validator/validator-tests.ts index b7f45d4271..c5a55f59c2 100644 --- a/validator/validator-tests.ts +++ b/validator/validator-tests.ts @@ -19,6 +19,8 @@ validator.isURL("sample"); validator.isFQDN("sample"); +validator.isMACAddress("sample"); + validator.isIP("sample"); validator.isAlpha("sample"); diff --git a/validator/validator.d.ts b/validator/validator.d.ts index 05a391fa45..2b29efac0c 100644 --- a/validator/validator.d.ts +++ b/validator/validator.d.ts @@ -22,7 +22,7 @@ interface IEmailoptions { lowercase?: boolean } -// callback type for #extend +// callback type for #extend interface IExtendCallback { (argv: string): any } @@ -54,6 +54,9 @@ interface IValidatorStatic { // check if the string is a fully qualified domain name (e.g. domain.com). isFQDN(str: string, options?: IFQDNoptions): boolean; + // check if the string is a MAC address. + isMACAddress(str: string): boolean; + // check if the string is an IP (version 4 or 6). isIP(str: string, version?: number): boolean; @@ -177,7 +180,7 @@ interface IValidatorStatic { // remove characters that do not appear in the whitelist. whitelist(input: string, chars: string): string; - // remove characters that appear in the blacklist. + // remove characters that appear in the blacklist. blacklist(input: string, chars: string): string; // canonicalize an email address. From b2ee74c4c726246604c9e6dd8f8f5cab98b03eda Mon Sep 17 00:00:00 2001 From: Andrzej Gis Date: Mon, 7 Dec 2015 18:22:45 +0100 Subject: [PATCH 138/474] Add L.Map.eachLayer method typing --- leaflet/leaflet-tests.ts | 3 ++- leaflet/leaflet.d.ts | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts index 0ea66d32e0..2a7e418f71 100755 --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -131,6 +131,7 @@ var layer = L.tileLayer("http://{s}.example.net/{x}/{y}/{z}.png"); map.addLayer(layer); map.addLayer(layer, false); +map.eachLayer(l => {}); map.removeLayer(layer); map.hasLayer(layer); @@ -423,4 +424,4 @@ var zoomCtrl = L.control.zoom({ position: "topleft", zoomInText: '+', zoomOutText: '-' -}); +}); \ No newline at end of file diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index 565a3c25de..94e6ab51c3 100755 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -516,7 +516,7 @@ declare module L { function (options?: ControlOptions): Control; } - namespace control { + export namespace control { /** * Creates a zoom control. @@ -2441,6 +2441,12 @@ declare namespace L { */ options: Map.MapOptions; + /** + * Iterates over the layers of the map, optionally specifying context + * of the iterator function. + */ + eachLayer(fn: (layer: ILayer) => void, context?: any): Map; + //////////////// //////////////// addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): Map; @@ -3261,7 +3267,7 @@ declare namespace L { off(eventMap?: any, context?: any): Path; } - namespace Path { + export namespace Path { /** * True if SVG is used for vector rendering (true for most modern browsers). */ From c6a1eb87530f8bbe638b121f4099b33f00dd3bd2 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 7 Dec 2015 18:46:54 +0100 Subject: [PATCH 139/474] Add definition "express-brute". --- express-brute/express-brute-tests.ts | 16 ++++ express-brute/express-brute.d.ts | 129 +++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 express-brute/express-brute-tests.ts create mode 100644 express-brute/express-brute.d.ts diff --git a/express-brute/express-brute-tests.ts b/express-brute/express-brute-tests.ts new file mode 100644 index 0000000000..ea0f2f5b4d --- /dev/null +++ b/express-brute/express-brute-tests.ts @@ -0,0 +1,16 @@ +/// + +import express = require("express"); +import ExpressBrute = require("express-brute"); + +var store = new ExpressBrute.MemoryStore(); +store = new ExpressBrute.MemoryStore({ prefix: "prefix" }); +store.set("key", "value", 0, (error: any) => { }); +store.get("key", (error: any, data: Object) => { }); +store.reset("key", (error: any) => { }); + +var app = express(); +var bruteforce = new ExpressBrute(store); +app.post("/auth", bruteforce.prevent, (req, res, next) => { + res.send("Success!"); +}); diff --git a/express-brute/express-brute.d.ts b/express-brute/express-brute.d.ts new file mode 100644 index 0000000000..377efcdce6 --- /dev/null +++ b/express-brute/express-brute.d.ts @@ -0,0 +1,129 @@ +// Type definitions for express-validator 2.9.0 +// Project: https://github.com/AdamPflug/express-brute +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "express-brute" { + import express = require("express"); + + /** + * @summary Options for {@link MemoryStore} class. + * @interface + */ + interface MemoryStoreOptions { + /** + * @summary Key prefix. + * @type {string} + */ + prefix: string; + } + + /** + * @summary Options for {@link ExpressBrute#getMiddleware} class. + * @interface + */ + interface ExpressBruteMiddleware { + /** + * @summary Allows you to override the value of failCallback for this middleware. + * @type {Function} + */ + failCallback: Function; + + /** + * @summary Disregard IP address when matching requests if set to true. Defaults to false. + * @type {boolean} + */ + ignoreIP: boolean; + + /** + * @summary Key. + * @type {any} + */ + key: any; + } + + /** + * @summary Middleware. + * @class + */ + class ExpressBrute { + /** + * @summary Constructor. + * @constructor + * @param {any} store The store. + */ + constructor(store: any); + + /** + * @summary Generates middleware that will bounce requests with the same key and IP address that happen faster than the current wait time by calling failCallback. + * @param {Object} options The options. + */ + getMiddleware(options: ExpressBruteMiddleware): express.RequestHandler; + + /** + * @summary Uses the current proxy trust settings to get the current IP from a request object. + * @param {Request} request The HTTP request. + * @return {RequestHandler} The Request handler. + */ + getIPFromRequest(request: express.Request): express.RequestHandler; + + /** + * @summary Middleware that will bounce requests that happen faster than the current wait time by calling failCallback. + * @param {Request} request The HTTP request. + * @param {Response} response The HTTP response. + * @param {Function} next The next middleware. + * @return {RequestHandler} The Request handler. + */ + prevent(request: express.Request, response: express.Response, next: Function): express.RequestHandler; + + /** + * @summary Resets the wait time between requests back to its initial value. + * @param {string} ip The IP address. + * @param {string} key The key. response. + * @param {Function} next The next middleware. + * @return {RequestHandler} The Request handler. + */ + reset(ip: string, key: string, next: Function): express.RequestHandler; + } + + module ExpressBrute { + /** + * @summary In-memory store. + * @class + */ + export class MemoryStore { + /** + * @summary Constructor. + * @constructor + * @param {Object} options The options. + */ + constructor(options?: MemoryStoreOptions); + /** + * @summary Gets key value. + * @param {string} key The key name. + * @param {Function} callbck The callback. + */ + get(key: string, callback: (error: any, data: Object) => void): void; + + /** + * @summary Sets the key value. + * @param {string} key The name. + * @param {string} value The value. + * @param {number} lifetime The lifetime. + * @param {Function} callback The callback. + */ + set(key: string, value: any, lifetime: number, callback: (error: any) => void): void; + + /** + * @summary Deletes the key. + * @param {string} key The name. + * @param {Function} callback The callback. + */ + reset(key: string, callback: (error: any) => void): void; + } + } + + export = ExpressBrute; +} From 41ecb256fe6fe1c59c537d158721ba68d783e16b Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 7 Dec 2015 19:19:49 +0100 Subject: [PATCH 140/474] Add definition for "express-brute-mongo". --- .../express-brute-mongo-tests.ts | 27 +++++++++++++++++++ express-brute-mongo/express-brute-mongo.d.ts | 22 +++++++++++++++ express-brute/express-brute.d.ts | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 express-brute-mongo/express-brute-mongo-tests.ts create mode 100644 express-brute-mongo/express-brute-mongo.d.ts diff --git a/express-brute-mongo/express-brute-mongo-tests.ts b/express-brute-mongo/express-brute-mongo-tests.ts new file mode 100644 index 0000000000..a4512782be --- /dev/null +++ b/express-brute-mongo/express-brute-mongo-tests.ts @@ -0,0 +1,27 @@ +/// +/// +/// + +import express = require("express"); +import ExpressBrute = require("express-brute"); +import MongoStore = require("express-brute-mongo"); +import mongodb = require("mongodb"); +var MongoClient = mongodb.MongoClient; + +var store = new MongoStore(ready => { + MongoClient.connect("mongodb://127.0.0.1:27017/test", (err, db) => { + if (err) { + throw err; + } + + var collection = db.collection("bruteforce-store"); + ready(collection); + }); +}); + +var app = express(); +var bruteforce = new ExpressBrute(store); + +app.post("/auth", bruteforce.prevent, (req, res, next) => { + res.send("Success!"); +}); diff --git a/express-brute-mongo/express-brute-mongo.d.ts b/express-brute-mongo/express-brute-mongo.d.ts new file mode 100644 index 0000000000..bc4d5e43d3 --- /dev/null +++ b/express-brute-mongo/express-brute-mongo.d.ts @@ -0,0 +1,22 @@ +// Type definitions for express-brute-mongo +// Project: https://github.com/auth0/express-brute-mongo +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "express-brute-mongo" { + /** + * @summary MongoDB store adapter. + * @class + */ + export = class MongoStore { + /** + * @summary Constructor. + * @constructor + * @param {Function} getCollection The collection. + * @param {Object} options The otpions. + */ + constructor(getCollection: (collection: any) => void, options?: Object); + } +} diff --git a/express-brute/express-brute.d.ts b/express-brute/express-brute.d.ts index 377efcdce6..7242d44dc3 100644 --- a/express-brute/express-brute.d.ts +++ b/express-brute/express-brute.d.ts @@ -1,4 +1,4 @@ -// Type definitions for express-validator 2.9.0 +// Type definitions for express-brute // Project: https://github.com/AdamPflug/express-brute // Definitions by: Cyril Schumacher // Definitions: https://github.com/borisyankov/DefinitelyTyped From a961bfca179fd8d16dcdc166bc4c026d11e3fec6 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Mon, 7 Dec 2015 19:39:31 +0100 Subject: [PATCH 141/474] Update definition for "nodemailer". --- nodemailer/nodemailer-tests.ts | 16 ++++++++++++++-- nodemailer/nodemailer.d.ts | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/nodemailer/nodemailer-tests.ts b/nodemailer/nodemailer-tests.ts index 1d99046c0a..a991096d5b 100644 --- a/nodemailer/nodemailer-tests.ts +++ b/nodemailer/nodemailer-tests.ts @@ -11,6 +11,20 @@ var transporter: nodemailer.Transporter = nodemailer.createTransport({ } }); +// create reusable transporter object using SMTP transport and set default values for mail options. +transporter = nodemailer.createTransport({ + service: 'Gmail', + auth: { + user: 'gmail.user@gmail.com', + pass: 'userpass' + } +}, { + from: 'sender@address', + headers: { + 'My-Awesome-Header': '123' + } +}); + // setup e-mail data with unicode symbols var mailOptions: nodemailer.SendMailOptions = { from: 'Fred Foo ✔ ', // sender address @@ -24,5 +38,3 @@ var mailOptions: nodemailer.SendMailOptions = { transporter.sendMail(mailOptions, (error: Error, info: nodemailer.SentMessageInfo): void => { // nothing }); - - diff --git a/nodemailer/nodemailer.d.ts b/nodemailer/nodemailer.d.ts index e0d1300b0a..e7d09f54f2 100644 --- a/nodemailer/nodemailer.d.ts +++ b/nodemailer/nodemailer.d.ts @@ -51,13 +51,13 @@ declare module "nodemailer" { /** * Create a direct transporter */ - export function createTransport(options?: directTransport.DirectOptions): Transporter; + export function createTransport(options?: directTransport.DirectOptions, defaults?: Object): Transporter; /** * Create an SMTP transporter */ - export function createTransport(options?: smtpTransport.SmtpOptions): Transporter; + export function createTransport(options?: smtpTransport.SmtpOptions, defaults?: Object): Transporter; /** * Create a transporter from a given implementation */ - export function createTransport(transport: Transport): Transporter; + export function createTransport(transport: Transport, defaults?: Object): Transporter; } From 7e4c025262a4af55afb8f41f6ad4451d17066cd5 Mon Sep 17 00:00:00 2001 From: Calvin Fernandez Date: Sat, 5 Dec 2015 14:25:01 -0500 Subject: [PATCH 142/474] Add typings to support angular ui tree callbacks --- angular-ui-tree/angular-ui-tree-tests.ts | 69 ++++++++++++++++++++++++ angular-ui-tree/angular-ui-tree.d.ts | 64 ++++++++++++++++++++++ 2 files changed, 133 insertions(+) diff --git a/angular-ui-tree/angular-ui-tree-tests.ts b/angular-ui-tree/angular-ui-tree-tests.ts index e66408814e..4e5ef91b92 100644 --- a/angular-ui-tree/angular-ui-tree-tests.ts +++ b/angular-ui-tree/angular-ui-tree-tests.ts @@ -11,3 +11,72 @@ var treeNode2: AngularUITree.ITreeNode = { nodes: [treeNode], title: "test2" }; + +// fake jquery node here so that we can pull a pretend +// angular scope element out of it +var dummyJQueryNode: ng.IAugmentedJQuery; +var fakeScope: (ng.IScope | AngularUITree.IParentTreeNodeScope) = dummyJQueryNode.scope(); + +( fakeScope).node = treeNode; + +var treeNodeScope: AngularUITree.ITreeNodeScope = fakeScope; + +( fakeScope).isParent = (nodeScope: AngularUITree.ITreeNodeScope) => { + return true; +}; + +var parentTreeNodeScope: AngularUITree.IParentTreeNodeScope = fakeScope; + +var eventSourceInfo: AngularUITree.IEventSourceInfo = { + cloneModel: {}, + nodeScope: treeNodeScope, + index: 0, + nodesScope: parentTreeNodeScope +}; + +var position: AngularUITree.IPosition = { + dirAx: 0, + dirX: 0, + dirY: 0, + distAxX: 0, + distAxY: 0, + distX: 0, + distY: 0, + lastDirX: 0, + lastDirY: 0, + lastX: 0, + lastY: 0, + moving: true, + nowX: 0, + nowY: 0, + offsetX: 0, + offsetY: 0, + startX: 0, + startY: 0 + +}; + +var eventInfo: AngularUITree.IEventInfo = { + source: eventSourceInfo, + dest: { + index: 0, + nodesScope: parentTreeNodeScope + }, + elements: {}, + pos: position +}; + +var acceptCallback: AngularUITree.IAcceptCallback = (source: AngularUITree.ITreeNodeScope, + destination: AngularUITree.ITreeNodeScope, + destinationIndex: number) => { + return false; +}; + +var droppedCallback: AngularUITree.IDroppedCallback = (eventInfo: AngularUITree.IEventInfo) => { + return; +}; + +var callbacks: AngularUITree.ICallbacks = { + accept: acceptCallback, + dropped: droppedCallback +}; diff --git a/angular-ui-tree/angular-ui-tree.d.ts b/angular-ui-tree/angular-ui-tree.d.ts index 1017ac11cd..62c8899fa3 100644 --- a/angular-ui-tree/angular-ui-tree.d.ts +++ b/angular-ui-tree/angular-ui-tree.d.ts @@ -3,7 +3,71 @@ // Definitions by: Calvin Fernandez // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module AngularUITree { + interface IEventSourceInfo { + cloneModel: any; + index: number; + nodeScope: ITreeNodeScope; + nodesScope: ITreeNodeScope; + } + + interface IPosition { + dirAx: number; + dirX: number; + dirY: number; + distAxX: number; + distAxY: number; + distX: number; + distY: number; + lastDirX: number; + lastDirY: number; + lastX: number; + lastY: number; + moving: boolean; + nowX: number; + nowY: number; + offsetX: number; + offsetY: number; + startX: number; + startY: number; + } + + interface IEventInfo { + dest: { + index: number; + nodesScope: IParentTreeNodeScope; + }; + elements: any; + pos: IPosition; + source: IEventSourceInfo; + } + + interface IAcceptCallback { + (source: ITreeNodeScope, destination: ITreeNodeScope, destinationIndex: number): boolean; + } + + interface IDroppedCallback { + (eventInfo: IEventInfo): void; + } + + interface ICallbacks { + accept: IAcceptCallback; + dropped: IDroppedCallback; + } + + /** + * Internal representation of node in the UI + */ + interface ITreeNodeScope extends ng.IScope { + node: ITreeNode; + } + + interface IParentTreeNodeScope extends ITreeNodeScope { + isParent(nodeScope: ITreeNodeScope): boolean; + } + /** * Node in list */ From 44dad1d2373ed5e4135267b38b158202806dfbea Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Mon, 7 Dec 2015 17:56:00 -0500 Subject: [PATCH 143/474] Add getClient() to auth0.lock --- auth0.lock/auth0.lock.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/auth0.lock/auth0.lock.d.ts b/auth0.lock/auth0.lock.d.ts index bef269dbcb..3269103ab1 100644 --- a/auth0.lock/auth0.lock.d.ts +++ b/auth0.lock/auth0.lock.d.ts @@ -72,6 +72,8 @@ interface Auth0LockStatic { hide(callback: () => void): void; logout(callback: () => void): void; + + getClient(): Auth0Static; } declare var Auth0Lock: Auth0LockStatic; From 0c717541d80116f51bc2d9c0a4a2d731b0a50edb Mon Sep 17 00:00:00 2001 From: "Dylan R. E. Moonfire" Date: Mon, 7 Dec 2015 13:00:05 -0600 Subject: [PATCH 144/474] Added an interface to tokenizers to make it easier to pass into functinos. --- natural/natural.d.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/natural/natural.d.ts b/natural/natural.d.ts index d559f38012..249caf901d 100644 --- a/natural/natural.d.ts +++ b/natural/natural.d.ts @@ -8,24 +8,27 @@ declare module "natural" { import events = require("events"); - class WordTokenizer { + interface Tokenizer { tokenize(text: string): string[]; } - class AggressiveTokenizer { + class WordTokenizer implements Tokenizer { tokenize(text: string): string[]; } - class TreebankWordTokenizer { + class AggressiveTokenizer implements Tokenizer { + tokenize(text: string): string[]; + } + class TreebankWordTokenizer implements Tokenizer { tokenize(text: string): string[]; } interface RegexTokenizerOptions { pattern: RegExp; discardEmpty?: boolean; } - class RegexpTokenizer { + class RegexpTokenizer implements Tokenizer { constructor(options: RegexTokenizerOptions); tokenize(text: string): string[]; } - class WordPunctTokenizer { + class WordPunctTokenizer implements Tokenizer { tokenize(text: string): string[]; } @@ -74,6 +77,10 @@ declare module "natural" { static restore(classifier: any, stemmer?: Stemmer): BayesClassifier; } + interface Phonetic { + compare(stringA: string, stringB: string): boolean; + process(token: string, maxLength?: number): string; + } var Metaphone: { compare(stringA: string, stringB: string): boolean; process(token: string, maxLength?: number): string; From 412522a8d49a6d557d79ea4e5485a5c097afad52 Mon Sep 17 00:00:00 2001 From: "Dylan R. E. Moonfire" Date: Mon, 7 Dec 2015 13:00:19 -0600 Subject: [PATCH 145/474] Added missing LancasterStemmer. --- natural/natural.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/natural/natural.d.ts b/natural/natural.d.ts index 249caf901d..aaf3305a01 100644 --- a/natural/natural.d.ts +++ b/natural/natural.d.ts @@ -63,6 +63,9 @@ declare module "natural" { var PorterStemmerPt: { stem(token: string): string; } + var LancasterStemmer: { + stem(token: string): string; + } interface BayesClassifierCallback { (err: any, classifier: any): void } class BayesClassifier { From 494baf6691ed8fd7cbd4a0cfeee4b14086bc5245 Mon Sep 17 00:00:00 2001 From: "Dylan R. E. Moonfire" Date: Mon, 7 Dec 2015 13:08:03 -0600 Subject: [PATCH 146/474] Added initial definition for strip-json-comments. --- strip-json-comments/strip-json-comments-tests.ts | 11 +++++++++++ strip-json-comments/strip-json-comments.d.ts | 13 +++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 strip-json-comments/strip-json-comments-tests.ts create mode 100644 strip-json-comments/strip-json-comments.d.ts diff --git a/strip-json-comments/strip-json-comments-tests.ts b/strip-json-comments/strip-json-comments-tests.ts new file mode 100644 index 0000000000..3a9e91f3d8 --- /dev/null +++ b/strip-json-comments/strip-json-comments-tests.ts @@ -0,0 +1,11 @@ +// Type definitions for strip-json-comments +// Project: https://github.com/sindresorhus/strip-json-comments +// Definitions by: Dylan R. E. Moonfire +// Definitions: https://github.com/borisyankov/DefinitelyTyped +/// +import stripJsonComments = require("strip-json-comments"); + +const json = '{/*rainbows*/"unicorn":"cake"}'; + +JSON.parse(stripJsonComments(json)); +//=> {unicorn: 'cake'} diff --git a/strip-json-comments/strip-json-comments.d.ts b/strip-json-comments/strip-json-comments.d.ts new file mode 100644 index 0000000000..721b83314d --- /dev/null +++ b/strip-json-comments/strip-json-comments.d.ts @@ -0,0 +1,13 @@ +// Type definitions for strip-json-comments +// Project: https://github.com/sindresorhus/strip-json-comments +// Definitions by: Dylan R. E. Moonfire +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "strip-json-comments" { + interface StripJsonOptions { + whitespace?: boolean; + } + + function stripJsonComments(input: string, opts?: StripJsonOptions): string; + export = stripJsonComments; +} From 7d58f574a7faf3caac3ccdfb10576199949b879c Mon Sep 17 00:00:00 2001 From: Steve Ognibene Date: Mon, 7 Dec 2015 18:53:12 -0600 Subject: [PATCH 147/474] Added module declaration so Typescript will emit require statement. --- big.js/big.js.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/big.js/big.js.d.ts b/big.js/big.js.d.ts index d4ca239e36..2ad360a564 100644 --- a/big.js/big.js.d.ts +++ b/big.js/big.js.d.ts @@ -200,4 +200,9 @@ declare module BigJsLibrary { } } +declare module "big.js" { + var bigjs : BigJsLibrary.BigJS; + export = bigjs; +} + declare var Big: BigJsLibrary.BigJS; From 5111e014788097f739548ef63025bc22371a5ae9 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Tue, 8 Dec 2015 10:24:22 +0100 Subject: [PATCH 148/474] Add definition for "connect-timeout". --- connect-timeout/connect-timeout-tests.ts | 28 ++++++++++++++++++ connect-timeout/connect-timeout.d.ts | 36 ++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 connect-timeout/connect-timeout-tests.ts create mode 100644 connect-timeout/connect-timeout.d.ts diff --git a/connect-timeout/connect-timeout-tests.ts b/connect-timeout/connect-timeout-tests.ts new file mode 100644 index 0000000000..283ee2679d --- /dev/null +++ b/connect-timeout/connect-timeout-tests.ts @@ -0,0 +1,28 @@ +/// +/// +/// +/// + +import express = require("express"); +import timeout = require("connect-timeout"); +import bodyParser = require("body-parser"); +import cookieParser = require("cookie-parser"); + +// example of using this top-level; note the use of haltOnTimedout +// after every middleware; it will stop the request flow on a timeout +var app = express(); +app.use(timeout("5s", { respond: false })); +app.use(bodyParser()); +app.use(haltOnTimedout); +app.use(cookieParser()); +app.use(haltOnTimedout); + +// Add your routes here, etc. + +function haltOnTimedout(req, res, next) { + if (!req.timedout) { + next(); + } +} + +app.listen(3000); diff --git a/connect-timeout/connect-timeout.d.ts b/connect-timeout/connect-timeout.d.ts new file mode 100644 index 0000000000..8b7ff2879e --- /dev/null +++ b/connect-timeout/connect-timeout.d.ts @@ -0,0 +1,36 @@ +// Type definitions for connect-timeout +// Project: https://github.com/expressjs/timeout +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Express { + export interface Request { + /** + * @summary Clears the timeout on the request. + */ + clearTimeout(): void; + + /** + * + * @return {boolean} true if timeout fired; false otherwise. + */ + timedout(event: string, message: string): boolean; + } +} + +declare module "connect-timeout" { + import express = require("express"); + + interface TimeoutOptions extends Object { + /** + * @summary Controls if this module will "respond" in the form of forwarding an error. + * @type {boolean} + */ + respond: boolean; + } + + function timeout(timeout: string, options?: TimeoutOptions): express.RequestHandler; + export = timeout; +} From 93a277a4d4d624f5f3f9bcbde9f1543cb3f69c40 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Tue, 8 Dec 2015 03:26:05 -0600 Subject: [PATCH 149/474] [chai] Correct type of AssertionError AssertionError on the global chai object is the constructor for AssertionErrors, but the definition was written as though it was an instance of an assertion error. --- chai/chai.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chai/chai.d.ts b/chai/chai.d.ts index 28aaf48c25..e68e6fa3b4 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -19,7 +19,7 @@ declare module Chai { use(fn: (chai: any, utils: any) => void): any; assert: AssertStatic; config: Config; - AssertionError: AssertionError; + AssertionError: typeof AssertionError; } export interface ExpectStatic extends AssertionStatic { From 784857f638e949d67c80fcd7d7f5ab5de53fb808 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Tue, 8 Dec 2015 10:26:56 +0100 Subject: [PATCH 150/474] Fix errors. --- connect-timeout/connect-timeout-tests.ts | 2 +- connect-timeout/connect-timeout.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/connect-timeout/connect-timeout-tests.ts b/connect-timeout/connect-timeout-tests.ts index 283ee2679d..920c7fdc67 100644 --- a/connect-timeout/connect-timeout-tests.ts +++ b/connect-timeout/connect-timeout-tests.ts @@ -19,7 +19,7 @@ app.use(haltOnTimedout); // Add your routes here, etc. -function haltOnTimedout(req, res, next) { +function haltOnTimedout(req: express.Request, res: express.Response, next: Function) { if (!req.timedout) { next(); } diff --git a/connect-timeout/connect-timeout.d.ts b/connect-timeout/connect-timeout.d.ts index 8b7ff2879e..8494a3afbf 100644 --- a/connect-timeout/connect-timeout.d.ts +++ b/connect-timeout/connect-timeout.d.ts @@ -1,6 +1,6 @@ // Type definitions for connect-timeout // Project: https://github.com/expressjs/timeout -// Definitions by: Cyril Schumacher +// Definitions by: Cyril Schumacher // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From be0eda50824f411753ec1364d341e5305000b4ab Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 10:59:11 +0100 Subject: [PATCH 151/474] gulp jshint + gulp notify + typescript require --- gulp-jshint/gulp-jshint-tests.ts | 16 +++ gulp-jshint/gulp-jshint.d.ts | 29 +++++ gulp-notify/gulp-notify-tests.ts | 41 +++++++ gulp-notify/gulp-notify.d.ts | 113 ++++++++++++++++++ .../typescript-require-tests.ts | 7 ++ typescript-require/typescript-require.d.ts | 31 +++++ 6 files changed, 237 insertions(+) create mode 100644 gulp-jshint/gulp-jshint-tests.ts create mode 100644 gulp-jshint/gulp-jshint.d.ts create mode 100644 gulp-notify/gulp-notify-tests.ts create mode 100644 gulp-notify/gulp-notify.d.ts create mode 100644 typescript-require/typescript-require-tests.ts create mode 100644 typescript-require/typescript-require.d.ts diff --git a/gulp-jshint/gulp-jshint-tests.ts b/gulp-jshint/gulp-jshint-tests.ts new file mode 100644 index 0000000000..fe4d930418 --- /dev/null +++ b/gulp-jshint/gulp-jshint-tests.ts @@ -0,0 +1,16 @@ +/// +/// +import gulp = require("gulp"); +import jshint = require("gulp-jshint"); + + +gulp.task('check1', function() { + gulp.src('lib/*.ts') + .pipe(jshint()) + .pipe(jshint.reporter('default')); +}); + +gulp.task('check2', function() { + gulp.src('lib/*.ts') + .pipe(jshint({ linter: 'jshint', lookup: true })); +}); \ No newline at end of file diff --git a/gulp-jshint/gulp-jshint.d.ts b/gulp-jshint/gulp-jshint.d.ts new file mode 100644 index 0000000000..5e57694e48 --- /dev/null +++ b/gulp-jshint/gulp-jshint.d.ts @@ -0,0 +1,29 @@ +// Type definitions for gulp-jshint +// Project: https://github.com/spalger/gulp-jshint +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-jshint" { + function GulpJSHint(options?: IGulpJSHintOptions): NodeJS.ReadWriteStream; + + interface IGulpJSHintOptions { + /** + * When false do not lookup .jshintrc files. See the JSHint docs for more info. + * Default true. + */ + lookup?: boolean; + + /** + * Either the name of a module to use for linting the code or a linting function itself. This enables using an alternate (but jshint compatible) linter like "jsxhint". + * Default is "jshint" + */ + linter?: string; + } + + namespace GulpJSHint { + declare function reporter(kind: (string | Object)); + } + export = GulpJSHint; +} diff --git a/gulp-notify/gulp-notify-tests.ts b/gulp-notify/gulp-notify-tests.ts new file mode 100644 index 0000000000..0c434b4321 --- /dev/null +++ b/gulp-notify/gulp-notify-tests.ts @@ -0,0 +1,41 @@ +/// +/// +import gulp = require("gulp"); +import notify = require("gulp-notify"); + +var custom = notify.withReporter(function(options, callback) { + console.log("Title:", options.title); + console.log("Message:", options.message); + callback(); +}); + +notify.on('click', (options) => { + console.log('I clicked something!', options); +}); + +notify.on('timeout', (options) => { + console.log('The notification timed out', options); +}); + +gulp.task('notify1', function() { + gulp.src("./src/test.ext") + .pipe(notify("Hello Gulp! From file: <%= file.relative %>")); +}); + +gulp.task('notify2', function() { + gulp.src("./src/test.ext") + .pipe(notify({ + message: "Generated file: <%= file.relative %> @ <%= options.date %>", + templateOptions: { + date: new Date() + } + })); +}); + +gulp.task('notify3', function() { + gulp.src("./src/test.ext") + .pipe(custom("This is a message.")) + .on("error", notify.onError((error: Error) => { + return "Message to the notifier: " + error.message; + }); +}); \ No newline at end of file diff --git a/gulp-notify/gulp-notify.d.ts b/gulp-notify/gulp-notify.d.ts new file mode 100644 index 0000000000..a1e00514fa --- /dev/null +++ b/gulp-notify/gulp-notify.d.ts @@ -0,0 +1,113 @@ +// Type definitions for gulp-jshint +// Project: https://github.com/mikaelbr/gulp-notify +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-notify" { + function GulpNotify(param: string | Function | GulpNotifyOptions): NodeJS.ReadWriteStream; + + interface GulpNotifyOptions { + /** + * Type: Boolean Default: false + * If the notification should only happen on the last file of the stream. Per default a notification is triggered on each file. + */ + onLast?: boolean; + + /** + * Type: Boolean Default: false + * If the returned stream should emit an error or not. If emitError is true, you have to handle .on('error') manually in case the notifier (gulp-notify) fails. If the default false is set, the error will not be emitted but simply printed to the console. + * This means you can run the notifier on a CI system without opting it out but simply letting it fail gracefully. + */ + emitError?: boolean; + + /** + * Type: String Default: File path in stream + * + * The message you wish to attach to file. The string can be a lodash template as it is passed through gulp-util.template. + * + * Example: Created <%= file.relative %>. + * as function + * + * Type: Function(vinylFile) + * + * See notify(Function). + */ + message?: string | Function; + + /** + * Type: String Default: "Gulp Notification" + * + * The title of the notification. The string can be a lodash template as it is passed through gulp-util.template. + * + * Example: Created <%= file.relative %>. + * as function + * + * Type: Function(vinylFile) + * + * See notify(Function). + */ + title?: string | Function; + + /** + * Object passed to the lodash template, for additional properties passed to the template. + */ + templateOptions?: Object; + + /** + * Type: Function(options, callback) Default: node-notifier module + * + * Swap out the notifier by passing in an function. The function expects two arguments: options and callback. + * + * The callback must be called when the notification is finished. Options will contain both title and message. + * + * See notify.withReporter for syntactic sugar. + */ + notifier?: (options, callback) => void; + + /** + * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. + */ + wait?: boolean; + } + + namespace GulpNotify { + + /** + * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. + */ + function on(event: string, callback: (notificationOptions?: Object) => void): void; + + /** + * Wraps options.notifier to return a new notify-function only using the passed in reporter. + */ + function withReporter(reporter: (options: GulpNotifyOptions, callback: () => void) => void): (message: string | Function) => NodeJS.ReadWriteStream; + + + /** + * The exact same API as using notify(), but where a vinyl File is passed, the error object is passed instead. + */ + function onError(callback: (string | (error: Error) => string | GulpNotifyOptions)): NodeJS.ReadWriteStream; + + /** + * Type: Integer Default: 2 + * + * Set if logger should be used or not. If log level is set to 0, no logging will be used. If no new log level is passed, the current log level is returned. + * + * 0: No logging + * 1: Log on error + * 2: Log both on error and regular notification. + * + * If logging is set to > 0, the title and message passed to gulp-notify will be logged like so: + * ➜ gulp-notify git:(master) ✗ gulp --gulpfile examples/gulpfile.js one + * [gulp] Using file /Users/example/gulp-notify/examples/gulpfile.js + * [gulp] Working directory changed to /Users/example/repos/gulp-notify/examples + * [gulp] Running 'one'... + * [gulp] Finished 'one' in 4.08 ms + * [gulp] gulp-notify: [Gulp notification] /Users/example/gulp-notify/test/fixtures/1.txt + */ + function logLevel(level: number): void; + } + export = GulpNotify; +} diff --git a/typescript-require/typescript-require-tests.ts b/typescript-require/typescript-require-tests.ts new file mode 100644 index 0000000000..6269a4b9d3 --- /dev/null +++ b/typescript-require/typescript-require-tests.ts @@ -0,0 +1,7 @@ +/// + +require('typescript-require')({ + nodeLib: false, + targetES5: true, + exitOnError: true +}); diff --git a/typescript-require/typescript-require.d.ts b/typescript-require/typescript-require.d.ts new file mode 100644 index 0000000000..68b24ca274 --- /dev/null +++ b/typescript-require/typescript-require.d.ts @@ -0,0 +1,31 @@ +// Type definitions for typescript-require +// Project: https://github.com/theblacksmith/typescript-require +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "typescript-require" { + function TypeScriptRequire(options?: TypeScriptRequireOptions): void; + + interface TypeScriptRequireOptions { + /** + * If true node.d.ts definitions file is loaded before custom ts files. This is disabled by default and you should use. + * Default false. + */ + nodeLib?: boolean; + + /** + * Target ES5 / ES3 output mode. + * Default true. + */ + targetES5?: boolean; + + /** + * Wether execution should stop on compile error. + */ + exitOnError?: boolean; + } + + export = TypeScriptRequire; +} From 29c447bbed3d657a09b2309098362460e5e681fc Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 11:07:52 +0100 Subject: [PATCH 152/474] fixed syntax --- gulp-notify/gulp-notify.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-notify/gulp-notify.d.ts b/gulp-notify/gulp-notify.d.ts index a1e00514fa..34b752065d 100644 --- a/gulp-notify/gulp-notify.d.ts +++ b/gulp-notify/gulp-notify.d.ts @@ -88,7 +88,7 @@ declare module "gulp-notify" { /** * The exact same API as using notify(), but where a vinyl File is passed, the error object is passed instead. */ - function onError(callback: (string | (error: Error) => string | GulpNotifyOptions)): NodeJS.ReadWriteStream; + function onError(param: string | (error: Error): string | GulpNotifyOptions): NodeJS.ReadWriteStream; /** * Type: Integer Default: 2 From 737e8319a93d28f0fe903b9200d67394c593cb81 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 11:08:46 +0100 Subject: [PATCH 153/474] fixed declare --- gulp-jshint/gulp-jshint.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-jshint/gulp-jshint.d.ts b/gulp-jshint/gulp-jshint.d.ts index 5e57694e48..8c10fe0de8 100644 --- a/gulp-jshint/gulp-jshint.d.ts +++ b/gulp-jshint/gulp-jshint.d.ts @@ -23,7 +23,7 @@ declare module "gulp-jshint" { } namespace GulpJSHint { - declare function reporter(kind: (string | Object)); + function reporter(kind: (string | Object)); } export = GulpJSHint; } From 0aa8a6c9f51f8c736f44dfcc2413e57356c7cd68 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 11:09:01 +0100 Subject: [PATCH 154/474] fixed test syntax --- gulp-notify/gulp-notify-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulp-notify/gulp-notify-tests.ts b/gulp-notify/gulp-notify-tests.ts index 0c434b4321..4175d08628 100644 --- a/gulp-notify/gulp-notify-tests.ts +++ b/gulp-notify/gulp-notify-tests.ts @@ -37,5 +37,5 @@ gulp.task('notify3', function() { .pipe(custom("This is a message.")) .on("error", notify.onError((error: Error) => { return "Message to the notifier: " + error.message; - }); + })); }); \ No newline at end of file From b91489d6662a27ca5e57ff2e7b727e75d6dbbef7 Mon Sep 17 00:00:00 2001 From: nakakura Date: Tue, 8 Dec 2015 19:15:04 +0900 Subject: [PATCH 155/474] update webrtc/MediaStream.d.ts --- webrtc/MediaStream.d.ts | 66 ++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/webrtc/MediaStream.d.ts b/webrtc/MediaStream.d.ts index fc88469f06..37b6055926 100644 --- a/webrtc/MediaStream.d.ts +++ b/webrtc/MediaStream.d.ts @@ -9,23 +9,23 @@ /// interface ConstrainBooleanParameters { - exact: boolean; - ideal: boolean; + exact?: boolean; + ideal?: boolean; } interface NumberRange { - max: number; - min: number; + max?: number; + min?: number; } interface ConstrainNumberRange extends NumberRange { - exact: number; - ideal: number; + exact?: number; + ideal?: number; } interface ConstrainStringParameters { - exact: string | string[]; - ideal: string | string[]; + exact?: string | string[]; + ideal?: string | string[]; } interface MediaStreamConstraints { @@ -63,38 +63,38 @@ interface MediaTrackConstraintSet { } interface MediaTrackSupportedConstraints { - width: boolean; - height: boolean; - aspectRatio: boolean; - frameRate: boolean; - facingMode: boolean; - volume: boolean; - sampleRate: boolean; - sampleSize: boolean; - echoCancellation: boolean; - latency: boolean; - deviceId: boolean; - groupId: boolean; + width?: boolean; + height?: boolean; + aspectRatio?: boolean; + frameRate?: boolean; + facingMode?: boolean; + volume?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + echoCancellation?: boolean; + latency?: boolean; + deviceId?: boolean; + groupId?: boolean; } interface MediaStream extends EventTarget { id: string; active: boolean; - + onactive: EventListener; oninactive: EventListener; onaddtrack: (event: MediaStreamTrackEvent) => any; onremovetrack: (event: MediaStreamTrackEvent) => any; - + clone(): MediaStream; stop(): void; - + getAudioTracks(): MediaStreamTrack[]; getVideoTracks(): MediaStreamTrack[]; getTracks(): MediaStreamTrack[]; - + getTrackById(trackId: string): MediaStreamTrack; - + addTrack(track: MediaStreamTrack): void; removeTrack(track: MediaStreamTrack): void; } @@ -116,16 +116,16 @@ interface MediaStreamTrack extends EventTarget { muted: boolean; remote: boolean; readyState: MediaStreamTrackState; - + onmute: EventListener; onunmute: EventListener; onended: EventListener; onoverconstrained: EventListener; - + clone(): MediaStreamTrack; - + stop(): void; - + getCapabilities(): MediaTrackCapabilities; getConstraints(): MediaTrackConstraints; getSettings(): MediaTrackSettings; @@ -176,13 +176,13 @@ interface NavigatorGetUserMedia { interface Navigator { getUserMedia: NavigatorGetUserMedia; - + webkitGetUserMedia: NavigatorGetUserMedia; - + mozGetUserMedia: NavigatorGetUserMedia; - + msGetUserMedia: NavigatorGetUserMedia; - + mediaDevices: MediaDevices; } From 709cf2cb918b1fff49bcbfa041f48fefa5462786 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 11:16:17 +0100 Subject: [PATCH 156/474] fixed syntax and implicit any --- gulp-jshint/gulp-jshint.d.ts | 2 +- gulp-notify/gulp-notify.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gulp-jshint/gulp-jshint.d.ts b/gulp-jshint/gulp-jshint.d.ts index 8c10fe0de8..20db40a62a 100644 --- a/gulp-jshint/gulp-jshint.d.ts +++ b/gulp-jshint/gulp-jshint.d.ts @@ -23,7 +23,7 @@ declare module "gulp-jshint" { } namespace GulpJSHint { - function reporter(kind: (string | Object)); + function reporter(kind: (string | Object)): NodeJS.ReadWriteStream; } export = GulpJSHint; } diff --git a/gulp-notify/gulp-notify.d.ts b/gulp-notify/gulp-notify.d.ts index 34b752065d..96b11f95d1 100644 --- a/gulp-notify/gulp-notify.d.ts +++ b/gulp-notify/gulp-notify.d.ts @@ -88,7 +88,7 @@ declare module "gulp-notify" { /** * The exact same API as using notify(), but where a vinyl File is passed, the error object is passed instead. */ - function onError(param: string | (error: Error): string | GulpNotifyOptions): NodeJS.ReadWriteStream; + function onError(param: string | { (error: Error): string } | GulpNotifyOptions): NodeJS.ReadWriteStream; /** * Type: Integer Default: 2 From dc05db5550ce7bd5156db2b6f228ad17185f3740 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 11:20:52 +0100 Subject: [PATCH 157/474] fixed implicit any --- gulp-notify/gulp-notify.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gulp-notify/gulp-notify.d.ts b/gulp-notify/gulp-notify.d.ts index 96b11f95d1..4658616447 100644 --- a/gulp-notify/gulp-notify.d.ts +++ b/gulp-notify/gulp-notify.d.ts @@ -64,7 +64,7 @@ declare module "gulp-notify" { * * See notify.withReporter for syntactic sugar. */ - notifier?: (options, callback) => void; + notifier?: (options: GulpNotifyOptions, callback: () => void) => void; /** * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. @@ -77,7 +77,7 @@ declare module "gulp-notify" { /** * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. */ - function on(event: string, callback: (notificationOptions?: Object) => void): void; + function on(event: string, callback: (notificationOptions?: GulpNotifyOptions) => void): void; /** * Wraps options.notifier to return a new notify-function only using the passed in reporter. @@ -88,7 +88,7 @@ declare module "gulp-notify" { /** * The exact same API as using notify(), but where a vinyl File is passed, the error object is passed instead. */ - function onError(param: string | { (error: Error): string } | GulpNotifyOptions): NodeJS.ReadWriteStream; + function onError(param: string | { (error: Error): string } | GulpNotifyOptions): Function; /** * Type: Integer Default: 2 From f6e34ebc7c2750941f0416f2614fbc4679c35f71 Mon Sep 17 00:00:00 2001 From: pragyandas Date: Tue, 8 Dec 2015 16:19:41 +0530 Subject: [PATCH 158/474] changed return type of node() to Node --- d3/d3.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 396d0307e6..236b87d55e 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -791,7 +791,7 @@ declare module d3 { /** * Returns the first non-null element in the selection, or null otherwise. */ - node(): EventTarget; + node(): Node; /** * Returns the total number of elements in the selection. @@ -854,7 +854,7 @@ declare module d3 { call(func: (transition: Transition, ...args: any[]) => any, ...args: any[]): Transition; empty(): boolean; - node(): EventTarget; + node(): Node; size(): number; } From 2be15f1fe4719cae3c69fd87b70a81a5d7dd98a6 Mon Sep 17 00:00:00 2001 From: Glen Date: Tue, 8 Dec 2015 13:56:38 +0200 Subject: [PATCH 159/474] gulp-typescript: Add TsConfig --- gulp-typescript/gulp-typescript-tests.ts | 4 ++++ gulp-typescript/gulp-typescript.d.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gulp-typescript/gulp-typescript-tests.ts b/gulp-typescript/gulp-typescript-tests.ts index 5abd5a1523..ab40e478d8 100644 --- a/gulp-typescript/gulp-typescript-tests.ts +++ b/gulp-typescript/gulp-typescript-tests.ts @@ -60,3 +60,7 @@ gulp.task('default', function () { .pipe(typescript()) .pipe(gulp.dest('built/local')); }); + +var compilerOptions = tsProject.config.compilerOptions; +var exclude = tsProject.config.exclude; +var files = tsProject.config.files; diff --git a/gulp-typescript/gulp-typescript.d.ts b/gulp-typescript/gulp-typescript.d.ts index 84d4b5d9ce..5c7ab6b42c 100644 --- a/gulp-typescript/gulp-typescript.d.ts +++ b/gulp-typescript/gulp-typescript.d.ts @@ -26,8 +26,15 @@ declare module "gulp-typescript" { typescript?: any; } + interface TsConfig { + files?: string[]; + exclude?: string[]; + compilerOptions?: any; + } + interface Project { - src(): NodeJS.ReadWriteStream + config: TsConfig; + src(): NodeJS.ReadWriteStream; } interface FilterSettings { From 3aa59c162f9ff98fd7ce5e94908397bbeee2a1c9 Mon Sep 17 00:00:00 2001 From: stephenjelfs Date: Tue, 8 Dec 2015 13:31:05 +0100 Subject: [PATCH 160/474] Updated fixed-data-table to version 0.6.0 --- .../fixed-data-table-0.4.7-tests.tsx | 39 + fixed-data-table/fixed-data-table-0.4.7.d.ts | 402 +++++++++ fixed-data-table/fixed-data-table-tests.tsx | 192 ++++- fixed-data-table/fixed-data-table.d.ts | 778 ++++++++++-------- 4 files changed, 1038 insertions(+), 373 deletions(-) create mode 100644 fixed-data-table/fixed-data-table-0.4.7-tests.tsx create mode 100644 fixed-data-table/fixed-data-table-0.4.7.d.ts diff --git a/fixed-data-table/fixed-data-table-0.4.7-tests.tsx b/fixed-data-table/fixed-data-table-0.4.7-tests.tsx new file mode 100644 index 0000000000..28dae2890f --- /dev/null +++ b/fixed-data-table/fixed-data-table-0.4.7-tests.tsx @@ -0,0 +1,39 @@ +/// +/// +/// + +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import * as FixedDataTable from "fixed-data-table"; + +var rows = [ + ['a1', 'b1', 'c1'], + ['a2', 'b2', 'c2'], + ['a3', 'b3', 'c3'], + // .... and more +]; + +function rowGetter(rowIndex: number) { + return rows[rowIndex]; +} + + var table = + + + + +ReactDOM.render(table, document.body); diff --git a/fixed-data-table/fixed-data-table-0.4.7.d.ts b/fixed-data-table/fixed-data-table-0.4.7.d.ts new file mode 100644 index 0000000000..1dc22dc3de --- /dev/null +++ b/fixed-data-table/fixed-data-table-0.4.7.d.ts @@ -0,0 +1,402 @@ +// Type definitions for fixed-data-table 0.4.7 +// Project: https://github.com/facebook/fixed-data-table +// Definitions by: Petar Paar +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module FixedDataTable { + export var version: string; + + export interface TableProps extends __React.Props { + /** + * Pixel width of table. If all columns do not fit, + * a horizontal scrollbar will appear. + */ + width: number; + + /** + * Pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either `height` or `maxHeight` must be specified. + */ + height?: number; + + /** + * Maximum pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either `height` or `maxHeight` must be specified. + */ + maxHeight?: number; + + /** + * Pixel height of table's owner, this is used in a managed scrolling + * situation when you want to slide the table up from below the fold + * without having to constantly update the height on every scroll tick. + * Instead, vary this property on scroll. By using `ownerHeight`, we + * over-render the table while making sure the footer and horizontal + * scrollbar of the table are visible when the current space for the table + * in view is smaller than the final, over-flowing height of table. It + * allows us to avoid resizing and reflowing table when it is moving in the + * view. + * + * This is used if `ownerHeight < height` (or `maxHeight`). + */ + ownerHeight?: number; + + /** + * hidden or auto + */ + overflowX?: string; + overflowY?: string; + + /** + * Number of rows in the table. + */ + rowsCount: number; + + /** + * Pixel height of rows unless `rowHeightGetter` is specified and returns + * different value. + */ + rowHeight: number; + + /** + * If specified, `rowHeightGetter(index)` is called for each row and the + * returned value overrides `rowHeight` for particular row. + */ + rowHeightGetter?: Function; + + /** + * To get rows to display in table, `rowGetter(index)` + * is called. `rowGetter` should be smart enough to handle async + * fetching of data and return temporary objects + * while data is being fetched. + */ + rowGetter: Function; + + /** + * To get any additional CSS classes that should be added to a row, + * `rowClassNameGetter(index)` is called. + */ + rowClassNameGetter?: Function; + + /** + * Pixel height of the column group header. + */ + groupHeaderHeight?: number; + + /** + * Pixel height of header. + */ + headerHeight: number; + + /** + * Function that is called to get the data for the header row. + * If the function returns null, the header will be set to the + * Column's label property. + */ + headerDataGetter?: Function; + + /** + * Pixel height of footer. + */ + footerHeight?: number; + + /** + * DEPRECATED - use footerDataGetter instead. + * Data that will be passed to footer cell renderers. + */ + footerData?: any; + + /** + * Function that is called to get the data for the footer row. + */ + footerDataGetter?: Function; + + /** + * Value of horizontal scroll. + */ + scrollLeft?: number; + + /** + * Index of column to scroll to. + */ + scrollToColumn?: number; + + /** + * Value of vertical scroll. + */ + scrollTop?: number; + + /** + * Index of row to scroll to. + */ + scrollToRow?: number; + + /** + * Callback that is called when scrolling starts with current horizontal + * and vertical scroll values. + */ + onScrollStart?: Function; + + /** + * Callback that is called when scrolling ends or stops with new horizontal + * and vertical scroll values. + */ + onScrollEnd?: Function; + + /** + * Callback that is called when `rowHeightGetter` returns a different height + * for a row than the `rowHeight` prop. This is necessary because initially + * table estimates heights of some parts of the content. + */ + onContentHeightChange?: Function; + + /** + * Callback that is called when a row is clicked. + */ + onRowClick?: Function; + + /** + * Callback that is called when a row is double clicked. + */ + onRowDoubleClick?: Function; + + /** + * Callback that is called when a mouse-down event happens on a row. + */ + onRowMouseDown?: Function; + + /** + * Callback that is called when a mouse-enter event happens on a row. + */ + onRowMouseEnter?: Function; + + /** + * Callback that is called when a mouse-leave event happens on a row. + */ + onRowMouseLeave?: Function; + + /** + * Callback that is called when resizer has been released + * and column needs to be updated. + * + * Required if the isResizable property is true on any column. + * + * ``` + * function( + * newColumnWidth: number, + * dataKey: string, + * ) + * ``` + */ + onColumnResizeEndCallback?: Function; + + /** + * Whether a column is currently being resized. + */ + isColumnResizing?: boolean + } + + interface ColumnProps { + /** + * The horizontal alignment of the table cell content. + * 'left', 'center', 'right' + */ + align?: string; + + /** + * className for this column's header cell. + */ + headerClassName?: string; + + /** + * className for this column's footer cell. + */ + footerClassName?: string; + + /** + * className for each of this column's data cells. + */ + cellClassName?: string; + + /** + * The cell renderer that returns React-renderable content for table cell. + * ``` + * function( + * cellData: any, + * cellDataKey: string, + * rowData: object, + * rowIndex: number, + * columnData: any, + * width: number + * ): ?$jsx + * ``` + */ + cellRenderer?: Function; + + /** + * The getter `function(string_cellDataKey, object_rowData)` that returns + * the cell data for the `cellRenderer`. + * If not provided, the cell data will be collected from + * `rowData[cellDataKey]` instead. The value that `cellDataGetter` returns + * will be used to determine whether the cell should re-render. + */ + cellDataGetter?: Function; + + /** + * The key to retrieve the cell data from the data row. Provided key type + * must be either `string` or `number`. Since we use this + * for keys, it must be specified for each column. + */ + dataKey: string|number; + + /** + * Controls if the column is fixed when scrolling in the X axis. + */ + fixed?: boolean; + + /** + * The cell renderer that returns React-renderable content for table column + * header. + * ``` + * function( + * label: ?string, + * cellDataKey: string, + * columnData: any, + * rowData: array, + * width: number + * ): ?$jsx + * ``` + */ + headerRenderer?: Function; + + /** + * The cell renderer that returns React-renderable content for table column + * footer. + * ``` + * function( + * label: ?string, + * cellDataKey: string, + * columnData: any, + * rowData: array, + * width: number + * ): ?$jsx + * ``` + */ + footerRenderer?: Function; + + /** + * Bucket for any data to be passed into column renderer functions. + */ + columnData?: any; + + /** + * The column's header label. + */ + label: string; + + /** + * The pixel width of the column. + */ + width: number; + + /** + * If this is a resizable column this is its minimum pixel width. + */ + minWidth?: number; + + /** + * If this is a resizable column this is its maximum pixel width. + */ + maxWidth?: number; + + /** + * The grow factor relative to other columns. Same as the flex-grow API + * from http://www.w3.org/TR/css3-flexbox/. Basically, take any available + * extra width and distribute it proportionally according to all columns' + * flexGrow values. Defaults to zero (no-flexing). + */ + flexGrow?: number; + + /** + * Whether the column can be resized with the + * FixedDataTableColumnResizeHandle. Please note that if a column + * has a flex grow, once you resize the column this will be set to 0. + * + * This property only provides the UI for the column resizing. If this + * is set to true, you will need ot se the onColumnResizeEndCallback table + * property and render your columns appropriately. + */ + isResizable?: boolean; + + /** + * Experimental feature + * Whether cells in this column can be removed from document when outside + * of viewport as a result of horizontal scrolling. + * Setting this property to true allows the table to not render cells in + * particular column that are outside of viewport for visible rows. This + * allows to create table with many columns and not have vertical scrolling + * performance drop. + * Setting the property to false will keep previous behaviour and keep + * cell rendered if the row it belongs to is visible. + */ + allowCellsRecycling?: boolean; + } + + export interface ColumnGroupProps { + /** + * The horizontal alignment of the table cell content. + * 'left', 'center', 'right' + */ + align?: string; + + /** + * Controls if the column group is fixed when scrolling in the X axis. + */ + fixed?: boolean; + + /** + * Bucket for any data to be passed into column group renderer functions. + */ + columnGroupData?: any; + + /** + * The column group's header label. + */ + label?: string; + + /** + * The cell renderer that returns React-renderable content for a table + * column group header. If it's not specified, the label from props will + * be rendered as header content. + * ``` + * function( + * label: ?string, + * cellDataKey: string, + * columnGroupData: any, + * rowData: array, // array of labels of all columnGroups + * width: number + * ): ?$jsx + * ``` + */ + groupHeaderRenderer?: Function; + } + + export class Table extends __React.Component { + render(): __React.DOMElement + } + export class Column extends __React.Component { + render(): __React.DOMElement + } + export class ColumnGroup extends __React.Component { + render(): __React.DOMElement + } +} + +declare module "fixed-data-table" { + export = FixedDataTable; +} \ No newline at end of file diff --git a/fixed-data-table/fixed-data-table-tests.tsx b/fixed-data-table/fixed-data-table-tests.tsx index 28dae2890f..f104ac5e45 100644 --- a/fixed-data-table/fixed-data-table-tests.tsx +++ b/fixed-data-table/fixed-data-table-tests.tsx @@ -1,39 +1,169 @@ -/// +/// /// -/// import * as React from "react"; -import * as ReactDOM from "react-dom"; -import * as FixedDataTable from "fixed-data-table"; +import {Table, Cell, Column} from "fixed-data-table"; -var rows = [ - ['a1', 'b1', 'c1'], - ['a2', 'b2', 'c2'], - ['a3', 'b3', 'c3'], - // .... and more -]; - -function rowGetter(rowIndex: number) { - return rows[rowIndex]; +// create your Table +class MyTable1 extends React.Component<{}, {}> { + render(): React.ReactElement { + return ( +
+ // add columns +
+ ); + } } - var table = { + render(): React.ReactElement { + return ( + - - - + width={1000} + height={500}> + Basic content} + width={200} + /> +
+ ); + } +} -ReactDOM.render(table, document.body); +// provide Custom Data +interface MyTable3State { + myTableData: [{name: string}]; +} + +class MyTable3 extends React.Component<{}, MyTable3State> { + + constructor(props: {}) { + super(props); + + this.state = { + myTableData: [ + {name: "Rylan"}, + {name: "Amelia"}, + {name: "Estevan"}, + {name: "Florence"}, + {name: "Tressa"}, + ] + }; + } + + render(): React.ReactElement { + return ( + + Name} + cell={(props: any) => ( + + {this.state.myTableData[props.rowIndex].name} + + )} + width={200} + /> +
+ ); + } +} + +// Create Reusable Cells +interface RowData { + [field: string]: string; +} + +interface MyCellProps { + rowIndex?: number; + field: string; + data: RowData[]; +} + +class MyTextCell extends React.Component { + render(): React.ReactElement { + const {rowIndex, field, data} = this.props; + + return ( + + {data[rowIndex][field]} + + ); + } +} + +class MyLinkCell extends React.Component { + render(): React.ReactElement { + const {rowIndex, field, data} = this.props; + const link: string = data[rowIndex][field]; + + return ( + + {link} + + ); + } +} + +interface MyTable4State { + tableData: RowData[]; +} + +class MyTable4 extends React.Component<{}, MyTable4State> { + + constructor(props: {}) { + super(props); + this.state = { + tableData: [ + {name: "Rylan", email: "Angelita_Weimann42@gmail.com"}, + {name: "Amelia", email: "Dexter.Trantow57@hotmail.com"}, + {name: "Estevan", email: "Aimee7@hotmail.com"}, + {name: "Florence", email: "Jarrod.Bernier13@yahoo.com"}, + {name: "Tressa", email: "Yadira1@hotmail.com"} + ] + }; + } + + render(): React.ReactElement { + return ( + + Name} + cell={ + + } + width={200}/> + + Email} + cell={ + + } + width={200} + /> +
+ ); + } +} diff --git a/fixed-data-table/fixed-data-table.d.ts b/fixed-data-table/fixed-data-table.d.ts index 1dc22dc3de..a1400502e7 100644 --- a/fixed-data-table/fixed-data-table.d.ts +++ b/fixed-data-table/fixed-data-table.d.ts @@ -1,6 +1,6 @@ -// Type definitions for fixed-data-table 0.4.7 +// Type definitions for fixed-data-table 0.6.0 // Project: https://github.com/facebook/fixed-data-table -// Definitions by: Petar Paar +// Definitions by: Petar Paar , Stephen Jelfs // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -8,345 +8,396 @@ declare module FixedDataTable { export var version: string; + /** + * Data grid component with fixed or scrollable header and columns. + * + * The layout of the data table is as follows: + * + * + * +---------------------------------------------------+ + * | Fixed Column Group | Scrollable Column Group | + * | Header | Header | + * | | | + * +---------------------------------------------------+ + * | | | + * | Fixed Header Columns | Scrollable Header Columns | + * | | | + * +-----------------------+---------------------------+ + * | | | + * | Fixed Body Columns | Scrollable Body Columns | + * | | | + * +-----------------------+---------------------------+ + * | | | + * | Fixed Footer Columns | Scrollable Footer Columns | + * | | | + * +-----------------------+---------------------------+ + * + * Fixed Column Group Header: + * + * These are the headers for a group of columns if included in + * the table that do not scroll vertically or horizontally. + * + * Scrollable Column Group Header: + * + * The header for a group of columns that do not move while + * scrolling vertically, but move horizontally with the + * horizontal scrolling. + * + * Fixed Header Columns: + * + * The header columns that do not move while scrolling + * vertically or horizontally. + * + * Scrollable Header Columns: + * + * The header columns that do not move while scrolling + * vertically, but move horizontally with the horizontal scrolling. + * + * Fixed Body Columns: + * + * The body columns that do not move while scrolling + * horizontally, but move vertically with the vertical scrolling. + * + * Scrollable Body Columns: + * + * The body columns that move while scrolling vertically or + * horizontally. + * + */ export interface TableProps extends __React.Props { - /** - * Pixel width of table. If all columns do not fit, - * a horizontal scrollbar will appear. - */ - width: number; - - /** - * Pixel height of table. If all rows do not fit, - * a vertical scrollbar will appear. - * - * Either `height` or `maxHeight` must be specified. - */ - height?: number; - - /** - * Maximum pixel height of table. If all rows do not fit, - * a vertical scrollbar will appear. - * - * Either `height` or `maxHeight` must be specified. - */ - maxHeight?: number; - - /** - * Pixel height of table's owner, this is used in a managed scrolling - * situation when you want to slide the table up from below the fold - * without having to constantly update the height on every scroll tick. - * Instead, vary this property on scroll. By using `ownerHeight`, we - * over-render the table while making sure the footer and horizontal - * scrollbar of the table are visible when the current space for the table - * in view is smaller than the final, over-flowing height of table. It - * allows us to avoid resizing and reflowing table when it is moving in the - * view. - * - * This is used if `ownerHeight < height` (or `maxHeight`). - */ - ownerHeight?: number; + /** + * Pixel width of table. If all columns do not fit, a + * horizontal scrollbar will appear. + */ + width: number; + + /** + * Pixel height of table. If all rows do not fit, a + * vertical scrollbar will appear. + * + * Either height or maxHeight must be specified. + */ + height?: number; /** - * hidden or auto - */ - overflowX?: string; - overflowY?: string; + * Maximum pixel height of table. If all rows do not fit, + * a vertical scrollbar will appear. + * + * Either height or maxHeight must be specified. + */ + maxHeight?: number; + + /** + * Pixel height of table's owner, this is used in a managed + * scrolling situation when you want to slide the table up + * from below the fold without having to constantly update + * the height on every scroll tick. Instead, vary this + * property on scroll. By using ownerHeight, we over-render + * the table while making sure the footer and horizontal + * scrollbar of the table are visible when the current space + * for the table in view is smaller than the final, + * over-flowing height of table. It allows us to avoid + * resizing and reflowing table when it is moving in the + * view. + * + * This is used if ownerHeight < height (or maxHeight). + */ + ownerHeight?: number; - /** - * Number of rows in the table. - */ - rowsCount: number; + /** + * 'hidden'|'auto' + */ + overflowX?: string; + + /** + * 'hidden'|'auto' + */ + overflowY?: string; - /** - * Pixel height of rows unless `rowHeightGetter` is specified and returns - * different value. - */ - rowHeight: number; + /** + * Number of rows in the table. + */ + rowsCount: number; - /** - * If specified, `rowHeightGetter(index)` is called for each row and the - * returned value overrides `rowHeight` for particular row. - */ - rowHeightGetter?: Function; + /** + * Pixel height of rows unless rowHeightGetter is specified + * and returns different value. + */ + rowHeight: number; + + /** + * If specified, rowHeightGetter(index) is called for each + * row and the returned value overrides rowHeight for + * particular row. + */ + rowHeightGetter?: (index: number) => number; + + /** + * To get any additional CSS classes that should be added to + * a row, rowClassNameGetter(index) is called. + */ + rowClassNameGetter?: (index: number) => string; - /** - * To get rows to display in table, `rowGetter(index)` - * is called. `rowGetter` should be smart enough to handle async - * fetching of data and return temporary objects - * while data is being fetched. - */ - rowGetter: Function; + /** + * Pixel height of the column group header. + * + * defaultValue: 0 + */ + groupHeaderHeight?: number; - /** - * To get any additional CSS classes that should be added to a row, - * `rowClassNameGetter(index)` is called. - */ - rowClassNameGetter?: Function; + /** + * Pixel height of the header. + * + * defaultValue: 0 + */ + headerHeight?: number; - /** - * Pixel height of the column group header. - */ - groupHeaderHeight?: number; - - /** - * Pixel height of header. - */ - headerHeight: number; - - /** - * Function that is called to get the data for the header row. - * If the function returns null, the header will be set to the - * Column's label property. - */ - headerDataGetter?: Function; - - /** - * Pixel height of footer. - */ - footerHeight?: number; - - /** - * DEPRECATED - use footerDataGetter instead. - * Data that will be passed to footer cell renderers. - */ - footerData?: any; - - /** - * Function that is called to get the data for the footer row. - */ - footerDataGetter?: Function; - - /** - * Value of horizontal scroll. - */ - scrollLeft?: number; - - /** - * Index of column to scroll to. - */ - scrollToColumn?: number; - - /** - * Value of vertical scroll. - */ - scrollTop?: number; - - /** - * Index of row to scroll to. - */ - scrollToRow?: number; - - /** - * Callback that is called when scrolling starts with current horizontal - * and vertical scroll values. - */ - onScrollStart?: Function; - - /** - * Callback that is called when scrolling ends or stops with new horizontal - * and vertical scroll values. - */ - onScrollEnd?: Function; - - /** - * Callback that is called when `rowHeightGetter` returns a different height - * for a row than the `rowHeight` prop. This is necessary because initially - * table estimates heights of some parts of the content. - */ - onContentHeightChange?: Function; - - /** - * Callback that is called when a row is clicked. - */ - onRowClick?: Function; - - /** - * Callback that is called when a row is double clicked. - */ - onRowDoubleClick?: Function; - - /** - * Callback that is called when a mouse-down event happens on a row. - */ - onRowMouseDown?: Function; - - /** - * Callback that is called when a mouse-enter event happens on a row. - */ - onRowMouseEnter?: Function; - - /** - * Callback that is called when a mouse-leave event happens on a row. - */ - onRowMouseLeave?: Function; - - /** - * Callback that is called when resizer has been released - * and column needs to be updated. - * - * Required if the isResizable property is true on any column. - * - * ``` - * function( - * newColumnWidth: number, - * dataKey: string, - * ) - * ``` - */ - onColumnResizeEndCallback?: Function; - - /** - * Whether a column is currently being resized. - */ - isColumnResizing?: boolean + /** + * Pixel height of the footer. + * + * defaultValue: 0 + */ + footerHeight?: number; + + /** + * Value of horizontal scroll. + * + * defaultValue: 0 + */ + scrollLeft?: number; + + /** + * Index of column to scroll to. + */ + scrollToColumn?: number; + + /** + * Value of vertical scroll. + * + * defaultValue: 0 + */ + scrollTop?: number; + + /** + * Index of row to scroll to. + */ + scrollToRow?: number; + + /** + * Callback that is called when scrolling starts with + * current horizontal and vertical scroll values. + */ + onScrollStart?: (horizontalScroll: number, verticalScroll: number) => void; + + /** + * Callback that is called when scrolling ends or stops with + * new horizontal and vertical scroll values. + */ + onScrollEnd?: (horizontalScroll: number, verticalScroll: number) => void; + + /** + * Callback that is called when rowHeightGetter returns a + * different height for a row than the rowHeight prop. This + * is necessary because initially table estimates heights + * of some parts of the content. + */ + onContentHeightChange?: (height: number) => void; + + /** + * Callback that is called when a row is clicked. + */ + onRowClick?: (index: number) => void; + + /** + * Callback that is called when a row is double clicked. + */ + onRowDoubleClick?: (index: number) => void; + + /** + * Callback that is called when a mouse-down event happens + * on a row. + */ + onRowMouseDown?: (index: number) => void; + + /** + * Callback that is called when a mouse-enter event happens + * on a row. + */ + onRowMouseEnter?: (index: number) => void; + + /** + * Callback that is called when a mouse-leave event happens + * on a row. + */ + onRowMouseLeave?: (index: number) => void; + + /** + * Callback that is called when resizer has been released + * and column needs to be updated. + * + * Required if the isResizable property is true on any + * column. + */ + onColumnResizeEndCallback?: (newColumnWidth: number, columnKey: string) => void; + + /** + * Whether a column is currently being resized. + */ + isColumnResizing?: boolean; } + /** + * Component that defines the attributes of table column. + */ interface ColumnProps { /** - * The horizontal alignment of the table cell content. - * 'left', 'center', 'right' - */ - align?: string; + * The horizontal alignment of the table cell content. + * + * 'left'|'center'|'right' + */ + align?: string; - /** - * className for this column's header cell. - */ - headerClassName?: string; + /** + * Controls if the column is fixed when scrolling in the X + * axis. + * + * defaultValue: false + */ + fixed?: boolean; - /** - * className for this column's footer cell. - */ - footerClassName?: string; + /** + * The header cell for this column. This can either be a + * string. a React element, or a function that generates a + * React Element. Passing in a string will render a default + * header cell with that string. By default, the React + * element passed in can expect to receive the following + * props: + * + * props: { + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * + * Because you are passing in your own React element, you + * can feel free to pass in whatever props you may want or need. + * + * If you pass in a function, you will receive the same props object as the first argument. + */ + header?: any; + + /** + * This is the body cell that will be cloned for this + * column. This can either be a string a React element, + * or a function that generates a React Element. Passing + * in a string will render a default header cell with that + * string. By default, the React element passed in can + * expect to receive the following props: + * + * props: { + * rowIndex; number // (the row index of the cell) + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * + * Because you are passing in your own React element, you + * can feel free to pass in whatever props you may want or + * need. + * + * If you pass in a function, you will receive the same + * props object as the first argument. + */ + cell?: any; + + /** + * The footer cell for this column. This can either be a + * string. a React element, or a function that generates a + * React Element. Passing in a string will render a default + * header cell with that string. By default, the React + * element passed in can expect to receive the following + * props: + * + * props: { + * columnKey: string // (of the column, if given) + * height: number // (supplied from the Table or rowHeightGetter) + * width: number // (supplied from the Column) + * } + * + * Because you are passing in your own React element, you + * can feel free to pass in whatever props you may want or + * need. + * + * If you pass in a function, you will receive the same + * props object as the first argument. + */ + footer?: any; - /** - * className for each of this column's data cells. - */ - cellClassName?: string; + /** + * This is used to uniquely identify the column, and is not + * required unless you a resizing columns. This will be the + * key given in the onColumnResizeEndCallback on the Table. + */ + columnKey?: string | number; - /** - * The cell renderer that returns React-renderable content for table cell. - * ``` - * function( - * cellData: any, - * cellDataKey: string, - * rowData: object, - * rowIndex: number, - * columnData: any, - * width: number - * ): ?$jsx - * ``` - */ - cellRenderer?: Function; + /** + * The pixel width of the column. + */ + width: number; - /** - * The getter `function(string_cellDataKey, object_rowData)` that returns - * the cell data for the `cellRenderer`. - * If not provided, the cell data will be collected from - * `rowData[cellDataKey]` instead. The value that `cellDataGetter` returns - * will be used to determine whether the cell should re-render. - */ - cellDataGetter?: Function; + /** + * If this is a resizable column this is its minimum pixel + * width. + */ + minWidth?: number; - /** - * The key to retrieve the cell data from the data row. Provided key type - * must be either `string` or `number`. Since we use this - * for keys, it must be specified for each column. - */ - dataKey: string|number; + /** + * If this is a resizable column this is its maximum pixel + * width. + */ + maxWidth?: number; - /** - * Controls if the column is fixed when scrolling in the X axis. - */ - fixed?: boolean; + /** + * The grow factor relative to other columns. Same as the + * flex-grow API from http://www.w3.org/TR/css3-flexbox/. + * Basically, take any available extra width and distribute + * it proportionally according to all columns' flexGrow + * values. Defaults to zero (no-flexing). + */ + flexGrow?: number; - /** - * The cell renderer that returns React-renderable content for table column - * header. - * ``` - * function( - * label: ?string, - * cellDataKey: string, - * columnData: any, - * rowData: array, - * width: number - * ): ?$jsx - * ``` - */ - headerRenderer?: Function; + /** + * Whether the column can be resized with the + * FixedDataTableColumnResizeHandle. Please note that if a + * column has a flex grow, once you resize the column this + * will be set to 0. + * + * This property only provides the UI for the column + * resizing. If this is set to true, you will need to set the + * onColumnResizeEndCallback table property and render your + * columns appropriately. + */ + isResizable?: boolean; - /** - * The cell renderer that returns React-renderable content for table column - * footer. - * ``` - * function( - * label: ?string, - * cellDataKey: string, - * columnData: any, - * rowData: array, - * width: number - * ): ?$jsx - * ``` - */ - footerRenderer?: Function; - - /** - * Bucket for any data to be passed into column renderer functions. - */ - columnData?: any; - - /** - * The column's header label. - */ - label: string; - - /** - * The pixel width of the column. - */ - width: number; - - /** - * If this is a resizable column this is its minimum pixel width. - */ - minWidth?: number; - - /** - * If this is a resizable column this is its maximum pixel width. - */ - maxWidth?: number; - - /** - * The grow factor relative to other columns. Same as the flex-grow API - * from http://www.w3.org/TR/css3-flexbox/. Basically, take any available - * extra width and distribute it proportionally according to all columns' - * flexGrow values. Defaults to zero (no-flexing). - */ - flexGrow?: number; - - /** - * Whether the column can be resized with the - * FixedDataTableColumnResizeHandle. Please note that if a column - * has a flex grow, once you resize the column this will be set to 0. - * - * This property only provides the UI for the column resizing. If this - * is set to true, you will need ot se the onColumnResizeEndCallback table - * property and render your columns appropriately. - */ - isResizable?: boolean; - - /** - * Experimental feature - * Whether cells in this column can be removed from document when outside - * of viewport as a result of horizontal scrolling. - * Setting this property to true allows the table to not render cells in - * particular column that are outside of viewport for visible rows. This - * allows to create table with many columns and not have vertical scrolling - * performance drop. - * Setting the property to false will keep previous behaviour and keep - * cell rendered if the row it belongs to is visible. - */ - allowCellsRecycling?: boolean; + /** + * Whether cells in this column can be removed from document + * when outside of viewport as a result of horizontal + * scrolling. Setting this property to true allows the table + * to not render cells in particular column that are outside + * of viewport for visible rows. This allows to create table + * with many columns and not have vertical scrolling + * performance drop. Setting the property to false will keep + * previous behaviour and keep cell rendered if the row it + * belongs to is visible. + * + * defaultValue: false + */ + allowCellsRecycling?: boolean; } - + + /** + * Component that defines the attributes of a table column group. + */ export interface ColumnGroupProps { /** * The horizontal alignment of the table cell content. @@ -355,35 +406,75 @@ declare module FixedDataTable { align?: string; /** - * Controls if the column group is fixed when scrolling in the X axis. + * Controls if the column group is fixed when scrolling in the X + * axis. + * + * defaultValue: false */ fixed?: boolean; - /** - * Bucket for any data to be passed into column group renderer functions. - */ - columnGroupData?: any; + /** + * The header cell for this column group. This can either be + * a string. a React element, or a function that generates a + * React Element. Passing in a string will render a default + * header cell with that string. By default, the React + * element passed in can expect to receive the following + * props: + * + * props: { + * height: number // (supplied from the groupHeaderHeight) + * width: number // (supplied from the Column) + * } + * + * Because you are passing in your own React element, you + * can feel free to pass in whatever props you may want or + * need. + * + * If you pass in a function, you will receive the same props + * object as the first argument. + */ + header: any; + } + + /** + * Component that handles default cell layout and styling. + * + * All props unless specified below will be set onto the top + * level div rendered by the cell. + * + * Example usage via from a Column: + * + * const MyColumn = ( + * ( + * + * Cell number: {rowIndex} + * + * )} + * width={100} + * /> + * ); + */ + export interface CellProps { + /** + * Outer height of the cell. + */ + height?: number; - /** - * The column group's header label. - */ - label?: string; + /** + * Outer width of the cell. + */ + width?: number; - /** - * The cell renderer that returns React-renderable content for a table - * column group header. If it's not specified, the label from props will - * be rendered as header content. - * ``` - * function( - * label: ?string, - * cellDataKey: string, - * columnGroupData: any, - * rowData: array, // array of labels of all columnGroups - * width: number - * ): ?$jsx - * ``` - */ - groupHeaderRenderer?: Function; + /** + * Optional prop that if specified on the Column will be + * passed to the cell. It can be used to uniquely identify + * which column is the cell is in. + */ + columnKey?: string | number; } export class Table extends __React.Component { @@ -395,6 +486,9 @@ declare module FixedDataTable { export class ColumnGroup extends __React.Component { render(): __React.DOMElement } + export class Cell extends __React.Component { + render(): __React.DOMElement + } } declare module "fixed-data-table" { From 2572eb96ddfb139abfc4e1e6a6d0d90e81b52de8 Mon Sep 17 00:00:00 2001 From: stephenjelfs Date: Tue, 8 Dec 2015 13:51:38 +0100 Subject: [PATCH 161/474] Fixed-data-table 0.4.7 tests should use corresponding 0.4.7 definitions. --- fixed-data-table/fixed-data-table-0.4.7-tests.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fixed-data-table/fixed-data-table-0.4.7-tests.tsx b/fixed-data-table/fixed-data-table-0.4.7-tests.tsx index 28dae2890f..641487ff68 100644 --- a/fixed-data-table/fixed-data-table-0.4.7-tests.tsx +++ b/fixed-data-table/fixed-data-table-0.4.7-tests.tsx @@ -1,4 +1,4 @@ -/// +/// /// /// From c34b1e67eee7862f1b3ec48e6c8b6878ae8b0500 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 8 Dec 2015 19:12:39 +0500 Subject: [PATCH 162/474] lodash: signatures of _.omit have been changed --- lodash/lodash-tests.ts | 48 ++++++++++++++++++------- lodash/lodash.d.ts | 80 +++++++++++++++++++++++------------------- 2 files changed, 80 insertions(+), 48 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ce60da7793..c409e26214 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7073,19 +7073,43 @@ module TestFunctions { } } -interface HasName { - name: string; +// _.omit +module TestOmit { + let predicate: (element: any, key: string, collection: any) => boolean; + + { + let result: TResult; + + result = _.omit({}, 'a'); + result = _.omit({}, 0, 'a'); + result = _.omit({}, true, 0, 'a'); + result = _.omit({}, ['b', 1, false], true, 0, 'a'); + result = _.omit({}, predicate); + result = _.omit({}, predicate, any); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _({}).omit('a'); + result = _({}).omit(0, 'a'); + result = _({}).omit(true, 0, 'a'); + result = _({}).omit(['b', 1, false], true, 0, 'a'); + result = _({}).omit(predicate); + result = _({}).omit(predicate, any); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _({}).chain().omit('a'); + result = _({}).chain().omit(0, 'a'); + result = _({}).chain().omit(true, 0, 'a'); + result = _({}).chain().omit(['b', 1, false], true, 0, 'a'); + result = _({}).chain().omit(predicate); + result = _({}).chain().omit(predicate, any); + } } -result = _.omit({ 'name': 'moe', 'age': 40 }, 'age'); -result = _.omit({ 'name': 'moe', 'age': 40 }, ['age']); -result = _.omit({ 'name': 'moe', 'age': 40 }, function (value) { - return typeof value == 'number'; -}); -result = _({ 'name': 'moe', 'age': 40 }).omit('age').value(); -result = _({ 'name': 'moe', 'age': 40 }).omit(['age']).value(); -result = _({ 'name': 'moe', 'age': 40 }).omit(function (value) { - return typeof value == 'number'; -}).value(); // _.pairs module TestPairs { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 801b66be97..253107c7f0 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11842,54 +11842,62 @@ 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, - * object). - * @param object The source object. - * @param keys The properties to omit. - * @return An object without the omitted properties. - **/ - omit( + * The opposite of _.pick; this method creates an object composed of the own and inherited enumerable + * properties of object that are not omitted. + * + * @param object The source object. + * @param predicate The function invoked per iteration or property names to omit, specified as individual + * property names or arrays of property names. + * @param thisArg The this binding of predicate. + * @return Returns the new object. + */ + omit( object: T, - ...keys: string[]): Omitted; + predicate: ObjectIterator, + thisArg?: any + ): TResult; /** - * @see _.omit - **/ - omit( + * @see _.omit + */ + omit( object: T, - keys: string[]): Omitted; - - /** - * @see _.omit - **/ - omit( - object: T, - callback: ObjectIterator, - thisArg?: any): Omitted; + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): TResult; } interface LoDashImplicitObjectWrapper { /** - * @see _.omit - **/ - omit( - ...keys: string[]): LoDashImplicitObjectWrapper; + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashImplicitObjectWrapper; /** - * @see _.omit - **/ - omit( - keys: string[]): LoDashImplicitObjectWrapper; + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.omit + */ + omit( + predicate: ObjectIterator, + thisArg?: any + ): LoDashExplicitObjectWrapper; /** - * @see _.omit - **/ - omit( - callback: ObjectIterator, - thisArg?: any): LoDashImplicitObjectWrapper; + * @see _.omit + */ + omit( + ...predicate: (StringRepresentable|StringRepresentable[])[] + ): LoDashExplicitObjectWrapper; } //_.pairs From 5088a85caf3c7df439042e79b9fc34bd55b4b19f Mon Sep 17 00:00:00 2001 From: stephenjelfs Date: Tue, 8 Dec 2015 16:37:24 +0100 Subject: [PATCH 163/474] Improve type safety of header/cell/footer fixed-data-table getters. --- fixed-data-table/fixed-data-table-tests.tsx | 6 +++--- fixed-data-table/fixed-data-table.d.ts | 17 +++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/fixed-data-table/fixed-data-table-tests.tsx b/fixed-data-table/fixed-data-table-tests.tsx index f104ac5e45..916c0e64ad 100644 --- a/fixed-data-table/fixed-data-table-tests.tsx +++ b/fixed-data-table/fixed-data-table-tests.tsx @@ -2,7 +2,7 @@ /// import * as React from "react"; -import {Table, Cell, Column} from "fixed-data-table"; +import {Table, Cell, Column, CellProps} from "fixed-data-table"; // create your Table class MyTable1 extends React.Component<{}, {}> { @@ -68,7 +68,7 @@ class MyTable3 extends React.Component<{}, MyTable3State> { height={500}> Name} - cell={(props: any) => ( + cell={(props: CellProps) => ( {this.state.myTableData[props.rowIndex].name} @@ -85,7 +85,7 @@ interface RowData { [field: string]: string; } -interface MyCellProps { +interface MyCellProps extends CellProps { rowIndex?: number; field: string; data: RowData[]; diff --git a/fixed-data-table/fixed-data-table.d.ts b/fixed-data-table/fixed-data-table.d.ts index a1400502e7..5fb0438a01 100644 --- a/fixed-data-table/fixed-data-table.d.ts +++ b/fixed-data-table/fixed-data-table.d.ts @@ -284,13 +284,13 @@ declare module FixedDataTable { * * If you pass in a function, you will receive the same props object as the first argument. */ - header?: any; + header?: string | __React.ReactElement | ((props: CellProps) => (string | __React.ReactElement)); /** * This is the body cell that will be cloned for this * column. This can either be a string a React element, * or a function that generates a React Element. Passing - * in a string will render a default header cell with that + * in a string will render a default cell with that * string. By default, the React element passed in can * expect to receive the following props: * @@ -308,7 +308,7 @@ declare module FixedDataTable { * If you pass in a function, you will receive the same * props object as the first argument. */ - cell?: any; + cell?: string | __React.ReactElement | ((props: CellProps) => (string | __React.ReactElement)); /** * The footer cell for this column. This can either be a @@ -331,7 +331,7 @@ declare module FixedDataTable { * If you pass in a function, you will receive the same * props object as the first argument. */ - footer?: any; + footer?: string | __React.ReactElement | ((props: CellProps) => (string | __React.ReactElement)); /** * This is used to uniquely identify the column, and is not @@ -433,7 +433,7 @@ declare module FixedDataTable { * If you pass in a function, you will receive the same props * object as the first argument. */ - header: any; + header: string | __React.ReactElement | ((props: CellProps) => (string | __React.ReactElement)); } /** @@ -459,6 +459,11 @@ declare module FixedDataTable { * ); */ export interface CellProps { + /** + * The row index of the cell. + */ + rowIndex?: number + /** * Outer height of the cell. */ @@ -472,7 +477,7 @@ declare module FixedDataTable { /** * Optional prop that if specified on the Column will be * passed to the cell. It can be used to uniquely identify - * which column is the cell is in. + * which column is the cell is in. */ columnKey?: string | number; } From 4e8bcf2667a55bf807634e951ab081cc8717f338 Mon Sep 17 00:00:00 2001 From: paul cheung Date: Wed, 9 Dec 2015 00:25:53 +0800 Subject: [PATCH 164/474] add open event for dialog(as build failed in TypeScript 1.7) --- jqueryui/jqueryui.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index d9a33ed4fc..9dd576e1a5 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -362,7 +362,8 @@ declare module JQueryUI { title?: string; width?: any; // number or string zIndex?: number; - + + open?: DialogEvent; close?: DialogEvent; } From 59917025e03fac6bafdbcbfe5555c42ff8b3570e Mon Sep 17 00:00:00 2001 From: Sabeeh Ul Hussnain Date: Tue, 8 Dec 2015 22:33:30 +0500 Subject: [PATCH 165/474] file renamed --- lobibox/{lobibox.js-tests.ts => lobibox-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lobibox/{lobibox.js-tests.ts => lobibox-tests.ts} (100%) diff --git a/lobibox/lobibox.js-tests.ts b/lobibox/lobibox-tests.ts similarity index 100% rename from lobibox/lobibox.js-tests.ts rename to lobibox/lobibox-tests.ts From cf491bf776f23f5828ebd8f8ce476c9dc7c9e9bc Mon Sep 17 00:00:00 2001 From: Nick Malaguti Date: Tue, 8 Dec 2015 13:08:32 -0500 Subject: [PATCH 166/474] Add definitions for chai-string --- chai-string/chai-string-tests.ts | 128 +++++++++++++++++++++++++++++++ chai-string/chai-string.d.ts | 45 +++++++++++ 2 files changed, 173 insertions(+) create mode 100644 chai-string/chai-string-tests.ts create mode 100644 chai-string/chai-string.d.ts diff --git a/chai-string/chai-string-tests.ts b/chai-string/chai-string-tests.ts new file mode 100644 index 0000000000..f5380b0768 --- /dev/null +++ b/chai-string/chai-string-tests.ts @@ -0,0 +1,128 @@ +/// +/// +/// + +var should = chai.should(); +var assert = chai.assert; +var expect = chai.expect; + +var chai_string = require('chai-string'); +chai.use(chai_string); + +describe('chai-string', function() { + + describe('#startsWith', function() { + + it('check that', function() { + var obj = { foo: 'hello world' }; + expect(obj).to.have.property('foo').that.startsWith('hello'); + }); + + }); + + describe('#startWith', function() { + + it('should return true', function() { + var str = 'abcdef', + prefix = 'abc'; + str.should.startWith(prefix); + }); + + it('should return false', function() { + var str = 'abcdef', + prefix = 'cba'; + str.should.not.startWith(prefix); + }); + + }); + + describe('#endWith', function() { + + it('should return true', function() { + var str = 'abcdef', + suffix = 'def'; + str.should.endWith(suffix); + }); + + it('should return false', function() { + var str = 'abcdef', + suffix = 'fed'; + str.should.not.endWith(suffix); + }); + + }); + + describe('tdd alias', function() { + + beforeEach(function() { + this.str = 'abcdef'; + this.str2 = 'a\nb\tc\r d ef'; + }); + + it('.startsWith', function() { + assert.startsWith(this.str, 'abc'); + }); + + it('.notStartsWith', function() { + assert.notStartsWith(this.str, 'cba'); + }); + + it('.endsWith', function() { + assert.endsWith(this.str, 'def'); + }); + + it('.notEndsWith', function() { + assert.notEndsWith(this.str, 'fed'); + }); + + it('.equalIgnoreCase', function() { + assert.equalIgnoreCase(this.str, 'AbCdEf'); + }); + + it('.notEqualIgnoreCase', function() { + assert.notEqualIgnoreCase(this.str, 'abDDD'); + }); + + it('.equalIgnoreSpaces', function() { + assert.equalIgnoreSpaces(this.str, this.str2); + }); + + it('.notEqualIgnoreSpaces', function() { + assert.notEqualIgnoreSpaces(this.str, this.str2 + 'g'); + }); + + it('.singleLine', function() { + assert.singleLine(this.str); + }); + + it('.notSingleLine', function() { + assert.notSingleLine("abc\ndef"); + }); + + it('.reverseOf', function() { + assert.reverseOf(this.str, 'fedcba'); + }); + + it('.notReverseOf', function() { + assert.notReverseOf(this.str, 'aaaaa'); + }); + + it('.palindrome', function() { + assert.palindrome('abcba'); + assert.palindrome('abccba'); + assert.palindrome(''); + }); + + it('.notPalindrome', function() { + assert.notPalindrome(this.str); + }); + + it('.entriesCount', function() { + assert.entriesCount('abcabd', 'ab', 2); + assert.entriesCount('ababd', 'ab', 2); + assert.entriesCount('abab', 'ab', 2); + assert.entriesCount('', 'ab', 0); + }); + + }); +}); diff --git a/chai-string/chai-string.d.ts b/chai-string/chai-string.d.ts new file mode 100644 index 0000000000..fd17665232 --- /dev/null +++ b/chai-string/chai-string.d.ts @@ -0,0 +1,45 @@ +// Type definitions for chai-string 1.1.4 +// Project: https://github.com/onechiporenko/chai-string +// Definitions by: Nick Malaguti +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Chai { + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + startsWith(expected: string, message?: string): Assertion; + startWith(expected: string, message?: string): Assertion; + endsWith(expected: string, message?: string): Assertion; + endWith(expected: string, message?: string): Assertion; + equalIgnoreCase(expected: string, message?: string): Assertion; + equalIgnoreSpaces(expected: string, message?: string): Assertion; + singleLine(message?: string): Assertion; + reverseOf(message?: string): Assertion; + palindrome(message?: string): Assertion; + entriesCount(substr: string, expected: number, message?: string): Assertion; + } + + export interface Assert { + startsWith(val: string, exp: string, msg?: string): void; + notStartsWith(val: string, exp: string, msg?: string): void; + endsWith(val: string, exp: string, msg?: string): void; + notEndsWith(val: string, exp: string, msg?: string): void; + equalIgnoreCase(val: string, exp: string, msg?: string): void; + notEqualIgnoreCase(val: string, exp: string, msg?: string): void; + equalIgnoreSpaces(val: string, exp: string, msg?: string): void; + notEqualIgnoreSpaces(val: string, exp: string, msg?: string): void; + singleLine(val: string, msg?: string): void; + notSingleLine(val: string, msg?: string): void; + reverseOf(val: string, exp: string, msg?: string): void; + notReverseOf(val: string, exp: string, msg?: string): void; + palindrome(val: string, msg?: string): void; + notPalindrome(val: string, msg?: string): void; + entriesCount(str: string, substr: string, count: number, msg?: string): void; + } +} + +declare module 'chai-string' { + function chaiString(chai: any, utils: any): void; + namespace chaiString {} + export = chaiString; +} From 82764e58b49c370eff7127ae961750ed9f9921ac Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 8 Dec 2015 20:18:08 +0100 Subject: [PATCH 167/474] jade definition --- gulp-jade/gulp-jade-tests.ts | 25 +++++++++++++++++++++++++ gulp-jade/gulp-jade.d.ts | 24 ++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 gulp-jade/gulp-jade-tests.ts create mode 100644 gulp-jade/gulp-jade.d.ts diff --git a/gulp-jade/gulp-jade-tests.ts b/gulp-jade/gulp-jade-tests.ts new file mode 100644 index 0000000000..7334afc838 --- /dev/null +++ b/gulp-jade/gulp-jade-tests.ts @@ -0,0 +1,25 @@ +/// +/// +/// + +import gulp = require("gulp"); +import jade = require("gulp-jade"); + + +gulp.task('check1', function() { + gulp.src('lib/*.jade') + .pipe(jade({ + locals: {}, + client: false + })); +}); + +import jadeLib = require('jade'); + +gulp.task('check2', function() { + gulp.src('lib/*.jade') + .pipe(jade({ + jade: jadeLib, + pretty: true + })); +}); \ No newline at end of file diff --git a/gulp-jade/gulp-jade.d.ts b/gulp-jade/gulp-jade.d.ts new file mode 100644 index 0000000000..2f31889c22 --- /dev/null +++ b/gulp-jade/gulp-jade.d.ts @@ -0,0 +1,24 @@ +// Type definitions for gulp-jade +// Project: https://github.com/phated/gulp-jade +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "gulp-jade" { + function GulpJade(options?: GulpJadeOptions): NodeJS.ReadWriteStream; + + interface GulpJadeOptions { + client?: boolean; + + locals?: Object; + + jade?: any; + + pretty?: boolean; + } + + namespace GulpJade { + } + export = GulpJade; +} From aae1368c8ee377f6e9c59c2d6faf1acb3ece7e05 Mon Sep 17 00:00:00 2001 From: Joseph Dotson Date: Tue, 8 Dec 2015 14:47:30 -0500 Subject: [PATCH 168/474] passing a value to resolve should not be required in Q --- q/Q.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/q/Q.d.ts b/q/Q.d.ts index ba30b2745a..2594df7f7c 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -20,7 +20,7 @@ declare module Q { interface Deferred { promise: Promise; - resolve(value: T): void; + resolve(value?: T): void; reject(reason: any): void; notify(value: any): void; makeNodeResolver(): (reason: any, value: T) => void; From acf0d0f007bcfe03b62fcf14a68e6d275228640d Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Sat, 5 Dec 2015 15:45:33 -0500 Subject: [PATCH 169/474] eventemitter3 to 1.1.1 --- eventemitter3/eventemitter3-tests.ts | 548 ++++++++++++++++++++++++++- eventemitter3/eventemitter3.d.ts | 81 ++-- 2 files changed, 582 insertions(+), 47 deletions(-) diff --git a/eventemitter3/eventemitter3-tests.ts b/eventemitter3/eventemitter3-tests.ts index da13434135..4fa378bc20 100644 --- a/eventemitter3/eventemitter3-tests.ts +++ b/eventemitter3/eventemitter3-tests.ts @@ -1,16 +1,41 @@ -/// +/// +/// +/// 'use strict'; import EventEmitter = require('eventemitter3'); +import util = require('util'); +import * as EventEmitter3ImportedAsES6Module from 'eventemitter3'; + +declare namespace Assume { + interface Class { + new(...args: any[]): T; + } + + interface Assume { + equals(compare: T): Assume; + equal(compare: T): Assume; + eqls(compare: T): Assume; + is: Assume; + deep: Assume; + to: Assume; + either(arr: T[]): Assume; + instanceOf(clazz: Class): Assume; + a(typeofString: string): Assume; + } + + export function assume(input: T): Assume; +} + +let assume = Assume.assume; class EventEmitterTest { - v: EventEmitter; + v: EventEmitter3.EventEmitter; constructor() { this.v = new EventEmitter(); - this.v = new EventEmitter.EventEmitter(); - this.v = new EventEmitter.EventEmitter2(); - this.v = new EventEmitter.EventEmitter3(); + this.v = new EventEmitter3ImportedAsES6Module(); + var n: NodeJS.EventEmitter = this.v; } listeners() { @@ -27,39 +52,528 @@ class EventEmitterTest { on() { var fn = () => console.log(1); - var v1: EventEmitter = this.v.on('click', fn); - var v2: EventEmitter = this.v.on('click', fn, this); + var v1: EventEmitter3.EventEmitter = this.v.on('click', fn); + var v2: EventEmitter3.EventEmitter = this.v.on('click', fn, this); } once() { var fn = () => console.log(1); - var v1: EventEmitter = this.v.once('click', fn); - var v2: EventEmitter = this.v.once('click', fn, this); + var v1: EventEmitter3.EventEmitter = this.v.once('click', fn); + var v2: EventEmitter3.EventEmitter = this.v.once('click', fn, this); } removeListener() { var fn = () => console.log(1); - var v1: EventEmitter = this.v.removeListener('click', fn); - var v2: EventEmitter = this.v.removeListener('click', fn, true); + var v1: EventEmitter3.EventEmitter = this.v.removeListener('click', fn); + var v2: EventEmitter3.EventEmitter = this.v.removeListener('click', fn, true); } removeAllListeners() { - var v1: EventEmitter = this.v.removeAllListeners('click'); + var v1: EventEmitter3.EventEmitter = this.v.removeAllListeners('click'); } off() { var fn = () => console.log(1); - var v1: EventEmitter = this.v.off('click', fn); - var v2: EventEmitter = this.v.off('click', fn, true); + var v1: EventEmitter3.EventEmitter = this.v.off('click', fn); + var v2: EventEmitter3.EventEmitter = this.v.off('click', fn, true); } addListener() { var fn = () => console.log(1); - var v1: EventEmitter = this.v.addListener('click', fn); - var v2: EventEmitter = this.v.addListener('click', fn, this); + var v1: EventEmitter3.EventEmitter = this.v.addListener('click', fn); + var v2: EventEmitter3.EventEmitter = this.v.addListener('click', fn, this); } setMaxListeners() { - var v1: EventEmitter = this.v.setMaxListeners(); + var v1: EventEmitter3.EventEmitter = this.v.setMaxListeners(); } } + + +describe('EventEmitter', function tests() { + 'use strict'; + + it('exposes a `prefixed` property', function () { + assume(EventEmitter.prefixed).is.either([false, '~']); + }); + + it('inherits when used with require(util).inherits', function () { + class Beast extends EventEmitter { + /* rawr, i'm a beast */ + } + + util.inherits(Beast, EventEmitter); + + var moop = new Beast() + , meap = new Beast(); + + assume(moop).is.instanceOf(Beast); + assume(moop).is.instanceOf(EventEmitter); + + moop.listeners(); + meap.listeners(); + + moop.on('data', function () { + throw new Error('I should not emit'); + }); + + meap.emit('data', 'rawr'); + meap.removeListener('foo'); + meap.removeAllListeners(); + }); + + describe('EventEmitter#emit', function () { + it('should return false when there are not events to emit', function () { + var e = new EventEmitter(); + + assume(e.emit('foo')).equals(false); + assume(e.emit('bar')).equals(false); + }); + + it('emits with context', function (done) { + var context = { bar: 'baz' } + , e = new EventEmitter(); + + e.on('foo', function (bar: string) { + assume(bar).equals('bar'); + assume(this).equals(context); + + done(); + }, context).emit('foo', 'bar'); + }); + + it('emits with context, multiple arguments (force apply)', function (done) { + var context = { bar: 'baz' } + , e = new EventEmitter(); + + e.on('foo', function (bar: string) { + assume(bar).equals('bar'); + assume(this).equals(context); + + done(); + }, context).emit('foo', 'bar', 1,2,3,4,5,6,7,8,9,0); + }); + + it('can emit the function with multiple arguments', function () { + var e = new EventEmitter(); + + for(var i = 0; i < 100; i++) { + (function (j: number) { + for (var i = 0, args: number[] = []; i < j; i++) { + args.push(j); + } + + e.once('args', function () { + assume(arguments.length).equals(args.length); + }); + + e.emit.apply(e, (['args'] as any[]).concat(args)); + })(i); + } + }); + + it('can emit the function with multiple arguments, multiple listeners', function () { + var e = new EventEmitter(); + + for(var i = 0; i < 100; i++) { + (function (j: number) { + for (var i = 0, args: number[] = []; i < j; i++) { + args.push(j); + } + + e.once('args', function () { + assume(arguments.length).equals(args.length); + }); + + e.once('args', function () { + assume(arguments.length).equals(args.length); + }); + + e.once('args', function () { + assume(arguments.length).equals(args.length); + }); + + e.once('args', function () { + assume(arguments.length).equals(args.length); + }); + + e.emit.apply(e, (['args'] as any[]).concat(args)); + })(i); + } + }); + + it('emits with context, multiple listeners (force loop)', function () { + var e = new EventEmitter(); + + e.on('foo', function (bar: string) { + assume(this).eqls({ foo: 'bar' }); + assume(bar).equals('bar'); + }, { foo: 'bar' }); + + e.on('foo', function (bar: string) { + assume(this).eqls({ bar: 'baz' }); + assume(bar).equals('bar'); + }, { bar: 'baz' }); + + e.emit('foo', 'bar'); + }); + + it('emits with different contexts', function () { + var e = new EventEmitter() + , pattern = ''; + + function writer() { + pattern += this; + } + + e.on('write', writer, 'foo'); + e.on('write', writer, 'baz'); + e.once('write', writer, 'bar'); + e.once('write', writer, 'banana'); + + e.emit('write'); + assume(pattern).equals('foobazbarbanana'); + }); + + it('should return true when there are events to emit', function (done) { + var e = new EventEmitter(); + + e.on('foo', function () { + process.nextTick(done); + }); + + assume(e.emit('foo')).equals(true); + assume(e.emit('foob')).equals(false); + }); + + it('receives the emitted events', function (done) { + var e = new EventEmitter(); + + e.on('data', function (a: string, b: EventEmitter3.EventEmitter, c: Date, d: void, undef: void) { + assume(a).equals('foo'); + assume(b).equals(e); + assume(c).is.instanceOf(Date); + assume(undef).equals(undefined); + assume(arguments.length).equals(3); + + done(); + }); + + e.emit('data', 'foo', e, new Date()); + }); + + it('emits to all event listeners', function () { + var e = new EventEmitter() + , pattern: string[] = []; + + e.on('foo', function () { + pattern.push('foo1'); + }); + + e.on('foo', function () { + pattern.push('foo2'); + }); + + e.emit('foo'); + + assume(pattern.join(';')).equals('foo1;foo2'); + }); + + (function each(keys: string[]) { + var key = keys.shift(); + + if (!key) return; + + it('can store event which is a known property: '+ key, function (next) { + var e = new EventEmitter(); + + e.on(key, function (key: string) { + assume(key).equals(key); + next(); + }).emit(key, key); + }); + + each(keys); + })([ + 'hasOwnProperty', + 'constructor', + '__proto__', + 'toString', + 'toValue', + 'unwatch', + 'watch' + ]); + }); + + describe('EventEmitter#listeners', function () { + it('returns an empty array if no listeners are specified', function () { + var e = new EventEmitter(); + + assume(e.listeners('foo')).is.a('array'); + assume(e.listeners('foo').length).equals(0); + }); + + it('returns an array of function', function () { + var e = new EventEmitter(); + + function foo() {} + + e.on('foo', foo); + assume(e.listeners('foo')).is.a('array'); + assume(e.listeners('foo').length).equals(1); + assume(e.listeners('foo')).deep.equals([foo]); + }); + + it('is not vulnerable to modifications', function () { + var e = new EventEmitter(); + + function foo() {} + + e.on('foo', foo); + + assume(e.listeners('foo')).deep.equals([foo]); + + e.listeners('foo').length = 0; + assume(e.listeners('foo')).deep.equals([foo]); + }); + + it('can return a boolean as indication if listeners exist', function () { + var e = new EventEmitter(); + + function foo() {} + + e.once('once', foo); + e.once('multiple', foo); + e.once('multiple', foo); + e.on('on', foo); + e.on('multi', foo); + e.on('multi', foo); + + assume(e.listeners('foo', true)).equals(false); + assume(e.listeners('multiple', true)).equals(true); + assume(e.listeners('on', true)).equals(true); + assume(e.listeners('multi', true)).equals(true); + + e.removeAllListeners(); + + assume(e.listeners('multiple', true)).equals(false); + assume(e.listeners('on', true)).equals(false); + assume(e.listeners('multi', true)).equals(false); + }); + }); + + describe('EventEmitter#once', function () { + it('only emits it once', function () { + var e = new EventEmitter() + , calls = 0; + + e.once('foo', function () { + calls++; + }); + + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + + assume(e.listeners('foo').length).equals(0); + assume(calls).equals(1); + }); + + it('only emits once if emits are nested inside the listener', function () { + var e = new EventEmitter() + , calls = 0; + + e.once('foo', function () { + calls++; + e.emit('foo'); + }); + + e.emit('foo'); + assume(e.listeners('foo').length).equals(0); + assume(calls).equals(1); + }); + + it('only emits once for multiple events', function () { + var e = new EventEmitter() + , multi = 0 + , foo = 0 + , bar = 0; + + e.once('foo', function () { + foo++; + }); + + e.once('foo', function () { + bar++; + }); + + e.on('foo', function () { + multi++; + }); + + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + e.emit('foo'); + + assume(e.listeners('foo').length).equals(1); + assume(multi).equals(5); + assume(foo).equals(1); + assume(bar).equals(1); + }); + + it('only emits once with context', function (done) { + var context = { foo: 'bar' } + , e = new EventEmitter(); + + e.once('foo', function (bar: string) { + assume(this).equals(context); + assume(bar).equals('bar'); + + done(); + }, context).emit('foo', 'bar'); + }); + }); + + describe('EventEmitter#removeListener', function () { + it('should only remove the event with the specified function', function () { + var e = new EventEmitter(); + + function bar() {} + e.on('foo', function () {}); + e.on('bar', function () {}); + e.on('bar', bar); + + assume(e.removeListener('foo', bar)).equals(e); + assume(e.listeners('foo').length).equals(1); + assume(e.listeners('bar').length).equals(2); + + assume(e.removeListener('foo')).equals(e); + assume(e.listeners('foo').length).equals(0); + assume(e.listeners('bar').length).equals(2); + + assume(e.removeListener('bar', bar)).equals(e); + assume(e.listeners('bar').length).equals(1); + assume(e.removeListener('bar')).equals(e); + assume(e.listeners('bar').length).equals(0); + }); + + it('should only remove once events when using the once flag', function () { + var e = new EventEmitter(); + + function foo() {} + e.on('foo', foo); + + assume(e.removeListener('foo', function () {}, undefined, true)).equals(e); + assume(e.listeners('foo').length).equals(1); + assume(e.removeListener('foo', foo, undefined, true)).equals(e); + assume(e.listeners('foo').length).equals(1); + assume(e.removeListener('foo', foo)).equals(e); + assume(e.listeners('foo').length).equals(0); + + e.on('foo', foo); + e.once('foo', foo); + + assume(e.removeListener('foo', function () {}, undefined, true)).equals(e); + assume(e.listeners('foo').length).equals(2); + assume(e.removeListener('foo', foo, undefined, true)).equals(e); + assume(e.listeners('foo').length).equals(1); + + e.once('foo', foo); + + assume(e.removeListener('foo', foo)).equals(e); + assume(e.listeners('foo').length).equals(0); + }); + + it('should only remove listeners matching the correct context', function () { + var e = new EventEmitter() + , context = { foo: 'bar' }; + + function foo() {} + function bar() {} + e.on('foo', foo, context); + + assume(e.listeners('foo').length).equals(1); + assume(e.removeListener('foo', function () {}, context)).equals(e); + assume(e.listeners('foo').length).equals(1); + assume(e.removeListener('foo', foo, { baz: 'quux' })).equals(e); + assume(e.listeners('foo').length).equals(1); + assume(e.removeListener('foo', foo, context)).equals(e); + assume(e.listeners('foo').length).equals(0); + + e.on('foo', foo, context); + e.on('foo', bar); + + assume(e.listeners('foo').length).equals(2); + assume(e.removeListener('foo', foo, { baz: 'quux' })).equals(e); + assume(e.listeners('foo').length).equals(2); + assume(e.removeListener('foo', foo, context)).equals(e); + assume(e.listeners('foo').length).equals(1); + assume(e.listeners('foo')[0]).equals(bar); + + e.on('foo', foo, context); + + assume(e.listeners('foo').length).equals(2); + assume(e.removeAllListeners('foo')).equals(e); + assume(e.listeners('foo').length).equals(0); + }); + }); + + describe('EventEmitter#removeAllListeners', function () { + it('removes all events for the specified events', function () { + var e = new EventEmitter(); + + e.on('foo', function () { throw new Error('oops'); }); + e.on('foo', function () { throw new Error('oops'); }); + e.on('bar', function () { throw new Error('oops'); }); + e.on('aaa', function () { throw new Error('oops'); }); + + assume(e.removeAllListeners('foo')).equals(e); + assume(e.listeners('foo').length).equals(0); + assume(e.listeners('bar').length).equals(1); + assume(e.listeners('aaa').length).equals(1); + + assume(e.removeAllListeners('bar')).equals(e); + assume(e.removeAllListeners('aaa')).equals(e); + + assume(e.emit('foo')).equals(false); + assume(e.emit('bar')).equals(false); + assume(e.emit('aaa')).equals(false); + }); + + it('just nukes the fuck out of everything', function () { + var e = new EventEmitter(); + + e.on('foo', function () { throw new Error('oops'); }); + e.on('foo', function () { throw new Error('oops'); }); + e.on('bar', function () { throw new Error('oops'); }); + e.on('aaa', function () { throw new Error('oops'); }); + + assume(e.removeAllListeners()).equals(e); + assume(e.listeners('foo').length).equals(0); + assume(e.listeners('bar').length).equals(0); + assume(e.listeners('aaa').length).equals(0); + + assume(e.emit('foo')).equals(false); + assume(e.emit('bar')).equals(false); + assume(e.emit('aaa')).equals(false); + }); + }); + + describe('#setMaxListeners', function () { + it('is a function', function () { + var e = new EventEmitter(); + + assume(e.setMaxListeners).is.a('function'); + }); + + it('returns self when called', function () { + var e = new EventEmitter(); + + assume(e.setMaxListeners()).to.equal(e); + }); + }); +}); diff --git a/eventemitter3/eventemitter3.d.ts b/eventemitter3/eventemitter3.d.ts index f5cf9bcb2d..0d692b8247 100644 --- a/eventemitter3/eventemitter3.d.ts +++ b/eventemitter3/eventemitter3.d.ts @@ -1,11 +1,14 @@ -// Type definitions for EventEmitter3 0.1.6 +// Type definitions for EventEmitter3 1.1.1 // Project: https://github.com/primus/eventemitter3 -// Definitions by: Yuichi Murata -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: Yuichi Murata , Leon Yu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module EventEmitter3 { - // __Base is hack for https://github.com/Microsoft/TypeScript/issues/3602 - class __Base { +declare namespace EventEmitter3 { + interface EventEmitter3Static { + new (): EventEmitter; + prefixed: string | boolean; + } + class EventEmitter { /** * Minimal EventEmitter interface that is molded against the Node.js * EventEmitter interface. @@ -22,7 +25,17 @@ declare module EventEmitter3 { * @returns {Array} * @api public */ - listeners(event: string): Function[]; + listeners(event?: string): Function[]; + + /** + * Return a list of assigned event listeners. + * + * @param {String} event The events that should be listed. + * @param {Boolean} exists We only need to know if there are listeners. + * @returns {Boolean} + * @api public + */ + listeners(event: string, param: boolean): boolean; /** * Emit an event to all registered event listeners. @@ -37,8 +50,8 @@ declare module EventEmitter3 { * Register a new EventListener for the given event. * * @param {String} event Name of the event. - * @param {Functon} fn Callback function. - * @param {Mixed} context The context of the function. + * @param {Function} fn Callback function. + * @param {Mixed} [context=this] The context of the function. * @api public */ on(event: string, fn: Function, context?: any): EventEmitter; @@ -48,7 +61,7 @@ declare module EventEmitter3 { * * @param {String} event Name of the event. * @param {Function} fn Callback function. - * @param {Mixed} context The context of the function. + * @param {Mixed} [context=this] The context of the function. * @api public */ once(event: string, fn: Function, context?: any): EventEmitter; @@ -58,10 +71,11 @@ declare module EventEmitter3 { * * @param {String} event The event we want to remove. * @param {Function} fn The listener that we need to find. + * @param {Mixed} context Only remove listeners matching this context. * @param {Boolean} once Only remove once listeners. * @api public */ - removeListener(event: string, fn: Function, once?: boolean): EventEmitter; + removeListener(event: string, fn?: Function, context?: any, once?: boolean): EventEmitter; /** * Remove all listeners or only the listeners for the specified event. @@ -69,34 +83,41 @@ declare module EventEmitter3 { * @param {String} event The event want to remove all listeners for. * @api public */ - removeAllListeners(event: string): EventEmitter; + removeAllListeners(event?: string): EventEmitter; - // - // Alias methods names because people roll like that. - // - off(event: string, fn: Function, once?: boolean): EventEmitter; + /** + * Remove event listeners. + * + * @param {String} event The event we want to remove. + * @param {Function} fn The listener that we need to find. + * @param {Mixed} context Only remove listeners matching this context. + * @param {Boolean} once Only remove once listeners. + * @api public + */ + off(event: string, fn?: Function, context?: any, once?: boolean): EventEmitter; + + /** + * Register a new EventListener for the given event. + * + * @param {String} event Name of the event. + * @param {Function} fn Callback function. + * @param {Mixed} [context=this] The context of the function. + * @api public + */ addListener(event: string, fn: Function, context?: any): EventEmitter; - // - // This function doesn't apply anymore. - // + /** + * This function doesn't apply anymore. + * @deprecated + */ setMaxListeners(): EventEmitter; } - export class EventEmitter extends __Base { } - export module EventEmitter { - // - // Expose the module. - // - export class EventEmitter extends __Base {} - export class EventEmitter2 extends __Base {} - export class EventEmitter3 extends __Base {} - } } declare module 'eventemitter3' { // // Expose the module. // - class EventEmitter extends EventEmitter3.EventEmitter {} - export = EventEmitter; + var EventEmitter3: EventEmitter3.EventEmitter3Static; + export = EventEmitter3; } From b8c618001c9769b653da68e2f8b7d279f12b0366 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Wed, 9 Dec 2015 10:42:31 +0100 Subject: [PATCH 170/474] Update definition for "express-validator": add "isMACAddress" function. --- express-validator/express-validator.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index 428c90afd0..78073231be 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -66,12 +66,14 @@ declare module ExpressValidator { * Accepts http, https, ftp */ isUrl(): Validator; + /** * Combines isIPv4 and isIPv6 */ isIP(): Validator; isIPv4(): Validator; isIPv6(): Validator; + isMACAddress(): Validator; isAlpha(): Validator; isAlphanumeric(): Validator; isNumeric(): Validator; From abb55149183ccd505da474fca2837851fd0ef508 Mon Sep 17 00:00:00 2001 From: bgrieder Date: Wed, 9 Dec 2015 10:51:13 +0100 Subject: [PATCH 171/474] Type definitions for bull: https://github.com/OptimalBits/bull --- bull/bull-tests.ts.tscparams | 1 + bull/bull-tests.tsx | 102 ++++++++++++ bull/bull.d.ts | 311 +++++++++++++++++++++++++++++++++++ 3 files changed, 414 insertions(+) create mode 100644 bull/bull-tests.ts.tscparams create mode 100644 bull/bull-tests.tsx create mode 100644 bull/bull.d.ts diff --git a/bull/bull-tests.ts.tscparams b/bull/bull-tests.ts.tscparams new file mode 100644 index 0000000000..6641df12d4 --- /dev/null +++ b/bull/bull-tests.ts.tscparams @@ -0,0 +1 @@ +--target es5 --noImplicitAny --module commonjs diff --git a/bull/bull-tests.tsx b/bull/bull-tests.tsx new file mode 100644 index 0000000000..bd25efc0c9 --- /dev/null +++ b/bull/bull-tests.tsx @@ -0,0 +1,102 @@ +/** + * Created by Bruno Grieder + */ + +/// + + +import * as Queue from "bull" + +var videoQueue = Queue( 'video transcoding', 6379, '127.0.0.1' ); +var audioQueue = Queue( 'audio transcoding', 6379, '127.0.0.1' ); +var imageQueue = Queue( 'image transcoding', 6379, '127.0.0.1' ); + +videoQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + + // job.data contains the custom data passed when the job was created + // job.jobId contains id of this job. + + // transcode video asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { framerate: 29.5 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +audioQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + // transcode audio asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { samplerate: 48000 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +imageQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + // transcode image asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { width: 1280, height: 720 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +videoQueue.add( { video: 'http://example.com/video1.mov' } ); +audioQueue.add( { audio: 'http://example.com/audio1.mp3' } ); +imageQueue.add( { image: 'http://example.com/image1.tiff' } ); + + +////////////////////////////////////////////////////////////////////////////////// +// +// Using Promises +// +////////////////////////////////////////////////////////////////////////////////// + +const fetchVideo = ( url: string ): Promise => { return null } +const transcodeVideo = ( data: any ): Promise => { return null } + +interface VideoJob extends Queue.Job { + data: {url: string} +} + + +videoQueue.process( ( job: VideoJob ) => { // don't forget to remove the done callback! + // Simply return a promise + return fetchVideo( job.data.url ).then( transcodeVideo ); + + // Handles promise rejection + return Promise.reject( new Error( 'error transcoding' ) ); + + // Passes the value the promise is resolved with to the "completed" event + return Promise.resolve( { framerate: 29.5 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw new Error( 'some unexpected error' ); + // same as + return Promise.reject( new Error( 'some unexpected error' ) ); +} ); diff --git a/bull/bull.d.ts b/bull/bull.d.ts new file mode 100644 index 0000000000..b867c11235 --- /dev/null +++ b/bull/bull.d.ts @@ -0,0 +1,311 @@ +// Type definitions for bull 0.7.0 +// Project: https://github.com/OptimalBits/bull +// Definitions by: Bruno Grieder +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + + +declare module "bull" { + + import * as Redis from "redis"; + + /** + * This is the Queue constructor. + * It creates a new Queue that is persisted in Redis. + * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. + */ + function Bull(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): Bull.Queue; + + module Bull { + + export interface DoneCallback { + (error?: Error, value?: any): void + } + + export interface Job { + + id: string + + /** + * The custom data passed when the job was created + */ + data: Object; + + /** + * Report progress on a job + */ + progress(value: any): Promise; + + /** + * Removes a Job from the queue from all the lists where it may be included. + * @returns {Promise} A promise that resolves when the job is removed. + */ + remove(): Promise; + + /** + * Rerun a Job that has failed. + * @returns {Promise} A promise that resolves when the job is scheduled for retry. + */ + retry(): Promise; + } + + export interface Backoff { + + /** + * Backoff type, which can be either `fixed` or `exponential` + */ + type: string + + /** + * Backoff delay, in milliseconds + */ + delay: number; + } + + export interface AddOptions { + /** + * An amount of miliseconds to wait until this job can be processed. + * Note that for accurate delays, both server and clients should have their clocks synchronized + */ + delay?: number; + + /** + * A number of attempts to retry if the job fails [optional] + */ + attempts?: number; + + /** + * Backoff setting for automatic retries if the job fails + */ + backoff?: number | Backoff + + /** + * A boolean which, if true, adds the job to the right + * of the queue instead of the left (default false) + */ + lifo?: boolean; + + /** + * The number of milliseconds after which the job should be fail with a timeout error + */ + timeout?: number; + } + + export interface Queue { + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + */ + process(callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job) => void): Promise; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + */ + process(callback: (job: Job) => void): Promise; + + // process(callback: (job: Job, done?: DoneCallback) => void): Promise; + + /** + * Creates a new job and adds it to the queue. + * If the queue is empty the job will be executed directly, + * otherwise it will be placed in the queue and executed as soon as possible. + */ + add(data: Object, opts?: AddOptions): Promise; + + /** + * Returns a promise that resolves when the queue is paused. + * The pause is global, meaning that all workers in all queue instances for a given queue will be paused. + * A paused queue will not process new jobs until resumed, + * but current jobs being processed will continue until they are finalized. + * + * Pausing a queue that is already paused does nothing. + */ + pause(): Promise; + + /** + * Returns a promise that resolves when the queue is resumed after being paused. + * The resume is global, meaning that all workers in all queue instances for a given queue will be resumed. + * + * Resuming a queue that is not paused does nothing. + */ + resume(): Promise; + + /** + * Returns a promise that returns the number of jobs in the queue, waiting or paused. + * Since there may be other processes adding or processing jobs, this value may be true only for a very small amount of time. + */ + count(): Promise; + + /** + * Empties a queue deleting all the input lists and associated jobs. + */ + empty(): Promise; + + /** + * Closes the underlying redis client. Use this to perform a graceful shutdown. + * + * `close` can be called from anywhere, with one caveat: + * if called from within a job handler the queue won't close until after the job has been processed + */ + close(): Promise; + + /** + * Returns a promise that will return the job instance associated with the jobId parameter. + * If the specified job cannot be located, the promise callback parameter will be set to null. + */ + getJob(jobId: string): Promise; + + /** + * Tells the queue remove all jobs created outside of a grace period in milliseconds. + * You can clean the jobs with the following states: completed, waiting, active, delayed, and failed. + */ + clean(gracePeriod: number, jobsState?: string): Promise; + + /** + * Listens to queue events + * 'ready', 'error', 'activ', 'progress', 'completed', 'failed', 'paused', 'resumed', 'cleaned' + */ + on(eventName: string, callback: EventCallback): void; + } + + interface EventCallback { + (...args: any[]): void + } + + interface ReadyEventCallback extends EventCallback { + (): void; + } + + interface ErrorEventCallback extends EventCallback { + (error: Error): void; + } + + interface JobPromise { + /** + * Abort this job + */ + cancel(): void + } + + interface ActiveEventCallback extends EventCallback { + (job: Job, jobPromise: JobPromise): void; + } + + interface ProgressEventCallback extends EventCallback { + (job: Job, progress: any): void; + } + + interface CompletedEventCallback extends EventCallback { + (job: Job, result: Object): void; + } + + interface FailedEventCallback extends EventCallback { + (job: Job, error: Error): void; + } + + interface PausedEventCallback extends EventCallback { + (): void; + } + + interface ResumedEventCallback extends EventCallback { + (job?: Job): void; + } + + /** + * @see clean() for details + */ + interface CleanedEventCallback extends EventCallback { + (jobs: Job[], type: string): void; + } + } + + export = Bull; +} + +declare module "bull/lib/priority-queue" { + + import * as Bull from "bull"; + import * as Redis from "redis"; + + /** + * This is the Queue constructor of priority queue. + * + * It works same a normal queue, with same function and parameters. + * The only difference is that the Queue#add() allow an options opts.priority + * that could take ["low", "normal", "medium", "hight", "critical"]. If no options provider, "normal" will be taken. + * + * The priority queue will process more often highter priority jobs than lower. + */ + function PQueue(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): PQueue.PriorityQueue; + + module PQueue { + + export interface AddOptions extends Bull.AddOptions { + + /** + * "low", "normal", "medium", "high", "critical" + */ + priority?: string; + } + + + export interface PriorityQueue extends Bull.Queue { + + /** + * Creates a new job and adds it to the queue. + * If the queue is empty the job will be executed directly, + * otherwise it will be placed in the queue and executed as soon as possible. + */ + add(data: Object, opts?: PQueue.AddOptions): Promise; + + } + } + + export = PQueue; +} From f9944e023e7f1bcb13b080060dd253ed072dcd41 Mon Sep 17 00:00:00 2001 From: Roland Zwaga Date: Wed, 9 Dec 2015 11:56:35 +0100 Subject: [PATCH 172/474] Added IFontoMessageEventData interface (is currently undocumented publicly, so I can't post a link to any documentation) --- fontoxml/fontoxml-tests.ts | 7 +++++++ fontoxml/fontoxml.d.ts | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/fontoxml/fontoxml-tests.ts b/fontoxml/fontoxml-tests.ts index 7821806cf2..11d47db895 100644 --- a/fontoxml/fontoxml-tests.ts +++ b/fontoxml/fontoxml-tests.ts @@ -25,4 +25,11 @@ var simpleinit:com.fontoxml.IInvocator = { documentIds: ["11-22-33","44-55-66"], cmsBaseUrl: "/test/", editSessionToken: "aa-bb-cc-dd-ee" +} + +var eventData:com.fontoxml.IFontoMessageEventData = { + command: "test-command", + type: "test-type", + scope: init, + metadata: {} } \ No newline at end of file diff --git a/fontoxml/fontoxml.d.ts b/fontoxml/fontoxml.d.ts index 4d621c234c..8e6a0a2c76 100644 --- a/fontoxml/fontoxml.d.ts +++ b/fontoxml/fontoxml.d.ts @@ -37,4 +37,13 @@ declare module com.fontoxml roleId:string; } + //This is describes the object that is assigned to the MessageEvent.data + //property after the FontoXML editor posts a message + export interface IFontoMessageEventData { + command: string; + type: string; + scope: com.fontoxml.IInvocator; + metadata: any; + } + } \ No newline at end of file From e974403847dcd1d1464c5765668142920c41a447 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 9 Dec 2015 16:59:52 +0500 Subject: [PATCH 173/474] lodash: signatures of _.before have been changed --- lodash/lodash-tests.ts | 41 +++++++++++++++++++++++++---------------- lodash/lodash.d.ts | 21 ++++++++++++++++----- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c409e26214..7674eaf6f7 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4658,22 +4658,31 @@ module TestBackflow { } // _.before -var testBeforeFn = ((n: number) => () => ++n)(0); -var testBeforeResultFn = <() => number>_.before<() => number>(3, testBeforeFn); -result = testBeforeResultFn(); -// → 1 -result = testBeforeResultFn(); -// → 2 -result = testBeforeResultFn(); -// → 2 -var testBeforeFn = ((n: number) => () => ++n)(0); -var testBeforeResultFn = <() => number>_(3).before<() => number>(testBeforeFn); -result = testBeforeResultFn(); -// → 1 -result = testBeforeResultFn(); -// → 2 -result = testBeforeResultFn(); -// → 2 +module TestBefore { + interface Func { + (a: string, b: number): boolean; + } + + let func: Func; + + { + let result: Func; + + _.before(42, func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + _(42).before(func); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + _(42).chain().before(func); + } +} var funcBind = function(greeting: string, punctuation: string) { return greeting + ' ' + this.user + punctuation; }; var funcBound1: (punctuation: string) => any = _.bind(funcBind, { 'name': 'moe' }, 'hi'); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 253107c7f0..f7a9a5694b 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8048,20 +8048,31 @@ declare module _ { interface LoDashStatic { /** * Creates a function that invokes func, with the this binding and arguments of the created function, while - * it is called less than n times. Subsequent calls to the created function return the result of the last func + * it’s called less than n times. Subsequent calls to the created function return the result of the last func * invocation. + * * @param n The number of calls at which func is no longer invoked. * @param func The function to restrict. * @return Returns the new restricted function. */ - before(n: number, func: TFunc): TFunc; + before( + n: number, + func: TFunc + ): TFunc; } interface LoDashImplicitWrapper { /** - * @sed _.before - */ - before(func: TFunc): TFunc; + * @see _.before + **/ + before(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.before + **/ + before(func: TFunc): LoDashExplicitObjectWrapper; } //_.bind From 0f91841e0e2079d0d00603d30a5ccb30de5c86f4 Mon Sep 17 00:00:00 2001 From: Bart van den Burg Date: Wed, 9 Dec 2015 14:06:34 +0100 Subject: [PATCH 174/474] add definition for the angular translate filter --- angular-translate/angular-translate-tests.ts | 5 +++++ angular-translate/angular-translate.d.ts | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/angular-translate/angular-translate-tests.ts b/angular-translate/angular-translate-tests.ts index c60247f427..a19d27adec 100644 --- a/angular-translate/angular-translate-tests.ts +++ b/angular-translate/angular-translate-tests.ts @@ -36,4 +36,9 @@ app.controller('Ctrl', ($scope: Scope, $translate: angular.translate.ITranslateS $scope['changeLanguage'] = function (key: any) { $translate.use(key); }; +}).run(($filter: ng.IFilterService) => { + var x: string; + x = $filter('translate')('something'); + x = $filter('translate')('something', {}); + x = $filter('translate')('something', {}, ''); }); diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index e4f69c688b..ee855af3d6 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -108,3 +108,11 @@ declare module angular.translate { useLoaderCache(cache?: any): ITranslateProvider; } } + +declare module angular { + interface IFilterService { + (name:'translate'): { + (translationId: string, interpolateParams?: any, interpolation?: string): string; + }; + } +} From 1c5eb0244461d7dee0cf331cebb9830da29183bd Mon Sep 17 00:00:00 2001 From: Jacob Poul Richardt Date: Wed, 9 Dec 2015 14:09:09 +0100 Subject: [PATCH 175/474] Added missing viewModel property to ComponentConfig. --- knockout/knockout.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/knockout/knockout.d.ts b/knockout/knockout.d.ts index 8f5d6fef4a..087e945888 100644 --- a/knockout/knockout.d.ts +++ b/knockout/knockout.d.ts @@ -562,6 +562,7 @@ declare module KnockoutComponentTypes { } interface ComponentConfig { + viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule; template: any; createViewModel?: any; } From 6c8a227ec4be73b5bc5027baf1422ed62293b3ac Mon Sep 17 00:00:00 2001 From: Tim Perry Date: Wed, 9 Dec 2015 14:31:53 +0100 Subject: [PATCH 176/474] Fill out the full hopscotch API --- hopscotch/hopscotch-tests.ts | 2 +- hopscotch/hopscotch.d.ts | 79 +++++++++++++++++++++++++++++++----- 2 files changed, 70 insertions(+), 11 deletions(-) diff --git a/hopscotch/hopscotch-tests.ts b/hopscotch/hopscotch-tests.ts index 52d0213952..fb1d1c68a5 100644 --- a/hopscotch/hopscotch-tests.ts +++ b/hopscotch/hopscotch-tests.ts @@ -1,6 +1,6 @@ /// -var tourDefinition = { +var tourDefinition: TourDefinition = { id: 'intro-tour', steps: [ { diff --git a/hopscotch/hopscotch.d.ts b/hopscotch/hopscotch.d.ts index e7f7be6e9b..1baac775b5 100644 --- a/hopscotch/hopscotch.d.ts +++ b/hopscotch/hopscotch.d.ts @@ -3,14 +3,44 @@ // Definitions by: Tim Perry // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface TourDefinition { +declare type CallbackNameNamesOrDefinition = string | string[] | (() => void); + +interface HopscotchConfiguration { + bubbleWidth?: number; + buddleHeight?: number; + + smoothScroll?: boolean; + scrollDuration?: number; + scrollTopMargin?: number; + + showCloseButton?: boolean; + showNextButton?: boolean; + showPrevButton?: boolean; + + arrowWidth?: number; + skipIfNoElement?: boolean; + nextOnTargetClick?: boolean; + + onNext?: CallbackNameNamesOrDefinition; + onPrev?: CallbackNameNamesOrDefinition; + onStart?: CallbackNameNamesOrDefinition; + onEnd?: CallbackNameNamesOrDefinition; + onClose?: CallbackNameNamesOrDefinition; + onError?: CallbackNameNamesOrDefinition; + + i18n?: { + nextBtn?: string; + prevBtn?: string; + doneBtn?: string; + skipBtn?: string; + closeTooltip?: string; + stepNums?: string[]; + } +} + +interface TourDefinition extends HopscotchConfiguration { id: string; steps: StepDefinition[]; - - skipIfNoElement: boolean; - - onEnd: () => void; - onClose: () => void; } interface StepDefinition { @@ -20,22 +50,51 @@ interface StepDefinition { title?: string; content?: string; + width?: number; + padding?: number; + xOffset?: number; yOffset?: number; arrowOffset?: number; - height?: number; - width?: number; + delay?: number; + zIndex?: number; - multipage?: boolean; showNextButton?: boolean; + showPrevButton?: boolean; + showCTAButton?: boolean; + + ctaLabel?: string; + multipage?: boolean; + showSkip?: boolean; + fixedElement?: boolean; nextOnTargetClick?: boolean; - onShow?: () => void; + onPrev?: CallbackNameNamesOrDefinition; + onNext?: CallbackNameNamesOrDefinition; + onShow?: CallbackNameNamesOrDefinition; + onCTA?: CallbackNameNamesOrDefinition; } interface HopscotchStatic { startTour(tour: TourDefinition, stepNum?: number): void; + showStep(id: number): void; + prevStep(): void; + nextStep(): void; + endTour(clearCookie: boolean): void; + configure(options: HopscotchConfiguration): void; + getCurrTour(): TourDefinition; + getCurrStepNum(): number; + getState(): string; + + listen(eventName: string, callback: () => void): void; + unlisten(eventName: string, callback: () => void): void; + removeCallbacks(eventName?: string, tourOnly?: boolean): void; + + registerHelper(id: string, helper: (...args: any[]) => void): void; + + resetDefaultI18N(): void; + resetDefaultOptions(): void; } declare var hopscotch: HopscotchStatic; From 957c41c644b150a1ecba4377aa2c6f7f6442eef0 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Wed, 9 Dec 2015 14:41:05 +0000 Subject: [PATCH 177/474] Update flux.d.ts Replaced dependency upon `react-global.d.ts` in favour of the more targeted `react.d.ts` --- flux/flux.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flux/flux.d.ts b/flux/flux.d.ts index c65892321c..13d7163116 100644 --- a/flux/flux.d.ts +++ b/flux/flux.d.ts @@ -3,7 +3,7 @@ // Definitions by: Steve Baker , Giedrius Grabauskas // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// declare module Flux { @@ -70,6 +70,7 @@ declare module "flux" { declare module FluxUtils { + import React = __React; export class Container { constructor(); /** From f2afd9c258c5f6daebc6254ec08aab72e5794b94 Mon Sep 17 00:00:00 2001 From: jmercha Date: Thu, 10 Dec 2015 01:26:07 +1030 Subject: [PATCH 178/474] support es6 import syntax for gulp-babel --- gulp-babel/gulp-babel.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gulp-babel/gulp-babel.d.ts b/gulp-babel/gulp-babel.d.ts index 98d33881cf..632cb86f96 100644 --- a/gulp-babel/gulp-babel.d.ts +++ b/gulp-babel/gulp-babel.d.ts @@ -36,5 +36,7 @@ declare module 'gulp-babel' { retainLines?: boolean }): NodeJS.ReadWriteStream; + module babel { } + export = babel; } From d5eca5e9a3305939212e0479492dd09979345408 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:08:18 +0900 Subject: [PATCH 179/474] github-electron: Add 'electron' module for main process --- github-electron/github-electron-main-tests.ts | 88 ++++++++++--------- github-electron/github-electron-main.d.ts | 15 ++++ github-electron/github-electron.d.ts | 12 ++- 3 files changed, 70 insertions(+), 45 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index bafbaa49f7..30f6bee22f 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -1,21 +1,23 @@ /// -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 { + app, + autoUpdater, + BrowserWindow, + contentTracing, + dialog, + globalShortcut, + ipcMain, + Menu, + MenuItem, + powerMonitor, + protocol, + Tray, + clipboard, + crashReporter, + nativeImage, + screen, + shell +} from 'electron'; import path = require('path'); @@ -39,8 +41,8 @@ app.on('window-all-closed', () => { var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) { // Someone tried to run a second instance, we should focus our window if (mainWindow) { - if (mainWindow.isMinimized()) mainWindow.restore(); - mainWindow.focus(); + if (mainWindow.isMinimized()) mainWindow.restore(); + mainWindow.focus(); } return true; }); @@ -156,7 +158,7 @@ app.on('ready', () => { onlineStatusWindow.loadURL(`file://${__dirname}/online-status.html`); }); -ipc.on('online-status-changed', (event: any, status: any) => { +ipcMain.on('online-status-changed', (event: any, status: any) => { console.log(status); }); @@ -183,7 +185,7 @@ 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()); +autoUpdater.setFeedURL('http://mycompany.com/myapp/latest?version=' + app.getVersion()); // browser-window // https://github.com/atom/electron/blob/master/docs/api/browser-window.md @@ -199,11 +201,11 @@ win.show(); // content-tracing // https://github.com/atom/electron/blob/master/docs/api/content-tracing.md -ContentTracing.startRecording('*', ContentTracing.DEFAULT_OPTIONS, () => { +contentTracing.startRecording('*', contentTracing.DEFAULT_OPTIONS, () => { console.log('Tracing started'); setTimeout(() => { - ContentTracing.stopRecording('', path => { + contentTracing.stopRecording('', path => { console.log('Tracing data recorded to ' + path); }); }, 5000); @@ -212,7 +214,7 @@ ContentTracing.startRecording('*', ContentTracing.DEFAULT_OPTIONS, () => { // dialog // https://github.com/atom/electron/blob/master/docs/api/dialog.md -console.log(Dialog.showOpenDialog({ +console.log(dialog.showOpenDialog({ properties: ['openFile', 'openDirectory', 'multiSelections'] })); @@ -220,30 +222,30 @@ console.log(Dialog.showOpenDialog({ // https://github.com/atom/electron/blob/master/docs/api/global-shortcut.md // Register a 'ctrl+x' shortcut listener. -var ret = GlobalShortcut.register('ctrl+x', () => { +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')); +console.log(globalShortcut.isRegistered('ctrl+x')); // Unregister a shortcut. -GlobalShortcut.unregister('ctrl+x'); +globalShortcut.unregister('ctrl+x'); // Unregister all shortcuts. -GlobalShortcut.unregisterAll(); +globalShortcut.unregisterAll(); -// ipc +// ipcMain // https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md -ipc.on('asynchronous-message', (event: any, arg: any) => { +ipcMain.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) => { +ipcMain.on('synchronous-message', (event: any, arg: any) => { console.log(arg); // prints "ping" event.returnValue = 'pong'; }); @@ -405,7 +407,7 @@ Menu.buildFromTemplate([ // https://github.com/atom/electron/blob/master/docs/api/power-monitor.md app.on('ready', () => { - PowerMonitor.on('suspend', () => { + powerMonitor.on('suspend', () => { console.log('The system is going to sleep'); }); }); @@ -414,9 +416,9 @@ app.on('ready', () => { // https://github.com/atom/electron/blob/master/docs/api/protocol.md app.on('ready', () => { - Protocol.registerProtocol('atom', (request: any) => { + protocol.registerProtocol('atom', (request: any) => { var url = request.url.substr(7); - return new Protocol.RequestFileJob(path.normalize(`${__dirname}/${url}`)); + return new protocol.RequestFileJob(path.normalize(`${__dirname}/${url}`)); }); }); @@ -440,26 +442,26 @@ app.on('ready', () => { // 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')); +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({ +crashReporter.start({ productName: 'YourName', companyName: 'YourCompany', submitURL: 'https://your-domain.com/url-to-submit', autoSubmit: true }); -// NativeImage +// 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 image = clipboard.readImage(); var appIcon3 = new Tray(image); var appIcon4 = new Tray('/Users/somebody/images/icon.png'); @@ -467,12 +469,12 @@ var appIcon4 = new Tray('/Users/somebody/images/icon.png'); // https://github.com/atom/electron/blob/master/docs/api/screen.md app.on('ready', () => { - var size = Screen.getPrimaryDisplay().workAreaSize; + var size = screen.getPrimaryDisplay().workAreaSize; mainWindow = new BrowserWindow({ width: size.width, height: size.height }); }); app.on('ready', () => { - var displays = Screen.getAllDisplays(); + var displays = screen.getAllDisplays(); var externalDisplay: any = null; for (var i in displays) { if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { @@ -492,4 +494,4 @@ app.on('ready', () => { // shell // https://github.com/atom/electron/blob/master/docs/api/shell.md -Shell.openExternal('https://github.com'); +shell.openExternal('https://github.com'); diff --git a/github-electron/github-electron-main.d.ts b/github-electron/github-electron-main.d.ts index a133155a93..eb74ee4460 100644 --- a/github-electron/github-electron-main.d.ts +++ b/github-electron/github-electron-main.d.ts @@ -254,6 +254,21 @@ declare module 'tray' { export = Tray; } +declare module 'electron' { + export var app: GitHubElectron.App; + export var autoUpdater: GitHubElectron.AutoUpdater; + export var BrowserWindow: typeof GitHubElectron.BrowserWindow; + export var contentTracing: GitHubElectron.ContentTracing; + export var dialog: GitHubElectron.Dialog; + export var globalShortcut: GitHubElectron.GlobalShortcut; + export var ipcMain: NodeJS.EventEmitter; + export var Menu: typeof GitHubElectron.Menu; + export var MenuItem: typeof GitHubElectron.MenuItem; + export var powerMonitor: NodeJS.EventEmitter; + export var protocol: GitHubElectron.Protocol; + export var Tray: typeof GitHubElectron.Tray; +} + interface NodeRequireFunction { (id: 'app'): GitHubElectron.App (id: 'auto-updater'): GitHubElectron.AutoUpdater diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index d4ab0099f0..d2909c1a44 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1407,12 +1407,12 @@ declare module GitHubElectron { } declare module 'clipboard' { - var clipboard: GitHubElectron.Clipboard + var clipboard: GitHubElectron.Clipboard; export = clipboard; } declare module 'crash-reporter' { - var crashReporter: GitHubElectron.CrashReporter + var crashReporter: GitHubElectron.CrashReporter; export = crashReporter; } @@ -1431,6 +1431,14 @@ declare module 'shell' { export = shell; } +declare module 'electron' { + export var clipboard: GitHubElectron.Clipboard; + export var crashReporter: GitHubElectron.CrashReporter; + export var nativeImage: GitHubElectron.NativeImage; + export var screen: GitHubElectron.Screen; + export var shell: GitHubElectron.Shell; +} + interface Window { /** * Creates a new window. From cfa613956a5acac7df4bcfc2918973d6ea22cd5c Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:09:42 +0900 Subject: [PATCH 180/474] github-electron: Remove all deprecated modules from definitions for main process https://github.com/atom/electron/commit/c5913c31493dd36b1455c5f1c9a28d65f67c5c72 --- github-electron/github-electron-main.d.ts | 100 ++++------------------ github-electron/github-electron.d.ts | 39 ++------- 2 files changed, 24 insertions(+), 115 deletions(-) diff --git a/github-electron/github-electron-main.d.ts b/github-electron/github-electron-main.d.ts index eb74ee4460..aa83e88016 100644 --- a/github-electron/github-electron-main.d.ts +++ b/github-electron/github-electron-main.d.ts @@ -192,94 +192,28 @@ declare module GitHubElectron { RequestStringJob: typeof RequestStringJob; RequestBufferJob: typeof RequestBufferJob; } -} -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' { - var contentTracing: GitHubElectron.ContentTracing - export = contentTracing; -} - -declare module 'dialog' { - var dialog: GitHubElectron.Dialog - export = dialog; -} - -declare module 'global-shortcut' { - var globalShortcut: GitHubElectron.GlobalShortcut; - export = globalShortcut; -} - -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' { - var protocol: GitHubElectron.Protocol; - export = protocol; -} - -declare module 'tray' { - var Tray: typeof GitHubElectron.Tray; - export = Tray; + interface Electron { + app: GitHubElectron.App; + autoUpdater: GitHubElectron.AutoUpdater; + BrowserWindow: typeof GitHubElectron.BrowserWindow; + contentTracing: GitHubElectron.ContentTracing; + dialog: GitHubElectron.Dialog; + globalShortcut: GitHubElectron.GlobalShortcut; + ipcMain: NodeJS.EventEmitter; + Menu: typeof GitHubElectron.Menu; + MenuItem: typeof GitHubElectron.MenuItem; + powerMonitor: NodeJS.EventEmitter; + protocol: GitHubElectron.Protocol; + Tray: typeof GitHubElectron.Tray; + } } declare module 'electron' { - export var app: GitHubElectron.App; - export var autoUpdater: GitHubElectron.AutoUpdater; - export var BrowserWindow: typeof GitHubElectron.BrowserWindow; - export var contentTracing: GitHubElectron.ContentTracing; - export var dialog: GitHubElectron.Dialog; - export var globalShortcut: GitHubElectron.GlobalShortcut; - export var ipcMain: NodeJS.EventEmitter; - export var Menu: typeof GitHubElectron.Menu; - export var MenuItem: typeof GitHubElectron.MenuItem; - export var powerMonitor: NodeJS.EventEmitter; - export var protocol: GitHubElectron.Protocol; - export var Tray: typeof GitHubElectron.Tray; + var electron: GitHubElectron.Electron; + export = electron; } interface NodeRequireFunction { - (id: 'app'): GitHubElectron.App - (id: 'auto-updater'): GitHubElectron.AutoUpdater - (id: 'browser-window'): typeof GitHubElectron.BrowserWindow - (id: 'content-tracing'): GitHubElectron.ContentTracing - (id: 'dialog'): GitHubElectron.Dialog - (id: 'global-shortcut'): GitHubElectron.GlobalShortcut - (id: 'ipc'): NodeJS.EventEmitter - (id: 'menu'): typeof GitHubElectron.Menu - (id: 'menu-item'): typeof GitHubElectron.MenuItem - (id: 'power-monitor'): NodeJS.EventEmitter - (id: 'protocol'): GitHubElectron.Protocol - (id: 'tray'): typeof GitHubElectron.Tray + (id: 'electron'): GitHubElectron.Electron; } diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index d2909c1a44..05a4a65712 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1404,39 +1404,14 @@ declare module GitHubElectron { */ beep(): void; } -} -declare module 'clipboard' { - var clipboard: GitHubElectron.Clipboard; - export = clipboard; -} - -declare module 'crash-reporter' { - var crashReporter: GitHubElectron.CrashReporter; - export = crashReporter; -} - -declare module 'native-image' { - var nativeImage: typeof GitHubElectron.NativeImage; - export = nativeImage; -} - -declare module 'screen' { - var screen: GitHubElectron.Screen; - export = screen; -} - -declare module 'shell' { - var shell: GitHubElectron.Shell; - export = shell; -} - -declare module 'electron' { - export var clipboard: GitHubElectron.Clipboard; - export var crashReporter: GitHubElectron.CrashReporter; - export var nativeImage: GitHubElectron.NativeImage; - export var screen: GitHubElectron.Screen; - export var shell: GitHubElectron.Shell; + interface Electron { + clipboard: GitHubElectron.Clipboard; + crashReporter: GitHubElectron.CrashReporter; + nativeImage: GitHubElectron.NativeImage; + screen: GitHubElectron.Screen; + shell: GitHubElectron.Shell; + } } interface Window { From c073d5b052c3c8179ae4f45233112346a74e0a1a Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:14:18 +0900 Subject: [PATCH 181/474] github-electron: Add 'electron' module for renderer process --- .../github-electron-renderer-tests.ts | 46 ++++++++++--------- github-electron/github-electron-renderer.d.ts | 6 +++ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts index 86680600fc..88fa4fcd55 100644 --- a/github-electron/github-electron-renderer-tests.ts +++ b/github-electron/github-electron-renderer-tests.ts @@ -1,23 +1,25 @@ /// -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 { + ipcRenderer, + remote, + webFrame, + clipboard, + crashReporter, + nativeImage, + screen, + shell +} from 'electron'; 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" +console.log(ipcRenderer.sendSync('synchronous-message', 'ping')); // prints "pong" -ipc.on('asynchronous-reply', (arg: any) => { +ipcRenderer.on('asynchronous-reply', (arg: any) => { console.log(arg); // prints "pong" }); -ipc.send('asynchronous-message', 'ping'); +ipcRenderer.send('asynchronous-message', 'ping'); // remote // https://github.com/atom/electron/blob/master/docs/api/remote.md @@ -45,9 +47,9 @@ remote.getCurrentWindow().capturePage(buf => { // web-frame // https://github.com/atom/electron/blob/master/docs/api/web-frame.md -WebFrame.setZoomFactor(2); +webFrame.setZoomFactor(2); -WebFrame.setSpellCheckProvider('en-US', true, { +webFrame.setSpellCheckProvider('en-US', true, { spellCheck: text => { return !(require('spellchecker').isMisspelled(text)); } @@ -56,27 +58,27 @@ WebFrame.setSpellCheckProvider('en-US', true, { // 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')); +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({ +crashReporter.start({ productName: 'YourName', companyName: 'YourCompany', submitURL: 'https://your-domain.com/url-to-submit', autoSubmit: true }); -// NativeImage +// 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 image = clipboard.readImage(); var appIcon3 = new Tray(image); var appIcon4 = new Tray('/Users/somebody/images/icon.png'); @@ -88,12 +90,12 @@ var app: GitHubElectron.App = remote.require('app'); var mainWindow: GitHubElectron.BrowserWindow = null; app.on('ready', () => { - var size = Screen.getPrimaryDisplay().workAreaSize; + var size = screen.getPrimaryDisplay().workAreaSize; mainWindow = new BrowserWindow({ width: size.width, height: size.height }); }); app.on('ready', () => { - var displays = Screen.getAllDisplays(); + var displays = screen.getAllDisplays(); var externalDisplay: any = null; for (var i in displays) { if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { @@ -113,4 +115,4 @@ app.on('ready', () => { // shell // https://github.com/atom/electron/blob/master/docs/api/shell.md -Shell.openExternal('https://github.com'); +shell.openExternal('https://github.com'); diff --git a/github-electron/github-electron-renderer.d.ts b/github-electron/github-electron-renderer.d.ts index 62b29d9cd6..2ef31d9677 100644 --- a/github-electron/github-electron-renderer.d.ts +++ b/github-electron/github-electron-renderer.d.ts @@ -109,6 +109,12 @@ declare module 'web-frame' { export = webframe; } +declare module 'electron' { + var remote: GitHubElectron.Remote; + var ipcRenderer: GitHubElectron.InProcess; + var webFrame: GitHubElectron.WebFrame; +} + interface NodeRequireFunction { (id: 'ipc'): GitHubElectron.InProcess (id: 'remote'): GitHubElectron.Remote From 9e2e3b7b9c59bd4c6f9eff9423444f80117a360f Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:15:06 +0900 Subject: [PATCH 182/474] github-electron: Remove deprecated modules from definitions for renderer process https://github.com/atom/electron/commit/c5913c31493dd36b1455c5f1c9a28d65f67c5c72 --- github-electron/github-electron-renderer.d.ts | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/github-electron/github-electron-renderer.d.ts b/github-electron/github-electron-renderer.d.ts index 2ef31d9677..7cfdca5a06 100644 --- a/github-electron/github-electron-renderer.d.ts +++ b/github-electron/github-electron-renderer.d.ts @@ -92,31 +92,19 @@ declare module GitHubElectron { */ registerURLSchemeAsSecure(scheme: string): void; } -} -declare module 'ipc' { - var inProcess: GitHubElectron.InProcess; - export = inProcess; -} - -declare module 'remote' { - var remote: GitHubElectron.Remote; - export = remote; -} - -declare module 'web-frame' { - var webframe: GitHubElectron.WebFrame; - export = webframe; + export interface Electron { + remote: GitHubElectron.Remote; + ipcRenderer: GitHubElectron.InProcess; + webFrame: GitHubElectron.WebFrame; + } } declare module 'electron' { - var remote: GitHubElectron.Remote; - var ipcRenderer: GitHubElectron.InProcess; - var webFrame: GitHubElectron.WebFrame; + var electron: GitHubElectron.Electron; + export = electron; } interface NodeRequireFunction { - (id: 'ipc'): GitHubElectron.InProcess - (id: 'remote'): GitHubElectron.Remote - (id: 'web-frame'): GitHubElectron.WebFrame + (id: 'electron'): GitHubElectron.Electron; } From b10b59fe42978878f23b6bbae44c1c98a76ec492 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:44:14 +0900 Subject: [PATCH 183/474] github-electron: Unite main process definitions and renderer process definitions because currently github-electron-renderer.d.ts and github-electron-main.d.ts can't be used with tsd.d.ts at the same time. tsd.d.ts includes both definition files. So I unite them to resolve it. --- github-electron/github-electron-main-tests.ts | 2 +- github-electron/github-electron-main.d.ts | 219 ------------- .../github-electron-renderer-tests.ts | 2 +- github-electron/github-electron-renderer.d.ts | 110 ------- github-electron/github-electron.d.ts | 305 +++++++++++++++++- 5 files changed, 302 insertions(+), 336 deletions(-) delete mode 100644 github-electron/github-electron-main.d.ts delete mode 100644 github-electron/github-electron-renderer.d.ts diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 30f6bee22f..84f1ca89c1 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -1,4 +1,4 @@ -/// +/// import { app, autoUpdater, diff --git a/github-electron/github-electron-main.d.ts b/github-electron/github-electron-main.d.ts deleted file mode 100644 index aa83e88016..0000000000 --- a/github-electron/github-electron-main.d.ts +++ /dev/null @@ -1,219 +0,0 @@ -// 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 GitHubElectron { - interface ContentTracing { - /** - * 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. - */ - 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. - */ - 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. - */ - 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. - */ - 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. - */ - 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. - */ - 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. - */ - getTraceBufferUsage(callback: Function): void; - /** - * @param callback Called every time the given event occurs on any process. - */ - setWatchEvent(categoryName: string, eventName: string, callback: Function): void; - /** - * Cancel the watch event. If tracing is enabled, this may race with the watch event callback. - */ - cancelWatchEvent(): void; - DEFAULT_OPTIONS: number; - ENABLE_SYSTRACE: number; - ENABLE_SAMPLING: number; - RECORD_CONTINUOUSLY: number; - } - - interface 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. - */ - 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. - */ - 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. - */ - 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. - */ - showErrorBox(title: string, content: string): void; - } - - interface GlobalShortcut { - /** - * 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 {} - */ - 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. - */ - 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. - */ - unregister(accelerator: string): void; - /** - * Unregisters all the global shortcuts. - */ - unregisterAll(): void; - } - - class RequestFileJob { - /** - * Create a request job which would query a file of path and set corresponding mime types. - */ - constructor(path: string); - } - - 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; - }); - } - - 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; - }); - } - - interface Protocol { - registerProtocol(scheme: string, handler: (request: any) => void): void; - unregisterProtocol(scheme: string): void; - isHandledProtocol(scheme: string): boolean; - interceptProtocol(scheme: string, handler: (request: any) => void): void; - uninterceptProtocol(scheme: string): void; - RequestFileJob: typeof RequestFileJob; - RequestStringJob: typeof RequestStringJob; - RequestBufferJob: typeof RequestBufferJob; - } - - interface Electron { - app: GitHubElectron.App; - autoUpdater: GitHubElectron.AutoUpdater; - BrowserWindow: typeof GitHubElectron.BrowserWindow; - contentTracing: GitHubElectron.ContentTracing; - dialog: GitHubElectron.Dialog; - globalShortcut: GitHubElectron.GlobalShortcut; - ipcMain: NodeJS.EventEmitter; - Menu: typeof GitHubElectron.Menu; - MenuItem: typeof GitHubElectron.MenuItem; - powerMonitor: NodeJS.EventEmitter; - protocol: GitHubElectron.Protocol; - Tray: typeof GitHubElectron.Tray; - } -} - -declare module 'electron' { - var electron: GitHubElectron.Electron; - export = electron; -} - -interface NodeRequireFunction { - (id: 'electron'): GitHubElectron.Electron; -} diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts index 88fa4fcd55..cf610718ce 100644 --- a/github-electron/github-electron-renderer-tests.ts +++ b/github-electron/github-electron-renderer-tests.ts @@ -1,4 +1,4 @@ -/// +/// import { ipcRenderer, remote, diff --git a/github-electron/github-electron-renderer.d.ts b/github-electron/github-electron-renderer.d.ts deleted file mode 100644 index 7cfdca5a06..0000000000 --- a/github-electron/github-electron-renderer.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -// 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 { - export 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; - } - - interface Remote { - /** - * @returns The object returned by require(module) in the main process. - */ - require(module: string): any; - /** - * @returns The BrowserWindow object which this web page belongs to. - */ - getCurrentWindow(): BrowserWindow - /** - * @returns The global variable of name (e.g. global[name]) in the main process. - */ - getGlobal(name: string): any; - /** - * Returns the process object in the main process. This is the same as - * remote.getGlobal('process'), but gets cached. - */ - process: any; - } - - interface WebFrame { - /** - * Changes the zoom factor to the specified factor, zoom factor is - * zoom percent / 100, so 300% = 3.0. - */ - setZoomFactor(factor: number): void; - /** - * @returns The current zoom factor. - */ - 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. - */ - setZoomLevel(level: number): void; - /** - * @returns The current zoom level. - */ - getZoomLevel(): number; - /** - * Sets a provider for spell checking in input fields and text areas. - */ - 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. - */ - registerURLSchemeAsSecure(scheme: string): void; - } - - export interface Electron { - remote: GitHubElectron.Remote; - ipcRenderer: GitHubElectron.InProcess; - webFrame: GitHubElectron.WebFrame; - } -} - -declare module 'electron' { - var electron: GitHubElectron.Electron; - export = electron; -} - -interface NodeRequireFunction { - (id: 'electron'): GitHubElectron.Electron; -} diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 05a4a65712..10c3a43f2b 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1405,12 +1405,306 @@ declare module GitHubElectron { beep(): void; } + // Type definitions for renderer process + + export class IpcRenderer implements NodeJS.EventEmitter { + addListener(event: string, listener: Function): IpcRenderer; + on(event: string, listener: Function): IpcRenderer; + once(event: string, listener: Function): IpcRenderer; + removeListener(event: string, listener: Function): IpcRenderer; + removeAllListeners(event?: string): IpcRenderer; + 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; + } + + interface Remote { + /** + * @returns The object returned by require(module) in the main process. + */ + require(module: string): any; + /** + * @returns The BrowserWindow object which this web page belongs to. + */ + getCurrentWindow(): BrowserWindow + /** + * @returns The global variable of name (e.g. global[name]) in the main process. + */ + getGlobal(name: string): any; + /** + * Returns the process object in the main process. This is the same as + * remote.getGlobal('process'), but gets cached. + */ + process: any; + } + + interface WebFrame { + /** + * Changes the zoom factor to the specified factor, zoom factor is + * zoom percent / 100, so 300% = 3.0. + */ + setZoomFactor(factor: number): void; + /** + * @returns The current zoom factor. + */ + 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. + */ + setZoomLevel(level: number): void; + /** + * @returns The current zoom level. + */ + getZoomLevel(): number; + /** + * Sets a provider for spell checking in input fields and text areas. + */ + 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. + */ + registerURLSchemeAsSecure(scheme: string): void; + } + + // Type definitions for main process + + interface ContentTracing { + /** + * 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + getTraceBufferUsage(callback: Function): void; + /** + * @param callback Called every time the given event occurs on any process. + */ + setWatchEvent(categoryName: string, eventName: string, callback: Function): void; + /** + * Cancel the watch event. If tracing is enabled, this may race with the watch event callback. + */ + cancelWatchEvent(): void; + DEFAULT_OPTIONS: number; + ENABLE_SYSTRACE: number; + ENABLE_SAMPLING: number; + RECORD_CONTINUOUSLY: number; + } + + interface 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. + */ + 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. + */ + 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. + */ + 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. + */ + showErrorBox(title: string, content: string): void; + } + + interface GlobalShortcut { + /** + * 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 {} + */ + 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. + */ + 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. + */ + unregister(accelerator: string): void; + /** + * Unregisters all the global shortcuts. + */ + unregisterAll(): void; + } + + class RequestFileJob { + /** + * Create a request job which would query a file of path and set corresponding mime types. + */ + constructor(path: string); + } + + 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; + }); + } + + 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; + }); + } + + interface Protocol { + registerProtocol(scheme: string, handler: (request: any) => void): void; + unregisterProtocol(scheme: string): void; + isHandledProtocol(scheme: string): boolean; + interceptProtocol(scheme: string, handler: (request: any) => void): void; + uninterceptProtocol(scheme: string): void; + RequestFileJob: typeof RequestFileJob; + RequestStringJob: typeof RequestStringJob; + RequestBufferJob: typeof RequestBufferJob; + } + + interface Electron { clipboard: GitHubElectron.Clipboard; crashReporter: GitHubElectron.CrashReporter; nativeImage: GitHubElectron.NativeImage; screen: GitHubElectron.Screen; shell: GitHubElectron.Shell; + remote: GitHubElectron.Remote; + ipcRenderer: GitHubElectron.IpcRenderer; + webFrame: GitHubElectron.WebFrame; + app: GitHubElectron.App; + autoUpdater: GitHubElectron.AutoUpdater; + BrowserWindow: typeof GitHubElectron.BrowserWindow; + contentTracing: GitHubElectron.ContentTracing; + dialog: GitHubElectron.Dialog; + globalShortcut: GitHubElectron.GlobalShortcut; + ipcMain: NodeJS.EventEmitter; + Menu: typeof GitHubElectron.Menu; + MenuItem: typeof GitHubElectron.MenuItem; + powerMonitor: NodeJS.EventEmitter; + protocol: GitHubElectron.Protocol; + Tray: typeof GitHubElectron.Tray; } } @@ -1429,10 +1723,11 @@ interface File { path: string; } +declare module 'electron' { + var electron: GitHubElectron.Electron; + export = electron; +} + interface NodeRequireFunction { - (id: 'clipboard'): GitHubElectron.Clipboard - (id: 'crash-reporter'): GitHubElectron.CrashReporter - (id: 'native-image'): typeof GitHubElectron.NativeImage - (id: 'screen'): GitHubElectron.Screen - (id: 'shell'): GitHubElectron.Shell + (id: 'electron'): GitHubElectron.Electron; } From 1386ebca373368ddc149a389fe1973ceefe5c625 Mon Sep 17 00:00:00 2001 From: Igor Sidorov Date: Wed, 9 Dec 2015 18:52:15 +0300 Subject: [PATCH 184/474] mdDialog.hide should return Promise instead of void --- angular-material/angular-material-0.8.3.d.ts | 2 +- angular-material/angular-material-0.9.0.d.ts | 2 +- angular-material/angular-material.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/angular-material/angular-material-0.8.3.d.ts b/angular-material/angular-material-0.8.3.d.ts index 1e3eda18af..10724b8122 100644 --- a/angular-material/angular-material-0.8.3.d.ts +++ b/angular-material/angular-material-0.8.3.d.ts @@ -59,7 +59,7 @@ declare module angular.material { show(dialog: MDDialogOptions|MDPresetDialog): angular.IPromise; confirm(): MDConfirmDialog; alert(): MDAlertDialog; - hide(response?: any): void; + hide(response?: any): angular.IPromise; cancel(response?: any): void; } diff --git a/angular-material/angular-material-0.9.0.d.ts b/angular-material/angular-material-0.9.0.d.ts index 1383b0beb5..96134f114f 100644 --- a/angular-material/angular-material-0.9.0.d.ts +++ b/angular-material/angular-material-0.9.0.d.ts @@ -64,7 +64,7 @@ declare module angular.material { show(dialog: MDDialogOptions|MDAlertDialog|MDConfirmDialog): angular.IPromise; confirm(): MDConfirmDialog; alert(): MDAlertDialog; - hide(response?: any): void; + hide(response?: any): angular.IPromise; cancel(response?: any): void; } diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 43e0b9f53b..7d29e7492a 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -83,7 +83,7 @@ declare module angular.material { show(dialog: IDialogOptions|IAlertDialog|IConfirmDialog): angular.IPromise; confirm(): IConfirmDialog; alert(): IAlertDialog; - hide(response?: any): void; + hide(response?: any): angular.IPromise; cancel(response?: any): void; } From 8f6135b6a0b9484b7fb4e43d8549ff868c8043c1 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:52:07 +0900 Subject: [PATCH 185/474] github-electron: Fix min-width style properties of BrowserWindowOptions to minWidth style They were renamed at Electron v0.35 and previous names were deprecated. https://github.com/atom/electron/blob/master/docs/api/browser-window.md#new-browserwindowoptions --- github-electron/github-electron-main-tests.ts | 2 +- github-electron/github-electron.d.ts | 56 +++++++++---------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 84f1ca89c1..74a307710d 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -169,7 +169,7 @@ app.on('ready', () => { window = new BrowserWindow({ width: 800, height: 600, - 'title-bar-style': 'hidden-inset', + titleBarStyle: 'hidden-inset', }); window.loadURL('https://github.com'); }); diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 10c3a43f2b..e9d5aa0992 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -451,50 +451,50 @@ declare module GitHubElectron { // http://electron.atom.io/docs/v0.29.0/api/browser-window/ interface BrowserWindowOptions extends Rectangle { show?: boolean; - 'use-content-size'?: boolean; + useContentSize?: boolean; center?: boolean; - 'min-width'?: number; - 'min-height'?: number; - 'max-width'?: number; - 'max-height'?: number; + minWidth?: number; + minHeight?: number; + maxWidth?: number; + maxHeight?: number; resizable?: boolean; - 'always-on-top'?: boolean; + alwaysOnTop?: boolean; fullscreen?: boolean; - 'skip-taskbar'?: boolean; - 'zoom-factor'?: number; + skipTaskbar?: boolean; + zoomFactor?: number; kiosk?: boolean; title?: string; icon?: NativeImage|string; frame?: boolean; - 'node-integration'?: boolean; - 'accept-first-mouse'?: boolean; - 'disable-auto-hide-cursor'?: boolean; - 'auto-hide-menu-bar'?: boolean; - 'enable-larger-than-screen'?: boolean; - 'dark-theme'?: boolean; + nodeIntegration?: boolean; + acceptFirstMouse?: boolean; + disableAutoHideCursor?: boolean; + autoHideMenuBar?: boolean; + enableLargerThanScreen?: boolean; + darkTheme?: boolean; preload?: string; transparent?: boolean; type?: string; - 'standard-window'?: boolean; - 'web-preferences'?: any; // Object + standardWindow?: boolean; + webPreferences?: any; // Object javascript?: boolean; - 'web-security'?: boolean; + webSecurity?: boolean; images?: boolean; java?: boolean; - 'text-areas-are-resizable'?: boolean; + textAreasAreResizable?: boolean; webgl?: boolean; webaudio?: boolean; plugins?: boolean; - 'extra-plugin-dirs'?: string[]; - 'experimental-features'?: boolean; - 'experimental-canvas-features'?: boolean; - 'subpixel-font-scaling'?: boolean; - 'overlay-scrollbars'?: boolean; - 'overlay-fullscreen-video'?: boolean; - 'shared-worker'?: boolean; - 'direct-write'?: boolean; - 'page-visibility'?: boolean; - 'title-bar-style'?: string; + extraPluginDirs?: string[]; + experimentalFeatures?: boolean; + experimentalCanvasFeatures?: boolean; + subpixelFontScaling?: boolean; + overlayScrollbars?: boolean; + overlayFullscreenVideo?: boolean; + sharedWorker?: boolean; + directWrite?: boolean; + pageVisibility?: boolean; + titleBarStyle?: string; } interface Rectangle { From 9fbacecc6ad974a16f9867e9662da1c73a1bad61 Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 00:59:39 +0900 Subject: [PATCH 186/474] github-electron: Define type of webPreferences property of BrowserWindowOptions https://github.com/atom/electron/blob/master/docs/api/browser-window.md#new-browserwindowoptions --- github-electron/github-electron.d.ts | 37 +++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index e9d5aa0992..2d2363ccce 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -447,6 +447,28 @@ declare module GitHubElectron { isVisibleOnAllWorkspaces(): boolean; } + interface WebPreferences { + nodeIntegration?: boolean; + preload?: string; + partition: string; + zoomFactor: number; + javascript: boolean; + webSecurity: boolean; + allowDisplayingInsecureContent: boolean; + allowRunningInsecureContent: boolean; + images: boolean; + textAreasAreResizable: boolean; + webgl?: boolean; + webaudio?: boolean; + plugins?: boolean; + experimentalFeatures?: boolean; + experimentalCanvasFeatures?: boolean; + overlayScrollbars?: boolean; + sharedWorker?: boolean; + directWrite?: boolean; + pageVisibility?: boolean; + } + // Includes all options BrowserWindow can take as of this writing // http://electron.atom.io/docs/v0.29.0/api/browser-window/ interface BrowserWindowOptions extends Rectangle { @@ -466,7 +488,6 @@ declare module GitHubElectron { title?: string; icon?: NativeImage|string; frame?: boolean; - nodeIntegration?: boolean; acceptFirstMouse?: boolean; disableAutoHideCursor?: boolean; autoHideMenuBar?: boolean; @@ -476,24 +497,12 @@ declare module GitHubElectron { transparent?: boolean; type?: string; standardWindow?: boolean; - webPreferences?: any; // Object - javascript?: boolean; - webSecurity?: boolean; - images?: boolean; + webPreferences?: WebPreferences; java?: boolean; textAreasAreResizable?: boolean; - webgl?: boolean; - webaudio?: boolean; - plugins?: boolean; extraPluginDirs?: string[]; - experimentalFeatures?: boolean; - experimentalCanvasFeatures?: boolean; subpixelFontScaling?: boolean; - overlayScrollbars?: boolean; overlayFullscreenVideo?: boolean; - sharedWorker?: boolean; - directWrite?: boolean; - pageVisibility?: boolean; titleBarStyle?: string; } From 41b42c1609ce6f0b48af2952de352d0525e828e7 Mon Sep 17 00:00:00 2001 From: James O'Cull Date: Wed, 9 Dec 2015 17:08:36 -0500 Subject: [PATCH 187/474] QueryInterface should have `sequelize` property --- sequelize/sequelize.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sequelize/sequelize.d.ts b/sequelize/sequelize.d.ts index 46a0ba41a0..3f1e2c86fc 100644 --- a/sequelize/sequelize.d.ts +++ b/sequelize/sequelize.d.ts @@ -3949,6 +3949,11 @@ declare module "sequelize" { * We don't have a definition for the QueryGenerator, because I doubt it is commonly in use separately. */ QueryGenerator: any; + + /** + * Returns the current sequelize instance. + */ + sequelize: Sequelize; /** * Queries the schema (table list). From 47bf640e91b6ef48d7ad56a34fe9c91f84b81799 Mon Sep 17 00:00:00 2001 From: Quentin Jones Date: Wed, 9 Dec 2015 19:22:17 -0600 Subject: [PATCH 188/474] Added a couple options missing from interface --- bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts index fb0b1b3899..bd8a3ff54e 100644 --- a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts @@ -54,6 +54,8 @@ declare module BootstrapV3DatetimePicker { showTodayButton?: boolean; viewMode?: string; inline?: boolean; + toolbarPlacement?: string; + showClear?: boolean; } interface Datetimepicker { From 9cb7452abb970f4df7548b97587187b3b5b05123 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 10 Dec 2015 06:20:45 +0500 Subject: [PATCH 189/474] lodash: signatures of _.isBoolean have been changed --- lodash/lodash-tests.ts | 41 +++++++++++++++++++++++++++-------------- lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c409e26214..e45f03a091 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5337,20 +5337,33 @@ result = _({}).isArray(); } // _.isBoolean -result = _.isBoolean(any); -result = _(1).isBoolean(); -result = _([]).isBoolean(); -result = _({}).isBoolean(); -{ - let value: number[]|boolean = [1, 3, 5]; - if (_.isBoolean(value)) { - let b: boolean = value; - // compile error - // let length: number = value.length; - } else { - let length: number = value.length; - // compile error - // let b: boolean = value; +module TestIsBoolean { + { + let value: number|boolean; + + if (_.isBoolean(value)) { + let result: boolean = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isBoolean(any); + result = _(1).isBoolean(); + result = _([]).isBoolean(); + result = _({}).isBoolean(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isBoolean(); + result = _([]).chain().isBoolean(); + result = _({}).chain().isBoolean(); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 253107c7f0..04abeb4903 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9212,9 +9212,10 @@ declare module _ { interface LoDashStatic { /** * Checks if value is classified as a boolean primitive or object. + * * @param value The value to check. * @return Returns true if value is correctly classified, else false. - **/ + */ isBoolean(value?: any): value is boolean; } @@ -9225,6 +9226,13 @@ declare module _ { isBoolean(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isBoolean + */ + isBoolean(): LoDashExplicitWrapper; + } + //_.isDate interface LoDashStatic { /** From 0ef797c1356c5ed73483e164213f4d938fbbc6fd Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Wed, 9 Dec 2015 20:35:57 -0600 Subject: [PATCH 190/474] [node] export Stream as class, not interface require('stream').Stream in Node.js is a constructor. --- node/node.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/node.d.ts b/node/node.d.ts index 017ca8e6b9..d1650174cd 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1675,7 +1675,7 @@ declare module "crypto" { declare module "stream" { import * as events from "events"; - export interface Stream extends events.EventEmitter { + export class Stream extends events.EventEmitter { pipe(destination: T, options?: { end?: boolean; }): T; } From 249633b2150e89025ae836d52b32583ec8be75ac Mon Sep 17 00:00:00 2001 From: vvakame Date: Thu, 10 Dec 2015 21:38:55 +0900 Subject: [PATCH 191/474] fix chrome.d.ts type header --- chrome/chrome.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 7db591be27..77d2898fd2 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -1,6 +1,6 @@ // Type definitions for Chrome extension development // Project: http://developer.chrome.com/extensions/ -// Definitions by: Matthew Kimber , otiai10 , couven92 +// Definitions by: Matthew Kimber , otiai10 , couven92 // Definitions: https://github.com/borisyankov/DefinitelyTyped /// From 0eef583c76ec45f52808b60fe4be2bf835c859a4 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 7 Dec 2015 05:31:07 +0500 Subject: [PATCH 192/474] node: signatures of module "querystring" have been changed --- node/node-tests.ts | 47 ++++++++++++++++++++++++++++++++++++++-------- node/node.d.ts | 14 ++++++++++++-- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index 4ca651b333..aa0f55bb69 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -239,16 +239,47 @@ ds.send(new Buffer("hello"), 0, 5, 5000, "127.0.0.1", (error: Error, bytes: numb }); //////////////////////////////////////////////////// -///Querystring tests : https://gist.github.com/musubu/2202583 +///Querystring tests : https://nodejs.org/api/querystring.html //////////////////////////////////////////////////// -var original: string = 'http://example.com/product/abcde.html'; -var escaped: string = querystring.escape(original); -console.log(escaped); -// http%3A%2F%2Fexample.com%2Fproduct%2Fabcde.html -var unescaped: string = querystring.unescape(escaped); -console.log(unescaped); -// http://example.com/product/abcde.html +module querystring_tests { + type SampleObject = {a: string; b: number;} + + { + let obj: SampleObject; + let sep: string; + let eq: string; + let options: querystring.StringifyOptions; + let result: string; + + result = querystring.stringify(obj); + result = querystring.stringify(obj, sep); + result = querystring.stringify(obj, sep, eq); + result = querystring.stringify(obj, sep, eq); + result = querystring.stringify(obj, sep, eq, options); + } + + { + let str: string; + let sep: string; + let eq: string; + let options: querystring.ParseOptions; + let result: SampleObject; + + result = querystring.parse(str); + result = querystring.parse(str, sep); + result = querystring.parse(str, sep, eq); + result = querystring.parse(str, sep, eq, options); + } + + { + let str: string; + let result: string; + + result = querystring.escape(str); + result = querystring.unescape(str); + } +} //////////////////////////////////////////////////// /// path tests : http://nodejs.org/api/path.html diff --git a/node/node.d.ts b/node/node.d.ts index 39be040a49..34e6ffedcd 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -405,8 +405,18 @@ declare module "buffer" { } declare module "querystring" { - export function stringify(obj: any, sep?: string, eq?: string): string; - export function parse(str: string, sep?: string, eq?: string, options?: { maxKeys?: number; }): any; + export interface StringifyOptions { + encodeURIComponent?: Function; + } + + export interface ParseOptions { + maxKeys?: number; + decodeURIComponent?: Function; + } + + export function stringify(obj: T, sep?: string, eq?: string, options?: StringifyOptions): string; + export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): any; + export function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): T; export function escape(str: string): string; export function unescape(str: string): string; } From a0d89370306da9dd4643242b4b4c0ba9934511c4 Mon Sep 17 00:00:00 2001 From: Graham Mendick Date: Thu, 10 Dec 2015 13:44:18 +0000 Subject: [PATCH 193/474] Updated typings and tests for Navigation 1.2.0 --- navigation/navigation-tests.ts | 21 ++++-- navigation/navigation.d.ts | 127 +++++++++++++++++++++++++++++++-- 2 files changed, 138 insertions(+), 10 deletions(-) diff --git a/navigation/navigation-tests.ts b/navigation/navigation-tests.ts index 758e0e53f5..d3676e82ec 100644 --- a/navigation/navigation-tests.ts +++ b/navigation/navigation-tests.ts @@ -38,8 +38,8 @@ module NavigationTests { // Configuration Navigation.StateInfoConfig.build([ - { key: 'home', initial: 'page', states: [ - { key: 'page', route: '' } + { key: 'home', initial: 'page', help: 'home.htm', states: [ + { key: 'page', route: '', help: 'page.htm' } ]}, { key: 'person', initial: 'list', states: [ { key: 'list', route: ['people/{page}', 'people/{page}/sort/{sort}'], transitions: [ @@ -97,24 +97,28 @@ module NavigationTests { // Navigation Navigation.start('home'); Navigation.StateController.navigate('person'); + Navigation.StateController.navigate('person', null, Navigation.HistoryAction.Add); Navigation.StateController.refresh(); - Navigation.StateController.refresh({ page: 2 }); + Navigation.StateController.refresh({ page: 3 }); + Navigation.StateController.refresh({ page: 2 }, Navigation.HistoryAction.Replace); Navigation.StateController.navigate('select', { id: 10 }); var canGoBack: boolean = Navigation.StateController.canNavigateBack(1); Navigation.StateController.navigateBack(1); + Navigation.StateController.clearStateContext(); // Navigation Link var link = Navigation.StateController.getNavigationLink('person'); link = Navigation.StateController.getRefreshLink(); link = Navigation.StateController.getRefreshLink({ page: 2 }); + Navigation.StateController.navigateLink(link); link = Navigation.StateController.getNavigationLink('select', { id: 10 }); var nextDialog = Navigation.StateController.getNextState('select').parent; person = nextDialog; - Navigation.StateController.navigateLink(link); + Navigation.StateController.navigateLink(link, false); link = Navigation.StateController.getNavigationBackLink(1); var crumb = Navigation.StateController.crumbs[0]; link = crumb.navigationLink; - Navigation.StateController.navigateLink(link, true); + Navigation.StateController.navigateLink(link, true, Navigation.HistoryAction.None); // StateContext Navigation.StateController.navigate('home'); @@ -124,10 +128,15 @@ module NavigationTests { person === Navigation.StateContext.dialog; personList === Navigation.StateContext.state; var url: string = Navigation.StateContext.url; + var title: string = Navigation.StateContext.title; var page: number = Navigation.StateContext.data.page; + Navigation.StateController.refresh({ page: 2 }); + person = Navigation.StateContext.oldDialog; + personList = Navigation.StateContext.oldState; + page = Navigation.StateContext.oldData.page; + page = Navigation.StateContext.previousData.page; // Navigation Data - Navigation.StateController.refresh({ page: 2 }); var data = Navigation.StateContext.includeCurrentData({ sort: 'name' }, ['page']); Navigation.StateController.refresh(data); Navigation.StateContext.clear('sort'); diff --git a/navigation/navigation.d.ts b/navigation/navigation.d.ts index 59af79ca29..418cec8a4b 100644 --- a/navigation/navigation.d.ts +++ b/navigation/navigation.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Navigation 1.1.0 +// Type definitions for Navigation 1.2.0 // Project: http://grahammendick.github.io/navigation/ // Definitions by: Graham Mendick // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -31,6 +31,10 @@ declare module Navigation { * Gets the textual description of the dialog */ title?: string; + /** + * Gets the additional dialog attributes + */ + [extras: string]: any; } /** @@ -75,6 +79,10 @@ declare module Navigation { * preserved when navigating */ trackTypes?: boolean; + /** + * Gets the additional state attributes + */ + [extras: string]: any; } /** @@ -278,6 +286,24 @@ declare module Navigation { */ static build(dialogs: IDialog[]>[]>[]): void; } + + /** + * Determines the effect on browser history after a successful navigation + */ + enum HistoryAction { + /** + * Creates a new browser history entry + */ + Add = 0, + /** + * Changes the current browser history entry + */ + Replace = 1, + /** + * Leaves browser history unchanged + */ + None = 2, + } /** * Defines a contract a class must implement in order to manage the browser @@ -295,9 +321,17 @@ declare module Navigation { /** * Adds browser history * @param state The State navigated to - * @param url The current url + * @param url The current url */ addHistory(state: State, url: string): void; + /** + * Adds browser history + * @param state The State navigated to + * @param url The current url + * @param replace A value indicating whether to replace the current + * browser history entry + */ + addHistory(state: State, url: string, replace: boolean): void; /** * Gets the current location */ @@ -339,6 +373,14 @@ declare module Navigation { * @param url The current url */ addHistory(state: State, url: string): void; + /** + * Sets the browser Url's hash to the url + * @param state The State navigated to + * @param url The current url + * @param replace A value indicating whether to replace the current + * browser history entry + */ + addHistory(state: State, url: string, replace: boolean): void; /** * Gets the current location */ @@ -375,6 +417,14 @@ declare module Navigation { * @param url The current url */ addHistory(state: State, url: string): void; + /** + * Sets the browser Url to the url using pushState + * @param state The State navigated to + * @param url The current url + * @param replace A value indicating whether to replace the current + * browser history entry + */ + addHistory(state: State, url: string, replace: boolean): void; /** * Gets the current location */ @@ -587,6 +637,11 @@ declare module Navigation { * ReturnData should be part of the CrumbTrail */ combineCrumbTrail: boolean; + /** + * Gets or sets a value indicating whether to track PreviousData when + * navigating back or refreshing and combineCrumbTrail is false + */ + trackAllPreviousData: boolean; } /** @@ -595,6 +650,18 @@ declare module Navigation { * previous State (this is not the same as the previous Crumb) */ class StateContext { + /** + * Gets the last State displayed before the current State + */ + static oldState: State; + /** + * Gets the parent of the OldState property + */ + static oldDialog: Dialog; + /** + * Gets the NavigationData for the last displayed State + */ + static oldData: any; /** * Gets the State navigated away from to reach the current State */ @@ -603,6 +670,10 @@ declare module Navigation { * Gets the parent of the PreviousState property */ static previousDialog: Dialog; + /** + * Gets the NavigationData for the navigated away from State + */ + static previousData: any; /** * Gets the current State */ @@ -612,14 +683,17 @@ declare module Navigation { */ 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 + * Gets the NavigationData for the current State */ static data: any; /** * Gets the current Url */ static url: string; + /** + * Gets or sets the current title + */ + static title: string; /** * Combines the data with all the current NavigationData * @param The data to add to the current NavigationData @@ -660,6 +734,10 @@ declare module Navigation { * @param url The current Url */ static setStateContext(state: State, url: string): void; + /** + * Clears the Context Data + */ + static clearStateContext(): void; /** * Registers a navigate event listener * @param handler The navigate event listener @@ -694,6 +772,20 @@ declare module Navigation { * @throws A mandatory route parameter has not been supplied a value */ static navigate(action: string, toData: any): 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 + * @param A value determining the effect on browser history + * @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, historyAction: HistoryAction): 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' @@ -733,6 +825,17 @@ declare module Navigation { * @throws A mandatory route parameter has not been supplied a value */ static navigateBack(distance: number): void; + /** + * 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 + * @param A value determining the effect on browser history + * @throws canNavigateBack returns false for this distance + * @throws A mandatory route parameter has not been supplied a value + */ + static navigateBack(distance: number, historyAction: HistoryAction): void; /** * Gets a Url to navigate to a Crumb contained in the crumb trail, * represented by the Crumbs collection, as specified by the distance. @@ -755,6 +858,15 @@ declare module Navigation { * @throws A mandatory route parameter has not been supplied a value */ static refresh(toData: any): void; + /** + * Navigates to the current State + * @param toData The NavigationData to be passed to the current State + * and stored in the StateContext + * @param A value determining the effect on browser history + * @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, historyAction: HistoryAction): void; /** * Gets a Url to navigate to the current State passing no * NavigationData @@ -779,6 +891,13 @@ declare module Navigation { * @param history A value indicating whether browser history was used */ static navigateLink(url: string, history: boolean): void; + /** + * Navigates to the url + * @param url The target location + * @param history A value indicating whether browser history was used + * @param A value determining the effect on browser history + */ + static navigateLink(url: string, history: boolean, historyAction: HistoryAction): 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 From 87b5e5f03fdfa0e2561c87c9cca4a3c4d8817d64 Mon Sep 17 00:00:00 2001 From: Kaoru Hagihara Date: Thu, 10 Dec 2015 23:01:39 +0900 Subject: [PATCH 194/474] update vue.js to 1.0.11 --- vue/vue.d.ts | 509 ++++++++++++++++++++++++++------------------------- 1 file changed, 255 insertions(+), 254 deletions(-) diff --git a/vue/vue.d.ts b/vue/vue.d.ts index 4af732579e..650c8d98c4 100644 --- a/vue/vue.d.ts +++ b/vue/vue.d.ts @@ -1,269 +1,270 @@ -// Type definitions for vuejs 1.0.10 +// Type definitions for vuejs 1.0.11 // Project: https://github.com/vuejs/vue // Definitions by: odangosan , kaorun343 // Definitions: https://github.com/borisyankov/DefinitelyTyped interface Array { - $remove(item: T): Array; - $set(index: number, val: T): T; + $remove(item: T): Array; + $set(index: number, val: T): T; } declare namespace vuejs { + + interface PropOption { + type?: any; + required?: boolean; + default?: boolean; + twoWay?: boolean; + validator?(value: any): boolean; + } - interface PropOption { - type?: any; - required?: boolean; - default?: boolean; - twoWay?: boolean; - validator?(value: any): boolean; - } - - interface ComputedOption { - get(): any; - set(value: any): void; - } - - interface WatchOption { - handler(val: any, oldVal: any): void; - deep?: boolean; - immidiate?: boolean; - } - - interface DirectiveOption { - bind?(): any; - update?(newVal?: any, oldVal?: any): any; - unbind?(): any; - params?: string[]; - deep?: boolean; - twoWay?: boolean; - acceptStatement?: boolean; - priority?: number; - [key: string]: any; - } - - interface FilterOption { - read: Function; - write: Function; - } - - interface TransitionOption { - css?: boolean; - beforeEnter?(el: HTMLElement): void; - enter?(el: HTMLElement, done?: () => void): void; - afterEnter?(el: HTMLElement): void; - enterCancelled?(el: HTMLElement): void; - beforeLeave?(el: HTMLElement): void; - leave?(el: HTMLElement, done?: () => void): void; - afterLeave?(el: HTMLElement): void; - leaveCancelled?(el: HTMLElement): void; - stagger?(index: number): number; - } - - interface ComponentOption { - data?: {[key: string]: any } | Function; - props?: string[] | { [key: string]: PropOption }; - computed?: { [key: string]: ( Function | ComputedOption ) }; - methods?: { [key: string]: Function }; - watch?: { [key: string]: ( (val: any, oldVal: any) => void | string | WatchOption )}; - el?: string | HTMLElement | ( () => HTMLElement ); - template?: string; - replace?: boolean; - created?(): void; - beforeCompile?(): void; - compiled?(): void; - ready?(): void; - attached?(): void; - detached?(): void; - beforeDestroy?(): void; - destroyed?(): void; - directives?: { [key: string]: ( DirectiveOption | Function ) }; - elementDirectives?: { [key: string]: ( DirectiveOption | Function ) }; - filters?: { [key: string]: ( Function | FilterOption ) }; - components?: { [key: string]: ComponentOption }; - transitions?: { [key: string]: TransitionOption }; - partials?: { [key: string]: string }; - parent?: Vue; - events?: { [key: string]: ( (...args: any[]) => (boolean | void) ) | string }; - mixins?: ComponentOption[]; - name?: string; - [key: string]: any; - } - - // instance/api/data.js - interface $get { ( exp: string, asStatement?: boolean ): any; } - interface $set { ( key: string | number, value: any ): void; } - interface $delete { ( key: string) : void; } - interface $watch { ( expOrFn: string | Function, callback: ( (newVal: any, oldVal?: any) => any ) | string, options?: { deep?: boolean, immidiate?: boolean } ): Function; } - interface $eval { ( expression: string ): string; } - interface $interpolate { ( expression: string ): string; } - interface $log { ( keypath?: string ): void; } - // instance/api/dom.js - interface $nextTick { ( callback: Function ): void; } - interface $appendTo { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } - interface $prependTo { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } - interface $before { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } - interface $after { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } - interface $remove { ( callback?: Function ): V; } - // instance/api/events.js - interface $on { (event: string, callback: Function): V; } - interface $once { (event: string, callback: Function): V; } - interface $off { (event?: string, callback?: Function): V; } - interface $emit { (event: string, ...args: any[]): V; } - interface $broadcast { (event: string, ...args: any[]): V; } - interface $dispatch { (event: string, ...args: any[]): V; } - // instance/api/lifecycle.js - interface $mount { ( elementOrSelector?: ( HTMLElement | string ) ): V; } - interface $destroy { (remove?: boolean): void; } - interface $compile { (el: Element | DocumentFragment, host?: Vue): Function; } - - interface Vue { - $data?: any; - $el?: HTMLElement; - $options?: Object; - $parent?: Vue; - $root?: Vue; - $children?: Vue[]; - $refs?: Object; - $els?: Object; - - $get?: $get; - $set?: $set; - $delete?: $delete; - $eval?: $eval; - $interpolate?: $interpolate; - $log?: $log; - $watch?: $watch; - $on?: $on; - $once?: $once; - $off?: $off; - $emit?: $emit; - $dispatch?: $dispatch; - $broadcast?: $broadcast; - $appendTo?: $appendTo; - $before?: $before; - $after?: $after; - $remove?: $remove; - $nextTick?: $nextTick; - $mount?: $mount; - $destroy?: $destroy; - $compile?: $compile; - - _init?(options?: ComponentOption): void; - } - - interface VueConfig { - debug: boolean; - delimiters: [string, string]; - unsafeDelimiters: [string, string]; - silent: boolean; - async: boolean; - convertAllProperties: boolean; - } - - interface VueUtil { - // util/lang.js - set(obj: Object, key: string, value: any): void; - del(obj: Object, key: string): void; - hasOwn(obj: Object, key: string): boolean; - isLiteral(exp: string): boolean; - isReserved(str: string): boolean; - _toString(value: any): string; - toNumber(value: T): T | number; - toBoolean(value: T): T | boolean; - stripQuotes(str: string): string; - camelize(str: string): string; - hyphenate(str: string): string; - classify(str: string): string; - bind(fn: Function, ctx: Object): Function; - toAarray(list: ArrayLike, start?: number): Array; - extend(to: T, from: F): ( T & F ); - isObject(obj: any): boolean; - isPlainObject(obj: any): boolean; - isArray: typeof Array.isArray; - def(obj: Object, key: string, value: any, enumerable?: boolean): void; - debounce(func: Function, wait: number): Function; - indexOf(arr: Array, obj: T): number; - cancellable(fn: Function): Function; - looseEqual(a: any, b: any): boolean; - // util/env.js - hasProto: boolean; - inBrowser: boolean; - isIE9: boolean; - isAndroid: boolean; - transitionProp: string; - transitionEndEvent: string; - animationProp: string; - animationEndEvent: string; - nextTick(cb: Function, ctx?: Object): void; - // util/dom.js - query(el: string | Element): Element; - inDoc(node: Node): boolean; - getAttr(node: Node, _attr: string): string; - getBindAttr(node: Node, name: string): string; - before(el: Element, target: Element): void; - after(el: Element, target: Element): void; - remove(el: Element): void; - prepend(el: Element, target: Element): void; - replace(target: Element, el: Element): void; - on(el: Element, event: string, cb: Function): void; - off(el: Element, event: string, cb: Function): void; - addClass(el: Element, cls: string): void; - removeClass(el: Element, cls: string): void; - extractContent(el: Element, asFragment: boolean): ( HTMLDivElement | DocumentFragment ); - trimNode(node: Node): void; - isTemplate(el: Element): boolean; - createAnchor(content: string, persist: boolean): ( Comment | Text ); - findRef(node: Element): string; - mapNodeRange(node: Node, end: Node, op: Function): void; - removeNodeRange(start: Node, end: Node, vm: any, frag: DocumentFragment, cb: Function): void; - // util/options.js - mergeOptions(parent: P, child: C, vm?: any): ( P & C ); - resolveAsset(options: Object, type: string, id: string): ( Object | Function ); - assertAsset(val: any, type: string, id: string): void; - // util/component.js - commonTagRE: RegExp; - checkComponentAttr(el: Element, options?: Object): Object; - initProp(vm: Vue, prop: Object, value: any): void; - assertProp(prop: Object, value: any): boolean; - // util/debug.js - warn(msg: string, e?: Error): void; - // observer/index.js - defineReactive(obj: Object, key: string, val: any): void; - } - - // instance/api/global.js - interface VueStatic { - new(options?: any): Vue; - prototype: Vue; - util: VueUtil; - config: VueConfig; - set(object: Object, key: string, value: any): void; - delete(object: Object, key: string): void; - nextTick(callback: Function): any; - - cid: number; - - extend(options?: ComponentOption): VueStatic; - use(callback: Function | {install: Function, [key: string]: any}, option?: Object): VueStatic; - mixin(mixin: Object): void; - - directive(id: string, definition: T): T; - directive(id: string): any; - elementDirective(id: string, definition: T): T; - elementDirective(id: string): any; - filter(id: string, definition: T): T; - filter(id: string): any; - component(id: string, definition: ComponentOption): any; - component(id: string): any; - transition(id: string, hooks: T): T; - transition(id: string): TransitionOption; - partial(id: string, partial: string): string; - partial(id: string): string; - } + interface ComputedOption { + get(): any; + set(value: any): void; + } + + interface WatchOption { + handler(val: any, oldVal: any): void; + deep?: boolean; + immidiate?: boolean; + } + + interface DirectiveOption { + bind?(): any; + update?(newVal?: any, oldVal?: any): any; + unbind?(): any; + params?: string[]; + deep?: boolean; + twoWay?: boolean; + acceptStatement?: boolean; + priority?: number; + [key: string]: any; + } + + interface FilterOption { + read: Function; + write: Function; + } + + interface TransitionOption { + css?: boolean; + beforeEnter?(el: HTMLElement): void; + enter?(el: HTMLElement, done?: () => void): void; + afterEnter?(el: HTMLElement): void; + enterCancelled?(el: HTMLElement): void; + beforeLeave?(el: HTMLElement): void; + leave?(el: HTMLElement, done?: () => void): void; + afterLeave?(el: HTMLElement): void; + leaveCancelled?(el: HTMLElement): void; + stagger?(index: number): number; + } + + interface ComponentOption { + data?: {[key: string]: any } | Function; + props?: string[] | { [key: string]: PropOption }; + computed?: { [key: string]: ( Function | ComputedOption ) }; + methods?: { [key: string]: Function }; + watch?: { [key: string]: ( (val: any, oldVal: any) => void | string | WatchOption )}; + el?: string | HTMLElement | ( () => HTMLElement ); + template?: string; + replace?: boolean; + created?(): void; + beforeCompile?(): void; + compiled?(): void; + ready?(): void; + attached?(): void; + detached?(): void; + beforeDestroy?(): void; + destroyed?(): void; + activate?(): void; + directives?: { [key: string]: ( DirectiveOption | Function ) }; + elementDirectives?: { [key: string]: ( DirectiveOption | Function ) }; + filters?: { [key: string]: ( Function | FilterOption ) }; + components?: { [key: string]: ComponentOption }; + transitions?: { [key: string]: TransitionOption }; + partials?: { [key: string]: string }; + parent?: Vue; + events?: { [key: string]: ( (...args: any[]) => ( boolean | void ) ) | string }; + mixins?: ComponentOption[]; + name?: string; + [key: string]: any; + } + + // instance/api/data.js + interface $get { ( exp: string, asStatement?: boolean ): any; } + interface $set { ( key: string | number, value: T ): T; } + interface $delete { ( key: string) : void; } + interface $watch { ( expOrFn: string | Function, callback: ( (newVal: any, oldVal?: any) => any ) | string, options?: { deep?: boolean, immidiate?: boolean } ): Function; } + interface $eval { ( expression: string ): string; } + interface $interpolate { ( expression: string ): string; } + interface $log { ( keypath?: string ): void; } + // instance/api/dom.js + interface $nextTick { ( callback: Function ): void; } + interface $appendTo { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } + interface $prependTo { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } + interface $before { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } + interface $after { ( target: ( HTMLElement | string ), callback?: Function, withTransition?: boolean ): V; } + interface $remove { ( callback?: Function ): V; } + // instance/api/events.js + interface $on { (event: string, callback: Function): V; } + interface $once { (event: string, callback: Function): V; } + interface $off { (event?: string, callback?: Function): V; } + interface $emit { (event: string, ...args: any[]): V; } + interface $broadcast { (event: string, ...args: any[]): V; } + interface $dispatch { (event: string, ...args: any[]): V; } + // instance/api/lifecycle.js + interface $mount { ( elementOrSelector?: ( HTMLElement | string ) ): V; } + interface $destroy { (remove?: boolean): void; } + interface $compile { (el: Element | DocumentFragment, host?: Vue): Function; } + + interface Vue { + $data?: any; + $el?: HTMLElement; + $options?: Object; + $parent?: Vue; + $root?: Vue; + $children?: Vue[]; + $refs?: Object; + $els?: Object; + + $get?: $get; + $set?: $set; + $delete?: $delete; + $eval?: $eval; + $interpolate?: $interpolate; + $log?: $log; + $watch?: $watch; + $on?: $on; + $once?: $once; + $off?: $off; + $emit?: $emit; + $dispatch?: $dispatch; + $broadcast?: $broadcast; + $appendTo?: $appendTo; + $before?: $before; + $after?: $after; + $remove?: $remove; + $nextTick?: $nextTick; + $mount?: $mount; + $destroy?: $destroy; + $compile?: $compile; + + _init(options?: ComponentOption): void; + } + + interface VueConfig { + debug: boolean; + delimiters: [string, string]; + unsafeDelimiters: [string, string]; + silent: boolean; + async: boolean; + convertAllProperties: boolean; + } + + interface VueUtil { + // util/lang.js + set(obj: Object, key: string, value: any): void; + del(obj: Object, key: string): void; + hasOwn(obj: Object, key: string): boolean; + isLiteral(exp: string): boolean; + isReserved(str: string): boolean; + _toString(value: any): string; + toNumber(value: T): T | number; + toBoolean(value: T): T | boolean; + stripQuotes(str: string): string; + camelize(str: string): string; + hyphenate(str: string): string; + classify(str: string): string; + bind(fn: Function, ctx: Object): Function; + toAarray(list: ArrayLike, start?: number): Array; + extend(to: T, from: F): ( T & F ); + isObject(obj: any): boolean; + isPlainObject(obj: any): boolean; + isArray: typeof Array.isArray; + def(obj: Object, key: string, value: any, enumerable?: boolean): void; + debounce(func: Function, wait: number): Function; + indexOf(arr: Array, obj: T): number; + cancellable(fn: Function): Function; + looseEqual(a: any, b: any): boolean; + // util/env.js + hasProto: boolean; + inBrowser: boolean; + isIE9: boolean; + isAndroid: boolean; + transitionProp: string; + transitionEndEvent: string; + animationProp: string; + animationEndEvent: string; + nextTick(cb: Function, ctx?: Object): void; + // util/dom.js + query(el: string | Element): Element; + inDoc(node: Node): boolean; + getAttr(node: Node, _attr: string): string; + getBindAttr(node: Node, name: string): string; + before(el: Element, target: Element): void; + after(el: Element, target: Element): void; + remove(el: Element): void; + prepend(el: Element, target: Element): void; + replace(target: Element, el: Element): void; + on(el: Element, event: string, cb: Function): void; + off(el: Element, event: string, cb: Function): void; + addClass(el: Element, cls: string): void; + removeClass(el: Element, cls: string): void; + extractContent(el: Element, asFragment: boolean): ( HTMLDivElement | DocumentFragment ); + trimNode(node: Node): void; + isTemplate(el: Element): boolean; + createAnchor(content: string, persist: boolean): ( Comment | Text ); + findRef(node: Element): string; + mapNodeRange(node: Node, end: Node, op: Function): void; + removeNodeRange(start: Node, end: Node, vm: any, frag: DocumentFragment, cb: Function): void; + // util/options.js + mergeOptions(parent: P, child: C, vm?: any): ( P & C ); + resolveAsset(options: Object, type: string, id: string): ( Object | Function ); + assertAsset(val: any, type: string, id: string): void; + // util/component.js + commonTagRE: RegExp; + checkComponentAttr(el: Element, options?: Object): Object; + initProp(vm: Vue, prop: Object, value: any): void; + assertProp(prop: Object, value: any): boolean; + // util/debug.js + warn(msg: string, e?: Error): void; + // observer/index.js + defineReactive(obj: Object, key: string, val: any): void; + } + + // instance/api/global.js + interface VueStatic { + new(options?: ComponentOption): Vue; + prototype: Vue; + util: VueUtil; + config: VueConfig; + set(object: Object, key: string, value: any): void; + delete(object: Object, key: string): void; + nextTick(callback: Function): any; + + cid: number; + + extend(options?: ComponentOption): VueStatic; + use(callback: Function | {install: Function, [key: string]: any}, option?: Object): VueStatic; + mixin(mixin: Object): void; + + directive(id: string, definition: T): T; + directive(id: string): any; + elementDirective(id: string, definition: T): T; + elementDirective(id: string): any; + filter(id: string, definition: T): T; + filter(id: string): any; + component(id: string, definition: ComponentOption): any; + component(id: string): any; + transition(id: string, hooks: T): T; + transition(id: string): TransitionOption; + partial(id: string, partial: string): string; + partial(id: string): string; + } } declare var Vue: vuejs.VueStatic; declare module "vue" { - export default Vue; + export = Vue; } From 6d32913dc56b916ef69f916350ff9a04133466ed Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 10 Dec 2015 01:01:28 +0900 Subject: [PATCH 195/474] github-electron: Update header --- github-electron/github-electron.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 2d2363ccce..5bd8a44898 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1,7 +1,7 @@ -// Type definitions for Electron 0.25.2 (shared between main and rederer processes) +// Type definitions for Electron v0.35.0 // Project: http://electron.atom.io/ -// Definitions by: jedmao -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: jedmao , rhysd +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 624237a55346531ec0b6e9194895d36993eab051 Mon Sep 17 00:00:00 2001 From: Adam Babcock Date: Thu, 10 Dec 2015 09:34:27 -0600 Subject: [PATCH 196/474] Add containDeepOrdered --- should/should-tests.ts | 7 +++++++ should/should.d.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/should/should-tests.ts b/should/should-tests.ts index c940f7c13b..43b21d0efc 100644 --- a/should/should-tests.ts +++ b/should/should-tests.ts @@ -172,3 +172,10 @@ obj.should.have.keys('foo', 'bar'); obj.should.have.keys(['foo', 'bar']); (1).should.eql(0, 'some useful description'); + +[ 1, 2, 3].should.containDeepOrdered([1, 2]); +[ 1, 2, [ 1, 2, 3 ]].should.containDeepOrdered([ 1, [ 2, 3 ]]); + +({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({a: 10}); +({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({b: {c: 10}}); +({ a: 10, b: { c: 10, d: [1, 2, 3] }}).should.containDeepOrdered({b: {d: [1, 3]}}); diff --git a/should/should.d.ts b/should/should.d.ts index ba32f571b6..26a42d7edc 100644 --- a/should/should.d.ts +++ b/should/should.d.ts @@ -64,6 +64,7 @@ interface ShouldAssertion { contain(obj: any): ShouldAssertion; containEql(obj: any): ShouldAssertion; containDeep(obj: any): ShouldAssertion; + containDeepOrdered(obj: any): ShouldAssertion; keys(...allKeys: string[]): ShouldAssertion; keys(allKeys: string[]): ShouldAssertion; header(field: string, val?: string): ShouldAssertion; From 07deed85edf73b0d794db713559eb9a4f1f476ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e?= Date: Thu, 10 Dec 2015 19:16:01 +0100 Subject: [PATCH 197/474] Fix electron.nativeImage's type --- github-electron/github-electron.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 7c5fa8b4d6..48f893d06b 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1700,7 +1700,7 @@ declare module GitHubElectron { interface Electron { clipboard: GitHubElectron.Clipboard; crashReporter: GitHubElectron.CrashReporter; - nativeImage: GitHubElectron.NativeImage; + nativeImage: typeof GitHubElectron.NativeImage; screen: GitHubElectron.Screen; shell: GitHubElectron.Shell; remote: GitHubElectron.Remote; From 2e21448655e5819dce96ad255a9f119f5a6fd982 Mon Sep 17 00:00:00 2001 From: phiresky Date: Mon, 21 Sep 2015 00:45:56 +0200 Subject: [PATCH 198/474] add wu typings --- wu/wu-tests.ts | 411 +++++++++++++++++++++++++++++++++++++++ wu/wu-tests.ts.tscparams | 1 + wu/wu.d.ts | 117 +++++++++++ wu/wu.d.ts.tscparams | 1 + 4 files changed, 530 insertions(+) create mode 100644 wu/wu-tests.ts create mode 100644 wu/wu-tests.ts.tscparams create mode 100644 wu/wu.d.ts create mode 100644 wu/wu.d.ts.tscparams diff --git a/wu/wu-tests.ts b/wu/wu-tests.ts new file mode 100644 index 0000000000..c207820303 --- /dev/null +++ b/wu/wu-tests.ts @@ -0,0 +1,411 @@ +// adapted from `cat wu.js/test/* |sed '/= require/d'> wu-tests.ts` +/// +declare var describe: any, it: any, mocha: any, assert: { + iterable:any; + eqSet(expected:Set, actual: Iterable): any; + ok:any; + equal(x:T, y:T): any; + eqArray(x:T[], y:Iterable): any; + deepEqual(x:T, y:T): any; +} + +// Helper for asserting that the given thing is iterable. +assert.iterable = thing => { + assert.ok(wu(thing)); +}; + +// Helper for asserting that all the elements yielded from the |actual| +// iterator are in the |expected| set. +assert.eqSet = (expected, actual) => { + assert.iterable(actual); + for (var x of actual) { + assert.ok(expected.has(x)); + expected.delete(x); + } +}; + +// Helper for asserting that all the elements yielded from the |actual| +// iterator are equal to and in the same order as the elements of the +// |expected| array. +assert.eqArray = (expected, actual) => { + assert.iterable(actual); + assert.deepEqual(expected, [...actual]); +}; + +mocha.setup('bdd'); +describe("wu.asyncEach", () => { + it("should iterate over each item", () => { + const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + let n = 0; + + return wu(arr) + .asyncEach(x => { + n++; + const start = Date.now(); + while (Date.now() - start <= 3) { + // Kill time. + } + }, 3) + .then(() => { + assert.equal(n, arr.length); + }); + }); +}); +describe("wu.chain", () => { + it("should concatenate iterables", () => { + assert.eqArray([1, 2, 3, 4, 5, 6], + wu.chain([1, 2], [3, 4], [5, 6])); + }); +}); +describe("wu.chunk", () => { + it("should chunk items into tuples", () => { + assert.eqArray([[1,2,3], [4,5,6]], + wu.chunk(3, [1,2,3,4,5,6])); + }); +}); +describe("wu.concatMap", () => { + it("should map the function over the iterable and concatenate results", () => { + assert.eqArray([1, 1, 2, 4, 3, 9], + wu.concatMap(x => [x, x * x], [1, 2, 3])); + }); +}); +describe("wu.count", () => { + it("should keep incrementing", () => { + const count = wu.count(); + assert.equal(count.next().value, 0); + assert.equal(count.next().value, 1); + assert.equal(count.next().value, 2); + assert.equal(count.next().value, 3); + assert.equal(count.next().value, 4); + assert.equal(count.next().value, 5); + }); + + it("should start at the provided number", () => { + const count = wu.count(5); + assert.equal(count.next().value, 5); + assert.equal(count.next().value, 6); + assert.equal(count.next().value, 7); + }); + + it("should increment by the provided step", () => { + const count = wu.count(0, 2); + assert.equal(count.next().value, 0); + assert.equal(count.next().value, 2); + assert.equal(count.next().value, 4); + }); +}); +describe("wu.curryable", () => { + it("should wait until its given enough arguments", () => { + var f = wu.curryable((a, b) => a + b); + + var f0 = f()()()()(); + assert.equal(typeof f0, "function"); + + var f1 = f(1); + assert.equal(typeof f1, "function"); + assert.equal(f1(2), 3); + }); + + it("should just call the function when given enough arguments", () => { + var f = wu.curryable((a, b) => a + b); + assert.equal(f(1, 2), 3); + }); + + it("should expect the number of arguments we tell it to", () => { + var f = wu.curryable((...args) => 5, 5); + assert.equal(typeof f(1, 2, 3, 4), "function"); + assert.equal(f(1, 2, 3, 4, 5), 5); + }); +}); +describe("wu.cycle", () => { + it("should keep yielding items from the original iterable", () => { + let i = 0; + const arr = [1, 2, 3]; + for (let x of wu.cycle(arr)) { + assert.equal(x, arr[i % 3]); + if (i++ > 9) { + break; + } + } + }); +}); +describe("wu.drop", () => { + it("should drop the number of items specified", () => { + const count = wu.count().drop(5); + assert.equal(count.next().value, 5); + }); +}); +describe("wu.dropWhile", () => { + it("should drop items while the predicate is true", () => { + const count = wu.dropWhile(x => x < 5, wu.count()); + assert.equal(count.next().value, 5); + }); +}); +describe("wu.entries", () => { + it("should iterate over entries", () => { + const expected = new Map([["foo", 1], ["bar", 2], ["baz", 3]]); + for (let [k, v] of wu.entries({ foo: 1, bar: 2, baz: 3 })) { + assert.equal(expected.get(k), v); + } + }); +}); +describe("wu.enumerate", () => { + it("should yield items with their index", () => { + assert.eqArray([["a", 0], ["b", 1], ["c", 2]], + wu.enumerate("abc")); + }); +}); +describe("wu.every", () => { + it("should return true when the predicate succeeds for all items", () => { + assert.equal(true, wu.every(x => typeof x === "number", [1, 2, 3])); + }); + + it("should return false when the predicate fails for any item", () => { + assert.equal(false, wu.every(x => typeof x === "number", [1, 2, "3"])); + }); +}); +describe("wu.filter", () => { + it("should filter based on the predicate", () => { + assert.eqArray(["a", "b", "c"], + wu.filter(x => typeof x === "string", + [1, "a", true, "b", {}, "c"])); + }); +}); +describe("wu.find", () => { + it("should return the first item that matches the predicate", () => { + assert.deepEqual({ name: "rza" }, + wu.find(x => !!x.name.match(/.za$/), + [{ name: "odb" }, + { name: "method man" }, + { name: "rza" }, + { name: "gza" }])); + }); + + it("should return undefined if no items match the predicate", () => { + assert.equal(undefined, + wu.find(x => (x) === "raekwon", + [{ name: "odb" }, + { name: "method man" }, + { name: "rza" }, + { name: "gza" }])); + }); +}); +describe("wu.flatten", () => { + it("should flatten iterables", () => { + assert.eqArray(["I", "like", "LISP"], + wu(["I", ["like", ["LISP"]]]).flatten()); + }); + + it("should shallowly flatten iterables", () => { + assert.eqArray([1, 2, 3, [[4]]], + wu.flatten(true, [1, [2], [3, [[4]]]])); + }); +}); +describe("wu.forEach", () => { + it("should iterate over every item", () => { + const items = []; + wu.forEach(x => items.push(x), [1,2,3]); + assert.eqArray([1,2,3], items); + }); +}); +describe("wu.has", () => { + it("should return true if the item is in the iterable", () => { + assert.ok(wu.has(3, [1,2,3])); + }); + + it("should return false if the item is not in the iterable", () => { + assert.ok(!wu.has("36 chambers", [1,2,3])); + }); +}); +describe("wu.invoke", () => { + it("should yield the method invokation on each item", () => { + function Greeter(name) { + this.name = name + } + Greeter.prototype.greet = function (tail) { + return "hello " + this.name + tail; + }; + assert.eqArray(["hello world!", "hello test!"], + wu.invoke("greet", "!", + [new Greeter("world"), new Greeter("test")])); + }); +}); +describe("wu.keys", () => { + it("should iterate over keys", () => { + assert.eqSet(new Set(["foo", "bar", "baz"]), + wu.keys({ foo: 1, bar: 2, baz: 3 })); + }); +}); +describe("wu.map", () => { + it("should map the function over the iterable", () => { + assert.eqArray([1, 4, 9], + wu.map(x => x * x, [1, 2, 3])); + }); +}); +describe("wu.pluck", () => { + it("should access the named property of each item in the iterable", () => { + assert.eqArray([1, 2, 3], + wu.pluck("i", [{ i: 1 }, { i: 2 }, { i: 3 }])); + }); +}); +describe("wu.reduce", () => { + it("should reduce the iterable with the function", () => { + assert.equal(6, wu([1,2,3]).reduce((x, y) => x + y)); + }); + + it("should accept an initial state for the reducer function", () => { + assert.equal(16, wu.reduce((x, y) => x + y, 10, [1,2,3])); + }); +}); +describe("wu.reductions", () => { + it("should yield the intermediate reductions of the iterable", () => { + assert.eqArray([1, 3, 6], + wu.reductions((x, y) => x + y, undefined, [1, 2, 3])); + }); +}); +describe("wu.reject", () => { + it("should yield items for which the predicate is false", () => { + assert.eqArray([1, true, {}], + wu.reject(x => typeof x === "string", + [1, "a", true, "b", {}, "c"])); + }); +}); +describe("wu.repeat", () => { + it("should keep yielding its item", () => { + const repeat = wu.repeat(3); + assert.equal(repeat.next().value, 3); + assert.equal(repeat.next().value, 3); + assert.equal(repeat.next().value, 3); + assert.equal(repeat.next().value, 3); + assert.equal(repeat.next().value, 3); + assert.equal(repeat.next().value, 3); + assert.equal(repeat.next().value, 3); + }); + + it("should repeat n times", () => { + const repeat = wu.repeat(3, 2); + assert.equal(repeat.next().value, 3); + assert.equal(repeat.next().value, 3); + assert.equal(repeat.next().value, undefined); + assert.equal(repeat.next().done, true); + }); +}); +describe("wu.slice", () => { + it("should slice the front of iterables", () => { + assert.eqArray([3, 4, 5], + wu.slice(3, undefined, [0, 1, 2, 3, 4, 5])); + }); + + it("should slice the end of iterables", () => { + assert.eqArray([0, 1, 2], + wu.slice(undefined, + 3, + [0, 1, 2, 3, 4, 5])); + }); +}); +describe("wu.some", () => { + it("should return true if any item matches the predicate", () => { + assert.ok(wu.some(x => x % 2 === 0, [1,2,3])); + }); + + it("should return false if no items match the predicate", () => { + assert.ok(!wu.some(x => x % 5 === 0, [1,2,3])); + }); +}); +describe("wu.spreadMap", () => { + it("should map the function over the iterable with spread arguments", () => { + assert.eqArray([32, 9, 1000], + wu.spreadMap(Math.pow, [[2, 5], [3, 2], [10, 3]])); + }); +}); +describe("wu.take", () => { + it("should yield as many items as requested", () => { + assert.eqArray([0, 1, 2, 3, 4], + wu.take(5, wu.count())); + }); +}); +describe("wu.takeWhile", () => { + it("should keep yielding items from the iterable until the predicate is false", () => { + assert.eqArray([0, 1, 2, 3, 4], + wu.takeWhile(x => x < 5, wu.count())); + }); +}); +describe("wu.tap", () => { + it("should perform side effects and yield the original item", () => { + let i = 0; + assert.eqArray([1, 2, 3], + wu.tap(x => i++, [1, 2, 3])); + assert.equal(i, 3); + }); +}); +describe("wu.tee", () => { + it("should clone iterables", () => { + const factorials = wu(wu.count(1)).reductions((a, b) => a * b); + const [i1, i2] = wu(factorials).tee(); + + assert.equal(i1.next().value, 1); + assert.equal(i1.next().value, 2); + assert.equal(i1.next().value, 6); + assert.equal(i1.next().value, 24); + + assert.equal(i2.next().value, 1); + assert.equal(i2.next().value, 2); + assert.equal(i2.next().value, 6); + assert.equal(i2.next().value, 24); + }); +}); +describe("wu.unique", () => { + it("should yield only the unique items from the iterable", () => { + assert.eqArray([1, 2, 3], + wu.unique([1,1,2,2,1,1,3,3])); + }); +}); +describe("wu.unzip", () => { + it("should create iterables from zipped items", () => { + const pairs = [ + ["one", 1], + ["two", 2], + ["three", 3] + ]; + const [i1, i2] = wu(pairs).unzip(); + assert.eqArray(["one", "two", "three"], [...i1]); + assert.eqArray([1, 2, 3], [...i2]); + }); +}); +describe("wu.values", () => { + it("should iterate over values", () => { + assert.eqSet(new Set([1, 2, 3]), + wu.values({ foo: 1, bar: 2, baz: 3 })); + }); +}); +describe("wu.zip", () => { + it("should zip two iterables together", () => { + assert.eqArray([["a", 1], ["b", 2], ["c", 3]], + wu.zip("abc", [1, 2, 3])); + }); + + it("should stop with the shorter iterable", () => { + assert.eqArray([["a", 1], ["b", 2], ["c", 3]], + wu.zip("abc", wu.count(1))); + }); +}); +describe("wu.zipLongest", () => { + it("should stop with the longer iterable", () => { + const arr1 = []; + arr1[1] = 2; + const arr2 = []; + arr2[1] = 3; + assert.eqArray([["a", 1], arr1, arr2], + wu.zipLongest("a", [1, 2, 3])); + }); +}); +describe("wu.zipWith", () => { + it("should spread map over the zipped iterables", () => { + const add3 = (a, b, c) => a + b + c; + assert.eqArray([12, 15, 18], + wu.zipWith(add3, + [1, 2, 3], + [4, 5, 6], + [7, 8, 9])); + }); +}); diff --git a/wu/wu-tests.ts.tscparams b/wu/wu-tests.ts.tscparams new file mode 100644 index 0000000000..14fce22a5c --- /dev/null +++ b/wu/wu-tests.ts.tscparams @@ -0,0 +1 @@ +--target ES6 diff --git a/wu/wu.d.ts b/wu/wu.d.ts new file mode 100644 index 0000000000..61a0e6e97c --- /dev/null +++ b/wu/wu.d.ts @@ -0,0 +1,117 @@ +// Type definitions for wu.js v2.1.0 +// Project: http://backbonejs.org/ +// Definitions by: phiresky +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Wu { + type Consumer = (t: T) => void; + type Filter = (t: T) => boolean; + + export interface WuStatic { + (iterable: Iterable): WuIterable; + // only static + chain(...iters: Iterable[]): WuIterable; + count(start?: number, step?: number): WuIterable; + curryable(fun: (...x: any[]) => T, expected?: number): any; + entries(obj: { [i: string]: T }): WuIterable<[string, T]>; + keys(obj: { [i: string]: T }): WuIterable; + values(obj: { [i: string]: T }): WuIterable; + repeat(obj: T, times?: number): WuIterable; + // also copied to WuInterface + asyncEach(fn: Consumer, maxBlock?: number, timeout?: number): void; + drop(n: number, iter: Iterable): WuIterable; + dropWhile(fn: Filter, iter: Iterable): WuIterable; + cycle(iter: Iterable): Iterable; + chunk(n: number, iter: Iterable): WuIterable; + concatMap(fn: (t: T) => Iterable, iter: Iterable): WuIterable; + dropWhile(fn: Filter, iter: Iterable): WuIterable; + enumerate(iter: Iterable): Iterable<[number, T]>; + every(fn: Filter, iter: Iterable): boolean; + filter(fn: Filter, iter: Iterable): WuIterable; + find(fn: Filter, iter: Iterable): T; + flatten(iter: Iterable): WuIterable; + flatten(shallow: boolean, iter: Iterable): WuIterable; + forEach(fn: Consumer, iter: Iterable): void; + has(t: T, iter: Iterable): boolean; + // invoke(name:string, ...t:T[], iter: Iterable<(t:T)=>U>): WuIterable; + invoke: any; + map(fn: (t: T) => U, iter: Iterable): WuIterable; + // pluck(attribute:string, iter: Iterable<{[attribute]: T}>): WuIterable; + pluck(attribute: string, iter: Iterable): WuIterable; + reduce(fn: (a: T, b: T) => T, iter: Iterable): T; + reduce(fn: (a: T, b: T) => T, initial: T, iter: Iterable): T; + reduce(fn: (a: U, b: T) => U, iter: Iterable): U; + reduce(fn: (a: U, b: T) => U, initial: U, iter: Iterable): U; + reductions(fn: (a: T, b: T) => T, iter: Iterable): WuIterable; + reductions(fn: (a: T, b: T) => T, initial: T, iter: Iterable): WuIterable; + reductions(fn: (a: U, b: T) => U, iter: Iterable): WuIterable; + reductions(fn: (a: U, b: T) => U, initial: U, iter: Iterable): WuIterable; + reject(fn: Filter, iter: Iterable): WuIterable; + slice(iter: Iterable): WuIterable; + slice(start: number, iter: Iterable): WuIterable; + slice(start: number, stop: number, iter: Iterable): WuIterable; + some(fn: Filter, iter: Iterable): WuIterable; + spreadMap(fn: (...x: any[]) => T, iter: Iterable): WuIterable; + take(n: number, iter: Iterable): WuIterable; + takeWhile(fn: Filter, iter: Iterable): WuIterable; + tap(fn: Consumer, iter: Iterable): WuIterable; + unique(iter: Iterable): WuIterable; + zip(iter2: Iterable, iter: Iterable): WuIterable<[T, U]>; + zipLongest(iter2: Iterable, iter: Iterable): WuIterable<[T, U]>; + zipWith: any; + unzip: any; + tee(iter: Iterable): WuIterable[]; + tee(n: number, iter: Iterable): WuIterable[]; + } + export interface WuIterable extends IterableIterator { + // generated from section "copied to WuIterable" above via + // sed -r 's/(, )?iter: Iterable<\w+>//' | + // sed -r 's/^(\s+\w+)/\1/' | + // sed -r 's/^(\s+\w+)(fn: Consumer, maxBlock?: number, timeout?: number): any; + drop(n: number): WuIterable; + dropWhile(fn: Filter): WuIterable; + cycle(): Iterable; + chunk(n: number): WuIterable; + concatMap(fn: (t: T) => Iterable): WuIterable; + dropWhile(fn: Filter): WuIterable; + enumerate(): Iterable<[number, T]>; + every(fn: Filter): boolean; + filter(fn: Filter): WuIterable; + find(fn: Filter): T; + flatten(): WuIterable; + flatten(shallow: boolean): WuIterable; + forEach(fn: Consumer): void; + has(t: T): boolean; + // invoke(name:string, ...t:T[], iter: Iterable<(t:T)=>U>): WuIterable; + invoke: any; + map(fn: (t: T) => U): WuIterable; + // pluck(attribute:string, iter: Iterable<{[attribute]: T}>): WuIterable; + pluck(attribute: string): WuIterable; + reduce(fn: (a: T, b: T) => T): T; + reduce(fn: (a: T, b: T) => T, initial: T): T; + reduce(fn: (a: U, b: T) => U): U; + reduce(fn: (a: U, b: T) => U, initial: U): U; + reductions(fn: (a: T, b: T) => T): WuIterable; + reductions(fn: (a: T, b: T) => T, initial: T): WuIterable; + reductions(fn: (a: U, b: T) => U): WuIterable; + reductions(fn: (a: U, b: T) => U, initial: U): WuIterable; + reject(fn: Filter): WuIterable; + slice(): WuIterable; + slice(start: number): WuIterable; + slice(start: number, stop: number): WuIterable; + some(fn: Filter): WuIterable; + spreadMap(fn: (...x: any[]) => T, iter: Iterable): WuIterable; + take(n: number): WuIterable; + takeWhile(fn: Filter): WuIterable; + tap(fn: Consumer): WuIterable; + unique(): WuIterable; + zip(iter2: Iterable): WuIterable<[T, U]>; + zipLongest(iter2: Iterable): WuIterable<[T, U]>; + zipWith: any; + unzip: any; + tee(): WuIterable[]; + tee(n: number): WuIterable[]; + } +} +declare var wu: Wu.WuStatic; diff --git a/wu/wu.d.ts.tscparams b/wu/wu.d.ts.tscparams new file mode 100644 index 0000000000..14fce22a5c --- /dev/null +++ b/wu/wu.d.ts.tscparams @@ -0,0 +1 @@ +--target ES6 From 9d54d10a8847504e6009c15aba5244942941b6d8 Mon Sep 17 00:00:00 2001 From: Alexander <4nonym0us@xakep.ru> Date: Thu, 10 Dec 2015 21:09:58 +0200 Subject: [PATCH 199/474] Raact to Ionic 1.2 release https://github.com/driftyco/ionic/pull/4613/files --- ionic/ionic.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index bb009df513..ce097a2265 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -343,6 +343,7 @@ declare module ionic { select(index: number): void; selectedIndex(): number; $getByHandle(handle: string): IonicTabsDelegate; + showBar(show?: boolean): boolean; } } module utility { From 4a61f4eccd1f334ac07c24f68e8668b7e7913f37 Mon Sep 17 00:00:00 2001 From: Nax Date: Thu, 10 Dec 2015 20:18:16 +0100 Subject: [PATCH 200/474] Added socketty v0.2.2 --- socketty/socketty.d.ts | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 socketty/socketty.d.ts diff --git a/socketty/socketty.d.ts b/socketty/socketty.d.ts new file mode 100644 index 0000000000..9cbbeeef9d --- /dev/null +++ b/socketty/socketty.d.ts @@ -0,0 +1,57 @@ +// Type definitions for Socketty v0.2.2 +// Project: https://www.npmjs.com/package/socketty +// Definitions by: Nax +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare var socketty: Socketty; + +declare module 'socketty' { + export = socketty; +} + +interface Socketty { + /** + * Connect to a socketty server. + * @param url The server url + * @param callback The callback to be run when the connection is open + * @return A Socket + */ + connect(url: string, callback: (SockettySocket) => void): SockettySocket; + + /** + * Create a socketty server. + * @param httpServer The HTTP server to use + * @return A socketty server + */ + createServer(httpServer: any): void; +} + +interface SockettySocket { + /** + * Listen for an action. + * @param action The action to listen to + * @param callback A callback to be run when the action is fired + */ + on(action: string, callback: (any?) => void): void; + + /** + * Send an action, as well as an optional message. + * @param action The action to send + * @param message The message to send + */ + send(action: string, message?: any): void; + + /** + * Specify a callback to be run when the socket is disconnected. + * @param callback The disconnect callback + */ + disconnect(callback: () => void): void; +} + +interface SockettyServer { + /** + * Specify a callback to be run when a new socket connects to the server. + * @param callback The callback + */ + connection(callback: (SockettySocket) => void): void; +} From 6f04aca222d233a4c610b5020a09c760140d33f5 Mon Sep 17 00:00:00 2001 From: Nax Date: Thu, 10 Dec 2015 20:39:16 +0100 Subject: [PATCH 201/474] Fixed typescript errors and added tests --- socketty/socketty-tests.ts | 24 ++++++++++++++++++++++++ socketty/socketty.d.ts | 8 ++++---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 socketty/socketty-tests.ts diff --git a/socketty/socketty-tests.ts b/socketty/socketty-tests.ts new file mode 100644 index 0000000000..22809a6b06 --- /dev/null +++ b/socketty/socketty-tests.ts @@ -0,0 +1,24 @@ +/// + +/* Server */ + +var httpServer = {}; // Assume it's a real HTTP server object + +var webSocketServer = socketty.createServer(httpServer); + +webSocketServer.connection((socket: SockettySocket) => { + console.log('Client connected'); + socket.on('msg', (message?: any) => { + console.log('Client said' + message); + }); + socket.disconnect(() => { + console.log('Goodbye, client!'); + }); +}); + +/* Client */ + +socketty.connect('ws://localhost:8080', (socket: SockettySocket) => { + console.log('Connected !'); + socket.send('msg', 'Hello server!'); +}); diff --git a/socketty/socketty.d.ts b/socketty/socketty.d.ts index 9cbbeeef9d..da7f825071 100644 --- a/socketty/socketty.d.ts +++ b/socketty/socketty.d.ts @@ -16,14 +16,14 @@ interface Socketty { * @param callback The callback to be run when the connection is open * @return A Socket */ - connect(url: string, callback: (SockettySocket) => void): SockettySocket; + connect(url: string, callback: (socket: SockettySocket) => void): SockettySocket; /** * Create a socketty server. * @param httpServer The HTTP server to use * @return A socketty server */ - createServer(httpServer: any): void; + createServer(httpServer: any): SockettyServer; } interface SockettySocket { @@ -32,7 +32,7 @@ interface SockettySocket { * @param action The action to listen to * @param callback A callback to be run when the action is fired */ - on(action: string, callback: (any?) => void): void; + on(action: string, callback: (message?: any) => void): void; /** * Send an action, as well as an optional message. @@ -53,5 +53,5 @@ interface SockettyServer { * Specify a callback to be run when a new socket connects to the server. * @param callback The callback */ - connection(callback: (SockettySocket) => void): void; + connection(callback: (socket: SockettySocket) => void): void; } From c48c6ff985ad6c2dc12976c86fc959bf56bad48c Mon Sep 17 00:00:00 2001 From: Samuel Reed Date: Thu, 10 Dec 2015 13:42:29 -0600 Subject: [PATCH 202/474] Fix Bluebird nodeify() when not passed callback .nodeify() will return the Promise it was called on, not void, when no callback is passed. --- bluebird/bluebird.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index da3b9902a3..f3420957a3 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -117,7 +117,7 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { * Returns back this promise instead of creating a new one. If the `callback` argument is not a function, this method does not do anything. */ nodeify(callback: (err: any, value?: R) => void, options?: Promise.SpreadOption): Promise; - nodeify(...sink: any[]): void; + nodeify(...sink: any[]): Promise; /** * Marks this promise as cancellable. Promises by default are not cancellable after v0.11 and must be marked as such for `.cancel()` to have any effect. Marking a promise as cancellable is infectious and you don't need to remark any descendant promise. From be2e3466d4007b38209664d0508ab23181886e56 Mon Sep 17 00:00:00 2001 From: Alexander <4nonym0us@xakep.ru> Date: Thu, 10 Dec 2015 22:55:08 +0200 Subject: [PATCH 203/474] Adding tests for $ionicTabsDelegate.showBar() --- ionic/ionic-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ionic/ionic-tests.ts b/ionic/ionic-tests.ts index c68846715e..9c5cfdad0c 100644 --- a/ionic/ionic-tests.ts +++ b/ionic/ionic-tests.ts @@ -360,6 +360,8 @@ class IonicTestController { this.$ionicTabsDelegate.select(1); var selectedIndex: number = this.$ionicTabsDelegate.selectedIndex(); var ionicTabsDelegate: ionic.tabs.IonicTabsDelegate = this.$ionicTabsDelegate.$getByHandle("handle"); + this.$ionicTabsDelegate.showBar(true); + var isBarShown: boolean = this.$ionicTabsDelegate.showBar(); } private testUtility(): void { var {top: number, left: number, width: number, height: number} = this.$ionicPositionService.position(angular.element("body")); From d84ba2d2c36776b81a954ad2b84cefb560dc2cd9 Mon Sep 17 00:00:00 2001 From: stunaz Date: Thu, 10 Dec 2015 19:55:49 -0500 Subject: [PATCH 204/474] =?UTF-8?q?-=20Added=20namespace=20=E2=80=98Loadin?= =?UTF-8?q?gBar=E2=80=99=20-=20Added=20loadingBar=20interface=20Definition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../angular-loading-bar-tests.ts | 10 +++++++ angular-loading-bar/angular-loading-bar.d.ts | 26 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/angular-loading-bar/angular-loading-bar-tests.ts b/angular-loading-bar/angular-loading-bar-tests.ts index b7ca2894ea..6acdfa6d5b 100644 --- a/angular-loading-bar/angular-loading-bar-tests.ts +++ b/angular-loading-bar/angular-loading-bar-tests.ts @@ -13,3 +13,13 @@ class TestController { } app.controller('TestController', TestController); + + + +var barConfig: angular.loadingBar.ILoadingBarProvider[] = []; +barConfig.push({ + includeSpinner: true, + includeBar: true, + spinnerTemplate: 'template', + latencyThreshold: 100 +}); diff --git a/angular-loading-bar/angular-loading-bar.d.ts b/angular-loading-bar/angular-loading-bar.d.ts index b1a8cd55df..d026db098b 100644 --- a/angular-loading-bar/angular-loading-bar.d.ts +++ b/angular-loading-bar/angular-loading-bar.d.ts @@ -6,7 +6,7 @@ /// -declare module angular { +declare module angular.loadingBar { interface IRequestShortcutConfig { /** @@ -15,4 +15,26 @@ declare module angular { ignoreLoadingBar?: boolean; } -} \ No newline at end of file + interface ILoadingBarProvider{ + /** + * Turn the spinner on or off + */ + includeSpinner?: boolean; + + /** + * Turn the loading bar on or off + */ + includeBar?: boolean; + + /** + * HTML template + */ + spinnerTemplate?: string; + + /** + * Latency Threshold + */ + latencyThreshold?: number; + } + +} From 79e875c9566e3da496fe68292d11700f2bc9a6af Mon Sep 17 00:00:00 2001 From: Artem Berezin Date: Fri, 11 Dec 2015 11:13:32 +0900 Subject: [PATCH 205/474] Update angular-resource.d.ts --- angularjs/angular-resource.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 442d8fa608..fca03678f6 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -141,7 +141,7 @@ declare module angular.resource { /** * Really just a regular Array object with $promise and $resolve attached to it */ - interface IResourceArray extends Array> { + interface IResourceArray extends Array> { /** the promise of the original server interaction that created this collection. **/ $promise : angular.IPromise>; $resolved : boolean; From 7238dde0a51c96f6c3d0fbde772d9f510a59050c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 11 Dec 2015 09:43:45 +0500 Subject: [PATCH 206/474] lodash: signatures of _.debounce have been changed --- lodash/lodash-tests.ts | 56 ++++++++++++++++++--------- lodash/lodash.d.ts | 87 +++++++++++++++++++++++++----------------- 2 files changed, 90 insertions(+), 53 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index b4528be6d4..2d244b16e5 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4811,28 +4811,50 @@ curryResult7 = _.curryRight(testCurry2)(true)(2); curryResult8 = _.curryRight(testCurry2)(true); curryResult9 = _.curryRight(testCurry2); -declare var source: any; -result = _.debounce(function () { }, 150); +// _.debounce +module TestDebounce { + interface SampleFunc { + (n: number, s: string): boolean; + } -jQuery('#postbox').on('click', _.debounce(function () { }, 300, { - 'leading': true, - 'trailing': false -})); + interface Options { + leading?: boolean; + maxWait?: number; + trailing?: boolean; + } -source.addEventListener('message', _.debounce(function () { }, 250, { - 'maxWait': 1000 -}), false); + interface ResultFunc { + (n: number, s: string): boolean; + cancel(): void; + } -result = <_.LoDashImplicitObjectWrapper>_(function () { }).debounce(150); + let func: SampleFunc; + let options: Options; -jQuery('#postbox').on('click', <_.LoDashImplicitObjectWrapper>_(function () { }).debounce(300, { - 'leading': true, - 'trailing': false -})); + { + let result: ResultFunc; -source.addEventListener('message', <_.LoDashImplicitObjectWrapper>_(function () { }).debounce(250, { - 'maxWait': 1000 -}), false); + result = _.debounce(func); + result = _.debounce(func, 42); + result = _.debounce(func, 42, options); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).debounce(); + result = _(func).debounce(42); + result = _(func).debounce(42, options); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().debounce(); + result = _(func).chain().debounce(42); + result = _(func).chain().debounce(42, options); + } +} // _.defer module TestDefer { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index f44d3f63fe..8425f1d823 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -8380,54 +8380,69 @@ declare module _ { } //_.debounce + interface DebounceSettings { + /** + * Specify invoking on the leading edge of the timeout. + */ + leading?: boolean; + + /** + * The maximum time func is allowed to be delayed before it’s invoked. + */ + maxWait?: number; + + /** + * Specify invoking on the trailing edge of the timeout. + */ + trailing?: boolean; + } + 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 - * 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 - * timeout. - * @param func The function to debounce. - * @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.trailing Specify execution on the trailing edge of the timeout. - * @return The new debounced function. - **/ + * Creates a debounced function that delays invoking func until after wait milliseconds have elapsed since + * the last time the debounced function was invoked. The debounced function comes with a cancel method to + * cancel delayed invocations. 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 return the + * result of the last func invocation. + * + * Note: If leading and trailing options are true, func is invoked on the trailing edge of the timeout only + * if the the debounced function is invoked more than once during the wait timeout. + * + * See David Corbacho’s article for details over the differences between _.debounce and _.throttle. + * + * @param func The function to debounce. + * @param wait The number of milliseconds to delay. + * @param options The options object. + * @param options.leading Specify invoking on the leading edge of the timeout. + * @param options.maxWait The maximum time func is allowed to be delayed before it’s invoked. + * @param options.trailing Specify invoking on the trailing edge of the timeout. + * @return Returns the new debounced function. + */ debounce( func: T, - wait: number, - options?: DebounceSettings): T; + wait?: number, + options?: DebounceSettings + ): T & Cancelable; } interface LoDashImplicitObjectWrapper { /** - * @see _.debounce - **/ + * @see _.debounce + */ debounce( - wait: number, - options?: DebounceSettings): LoDashImplicitObjectWrapper; + wait?: number, + options?: DebounceSettings + ): LoDashImplicitObjectWrapper; } - interface DebounceSettings { + interface LoDashExplicitObjectWrapper { /** - * Specify execution on the leading edge of the timeout. - **/ - leading?: boolean; - - /** - * The maximum time func is allowed to be delayed before it's called. - **/ - maxWait?: number; - - /** - * Specify execution on the trailing edge of the timeout. - **/ - trailing?: boolean; + * @see _.debounce + */ + debounce( + wait?: number, + options?: DebounceSettings + ): LoDashExplicitObjectWrapper; } //_.defer From e1fa07aaf86dbf299bf4999d613ea76a8fa63540 Mon Sep 17 00:00:00 2001 From: hadriandeoliveira Date: Fri, 11 Dec 2015 03:48:23 -0200 Subject: [PATCH 207/474] added LeState type definitions --- lestate/lestate-tests.ts | 20 ++++++++++++++++++++ lestate/lestate.d.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 lestate/lestate-tests.ts create mode 100644 lestate/lestate.d.ts diff --git a/lestate/lestate-tests.ts b/lestate/lestate-tests.ts new file mode 100644 index 0000000000..9a007c68d2 --- /dev/null +++ b/lestate/lestate-tests.ts @@ -0,0 +1,20 @@ +/// + +let State = LeState.createState() + +State.set({ + test : {} +}) + +let currentState = State.get() + +State.insert({ + test : {} +}) + +let currentDescription = State.getDescription() + +State.createListener({ + id : 0, + selector : state => ({ test : state.test }) +}) diff --git a/lestate/lestate.d.ts b/lestate/lestate.d.ts new file mode 100644 index 0000000000..d36a137eb4 --- /dev/null +++ b/lestate/lestate.d.ts @@ -0,0 +1,27 @@ +// Type definitions for LeState v0.1.3 +// Project: https://github.com/LeTools/LeState +// Definitions by: Hadrian Oliveira +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare let LeState : { + createState: (props?: { + initialState: {}; + }) => { + set(newValue: {}): [{ + id: number; + state: {}; + }]; + get(): any; + insert(newValue: {}): void; + getDescription(): {}; + createListener({ id, selector, force }: { + id: number; + selector: (state :any) => {}; + force?: boolean; + }): void; + }; +}; + +declare module "lestate" { + export default LeState; +} From 9abd523d14733b66e641eba4ac94951cf98a554d Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 11 Dec 2015 08:40:27 +0100 Subject: [PATCH 208/474] polymer ts test file --- polymer-ts/polymer-ts-tests.ts | 38 ++++++++++++++++++++++++++++++++++ polymer-ts/polymer-ts.d.ts | 7 +------ 2 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 polymer-ts/polymer-ts-tests.ts diff --git a/polymer-ts/polymer-ts-tests.ts b/polymer-ts/polymer-ts-tests.ts new file mode 100644 index 0000000000..5e4e42df26 --- /dev/null +++ b/polymer-ts/polymer-ts-tests.ts @@ -0,0 +1,38 @@ +/// + +namespace Components { + + export class TestComponent extends polymer.Base { + + public field: string = 'foo'; + public is: string; + + constructor() { + super(); + this.is = 'test-test'; + } + + public ready(): void { + console.log('ready'); + this.async(() => { + console.log('delayed'); + }, 500); + } + } + + polymer.createElement(TestComponent); + + @component('test-annotated') + export class AnnotatedComponent extends polymer.Base { + + public field: string = 'xx'; + + constructor() { + super(); + } + + public ready(): void { + console.log('annotated ready'); + } + } +} diff --git a/polymer-ts/polymer-ts.d.ts b/polymer-ts/polymer-ts.d.ts index cd96dfe21a..c00c0ce1a0 100644 --- a/polymer-ts/polymer-ts.d.ts +++ b/polymer-ts/polymer-ts.d.ts @@ -1,8 +1,3 @@ -// Type definitions for PolymerTS 0.1.17 -// Project: https://github.com/nippur72/PolymerTS -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - declare module polymer { class PolymerBase extends HTMLElement { $: any; @@ -93,7 +88,7 @@ declare module polymer { type?: any; value?: any; reflectToAttribute?: boolean; - readonly?: boolean; + readOnly?: boolean; notify?: boolean; computed?: string; observer?: string; From 31ae86e54c72ad8e52e2c8f0abfed5f830672a80 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 11 Dec 2015 08:43:27 +0100 Subject: [PATCH 209/474] fixed def typed header --- polymer-ts/polymer-ts.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/polymer-ts/polymer-ts.d.ts b/polymer-ts/polymer-ts.d.ts index c00c0ce1a0..921b256656 100644 --- a/polymer-ts/polymer-ts.d.ts +++ b/polymer-ts/polymer-ts.d.ts @@ -1,3 +1,8 @@ +// Type definitions for PolymerTS 0.1.19 +// Project: https://github.com/nippur72/PolymerTS +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module polymer { class PolymerBase extends HTMLElement { $: any; From 5b8db10eaa365f248d644a14dd44f755d190a651 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Fri, 11 Dec 2015 08:48:01 +0100 Subject: [PATCH 210/474] tests modified --- polymer-ts/polymer-ts-tests.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/polymer-ts/polymer-ts-tests.ts b/polymer-ts/polymer-ts-tests.ts index 5e4e42df26..1347b3bb71 100644 --- a/polymer-ts/polymer-ts-tests.ts +++ b/polymer-ts/polymer-ts-tests.ts @@ -21,18 +21,4 @@ namespace Components { } polymer.createElement(TestComponent); - - @component('test-annotated') - export class AnnotatedComponent extends polymer.Base { - - public field: string = 'xx'; - - constructor() { - super(); - } - - public ready(): void { - console.log('annotated ready'); - } - } } From f9d722838776698c634a9af179d10eb3a7858c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20Sojo?= Date: Fri, 11 Dec 2015 09:12:43 +0100 Subject: [PATCH 211/474] Fix position type, string to any, in jQueryui autocompleteOptions https://api.jqueryui.com/autocomplete/#option-position --- jqueryui/jqueryui.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index 9dd576e1a5..ade8eb735d 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -49,7 +49,7 @@ declare module JQueryUI { delay?: number; disabled?: boolean; minLength?: number; - position?: string; + position?: any; // object source?: any; // [], string or () } From 482c331129ac50e6bc680700a3405baae517a06a Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 11 Dec 2015 11:45:17 +0100 Subject: [PATCH 212/474] Update type definition to version 0.20.2 Newer version of Angulartics (0.20.2), brings a new feature that allows to exclude specific routes from pageview tracking. Version release on 17/11/2015. Project changes log: https://github.com/angulartics/angulartics/blob/master/CHANGELOG.md Original plugin pull request and description: https://github.com/angulartics/angulartics/pull/419 --- angulartics/angulartics.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/angulartics/angulartics.d.ts b/angulartics/angulartics.d.ts index edb9aefb3d..d586eee54a 100644 --- a/angulartics/angulartics.d.ts +++ b/angulartics/angulartics.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angulartics v0.19.2 +// Type definitions for Angulartics v0.20.2 // Project: http://luisfarzati.github.io/angulartics/ // Definitions by: Steven Fan // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -21,6 +21,7 @@ declare module angulartics { interface IAnalyticsServiceProvider extends angular.IServiceProvider { virtualPageviews(value: boolean): void; + excludeRoutes(value: string[]):void; firstPageview(value: boolean): void; withBase(value: boolean): void; withAutoBase(value: boolean): void; From f7ba60bb1434c6d538a03bb5338fafa9ef2646c9 Mon Sep 17 00:00:00 2001 From: WAEL BEN ZID Date: Fri, 11 Dec 2015 12:16:01 +0100 Subject: [PATCH 213/474] Update definition of ITemplateOptions --- angular-formly/angular-formly.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/angular-formly/angular-formly.d.ts b/angular-formly/angular-formly.d.ts index 2bf75af7d7..d52df5e48f 100644 --- a/angular-formly/angular-formly.d.ts +++ b/angular-formly/angular-formly.d.ts @@ -70,6 +70,11 @@ declare module AngularFormly { postWrapper?: ITemplateManipulator[]; } + interface ISelectOption { + name: string; + value: string; + group?: string; + } /** * see http://docs.angular-formly.com/docs/ngmodelattrstemplatemanipulator @@ -104,6 +109,12 @@ declare module AngularFormly { description?: string; [key: string]: any; + // types for select/radio fields + options?: ISelectOption | any; + groupProp?: string; // default: group + valueProp?: string; // default: value + labelProp?: string; // default: name + } From 0eaa2e33f76641182d1713c2f865c1417c68a37c Mon Sep 17 00:00:00 2001 From: Nick Zamosenchuk Date: Fri, 11 Dec 2015 14:13:49 +0100 Subject: [PATCH 214/474] [ngNotify] create Type Definition for Angular JS ngNotify library ngNotify is a simple, lightweight and elegant notification service for AngularJS applications. This commit/pull request contains a type definition for the latest version of this library --- ng-notify/ng-notify-tests.ts | 11 ++++++ ng-notify/ng-notify.d.ts | 72 ++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 ng-notify/ng-notify-tests.ts create mode 100644 ng-notify/ng-notify.d.ts diff --git a/ng-notify/ng-notify-tests.ts b/ng-notify/ng-notify-tests.ts new file mode 100644 index 0000000000..4a03d62cec --- /dev/null +++ b/ng-notify/ng-notify-tests.ts @@ -0,0 +1,11 @@ +/// +/// + +class NgNotifyTestController { + + static $inject = ['$scope', 'ngNotify']; + + constructor($scope:ng.IScope, ngNotify:ngNotify.INotifyService) { + ngNotify.set('Your error message goes here!', 'error'); + } +}; \ No newline at end of file diff --git a/ng-notify/ng-notify.d.ts b/ng-notify/ng-notify.d.ts new file mode 100644 index 0000000000..f1092df625 --- /dev/null +++ b/ng-notify/ng-notify.d.ts @@ -0,0 +1,72 @@ +// Type definitions for ng-notify 0.7.1 +// Project: https://github.com/matowens/ng-notify +// Definitions by: Nick Zamosenchuk +// Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + +declare module ngNotify { + + /** + * Contains the options used to configure notification. + */ + interface IUserOptions{ + type?: string; + theme?: string; + position?: string; + duration?: number; + sticky?: boolean; + button?: boolean; + html?: boolean; + } + + /** + * Simply and lightweight notification service for AngularJS + */ + interface INotifyService { + + /** + * Allows to create a whole new set of styles for each notification type. + * @param themeName The name used when setting the theme in the config object. + * @param className The class used to target this theme in the stylesheet. + */ + addTheme(themeName:string, className:string):void; + + /** + * Allows to create a new type of notification to use in their app. + * @param typeName The name used to trigger this notification type in the set method. + * @param className The class used to target this type in the stylesheet. + */ + addType(typeName:string, className:string):void; + + /** + * Sets default settings for all notifications to take into account when displaying. + * @param userOptions Notification configuration object + */ + config(userOptions: IUserOptions):void; + + /** + * Manually dismisses any sticky notifications that may still be set. + */ + dismiss():void; + + /** + * Displays a notification message. + * @param message A message text to display. + */ + set(message: string):void; + + /** + * Displays a notification message and sets the type for this one notification. + * @param message A message text to display. + * @param type The type of the notification. + */ + set(message: string, type: string):void; + + /** + * displays a notification message and sets the formatting/behavioral options for this one notification. + * @param message A message text to display. + * @param userOptions Notification configuration object. + */ + set(message: string, userOptions: IUserOptions):void; + } +} From 5c9b77c2db4f324ab2431f27b35a0b9c44383dbe Mon Sep 17 00:00:00 2001 From: George Wu Date: Fri, 11 Dec 2015 21:49:53 +0800 Subject: [PATCH 215/474] Added type definitions for sql.js. --- sql.js/sql.js-tests.ts | 81 ++++++++++++++++++++++++++++++++++++++++++ sql.js/sql.js.d.ts | 71 ++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 sql.js/sql.js-tests.ts create mode 100644 sql.js/sql.js.d.ts diff --git a/sql.js/sql.js-tests.ts b/sql.js/sql.js-tests.ts new file mode 100644 index 0000000000..eeba3f0809 --- /dev/null +++ b/sql.js/sql.js-tests.ts @@ -0,0 +1,81 @@ +/// +/// + +import fs = require("fs"); +import SQL = require("sql.js"); + +var DB_PATH = "data.db"; + +function createFile(path: string): void { + var fd = fs.openSync(path, "a"); + fs.closeSync(fd); +} + +// Open the database file. If it does not exist, create a blank database in memory. +var databaseData: Buffer; +databaseData = fs.existsSync(DB_PATH) ? fs.readFileSync(DB_PATH) : null; +var db = new SQL.Database(databaseData); + +// Create a new table 'test_table' in the database in memory. +var createTableStatement = + "DROP TABLE IF EXISTS test_table;" + + "CREATE TABLE test_table (id INTEGER PRIMARY KEY, content TEXT);"; +db.run(createTableStatement); + +// Insert 2 records for testing. +var insertRecordStatement = + "INSERT INTO test_table (id, content) VALUES (@id, @content);"; +db.run(insertRecordStatement, { + "@id": 1, + "@content": "Content 1" +}); +db.run(insertRecordStatement, { + "@id": 2, + "@content": "Content 2" +}); + +try { + // This query will throw exception: primary key constraint failed. + db.run(insertRecordStatement, { + "@id": 1, + "@content": "Content 3" + }); +} catch (ex) { + console.warn(ex); +} + +// A simple SELECT query. +var selectRecordStatement = + "SELECT * FROM test_table WHERE id = @id;" +var selectStatementObject = db.prepare(selectRecordStatement); +var results = selectStatementObject.get({ + "@id": 1 +}); +console.log(results); +selectStatementObject.free(); + +// Access the results one by one, asynchronously. +var selectRecordsStatement = + "SELECT * FROM test_table;"; +db.each( + selectRecordsStatement, + (obj: SQL.SQLValueObject): void => { + console.log(obj); + }, + (): void => { + console.info("Iteration done."); + dbAccessDone(); + }); + + +function dbAccessDone(): void { + // Save the database into SQLite version 3 format. + if (!fs.existsSync(DB_PATH)) { + createFile(DB_PATH); + } + var exportedData = db.export(); + fs.writeFileSync(DB_PATH, exportedData); + + // Finally, close the database connection and release the resources in memory. + db.close(); +} diff --git a/sql.js/sql.js.d.ts b/sql.js/sql.js.d.ts new file mode 100644 index 0000000000..5f2ddd0691 --- /dev/null +++ b/sql.js/sql.js.d.ts @@ -0,0 +1,71 @@ + +// Type definitions for sql.js (Sep. 6 2015 snapshot) +// Project: https://github.com/kripken/sql.js +// Definitions by: George Wu +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "sql.js" { + + type SQLValue = number | string | Uint8Array; + type KeyValueObject = { [key: string]: SQLValue }; + type SQLValueObject = { [columnName: string]: SQLValue }; + type DataRow = SQLValue[]; + + class Database { + constructor(data: Buffer); + constructor(data: Uint8Array); + constructor(data: number[]); + + run(sql: string): Database; + run(sql: string, params: KeyValueObject): Database; + run(sql: string, params: SQLValue[]): Database; + + exec(sql: string): QueryResults[]; + + each(sql: string, callback: (obj: SQLValueObject) => void, done: () => void): void; + each(sql: string, params: KeyValueObject, callback: (obj: SQLValueObject) => void, done: () => void): void; + each(sql: string, params: SQLValue[], callback: (obj: SQLValueObject) => void, done: () => void): void; + + prepare(sql: string): Statement; + prepare(sql: string, params: KeyValueObject): Statement; + prepare(sql: string, params: SQLValue[]): Statement; + + export(): Uint8Array; + + close(): void; + } + + class Statement { + bind(): boolean; + bind(values: KeyValueObject): boolean; + bind(values: SQLValue[]): boolean; + + step(): boolean; + + get(): DataRow; + get(params: KeyValueObject): DataRow; + get(params: SQLValue[]): DataRow; + + getColumnNames(): string[]; + + getAsObject(): SQLValueObject; + getAsObject(params: KeyValueObject): SQLValueObject; + getAsObject(params: SQLValue[]): SQLValueObject; + + run(): void; + run(values: KeyValueObject): void; + run(values: SQLValue[]): void; + + reset(): void; + + freemem(): void; + + free(): boolean; + } + + interface QueryResults { + columns: string[]; + values: DataRow[]; + } + +} From 98339951b7a45fe9679a83777d61bad70a037976 Mon Sep 17 00:00:00 2001 From: George Wu Date: Fri, 11 Dec 2015 22:09:48 +0800 Subject: [PATCH 216/474] Renewed code to follow DefinitelyTyped's contribution guidelines. --- sql.js/sql.js-tests.ts | 2 +- sql.js/sql.js.d.ts | 46 +++++++++++++++++++----------------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/sql.js/sql.js-tests.ts b/sql.js/sql.js-tests.ts index eeba3f0809..40fceb8fbd 100644 --- a/sql.js/sql.js-tests.ts +++ b/sql.js/sql.js-tests.ts @@ -59,7 +59,7 @@ var selectRecordsStatement = "SELECT * FROM test_table;"; db.each( selectRecordsStatement, - (obj: SQL.SQLValueObject): void => { + (obj: { [columnName: string]: number | string | Uint8Array }): void => { console.log(obj); }, (): void => { diff --git a/sql.js/sql.js.d.ts b/sql.js/sql.js.d.ts index 5f2ddd0691..d3f22afc1f 100644 --- a/sql.js/sql.js.d.ts +++ b/sql.js/sql.js.d.ts @@ -1,15 +1,11 @@ - -// Type definitions for sql.js (Sep. 6 2015 snapshot) +// Type definitions for sql.js // Project: https://github.com/kripken/sql.js // Definitions by: George Wu // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module "sql.js" { +/// - type SQLValue = number | string | Uint8Array; - type KeyValueObject = { [key: string]: SQLValue }; - type SQLValueObject = { [columnName: string]: SQLValue }; - type DataRow = SQLValue[]; +declare module "sql.js" { class Database { constructor(data: Buffer); @@ -17,18 +13,18 @@ declare module "sql.js" { constructor(data: number[]); run(sql: string): Database; - run(sql: string, params: KeyValueObject): Database; - run(sql: string, params: SQLValue[]): Database; + run(sql: string, params: { [key: string]: number | string | Uint8Array }): Database; + run(sql: string, params: (number | string | Uint8Array)[]): Database; exec(sql: string): QueryResults[]; - each(sql: string, callback: (obj: SQLValueObject) => void, done: () => void): void; - each(sql: string, params: KeyValueObject, callback: (obj: SQLValueObject) => void, done: () => void): void; - each(sql: string, params: SQLValue[], callback: (obj: SQLValueObject) => void, done: () => void): void; + each(sql: string, callback: (obj: { [columnName: string]: number | string | Uint8Array }) => void, done: () => void): void; + each(sql: string, params: { [key: string]: number | string | Uint8Array }, callback: (obj: { [columnName: string]: number | string | Uint8Array }) => void, done: () => void): void; + each(sql: string, params: (number | string | Uint8Array)[], callback: (obj: { [columnName: string]: number | string | Uint8Array }) => void, done: () => void): void; prepare(sql: string): Statement; - prepare(sql: string, params: KeyValueObject): Statement; - prepare(sql: string, params: SQLValue[]): Statement; + prepare(sql: string, params: { [key: string]: number | string | Uint8Array }): Statement; + prepare(sql: string, params: (number | string | Uint8Array)[]): Statement; export(): Uint8Array; @@ -37,24 +33,24 @@ declare module "sql.js" { class Statement { bind(): boolean; - bind(values: KeyValueObject): boolean; - bind(values: SQLValue[]): boolean; + bind(values: { [key: string]: number | string | Uint8Array }): boolean; + bind(values: (number | string | Uint8Array)[]): boolean; step(): boolean; - get(): DataRow; - get(params: KeyValueObject): DataRow; - get(params: SQLValue[]): DataRow; + get(): (number | string | Uint8Array)[]; + get(params: { [key: string]: number | string | Uint8Array }): (number | string | Uint8Array)[]; + get(params: (number | string | Uint8Array)[]): (number | string | Uint8Array)[]; getColumnNames(): string[]; - getAsObject(): SQLValueObject; - getAsObject(params: KeyValueObject): SQLValueObject; - getAsObject(params: SQLValue[]): SQLValueObject; + getAsObject(): { [columnName: string]: number | string | Uint8Array }; + getAsObject(params: { [key: string]: number | string | Uint8Array }): { [columnName: string]: number | string | Uint8Array }; + getAsObject(params: (number | string | Uint8Array)[]): { [columnName: string]: number | string | Uint8Array }; run(): void; - run(values: KeyValueObject): void; - run(values: SQLValue[]): void; + run(values: { [key: string]: number | string | Uint8Array }): void; + run(values: (number | string | Uint8Array)[]): void; reset(): void; @@ -65,7 +61,7 @@ declare module "sql.js" { interface QueryResults { columns: string[]; - values: DataRow[]; + values: (number | string | Uint8Array)[][]; } } From bd1d3d2e0bf4a16d9d0aa3fee767b1d3658dc801 Mon Sep 17 00:00:00 2001 From: stephenjelfs Date: Fri, 11 Dec 2015 17:45:26 +0100 Subject: [PATCH 217/474] Initial definitions for react-datagrid. --- react-datagrid/react-datagrid-test.tsx | 82 +++++++ react-datagrid/react-datagrid.d.ts | 310 +++++++++++++++++++++++++ 2 files changed, 392 insertions(+) create mode 100644 react-datagrid/react-datagrid-test.tsx create mode 100644 react-datagrid/react-datagrid.d.ts diff --git a/react-datagrid/react-datagrid-test.tsx b/react-datagrid/react-datagrid-test.tsx new file mode 100644 index 0000000000..c0ca90a1a9 --- /dev/null +++ b/react-datagrid/react-datagrid-test.tsx @@ -0,0 +1,82 @@ +/// +/// +/// + +import * as React from "react"; +import ReactDataGrid = require("react-datagrid"); + +var data: any[] = []; + +var columns: ReactDataGrid.Column[] = [ + { name: 'index', title: '#', width: 50 }, + { name: 'firstName', style: { color: 'red' }, visible: true}, + { name: 'lastName', render: (v) => {return v + " Phd"}}, + { name: 'city', textAlign: 'right', defaultVisible: true}, + { name: 'email', defaultHidden: true } +]; +var selected = {}; +var sortInfo: ReactDataGrid.SortInfo[] = [ { name: 'country', dir: 'asc'}] + +export module X { +export class ExampleBasic extends React.Component<{},{}> { + render(): React.ReactElement { + return ( + + ); + } +} +} + +class ExampleFull extends React.Component<{},{}> { + + render(): React.ReactElement { + return ( + {}} + onPageSizeChange={(pageSize: number, props: ReactDataGrid.DataGridProps) => {}} + onColumnOrderChange={(index: number, dropIndex: number) => {}} + onColumnResize={(firstCol: ReactDataGrid.Column, firstSize: number, secondCol: ReactDataGrid.Column, secondSize: number) => {}} + onSelectionChange={(newSelectedId: string, data: any) => {}} + onSortChange={(sortInfo: ReactDataGrid.SortInfo[]) => {}} + onFilter={(column: ReactDataGrid.Column, value: any, allFilterValues: any[]) => {} } + /> + ); + } +} diff --git a/react-datagrid/react-datagrid.d.ts b/react-datagrid/react-datagrid.d.ts new file mode 100644 index 0000000000..aca7d355e1 --- /dev/null +++ b/react-datagrid/react-datagrid.d.ts @@ -0,0 +1,310 @@ +// Type definitions for react-datagrid 1.2.15 +// Project: https://github.com/zippyui/react-datagrid.git +// Definitions by: Stephen Jelfs +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "react-datagrid" { + import DataGrid = ReactDataGrid.DataGrid; + export = DataGrid; +} + +declare namespace ReactDataGrid { + import React = __React; + + interface DataGridProps extends React.Props { + /** + * Array/String/Function/Promise - for local data, an array of object + * to render in the grid. For remote data, a string url, or a function + * that returns a promise. + */ + dataSource: any[] | string | ((query: {pageSize: number, skip: number}) => Promise); + + dataSourceCount?: number; + + /** + * String - the name of the property where the id is found for each + * object in the data array. + */ + idProperty: string; + + /** + * Array - an array of columns that are going to be rendered in the + * grid. + */ + columns: Column[]; + + /** + * Sorting the data array is not done by the grid. You can however + * pass in sort info so the grid renders with sorting icons as needed. + */ + onSortChange?: (sortInfo: SortInfo[]) => void; + + /** + * Array - an array with sorting information. + */ + sortInfo?: SortInfo[]; + + style?: __React.CSSProperties; + + /** + * Object/Function - you can specify either a style object to be + * applied to all rows, or a function. The function is called with + * (data, props) (so you have access to props.index for example) and + * is expected to return a style object. + */ + rowStyle?: __React.CSSProperties | ((data: any, props: RowProps) => React.CSSProperties); + + /** + * Boolean - show a column menu to show/hide columns. + */ + withColumnMenu?: boolean; + + /** + * If you want to enable column reordering, just specify the + * onColumnOrderChange prop on the grid: + */ + onColumnOrderChange?: (index: number, dropIndex: number) => void; + + /** + * If you want to enable column resized, just specify the + * onColumnResize prop on the grid: + */ + onColumnResize?: (firstCol: Column, firstSize: number, + secondCol: Column, secondSize: number) => void; + + /** + * If you want to enable selection, just specify the + * onSelectionChange prop on the grid: + */ + onSelectionChange?: (newSelected: {}, data: any) => void; + + /** + * When a column is shown/hidden, you can be notified using the + * onColumnVisibilityChange callback prop. + */ + onColumnVisibilityChange?: (column: Column, visibility: boolean) => void; + + /** + * The current selection. + */ + selected?: {}; + + /** + * Group rows by matching values. + */ + groupBy?: any[]; + + /** + * If you want to enable filter, just specify the + * onFilter prop on the grid: + */ + onFilter?: (column: Column, value: any, allFilterValues: any[]) => void; + + /** + * To apply the filter while typing. + */ + liveFilter?: boolean; + + /** + * Empty text for no records. + */ + emptyText?: string; + + /** + * Loading grid. + */ + loading?: boolean; + + /** + * If you dont want loadMask over header, specify + */ + loadMaskOverHeader?: boolean; + + /** + * Show cell borders. Other valid values: 'horizontal', 'vertical'. + */ + showCellBorders?: boolean | string; + + /** + * Custom row height. + */ + rowHeight?: number; + + /** + * When you have remote data, pagination is setup by default. If you + * want to disable pagination, specify the pagination prop with a false + * value. + */ + pagination?: boolean; + defaultPageSize?: number; + defaultPage?: number; + + /** + * Number - controlled alternative for defaultPageSize. When pageSize + * changes, onPageSizeChange(pageSize) is called. + */ + pageSize?: number; + + /** + * Number - controlled alternative for defaultPage. When page changes, + * onPageChange(page) is called. + */ + page?: number; + + /** + * Customize the pagination toolbar. + */ + paginationToolbarProps?: PaginationToolbarProps; + + /** + * handle page changes. + */ + onPageChange?: (page: number) => void; + + /** + * handle page size changes. + */ + onPageSizeChange?: (pageSize: number, props: DataGridProps) => void; + } + + interface SortInfo { + name: string; + dir: string; + } + + interface Column { + /** + * String - each column should have a name property. + */ + name: string; + + /** + * String/ReactElement - a title to show in the header. If not + * specified, a humanized version of name will be used. Can be a string + * or anything that React can render, so you can customize it as you + * please. + */ + title?: string | React.ReactElement; + + /** + * Function - if you want custom rendering, specify this property. + * + * The column.render function is called with 3 args: + * value - the default value to be rendered (equals to data[column.name]) + * data - the corresponding data object for the current row + cellProps - an object with props for the current cell + */ + render?: (value: any, data: any, cellProps: CellProps) => any; + + /** + * Object - if you want cells in this column to be have a custom + * style. + */ + style?: __React.CSSProperties; + + /** + * String - one of 'left', 'right', 'center'. + */ + textAlign?: string; + + /** + * String - a className to be applied to all cells in this column + */ + className?: string; + + width?: number; + + minWidth?: number; + + /** + * Columns are flexible via flexbox. Specify a flex property for this. + * Unless a column specifies a flex or a width property, it is assumed + * to have flex: 1. + */ + flex?: number; + + /** + * Specify a column as visible/hidden. + */ + defaultVisible?: boolean; + defaultHidden?: boolean; + + /** + * Boolean - controlled (which means you have to manually set column + * visibility when it changes, by using onColumnVisibilityChange). + */ + visible?: boolean; + } + + interface CellProps { + /** + * the index of the row + */ + rowIndex: number; + + /** + * the index of the column + */ + index: number; + + /** + * a style for the cell + */ + style: React.CSSProperties; + + /** + * a class name for the cell + */ + className: string; + } + + interface RowProps { + /** + * the index of the row + */ + index: number; + + /** + * a class name for the row when the mouse is over it + */ + overClassName: string; + + /** + * a class name for the row when selected + */ + selectedClassName: string; + + /** + * a class name for the row + */ + className: string; + } + + interface PaginationToolbarProps { + /** + * Available page sizes. + */ + pageSizes: number[]; + + /** + * Hide/show page sizes. + */ + showPageSize: boolean; + + /** + * Customize icons. + */ + showRefreshIcon: boolean; + iconSize: number; + iconProps: { + style: React.SVGAttributes, + overStyle: React.SVGAttributes, + disabledStyle: React.SVGAttributes + } + } + + export class DataGrid extends __React.Component { + } +} From d065f93bab68ae7be4625c3b2847e601b2311505 Mon Sep 17 00:00:00 2001 From: stephenjelfs Date: Fri, 11 Dec 2015 17:58:28 +0100 Subject: [PATCH 218/474] Added missing promises --- react-datagrid/react-datagrid.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react-datagrid/react-datagrid.d.ts b/react-datagrid/react-datagrid.d.ts index aca7d355e1..1dc5d83616 100644 --- a/react-datagrid/react-datagrid.d.ts +++ b/react-datagrid/react-datagrid.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// declare module "react-datagrid" { import DataGrid = ReactDataGrid.DataGrid; From 55f9ccc901fbb3c42c8afd2d2bcc2ca864054062 Mon Sep 17 00:00:00 2001 From: stephenjelfs Date: Fri, 11 Dec 2015 18:07:34 +0100 Subject: [PATCH 219/474] Renamed tests file. --- .../{react-datagrid-test.tsx => react-datagrid-tests.tsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename react-datagrid/{react-datagrid-test.tsx => react-datagrid-tests.tsx} (100%) diff --git a/react-datagrid/react-datagrid-test.tsx b/react-datagrid/react-datagrid-tests.tsx similarity index 100% rename from react-datagrid/react-datagrid-test.tsx rename to react-datagrid/react-datagrid-tests.tsx From fc18b2dfd426eaf96ce4ca0f003d23656b952da6 Mon Sep 17 00:00:00 2001 From: Stefan Geneshky Date: Fri, 11 Dec 2015 10:14:44 -0800 Subject: [PATCH 220/474] Update Mithril definitions --- mithril/mithril.d.ts | 250 +++++++++++++++++++++++++++++-------------- 1 file changed, 167 insertions(+), 83 deletions(-) diff --git a/mithril/mithril.d.ts b/mithril/mithril.d.ts index 3cd0e21e49..c2304e7ece 100644 --- a/mithril/mithril.d.ts +++ b/mithril/mithril.d.ts @@ -5,90 +5,174 @@ //Mithril type definitions for Typescript -interface MithrilStatic { - (selector: string, attributes: Object, children?: any): MithrilVirtualElement; - (selector: string, children?: any): MithrilVirtualElement; - prop(value?: T): (value?: T) => T; - prop(promise: MithrilPromise): MithrilPromiseProperty; - withAttr(property: string, callback: (value: any) => void): (e: Event) => any; - module(rootElement: Node, module: MithrilModule): void; - trust(html: string): String; - render(rootElement: Element, children?: any): void; - render(rootElement: HTMLDocument, children?: any): void; - redraw: MithrilRedraw; - route: MithrilRoute; - request(options: MithrilXHROptions): MithrilPromise; - deferred(): MithrilDeferred; - sync(promises: MithrilPromise[]): MithrilPromise; - startComputation(): void; - endComputation(): void; +declare module _mithril { + interface MithrilStatic { + + (selector: string, attributes: MithrilAttributes, ...children: Array>): MithrilVirtualElement; + (selector: string, ...children: Array>): MithrilVirtualElement; + + prop(promise: MithrilPromise) : MithrilPromiseProperty; + prop(value: T): MithrilProperty; + prop(): MithrilProperty; // might be that this should be Property + + withAttr(property: string, callback: (value: any) => void): (e: MithrilEvent) => any; + + module(rootElement: Node, component: MithrilComponent): T; + module(rootElement: Node): T; + mount(rootElement: Node, component: MithrilComponent): T; + mount(rootElement: Node): T; + + component(component: MithrilComponent, ...args: Array): MithrilComponent + + trust(html: string): string; + + render(rootElement: Element|HTMLDocument): void; + render(rootElement: Element|HTMLDocument, children: MithrilVirtualElement, forceRecreation?: boolean): void; + render(rootElement: Element|HTMLDocument, children: MithrilVirtualElement[], forceRecreation?: boolean): void; + + redraw: { + (force?: boolean): void; + strategy: MithrilProperty; + } + + route: { + (rootElement: HTMLDocument, defaultRoute: string, routes: MithrilRoutes): void; + (rootElement: Element, defaultRoute: string, routes: MithrilRoutes): void; + + (element: Element, isInitialized: boolean, context: Object, vdom: Object): void; + (path: string, params?: any, shouldReplaceHistory?: boolean): void; + (): string; + + param(key: string): string; + mode: string; + buildQueryString(data: Object): String + parseQueryString(data: String): Object + } + + request(options: MithrilXHROptions): MithrilPromise; + + deferred: { + onerror(e: Error): void; + (): MithrilDeferred; + } + + sync(promises: MithrilPromise[]): MithrilPromise; + + startComputation(): void; + endComputation(): void; + + // For test suite + deps: { + (mockWindow: Window): Window; + factory: Object; + } + + } + + export interface MithrilVirtualElement { + key?: number; + tag?: string; + attrs?: MithrilAttributes; + children?: any[]; + } + + // Configuration function for an element + interface MithrilElementConfig { + (element: Element, isInitialized: boolean, context?: any, vdom?: MithrilVirtualElement): void; + } + + // Attributes on a virtual element + interface MithrilAttributes { + title?: string; + className?: string; + class?: string; + config?: MithrilElementConfig; + } + + // Defines the subset of Event that Mithril needs + interface MithrilEvent { + currentTarget: Element; + } + + interface MithrilController { + onunload?(evt: Event): any; + } + + interface MithrilControllerFunction extends MithrilController { + (): any; + } + + interface MithrilView { + (ctrl: T): string|MithrilVirtualElement; + } + + interface MithrilComponent { + controller: MithrilControllerFunction|{ new(): T }; + view: MithrilView; + } + + interface MithrilProperty { + (): T; + (value: T): T; + toJSON(): T; + } + + interface MithrilPromiseProperty extends MithrilPromise { + (): T; + (value: T): T; + toJSON(): T; + } + + interface MithrilRoutes { + [key: string]: MithrilComponent; + } + + + interface MithrilDeferred { + resolve(value?: T): void; + reject(value?: any): void; + promise: MithrilPromise; + } + + interface MithrilSuccessCallback { + (value: T): U; + (value: T): MithrilPromise; + } + + interface MithrilErrorCallback { + (value: Error): U; + (value: string): U; + } + + interface MithrilPromise { + (): T; + (value: T): T; + then(success: (value: T) => U): MithrilPromise; + then(success: (value: T) => MithrilPromise): MithrilPromise; + then(success: (value: T) => U, error: (value: Error) => V): MithrilPromise|MithrilPromise; + then(success: (value: T) => MithrilPromise, error: (value: Error) => V): MithrilPromise|MithrilPromise; + } + interface MithrilXHROptions { + method?: string; + url: string; + user?: string; + password?: string; + data?: any; + background?: boolean; + unwrapSuccess?(data: any): any; + unwrapError?(data: any): any; + serialize?(dataToSerialize: any): string; + deserialize?(dataToDeserialize: string): any; + extract?(xhr: XMLHttpRequest, options: MithrilXHROptions): string; + type?(data: Object): void; + config?(xhr: XMLHttpRequest, options: MithrilXHROptions): XMLHttpRequest; + dataType?: string; + } } -interface MithrilRoute { - (rootElement: Element, defaultRoute: string, routes: { [key: string]: MithrilModule }): void; - (rootElement: HTMLDocument, defaultRoute: string, routes: { [key: string]: MithrilModule }): void; - (path: string, params?: any, shouldReplaceHistory?: boolean): void; - (element: Element, isInitialized: boolean): void; - (): string; - mode: string; - param: MithrilParam; - buildQueryString(data: Object): string; - parseQueryString(queryString: string): Object; -} +declare var Mithril: _mithril.MithrilStatic; +declare var m: _mithril.MithrilStatic; -interface MithrilParam { - (param: string): string; +declare module "mithril" { + export = m; } - -interface MithrilRedraw { - (): void; - strategy: (value?: string) => string; -} - -interface MithrilVirtualElement { - tag: string; - attrs: Object; - children: any; -} - -interface MithrilModule { - controller: Function; - view: (controller?: any) => MithrilVirtualElement; -} - -interface MithrilDeferred { - resolve(value?: T): void; - reject(value?: any): void; - promise: MithrilPromise; -} - -interface MithrilPromise { - (value?: T): T; - then(successCallback?: (value: T) => R, errorCallback?: (value: any) => any): MithrilPromise; - then(successCallback?: (value: T) => MithrilPromise, errorCallback?: (value: any) => any): MithrilPromise; -} - -interface MithrilPromiseProperty extends MithrilPromise { - (): T; - (value: T): T; - toJSON(): T; -} - -interface MithrilXHROptions { - method: string; - url: string; - user?: string; - password?: string; - data?: any; - background?: boolean; - unwrapSuccess?(data: any): any; - unwrapError?(data: any): any; - serialize?(dataToSerialize: any): string; - deserialize?(dataToDeserialize: string): any; - extract?(xhr: XMLHttpRequest, options: MithrilXHROptions): string; - type?(data: Object): void; - config?(xhr: XMLHttpRequest, options: MithrilXHROptions): XMLHttpRequest; -} - -declare var Mithril: MithrilStatic; -declare var m: MithrilStatic; From 208be8144e834ae82881ab9414c57c6fcd5ef11c Mon Sep 17 00:00:00 2001 From: Dan Marshall Date: Fri, 11 Dec 2015 10:23:13 -0800 Subject: [PATCH 221/474] added optional rendering type --- fullCalendar/fullCalendar.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/fullCalendar/fullCalendar.d.ts b/fullCalendar/fullCalendar.d.ts index 6400dba7e0..7415bdd73c 100644 --- a/fullCalendar/fullCalendar.d.ts +++ b/fullCalendar/fullCalendar.d.ts @@ -247,6 +247,7 @@ declare module FullCalendar { backgroundColor?: string; borderColor?: string; textColor?: string; + rendering?: string; } export interface ViewObject extends Timespan { From f3eeb32d711a1985cec596acb9424bcd827fe2a0 Mon Sep 17 00:00:00 2001 From: Mark Nadig Date: Fri, 11 Dec 2015 10:55:03 -0700 Subject: [PATCH 222/474] ng-dialog add IDialogOptions.disableAnimation, IDialogOpenOptions.data and upadated test --- ng-dialog/ng-dialog-tests.ts | 2 ++ ng-dialog/ng-dialog.d.ts | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/ng-dialog/ng-dialog-tests.ts b/ng-dialog/ng-dialog-tests.ts index 6d68111a6d..27f50f89c9 100644 --- a/ng-dialog/ng-dialog-tests.ts +++ b/ng-dialog/ng-dialog-tests.ts @@ -20,6 +20,8 @@ class DialogTestController { template: "login.html", className: "default flat-ui", closeByEscape: false, + data: "string", + disableAnimation: false, name: "login-popup" }); diff --git a/ng-dialog/ng-dialog.d.ts b/ng-dialog/ng-dialog.d.ts index 3ad5c4d09a..95f02af632 100644 --- a/ng-dialog/ng-dialog.d.ts +++ b/ng-dialog/ng-dialog.d.ts @@ -61,6 +61,12 @@ declare module angular.dialog { * It will be appended with the "ngdialog" class e.g. className is "default-theme flat-ui" it will be class="ngdialog default-theme flat-ui". */ className?: string; + + /** + * If true then animation for the dialog will be disabled, default false. + */ + disableAnimation?: boolean; + /** * If false it allows to hide overlay div behind the modals, default true. */ @@ -106,5 +112,9 @@ declare module angular.dialog { * Scope object that will be passed to dialog. If you use controller with separate $scope service this object will be passed to $scope.$parent param. */ scope?: ng.IScope; + /** + * Any serializable data that you want to be stored in the controller's dialog scope. + */ + data?: string|Object|any[]; } } From c3dce5b44d8ee3ac1cdc6e074626acc5fb8ce79c Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Sat, 12 Dec 2015 15:51:42 +0200 Subject: [PATCH 223/474] Restored jsSHA browser global definition & test. --- jssha/jssha-tests.ts | 7 +++++++ jssha/jssha.d.ts | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/jssha/jssha-tests.ts b/jssha/jssha-tests.ts index f6e0f96b48..e5a83b14a8 100644 --- a/jssha/jssha-tests.ts +++ b/jssha/jssha-tests.ts @@ -46,4 +46,11 @@ let hmac5:string = shaObj1.getHMAC("HEX", { outputUpper: true, b64Pad: '=' }); shaObj.setHMACKey("abc", "TEXT"); shaObj.update("This is a test"); let hmac = shaObj.getHMAC("HEX"); +} + +// Browser global test +{ + var shaObj = new jsSHA("SHA-512", "TEXT"); + shaObj.update("This is a test"); + var hash = shaObj.getHash("HEX"); } \ No newline at end of file diff --git a/jssha/jssha.d.ts b/jssha/jssha.d.ts index 6dc4f65d3e..f695a66700 100644 --- a/jssha/jssha.d.ts +++ b/jssha/jssha.d.ts @@ -79,7 +79,7 @@ declare module jsSHA { } } +declare var jsSHA: jsSHA.jsSHA; declare module 'jssha' { - var jsSHA: jsSHA.jsSHA; export = jsSHA; -} \ No newline at end of file +} From 5b5bfbec4c121532ac5754e742797ed3eb9fe6da Mon Sep 17 00:00:00 2001 From: abraaoalves Date: Sat, 12 Dec 2015 10:54:06 -0300 Subject: [PATCH 224/474] definitions to steps and hooks --- cucumber/cucumber-tests.ts | 40 ++++++++++++++++++++++++++ cucumber/cucumber.d.ts | 57 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 cucumber/cucumber-tests.ts create mode 100644 cucumber/cucumber.d.ts diff --git a/cucumber/cucumber-tests.ts b/cucumber/cucumber-tests.ts new file mode 100644 index 0000000000..ba7ff1f72e --- /dev/null +++ b/cucumber/cucumber-tests.ts @@ -0,0 +1,40 @@ +/// + +function StepSample() { + type Callback = cucumber.CallbackStepDefinition; + var step = this; + var hook = this; + + hook.Before(function(scenario, callback){ + scenario.isFailed() && callback.pending(); + }) + + hook.Around(function(scenario, runScenario) { + scenario.isFailed() && runScenario(null, function(){ + console.log('finish tasks'); + }); + }); + + hook.registerHandler('AfterFeatures', function (event, callback) { + callback(); + }); + + step.Given(/^I am on the Cucumber.js GitHub repository$/, function(callback) { + this.visit('https://github.com/cucumber/cucumber-js', callback); + }); + + step.When(/^I go to the README file$/, function(title:string, callback:Callback) { + callback.pending(); + }); + + step.Then(/^I should see "(.*)" as the page title$/, { timeout:60*1000}, function(title:string, callback) { + var pageTitle = this.browser.text('title'); + + if (title === pageTitle) { + callback(); + } else { + callback(new Error("Expected to be on page with title " + title)); + } + }); +} + diff --git a/cucumber/cucumber.d.ts b/cucumber/cucumber.d.ts new file mode 100644 index 0000000000..b70fbb6b46 --- /dev/null +++ b/cucumber/cucumber.d.ts @@ -0,0 +1,57 @@ +// Type definitions for cucumber-js +// Project: https://github.com/cucumber/cucumber-js +// Definitions by: Abraão Alves +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module cucumber { + + export interface CallbackStepDefinition{ + pending : () => Thenable; + (errror?:any):void; + } + + interface StepDefinitionCode { + (...stepArgs: Array): Thenable | any | void; + } + + interface StepDefinitionOptions{ + timeout?: number; + } + + export interface StepDefinitions { + Given(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void; + Given(pattern: RegExp | string, code: StepDefinitionCode): void; + When(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void; + When(pattern: RegExp | string, code: StepDefinitionCode): void; + Then(pattern: RegExp | string, options: StepDefinitionOptions, code: StepDefinitionCode): void; + Then(pattern: RegExp | string, code: StepDefinitionCode): void; + setDefaultTimeout(time:number): void; + } + + interface HookScenario{ + attach(text: string, mimeType?: string, callback?: (err?) => void): void; + isFailed() : boolean; + } + + interface HookCode { + (scenario: HookScenario, callback?: CallbackStepDefinition): void; + } + + interface AroundCode{ + (scenario: HookScenario, runScenario?: (error:string, callback?:Function)=>void): void; + } + + export interface Hooks { + Before(code: HookCode): void; + After(code: HookCode): void; + Around(code: AroundCode):void; + setDefaultTimeout(time:number): void; + registerHandler(handlerOption:string, code:(event, callback:CallbackStepDefinition) =>void): void; + } +} + +declare module 'cucumber'{ + export = cucumber; +} \ No newline at end of file From 0bcb4658eca981568d5cce48fd4b370c8778cbd6 Mon Sep 17 00:00:00 2001 From: abraaoalves Date: Sat, 12 Dec 2015 11:24:19 -0300 Subject: [PATCH 225/474] fix noimplicitAny errors --- cucumber/cucumber-tests.ts | 6 +++--- cucumber/cucumber.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cucumber/cucumber-tests.ts b/cucumber/cucumber-tests.ts index ba7ff1f72e..f8b5606070 100644 --- a/cucumber/cucumber-tests.ts +++ b/cucumber/cucumber-tests.ts @@ -1,4 +1,4 @@ -/// +/// function StepSample() { type Callback = cucumber.CallbackStepDefinition; @@ -19,7 +19,7 @@ function StepSample() { callback(); }); - step.Given(/^I am on the Cucumber.js GitHub repository$/, function(callback) { + step.Given(/^I am on the Cucumber.js GitHub repository$/, function(callback:Callback) { this.visit('https://github.com/cucumber/cucumber-js', callback); }); @@ -27,7 +27,7 @@ function StepSample() { callback.pending(); }); - step.Then(/^I should see "(.*)" as the page title$/, { timeout:60*1000}, function(title:string, callback) { + step.Then(/^I should see "(.*)" as the page title$/, { timeout:60*1000}, function(title:string, callback:Callback) { var pageTitle = this.browser.text('title'); if (title === pageTitle) { diff --git a/cucumber/cucumber.d.ts b/cucumber/cucumber.d.ts index b70fbb6b46..75faeff7a5 100644 --- a/cucumber/cucumber.d.ts +++ b/cucumber/cucumber.d.ts @@ -31,7 +31,7 @@ declare module cucumber { } interface HookScenario{ - attach(text: string, mimeType?: string, callback?: (err?) => void): void; + attach(text: string, mimeType?: string, callback?: (err?:any) => void): void; isFailed() : boolean; } @@ -48,7 +48,7 @@ declare module cucumber { After(code: HookCode): void; Around(code: AroundCode):void; setDefaultTimeout(time:number): void; - registerHandler(handlerOption:string, code:(event, callback:CallbackStepDefinition) =>void): void; + registerHandler(handlerOption:string, code:(event:any, callback:CallbackStepDefinition) =>void): void; } } From 0bb3a46b8baea5eb91e50560fc5cfd4b5895e1ba Mon Sep 17 00:00:00 2001 From: phiresky Date: Sat, 12 Dec 2015 15:58:14 +0100 Subject: [PATCH 226/474] wu: fix project link --- wu/wu.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wu/wu.d.ts b/wu/wu.d.ts index 61a0e6e97c..cb794ff300 100644 --- a/wu/wu.d.ts +++ b/wu/wu.d.ts @@ -1,5 +1,5 @@ // Type definitions for wu.js v2.1.0 -// Project: http://backbonejs.org/ +// Project: https://fitzgen.github.io/wu.js/ // Definitions by: phiresky // Definitions: https://github.com/borisyankov/DefinitelyTyped From e2309e6ed913f2733eb8f6af1d56d22a93d0a6e3 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 12 Dec 2015 22:32:14 +0500 Subject: [PATCH 227/474] lodash: signatures of _.isFunction have been changed --- lodash/lodash-tests.ts | 39 ++++++++++++++++++++++++++++----------- lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2d244b16e5..9cf772cab4 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5532,17 +5532,34 @@ result = _([]).isFinite(); result = _({}).isFinite(); // _.isFunction -result = _.isFunction(any); -result = _(1).isFunction(); -result = _([]).isFunction(); -result = _({}).isFunction(); -{ - let value: Function|string = "foo"; - if (_.isFunction(value)) { - value(); - } else { - let result: string = value; - } +module TestIsFunction { + { + let value: number|Function; + + if (_.isFunction(value)) { + let result: Function = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isFunction(any); + result = _(1).isFunction(); + result = _([]).isFunction(); + result = _({}).isFunction(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isFunction(); + result = _([]).chain().isFunction(); + result = _({}).chain().isFunction(); + } } // _.isMatch diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 8425f1d823..81d78b1bcf 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9434,9 +9434,10 @@ declare module _ { interface LoDashStatic { /** * Checks if value is classified as a Function object. + * * @param value The value to check. * @return Returns true if value is correctly classified, else false. - **/ + */ isFunction(value?: any): value is Function; } @@ -9447,6 +9448,13 @@ declare module _ { isFunction(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isFunction + */ + isFunction(): LoDashExplicitWrapper; + } + //_.isMatch interface isMatchCustomizer { (value: any, other: any, indexOrKey?: number|string): boolean; From bba4c44ba25d6feb40fa100525bc76db9d3d33c0 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Sat, 12 Dec 2015 20:08:50 +0100 Subject: [PATCH 228/474] deleted definitions to split PR --- gulp-jade/gulp-jade-tests.ts | 25 ------------------------- gulp-jade/gulp-jade.d.ts | 24 ------------------------ 2 files changed, 49 deletions(-) delete mode 100644 gulp-jade/gulp-jade-tests.ts delete mode 100644 gulp-jade/gulp-jade.d.ts diff --git a/gulp-jade/gulp-jade-tests.ts b/gulp-jade/gulp-jade-tests.ts deleted file mode 100644 index 7334afc838..0000000000 --- a/gulp-jade/gulp-jade-tests.ts +++ /dev/null @@ -1,25 +0,0 @@ -/// -/// -/// - -import gulp = require("gulp"); -import jade = require("gulp-jade"); - - -gulp.task('check1', function() { - gulp.src('lib/*.jade') - .pipe(jade({ - locals: {}, - client: false - })); -}); - -import jadeLib = require('jade'); - -gulp.task('check2', function() { - gulp.src('lib/*.jade') - .pipe(jade({ - jade: jadeLib, - pretty: true - })); -}); \ No newline at end of file diff --git a/gulp-jade/gulp-jade.d.ts b/gulp-jade/gulp-jade.d.ts deleted file mode 100644 index 2f31889c22..0000000000 --- a/gulp-jade/gulp-jade.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Type definitions for gulp-jade -// Project: https://github.com/phated/gulp-jade -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "gulp-jade" { - function GulpJade(options?: GulpJadeOptions): NodeJS.ReadWriteStream; - - interface GulpJadeOptions { - client?: boolean; - - locals?: Object; - - jade?: any; - - pretty?: boolean; - } - - namespace GulpJade { - } - export = GulpJade; -} From e3b69d13c85ebf92f9a721073376f87c6af74e46 Mon Sep 17 00:00:00 2001 From: lgrignon Date: Sat, 12 Dec 2015 20:16:50 +0100 Subject: [PATCH 229/474] deleted files to split PR --- .../backbone.localstorage.d.ts | 51 -------- gulp-jshint/gulp-jshint-tests.ts | 16 --- gulp-jshint/gulp-jshint.d.ts | 29 ----- gulp-notify/gulp-notify-tests.ts | 41 ------- gulp-notify/gulp-notify.d.ts | 113 ------------------ .../typescript-require-tests.ts | 7 -- typescript-require/typescript-require.d.ts | 31 ----- 7 files changed, 288 deletions(-) delete mode 100644 backbone.localstorage/backbone.localstorage.d.ts delete mode 100644 gulp-jshint/gulp-jshint-tests.ts delete mode 100644 gulp-jshint/gulp-jshint.d.ts delete mode 100644 gulp-notify/gulp-notify-tests.ts delete mode 100644 gulp-notify/gulp-notify.d.ts delete mode 100644 typescript-require/typescript-require-tests.ts delete mode 100644 typescript-require/typescript-require.d.ts diff --git a/backbone.localstorage/backbone.localstorage.d.ts b/backbone.localstorage/backbone.localstorage.d.ts deleted file mode 100644 index 122c475876..0000000000 --- a/backbone.localstorage/backbone.localstorage.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Type definitions for backbone.localStorage 1.0.0 -// Project: https://github.com/jeromegn/Backbone.localStorage -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module Backbone { - interface Serializer { - serialize(item: any): any; - deserialize(data: any): any; - } - - class LocalStorage { - name: string; - serializer: Serializer; - records: string[]; - - constructor(name: string, serializer?: Serializer); - - save(): void; - - // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already - // have an id of it's own. - create(model: any): any; - - // Update a model by replacing its copy in `this.data`. - update(model: any): any; - - // Retrieve a model from `this.data` by id. - find(model: any): any; - - // Return the array of all models currently in storage. - findAll(): any; - - // Delete a model from `this.data`, returning it. - destroy(model: T): T; - - localStorage(): any; - - // Clear localStorage for specific collection. - _clear(): void; - - _storageSize(): number; - - _itemName(id: any): string; - } -} - -import Store = Backbone.LocalStorage; - diff --git a/gulp-jshint/gulp-jshint-tests.ts b/gulp-jshint/gulp-jshint-tests.ts deleted file mode 100644 index fe4d930418..0000000000 --- a/gulp-jshint/gulp-jshint-tests.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// -/// -import gulp = require("gulp"); -import jshint = require("gulp-jshint"); - - -gulp.task('check1', function() { - gulp.src('lib/*.ts') - .pipe(jshint()) - .pipe(jshint.reporter('default')); -}); - -gulp.task('check2', function() { - gulp.src('lib/*.ts') - .pipe(jshint({ linter: 'jshint', lookup: true })); -}); \ No newline at end of file diff --git a/gulp-jshint/gulp-jshint.d.ts b/gulp-jshint/gulp-jshint.d.ts deleted file mode 100644 index 20db40a62a..0000000000 --- a/gulp-jshint/gulp-jshint.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Type definitions for gulp-jshint -// Project: https://github.com/spalger/gulp-jshint -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "gulp-jshint" { - function GulpJSHint(options?: IGulpJSHintOptions): NodeJS.ReadWriteStream; - - interface IGulpJSHintOptions { - /** - * When false do not lookup .jshintrc files. See the JSHint docs for more info. - * Default true. - */ - lookup?: boolean; - - /** - * Either the name of a module to use for linting the code or a linting function itself. This enables using an alternate (but jshint compatible) linter like "jsxhint". - * Default is "jshint" - */ - linter?: string; - } - - namespace GulpJSHint { - function reporter(kind: (string | Object)): NodeJS.ReadWriteStream; - } - export = GulpJSHint; -} diff --git a/gulp-notify/gulp-notify-tests.ts b/gulp-notify/gulp-notify-tests.ts deleted file mode 100644 index 4175d08628..0000000000 --- a/gulp-notify/gulp-notify-tests.ts +++ /dev/null @@ -1,41 +0,0 @@ -/// -/// -import gulp = require("gulp"); -import notify = require("gulp-notify"); - -var custom = notify.withReporter(function(options, callback) { - console.log("Title:", options.title); - console.log("Message:", options.message); - callback(); -}); - -notify.on('click', (options) => { - console.log('I clicked something!', options); -}); - -notify.on('timeout', (options) => { - console.log('The notification timed out', options); -}); - -gulp.task('notify1', function() { - gulp.src("./src/test.ext") - .pipe(notify("Hello Gulp! From file: <%= file.relative %>")); -}); - -gulp.task('notify2', function() { - gulp.src("./src/test.ext") - .pipe(notify({ - message: "Generated file: <%= file.relative %> @ <%= options.date %>", - templateOptions: { - date: new Date() - } - })); -}); - -gulp.task('notify3', function() { - gulp.src("./src/test.ext") - .pipe(custom("This is a message.")) - .on("error", notify.onError((error: Error) => { - return "Message to the notifier: " + error.message; - })); -}); \ No newline at end of file diff --git a/gulp-notify/gulp-notify.d.ts b/gulp-notify/gulp-notify.d.ts deleted file mode 100644 index 4658616447..0000000000 --- a/gulp-notify/gulp-notify.d.ts +++ /dev/null @@ -1,113 +0,0 @@ -// Type definitions for gulp-jshint -// Project: https://github.com/mikaelbr/gulp-notify -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "gulp-notify" { - function GulpNotify(param: string | Function | GulpNotifyOptions): NodeJS.ReadWriteStream; - - interface GulpNotifyOptions { - /** - * Type: Boolean Default: false - * If the notification should only happen on the last file of the stream. Per default a notification is triggered on each file. - */ - onLast?: boolean; - - /** - * Type: Boolean Default: false - * If the returned stream should emit an error or not. If emitError is true, you have to handle .on('error') manually in case the notifier (gulp-notify) fails. If the default false is set, the error will not be emitted but simply printed to the console. - * This means you can run the notifier on a CI system without opting it out but simply letting it fail gracefully. - */ - emitError?: boolean; - - /** - * Type: String Default: File path in stream - * - * The message you wish to attach to file. The string can be a lodash template as it is passed through gulp-util.template. - * - * Example: Created <%= file.relative %>. - * as function - * - * Type: Function(vinylFile) - * - * See notify(Function). - */ - message?: string | Function; - - /** - * Type: String Default: "Gulp Notification" - * - * The title of the notification. The string can be a lodash template as it is passed through gulp-util.template. - * - * Example: Created <%= file.relative %>. - * as function - * - * Type: Function(vinylFile) - * - * See notify(Function). - */ - title?: string | Function; - - /** - * Object passed to the lodash template, for additional properties passed to the template. - */ - templateOptions?: Object; - - /** - * Type: Function(options, callback) Default: node-notifier module - * - * Swap out the notifier by passing in an function. The function expects two arguments: options and callback. - * - * The callback must be called when the notification is finished. Options will contain both title and message. - * - * See notify.withReporter for syntactic sugar. - */ - notifier?: (options: GulpNotifyOptions, callback: () => void) => void; - - /** - * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. - */ - wait?: boolean; - } - - namespace GulpNotify { - - /** - * If the wait option is set to true, the notifier will tigger events click or timeout, whether the user clicks the notification or it times out. You listen to these events on the main notify object, not the produces stream. - */ - function on(event: string, callback: (notificationOptions?: GulpNotifyOptions) => void): void; - - /** - * Wraps options.notifier to return a new notify-function only using the passed in reporter. - */ - function withReporter(reporter: (options: GulpNotifyOptions, callback: () => void) => void): (message: string | Function) => NodeJS.ReadWriteStream; - - - /** - * The exact same API as using notify(), but where a vinyl File is passed, the error object is passed instead. - */ - function onError(param: string | { (error: Error): string } | GulpNotifyOptions): Function; - - /** - * Type: Integer Default: 2 - * - * Set if logger should be used or not. If log level is set to 0, no logging will be used. If no new log level is passed, the current log level is returned. - * - * 0: No logging - * 1: Log on error - * 2: Log both on error and regular notification. - * - * If logging is set to > 0, the title and message passed to gulp-notify will be logged like so: - * ➜ gulp-notify git:(master) ✗ gulp --gulpfile examples/gulpfile.js one - * [gulp] Using file /Users/example/gulp-notify/examples/gulpfile.js - * [gulp] Working directory changed to /Users/example/repos/gulp-notify/examples - * [gulp] Running 'one'... - * [gulp] Finished 'one' in 4.08 ms - * [gulp] gulp-notify: [Gulp notification] /Users/example/gulp-notify/test/fixtures/1.txt - */ - function logLevel(level: number): void; - } - export = GulpNotify; -} diff --git a/typescript-require/typescript-require-tests.ts b/typescript-require/typescript-require-tests.ts deleted file mode 100644 index 6269a4b9d3..0000000000 --- a/typescript-require/typescript-require-tests.ts +++ /dev/null @@ -1,7 +0,0 @@ -/// - -require('typescript-require')({ - nodeLib: false, - targetES5: true, - exitOnError: true -}); diff --git a/typescript-require/typescript-require.d.ts b/typescript-require/typescript-require.d.ts deleted file mode 100644 index 68b24ca274..0000000000 --- a/typescript-require/typescript-require.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Type definitions for typescript-require -// Project: https://github.com/theblacksmith/typescript-require -// Definitions by: Louis Grignon -// Definitions: https://github.com/borisyankov/DefinitelyTyped - -/// - -declare module "typescript-require" { - function TypeScriptRequire(options?: TypeScriptRequireOptions): void; - - interface TypeScriptRequireOptions { - /** - * If true node.d.ts definitions file is loaded before custom ts files. This is disabled by default and you should use. - * Default false. - */ - nodeLib?: boolean; - - /** - * Target ES5 / ES3 output mode. - * Default true. - */ - targetES5?: boolean; - - /** - * Wether execution should stop on compile error. - */ - exitOnError?: boolean; - } - - export = TypeScriptRequire; -} From 448bcc6e964f0f1c1ac87a6fb3ee0a4f186ec3b9 Mon Sep 17 00:00:00 2001 From: Howard Pinsley Date: Sat, 12 Dec 2015 16:25:16 -0500 Subject: [PATCH 230/474] Add optional startup property to TransitionAnimation --- google.visualization/google.visualization.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/google.visualization/google.visualization.d.ts b/google.visualization/google.visualization.d.ts index 222faec1d1..f1ef8278c3 100644 --- a/google.visualization/google.visualization.d.ts +++ b/google.visualization/google.visualization.d.ts @@ -365,6 +365,7 @@ declare module google { export interface TransitionAnimation { duration?: number; easing?: string; // linear, in, out, inAndOut + startup?: boolean; } export interface ChartAxis { From 3a4f3278d7061041c9ad6c8c1bd69a1b6799c703 Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Sat, 12 Dec 2015 15:48:55 -0600 Subject: [PATCH 231/474] Add ImapMessageBodyInfo and ImapMessageAttributes interfaces; correct some of the occurrences; fix Folder interface --- imap/imap.d.ts | 105 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 34 deletions(-) diff --git a/imap/imap.d.ts b/imap/imap.d.ts index ce9fd72233..105e64c85d 100644 --- a/imap/imap.d.ts +++ b/imap/imap.d.ts @@ -83,34 +83,68 @@ declare module IMAP { }; } + export interface ImapMessageBodyInfo { + /** The specifier for this body (e.g. 'TEXT', 'HEADER.FIELDS (TO FROM SUBJECT)', etc). */ + which: string; + /** The size of this body in bytes. */ + size: number; + } + + export interface ImapMessageAttributes { + /** A 32-bit ID that uniquely identifies this message within its mailbox. */ + uid: number; + /** A list of flags currently set on this message. */ + flags: string[]; + /** The internal server date for the message. */ + date: Date; + /** The message's body structure (only set if requested with fetch()). */ + struct?: any[]; + /** The RFC822 message size (only set if requested with fetch()). */ + size?: number; + } /** Given in a 'message' event from ImapFetch */ - export interface ImapMessage extends NodeJS.EventEmitter { } + export interface ImapMessage extends NodeJS.EventEmitter { + on(event: string, listener: Function): this; + on(event: 'body', listener: (stream: NodeJS.ReadableStream, info: ImapMessageBodyInfo) => void): this; + on(event: 'attributes', listener: (attrs: ImapMessageAttributes) => void): this; + on(event: 'end', listener: () => void): this; + } export interface FetchOptions { /** Mark message(s) as read when fetched. Default: false */ - markSeen?: boolean; + markSeen?: boolean; /** Fetch the message structure. Default: false */ - struct?: boolean; + struct?: boolean; /** Fetch the message envelope. Default: false */ - envelope?: boolean; + envelope?: boolean; /** Fetch the RFC822 size. Default: false */ - size?: boolean; + size?: boolean; /** Fetch modifiers defined by IMAP extensions. Default: (none) */ - modifiers?: Object; + modifiers?: Object; /** A string or Array of strings containing the body part section to fetch. Default: (none) Example sections: */ - bodies?: any; /* string|string[] */ + bodies?: string | string[]; } /** Returned from fetch() */ - export interface ImapFetch extends NodeJS.EventEmitter { } + export interface ImapFetch extends NodeJS.EventEmitter { + on(event: string, listener: Function): this; + on(event: 'message', listener: (message: ImapMessage, seqno: number) => void): this; + on(event: 'error', listener: (error: Error) => void): this; + once(event: string, listener: Function): this; + once(event: 'error', listener: (error: Error) => void): this; + } export interface Folder { + /** mailbox attributes. An attribute of 'NOSELECT' indicates the mailbox cannot be opened */ attribs: string[]; + /** hierarchy delimiter for accessing this mailbox's direct children. */ delimiter: string; - children: Folder[]; + /** an object containing another structure similar in format to this top level, otherwise null if no children */ + children: MailBoxes; + /** pointer to parent mailbox, null if at the top level */ parent: Folder; } @@ -129,10 +163,11 @@ declare module IMAP { date?: Date; } + export interface MessageFunctions { + /** Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. + + The following message flags are valid types that do not have arguments: - // search() criteria - /** - // The following message flags are valid types that do not have arguments: ALL: void; // All messages. ANSWERED: void; // Messages with the Answered flag set. DELETED: void; // Messages with the Deleted flag set. @@ -148,7 +183,7 @@ declare module IMAP { UNFLAGGED: void; // Messages that do not have the Flagged flag set. UNSEEN: void; // Messages that do not have the Seen flag set. - // The following are valid types that require string value(s): + The following are valid types that require string value(s): BCC: any; // Messages that contain the specified string in the BCC field. CC: any; // Messages that contain the specified string in the CC field. @@ -159,25 +194,27 @@ declare module IMAP { TEXT: any; // Messages that contain the specified string in the header OR the message body. KEYWORD: any; // Messages with the specified keyword set. HEADER: any; // Requires two string values, with the first being the header name and the second being the value to search for. If this second string is empty, all messages that contain the given header name will be returned. - // The following are valid types that require a string parseable by JavaScripts Date object OR a Date instance: + + The following are valid types that require a string parseable by JavaScripts Date object OR a Date instance: + BEFORE: any; // Messages whose internal date (disregarding time and timezone) is earlier than the specified date. ON: any; // Messages whose internal date (disregarding time and timezone) is within the specified date. SINCE: any; // Messages whose internal date (disregarding time and timezone) is within or later than the specified date. SENTBEFORE: any; // Messages whose Date header (disregarding time and timezone) is earlier than the specified date. SENTON: any; // Messages whose Date header (disregarding time and timezone) is within the specified date. SENTSINCE: any; // Messages whose Date header (disregarding time and timezone) is within or later than the specified date. - //The following are valid types that require one Integer value: + + The following are valid types that require one Integer value: + LARGER: number; // Messages with a size larger than the specified number of bytes. SMALLER: number; // Messages with a size smaller than the specified number of bytes. - // The following are valid criterion that require one or more Integer values: + + The following are valid criterion that require one or more Integer values: + UID: any; // Messages with UIDs corresponding to the specified UID set. Ranges are permitted (e.g. '2504:2507' or '*' or '2504:*'). - */ - - - export interface MessageFunctions { - /** Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. */ - search(criteria: any[], callback: (error: Error, uids: string[]) => void): void; - /** Fetches message(s) in the currently open mailbox. */ + */ + search(criteria: any[], callback: (error: Error, uids: number[]) => void): void; + /** Fetches message(s) in the currently open mailbox; source can be a single message identifier, a message identifier range (e.g. '2504:2507' or '*' or '2504:*'), an array of message identifiers, or an array of message identifier ranges. */ fetch(source: any /* MessageSource */, options: FetchOptions): ImapFetch; /** Copies message(s) in the currently open mailbox to another mailbox. */ copy(source: any /* MessageSource */, mailboxName: string, callback: (error: Error) => void): void; @@ -199,26 +236,23 @@ declare module IMAP { serverSupports(capability: string): boolean; } - - - export class Connection implements NodeJS.EventEmitter, MessageFunctions { /** @constructor */ constructor(config: Config); // from NodeJS.EventEmitter - 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; + addListener(event: string, listener: Function): this; + on(event: string, listener: Function): this; + once(event: string, listener: Function): this; + removeListener(event: string, listener: Function): this; + removeAllListeners(event?: string): this; setMaxListeners(n: number): void; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; // from MessageFunctions /** Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. */ - search(criteria: any[], callback: (error: Error, uids: string[]) => void): void; + search(criteria: any[], callback: (error: Error, uids: number[]) => void): void; /** Fetches message(s) in the currently open mailbox. */ fetch(source: any /* MessageSource */, options: FetchOptions): ImapFetch; /** Copies message(s) in the currently open mailbox to another mailbox. */ @@ -241,7 +275,7 @@ declare module IMAP { serverSupports(capability: string): boolean; /** Parses a raw header and returns an object keyed on header fields and the values are Arrays of header field values. Set disableAutoDecode to true to disable automatic decoding of MIME encoded-words that may exist in header field values. */ - static parseHeader(rawHeader: string, disableAutoDecode?: boolean): any; + static parseHeader(rawHeader: string, disableAutoDecode?: boolean): {[index: string]: string[]}; /** The current state of the connection (e.g. 'disconnected', 'connected', 'authenticated'). */ state: string; @@ -256,6 +290,9 @@ declare module IMAP { /** Mailboxes that are accessible by any logged in user. */ shared: any[]; }; + /** + seq exposes the search() ... serverSupports() set of commands, but returns sequence number(s) instead of UIDs. + */ seq: MessageFunctions; /** Attempts to connect and authenticate with the IMAP server. */ connect(): void; @@ -273,7 +310,7 @@ declare module IMAP { /** Creates a new mailbox on the server. mailboxName should include any necessary prefix/path. */ addBox(mailboxName: string, callback: (error: Error) => void): void; /** Removes a specific mailbox that exists on the server. mailboxName should including any necessary prefix/path. */ - delBox(mailboxName: string, callback: (error: Error, uids: string[]) => void): void; + delBox(mailboxName: string, callback: (error: Error) => void): void; /** Renames a specific mailbox that exists on the server. Both oldMailboxName and newMailboxName should include any necessary prefix/path. Note: Renaming the 'INBOX' mailbox will instead cause all messages in 'INBOX' to be moved to the new mailbox. */ renameBox(oldMailboxName: string, newMailboxName: string, callback: (error: Error, mailbox: Box) => void): void; /** Subscribes to a specific mailbox that exists on the server. mailboxName should include any necessary prefix/path. */ From 7bd7a4233e446a3b8212c8f35233c5ba6f223791 Mon Sep 17 00:00:00 2001 From: Christopher Brown Date: Sat, 12 Dec 2015 15:49:58 -0600 Subject: [PATCH 232/474] Fix tests to reflect what imap returns --- imap/imap-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imap/imap-tests.ts b/imap/imap-tests.ts index 23f5f8f17e..8d9ce6cce8 100644 --- a/imap/imap-tests.ts +++ b/imap/imap-tests.ts @@ -124,7 +124,7 @@ var fs = require('fs'); openInbox(function(err : Error, box : IMAP.Box) { if (err) throw err; - imap.search([ 'UNSEEN', ['SINCE', 'May 20, 2010'] ], function(err : Error, results : string[]) { + imap.search([ 'UNSEEN', ['SINCE', 'May 20, 2010'] ], function(err : Error, results : number[]) { if (err) throw err; var f = imap.fetch(results, { bodies: '' }); f.on('message', function(msg : IMAP.ImapMessage, seqno : number) { From de5a50a5f319931dcc8c43b215945eabe17189dc Mon Sep 17 00:00:00 2001 From: Eric Winkelmann Date: Sat, 12 Dec 2015 19:26:28 -0800 Subject: [PATCH 233/474] Fix PDFPageProxy property getter types in pdf.d.ts `pageNumber`, `rotate`, `ref`, and `view` are property getters, not functions. Resolves #6726 --- pdf/pdf.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pdf/pdf.d.ts b/pdf/pdf.d.ts index 8cac3a81c1..107031cade 100644 --- a/pdf/pdf.d.ts +++ b/pdf/pdf.d.ts @@ -221,22 +221,22 @@ interface PDFPageProxy { /** * Page number of the page. First page is 1. **/ - pageNumber(): number; + pageNumber: number; /** * The number of degrees the page is rotated clockwise. **/ - rotate(): number; + rotate: number; /** * The reference that points to this page. **/ - ref(): PDFRef; + ref: PDFRef; /** * @return An array of the visible portion of the PDF page in the user space units - [x1, y1, x2, y2]. **/ - view(): number[]; + view: number[]; /** * @param scale The desired scale of the viewport. From 33a79667e06b2b65336b79178a807ce751a9654c Mon Sep 17 00:00:00 2001 From: Eric Winkelmann Date: Sat, 12 Dec 2015 21:25:13 -0800 Subject: [PATCH 234/474] Make IObservable.off() args optional in fabricjs.d.ts As specified in the [fabric.js documentation](http://fabricjs.com/docs/fabric.Observable.html#off), `IObservable.off()` accepts two optional arguments. --- fabricjs/fabricjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index d4ac5ad75b..248ee29f2c 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -345,7 +345,7 @@ declare module fabric { * @param eventName Event name (eg. 'after:render') or object with key/value pairs (eg. {'after:render': handler, 'selection:cleared': handler}) * @param handler Function to be deleted from EventListeners */ - off(eventName: string|any, handler: (e: IEvent) => any): T; + off(eventName?: string|any, handler?: (e: IEvent) => any): T; } // animation mixin From f791d1f4763660a84d6f02117d5a70a80c5f3e49 Mon Sep 17 00:00:00 2001 From: Leon Yu Date: Sun, 13 Dec 2015 03:18:32 -0500 Subject: [PATCH 235/474] Modernizr 3.2.0 --- modernizr/modernizr-tests.ts | 102 +++++- modernizr/modernizr-tests.ts.tscparams | 1 - modernizr/modernizr.d.ts | 485 +++++++++++++++++++------ 3 files changed, 470 insertions(+), 118 deletions(-) delete mode 100644 modernizr/modernizr-tests.ts.tscparams diff --git a/modernizr/modernizr-tests.ts b/modernizr/modernizr-tests.ts index 86355a3100..f5308dd9e7 100644 --- a/modernizr/modernizr-tests.ts +++ b/modernizr/modernizr-tests.ts @@ -19,9 +19,9 @@ $(function () { document.getElementById('#notice').innerHTML = msg; } - Modernizr.prefixed('boxSizing'); + Modernizr.prefixed('boxSizing'); Modernizr.prefixed('requestAnimationFrame', window); - var ms = Modernizr.prefixed("matchesSelector", HTMLElement.prototype, document.body); + var ms = Modernizr.prefixed("matchesSelector", HTMLElement.prototype, true); Modernizr.prefixed('requestAnimationFrame', window, false); Modernizr.mq('only all and (max-width: 400px)'); @@ -30,7 +30,7 @@ $(function () { Modernizr.addTest('track', () => { var video = document.createElement('video'); - // return typeof video.addTextTrack === 'function' + return typeof video.addTextTrack === 'function' }); Modernizr.testStyles('#modernizr { width: 9px; color: papayawhip; }', (elem, rule) => { @@ -45,10 +45,100 @@ $(function () { Modernizr.testAllProps('boxSizing'); - var elem; + var elem: Element; Modernizr.hasEvent('gesturestart', elem); - - if (!Modernizr.autofocus) { + + if (!Modernizr.input.autofocus) { $("[autofocus]").focus(); } }); + + +Modernizr.on('flash', function( result ) { + if (result) { + // the browser has flash + } else { + // the browser does not have flash + } +}); + +Modernizr.addTest('itsTuesday', function() { + var d = new Date(); + return d.getDay() === 2; +}); + +Modernizr.addTest('hasJquery', 'jQuery' in window); + +var detects = { + 'hasjquery': 'jQuery' in window, + 'itstuesday': function() { + var d = new Date(); + return d.getDay() === 2; + } +} +Modernizr.addTest(detects); + +var keyframes = Modernizr.atRule('@keyframes'); +if (keyframes) { + // keyframes are supported + // could be `@-webkit-keyframes` or `@keyframes` +} else { + // keyframes === `false` +} + +Modernizr._domPrefixes === [ "Moz", "O", "ms", "Webkit" ]; + +Modernizr.hasEvent('blur') // true; + +Modernizr.hasEvent('devicelight', window) // true; + +var query = Modernizr.mq('(min-width: 900px)'); +if (query) { + // the browser window is larger than 900px +} + +Modernizr.prefixed('boxSizing') + +var raf = Modernizr.prefixed('requestAnimationFrame', window); +raf(function() { +}); + +var rAFProp = Modernizr.prefixed('requestAnimationFrame', window, false); +rAFProp === 'WebkitRequestAnimationFrame' // in older webkit + +Modernizr.prefixedCSS('transition') // '-moz-transition' in old Firefox + +Modernizr.prefixedCSSValue('background', 'linear-gradient(left, red, red)') + +var rule = Modernizr._prefixes.join('transform: rotate(20deg); '); +rule === 'transform: rotate(20deg); webkit-transform: rotate(20deg); moz-transform: rotate(20deg); o-transform: rotate(20deg); ms-transform: rotate(20deg);' + +rule = 'display:' + Modernizr._prefixes.join('flex; display:') + 'flex'; +rule === 'display:flex; display:-webkit-flex; display:-moz-flex; display:-o-flex; display:-ms-flex; display:flex' + +Modernizr.testAllProps('boxSizing') // true +Modernizr.testAllProps('display', 'block') // true +Modernizr.testAllProps('display', 'penguin') // false +Modernizr.testAllProps('shapeOutside', 'content-box', true); + +Modernizr.testProp('pointerEvents') // true +Modernizr.testProp('pointerEvents', 'none') // true +Modernizr.testProp('pointerEvents', 'penguin') // false + +Modernizr.testStyles('#modernizr { width: 9px; color: papayawhip; }', function(elem, rule) { + // elem is the first DOM node in the page (by default #modernizr) + // rule is the first argument you supplied - the CSS rule in string form + Modernizr.addTest('widthworks', elem.style.width === '9px') +}); + +Modernizr.testStyles('#modernizr {width: 1px}; #modernizr2 {width: 2px}', function(elem) { + document.getElementById('modernizr').style.width === '1px'; // true + document.getElementById('modernizr2').style.width === '2px'; // true + elem.firstChild === document.getElementById('modernizr2'); // true +}, 1); + +Modernizr.testStyles('#modernizr {width: 1px}; #modernizr2 {width: 2px}', function(elem) { + document.getElementById('modernizr').style.width === '1px'; // true + document.getElementById('modernizr2').style.width === '2px'; // true + elem.firstChild === document.getElementById('modernizr2'); // true +}, 1); diff --git a/modernizr/modernizr-tests.ts.tscparams b/modernizr/modernizr-tests.ts.tscparams deleted file mode 100644 index d3f5a12faa..0000000000 --- a/modernizr/modernizr-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ - diff --git a/modernizr/modernizr.d.ts b/modernizr/modernizr.d.ts index a9104fd226..fa976c217e 100644 --- a/modernizr/modernizr.d.ts +++ b/modernizr/modernizr.d.ts @@ -1,116 +1,379 @@ -// Type definitions for Modernizr 2.6.2 +// Type definitions for Modernizr 3.2.0 // Project: http://modernizr.com/ -// Definitions by: Boris Yankov , Theodore Brown -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: Boris Yankov , Theodore Brown , Leon Yu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare namespace __Modernizr { + interface AudioBoolean { + ogg: boolean; + mp3: boolean; + wav: boolean; + m4a: boolean; + } -interface Audioboolean { - ogg: boolean; - mp3: boolean; - wav: boolean; - m4a: boolean; + interface VideoBoolean { + ogg: boolean; + h264: boolean; + webm: boolean; + } + + interface InputBoolean { + autocomplete: boolean; + autofocus: boolean; + list: boolean; + placeholder: boolean; + max: boolean; + min: boolean; + multiple: boolean; + pattern: boolean; + required: boolean; + step: boolean; + } + + interface InputTypesBoolean { + color: boolean; + date: boolean; + datetime: boolean; + "datetime-local": boolean; + email: boolean; + month: boolean; + number: boolean; + range: boolean; + search: boolean; + tel: boolean; + time: boolean; + url: boolean; + week: boolean; + } + + interface FeatureDetects { + // Documented + + ambientlight: boolean; + applicationcache: boolean; + audio: AudioBoolean; + batteryapi: boolean; + blobconstructor: boolean; + canvas: boolean; + canvastext: boolean; + contenteditable: boolean; + contextmenu: boolean; + cookies: boolean; + cors: boolean; + cryptography: boolean; + customprotocolhandler: boolean; + customevent: boolean; + dart: boolean; + dataview: boolean; + emoji: boolean; + eventlistener: boolean; + exiforientation: boolean; + flash: boolean; + forcetouch: boolean; + fullscreen: boolean; + gamepads: boolean; + geolocation: boolean; + hashchange: boolean; + hiddenscroll: boolean; + history: boolean; + htmlimports: boolean; + ie8compat: boolean; + indexeddb: boolean; + indexeddbblob: boolean; + input: InputBoolean; + search: boolean; + inputtypes: InputTypesBoolean; + intl: boolean; + json: boolean; + ligatures: boolean; + olreversed: boolean; + mathml: boolean; + notification: boolean; + pagevisibility: boolean; + performance: boolean; + pointerevents: boolean; + pointerlock: boolean; + postmessage: boolean; + proximity: boolean; + queryselector: boolean; + quotamanagement: boolean; + requestanimationframe: boolean; + serviceworker: boolean; + svg: boolean; + templatestrings: boolean; + touchevents: boolean; + typedarrays: boolean; + unicoderange: boolean; + unicode: boolean; + userdata: boolean; + vibrate: boolean; + video: VideoBoolean; + vml: boolean; + webintents: boolean; + animation: boolean; + webgl: boolean; + websockets: boolean; + xdomainrequest: boolean; + adownload: boolean; + audioloop: boolean; + audiopreload: boolean; + webaudio: boolean; + lowbattery: boolean; + canvasblending: boolean; + todataurljpeg: boolean; + todataurlpng: boolean; + todataurlwebp: boolean; + canvaswinding: boolean; + getrandomvalues: boolean; + cssall: boolean; + cssanimations: boolean; + appearance: boolean; + backdropfilter: boolean; + backgroundblendmode: boolean; + backgroundcliptext: boolean; + bgpositionshorthand: boolean; + bgpositionxy: boolean; + bgrepeatspace: boolean; + bgrepeatround: boolean; + backgroundsize: boolean; + bgsizecover: boolean; + borderimage: boolean; + borderradius: boolean; + boxshadow: boolean; + boxsizing: boolean; + csscalc: boolean; + checked: boolean; + csschunit: boolean; + csscolumns: boolean; + cubicbezierrange: boolean; + "display-runin": boolean; + displaytable: boolean; + ellipsis: boolean; + cssescape: boolean; + cssexunit: boolean; + cssfilters: boolean; + flexbox: boolean; + flexboxlegacy: boolean; + flexboxtweener: boolean; + flexwrap: boolean; + fontface: boolean; + generatedcontent: boolean; + cssgradients: boolean; + csshairline: boolean; + hsla: boolean; + csshyphens: boolean; + softhyphens: boolean; + softhyphensfind: boolean; + cssinvalid: boolean; + lastchild: boolean; + cssmask: boolean; + mediaqueries: boolean; + multiplebgs: boolean; + nthchild: boolean; + objectfit: boolean; + opacity: boolean; + overflowscrolling: boolean; + csspointerevents: boolean; + csspositionsticky: boolean; + csspseudoanimations: boolean; + csspseudotransitions: boolean; + cssreflections: boolean; + regions: boolean; + cssremunit: boolean; + cssresize: boolean; + rgba: boolean; + cssscrollbar: boolean; + scrollsnappoints: boolean; + shapes: boolean; + siblinggeneral: boolean; + subpixelfont: boolean; + supports: boolean; + target: boolean; + textalignlast: boolean; + textshadow: boolean; + csstransforms: boolean; + csstransforms3d: boolean; + preserve3d: boolean; + csstransitions: boolean; + userselect: boolean; + cssvalid: boolean; + cssvhunit: boolean; + cssvmaxunit: boolean; + cssvminunit: boolean; + cssvwunit: boolean; + willchange: boolean; + wrapflow: boolean; + classlist: boolean; + createelementattrs: boolean; + "createelement-attrs": boolean; + dataset: boolean; + documentfragment: boolean; + hidden: boolean; + microdata: boolean; + mutationobserver: boolean; + bdi: boolean; + datalistelem: boolean; + details: boolean; + outputelem: boolean; + picture: boolean; + progressbar: boolean; + meter: boolean; + ruby: boolean; + template: boolean; + time: boolean; + texttrackapi: boolean; + track: boolean; + unknownelements: boolean; + es5array: boolean; + es5date: boolean; + es5function: boolean; + es5object: boolean; + es5: boolean; + strictmode: boolean; + es5string: boolean; + es5syntax: boolean; + es5undefined: boolean; + es6array: boolean; + es6collections: boolean; + contains: boolean; + generators: boolean; + es6math: boolean; + es6number: boolean; + es6object: boolean; + promises: boolean; + es6string: boolean; + devicemotion: boolean; + deviceorientation: boolean; + oninput: boolean; + filereader: boolean; + filesystem: boolean; + capture: boolean; + fileinput: boolean; + directory: boolean; + formattribute: boolean; + localizednumber: boolean; + placeholder: boolean; + requestautocomplete: boolean; + formvalidation: boolean; + sandbox: boolean; + seamless: boolean; + srcdoc: boolean; + apng: boolean; + imgcrossorigin: boolean; + jpeg2000: boolean; + jpegxr: boolean; + sizes: boolean; + srcset: boolean; + webpalpha: boolean; + webpanimation: boolean; + webplossless: boolean; + "webp-lossless": boolean; + webp: boolean; + inputformaction: boolean; + inputformenctype: boolean; + inputformmethod: boolean; + inputformtarget: boolean; + beacon: boolean; + lowbandwidth: boolean; + eventsource: boolean; + fetch: boolean; + xhrresponsetypearraybuffer: boolean; + xhrresponsetypeblob: boolean; + xhrresponsetypedocument: boolean; + xhrresponsetypejson: boolean; + xhrresponsetypetext: boolean; + xhrresponsetype: boolean; + xhr2: boolean; + scriptasync: boolean; + scriptdefer: boolean; + speechrecognition: boolean; + speechsynthesis: boolean; + localstorage: boolean; + sessionstorage: boolean; + websqldatabase: boolean; + stylescoped: boolean; + svgasimg: boolean; + svgclippaths: boolean; + svgfilters: boolean; + svgforeignobject: boolean; + inlinesvg: boolean; + smil: boolean; + textareamaxlength: boolean; + bloburls: boolean; + datauri: boolean; + urlparser: boolean; + videoautoplay: boolean; + videoloop: boolean; + videopreload: boolean; + webglextensions: boolean; + datachannel: boolean; + getusermedia: boolean; + peerconnection: boolean; + websocketsbinary: boolean; + atobbtoa: boolean; + framed: boolean; + matchmedia: boolean; + blobworkers: boolean; + dataworkers: boolean; + sharedworkers: boolean; + transferables: boolean; + webworkers: boolean; + + // Undocumented - usually aliases or new features + + "atob-btoa": boolean; + "battery-api": boolean; + "blob-constructor": boolean; + "display-table": boolean; + "input-formaction": boolean; + "input-formenctype": boolean; + "input-formtarget": boolean; + "object-fit": boolean; + crypto: boolean; + displayrunin: boolean; + fileinputdirectory: boolean; + hairline: boolean; + inputsearchevent: boolean; + raf: boolean; + webanimations: boolean; + } + + interface Dictionary { + [key: string]: T; + } + + interface ModernizrAPI { + on(feature: string, cb: (result: boolean) => any): void; + + addTest(feature: string, test: () => boolean): void; + addTest(feature: string, test: boolean): void; + addTest(feature: Dictionary): void; + + atRule(prop: string): boolean; + + _domPrefixes: string[]; + + hasEvent(eventName: string, element?: EventTarget): boolean; + + mq(mq: string): boolean; + + prefixed(prop: string): string; + prefixed(prop: string, obj: EventTarget, element?: boolean): any; + + prefixedCSS(prop: string): string; + + prefixedCSSValue(prop: string, value: string): string; + + _prefixes: string[]; + + testAllProps(prop: string, value?: string, skipValueTest?: boolean): boolean; + + testProp(prop: string, value?: string, useValue?: boolean): boolean; + + testStyles(rule: string, callback: (elem: HTMLDivElement, rule: string) => void, nodes?: number, testnames?: string[]): boolean; + } + + export interface ModernizrStatic extends ModernizrAPI, FeatureDetects { } } -interface Videoboolean { - ogg: boolean; - h264: boolean; - webm: boolean; -} - -interface Inputboolean { - autocomplete: boolean; - autofocus: boolean; - list: boolean; - placeholder: boolean; - max: boolean; - min: boolean; - multiple: boolean; - pattern: boolean; - required: boolean; - step: boolean; -} - -interface InputTypesboolean { - search: boolean; - tel: boolean; - url: boolean; - email: boolean; - datetime: boolean; - date: boolean; - month: boolean; - week: boolean; - time: boolean; - datetimelocal: boolean; - number: boolean; - range: boolean; - color: boolean; -} - -interface ModernizrStatic { - autofocus: boolean; - fontface: boolean; - backgroundsize: boolean; - borderimage: boolean; - borderradius: boolean; - boxshadow: boolean; - flexbox: boolean; - hsla: boolean; - multiplebgs: boolean; - opacity: boolean; - rgba: boolean; - textshadow: boolean; - cssanimations: boolean; - csscolumns: boolean; - generatedcontent: boolean; - cssgradients: boolean; - cssreflections: boolean; - csstransforms: boolean; - csstransforms3d: boolean; - csstransitions: boolean; - applicationcache: boolean; - canvas: boolean; - canvastext: boolean; - draganddrop: boolean; - hashchange: boolean; - history: boolean; - audio: Audioboolean; - video: Videoboolean; - indexeddb: boolean; - input: Inputboolean; - inputtypes: InputTypesboolean; - localstorage: boolean; - postmessage: boolean; - sessionstorage: boolean; - websockets: boolean; - websqldatabase: boolean; - webworkers: boolean; - geolocation: boolean; - inlinesvg: boolean; - smil: boolean; - svg: boolean; - svgclippaths: boolean; - touch: boolean; - webgl: boolean; - - load(resources: any[]): void; - load(resourceObject: any): void; - load(resourceString: string): void; - - prefixed(property: string): any; - prefixed(property: string, obj: any, element?: any): any; - - mq(mediaQuery: string): boolean; - - addTest(feature: string, test: () => any): void; - addTest(feature: string, test: boolean): void; - addTest(feature: any): void; - - testStyles(rule: string, callback: (element: HTMLDivElement, rule: string) => void, nodes?: number, testnames?: string[]): boolean; - testProp(property: string): boolean; - testAllProps(property: string, prefix?: string): boolean; - testAllProps(property: string, obj: any, element: any): boolean; - - hasEvent(eventName: string, element?: any): boolean; -} - -declare var Modernizr: ModernizrStatic; +declare var Modernizr: __Modernizr.ModernizrStatic; From 2f970d1bddc31accd9a164b41cfe81fdc255c7e7 Mon Sep 17 00:00:00 2001 From: Alex Dresko Date: Sun, 13 Dec 2015 10:58:47 -0500 Subject: [PATCH 236/474] Added parameter to sendResposne --- chrome/chrome.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 77d2898fd2..febf50a628 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2646,13 +2646,13 @@ declare module chrome.extension { * Parameter request: The request sent by the calling script. * Parameter sendResponse: Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object, or undefined if there is no response. If you have more than one onRequest listener in the same document, then only one may send a response. */ - addListener(callback: (request: any, sender: runtime.MessageSender, sendResponse: () => void) => void): void; + addListener(callback: (request: any, sender: runtime.MessageSender, sendResponse: (response: any) => void) => void): void; /** * @param callback The callback parameter should be a function that looks like this: * function(runtime.MessageSender sender, function sendResponse) {...}; * Parameter sendResponse: Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object, or undefined if there is no response. If you have more than one onRequest listener in the same document, then only one may send a response. */ - addListener(callback: (sender: runtime.MessageSender, sendResponse: () => void) => void): void; + addListener(callback: (sender: runtime.MessageSender, sendResponse: (response: any) => void) => void): void; } /** @@ -5553,7 +5553,7 @@ declare module chrome.runtime { * Optional parameter message: The message sent by the calling script. * Parameter sendResponse: Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one onMessage listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until sendResponse is called). */ - addListener(callback: (message: any, sender: MessageSender, sendResponse: Function) => void): void; + addListener(callback: (message: any, sender: MessageSender, sendResponse: (response: any) => void) => void): void; } interface ExtensionConnectEvent extends chrome.events.Event { From b444f6ad9e1853c7a420b7e76d8672b737ba0716 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 13 Dec 2015 21:48:02 +0500 Subject: [PATCH 237/474] lodash: signatures of _.isDate have been changed --- lodash/lodash-tests.ts | 39 ++++++++++++++++++++++++++++----------- lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2d244b16e5..8ccf58aa22 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5444,17 +5444,34 @@ module TestIsBoolean { } // _.isDate -result = _.isDate(any); -result = _(42).isDate(); -result = _([]).isDate(); -result = _({}).isDate(); -{ - let value: Date|string = "foo"; - if (_.isDate(value)) { - value.toTimeString(); - } else { - value.charAt(0); - } +module TestIsBoolean { + { + let value: number|Date; + + if (_.isDate(value)) { + let result: Date = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isDate(any); + result = _(42).isDate(); + result = _([]).isDate(); + result = _({}).isDate(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(42).chain().isDate(); + result = _([]).chain().isDate(); + result = _({}).chain().isDate(); + } } // _.isElement diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 8425f1d823..dea870c2d6 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9285,8 +9285,9 @@ declare module _ { /** * Checks if value is classified as a Date object. * @param value The value to check. + * * @return Returns true if value is correctly classified, else false. - **/ + */ isDate(value?: any): value is Date; } @@ -9297,6 +9298,13 @@ declare module _ { isDate(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * @see _.isDate + */ + isDate(): LoDashExplicitWrapper; + } + //_.isElement interface LoDashStatic { /** From e081e6899a61bbcf340c48e975bced76621d829a Mon Sep 17 00:00:00 2001 From: Nick Date: Sun, 13 Dec 2015 18:28:12 +0100 Subject: [PATCH 238/474] fix formatting Adding a space before void to align changes to the original file formatting. --- angulartics/angulartics.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angulartics/angulartics.d.ts b/angulartics/angulartics.d.ts index d586eee54a..fdcb409ca2 100644 --- a/angulartics/angulartics.d.ts +++ b/angulartics/angulartics.d.ts @@ -21,7 +21,7 @@ declare module angulartics { interface IAnalyticsServiceProvider extends angular.IServiceProvider { virtualPageviews(value: boolean): void; - excludeRoutes(value: string[]):void; + excludeRoutes(value: string[]): void; firstPageview(value: boolean): void; withBase(value: boolean): void; withAutoBase(value: boolean): void; From 0d7e1be8b40682520c56c63aef9b9b7e11fa992e Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Sun, 13 Dec 2015 18:58:34 +0100 Subject: [PATCH 239/474] Remove trailing spaces Trailing spaces make it hard to contribute --- bookshelf/bookshelf-tests.ts | 1 - bookshelf/bookshelf.d.ts | 66 ++++++++--------- knex/knex.d.ts | 140 +++++++++++++++++------------------ 3 files changed, 103 insertions(+), 104 deletions(-) diff --git a/bookshelf/bookshelf-tests.ts b/bookshelf/bookshelf-tests.ts index 67580dae5f..42faf0909e 100644 --- a/bookshelf/bookshelf-tests.ts +++ b/bookshelf/bookshelf-tests.ts @@ -97,4 +97,3 @@ class Photo extends bookshelf.Model { return this.morphTo('imageable', Site, Post); } } - diff --git a/bookshelf/bookshelf.d.ts b/bookshelf/bookshelf.d.ts index 0da1ce2d68..e0278df261 100644 --- a/bookshelf/bookshelf.d.ts +++ b/bookshelf/bookshelf.d.ts @@ -11,7 +11,7 @@ declare module 'bookshelf' { import knex = require('knex'); import Promise = require('bluebird'); import Lodash = require('lodash'); - + interface Bookshelf extends Bookshelf.Events { VERSION : string; knex : knex; @@ -20,9 +20,9 @@ declare module 'bookshelf' { transaction(callback : (transaction : knex.Transaction) => T) : Promise; } - + function Bookshelf(knex : knex) : Bookshelf; - + namespace Bookshelf { abstract class Events { on(event? : string, callback? : EventFunction, context? : any) : void; @@ -31,20 +31,20 @@ declare module 'bookshelf' { triggerThen(name : string, ...args : any[]) : Promise; once(event : string, callback : EventFunction, context? : any) : void; } - + interface IModelBase { /** Should be declared as a getter instead of a plain property. */ hasTimestamps? : boolean|string[]; /** Should be declared as a getter instead of a plain property. Should be required, but cannot have abstract properties yet. */ tableName? : string; } - + abstract class ModelBase> extends Events> implements IModelBase { /** If overriding, must use a getter instead of a plain property. */ idAttribute : string; - + constructor(attributes? : any, options? : ModelOptions); - + clear() : T; clone() : T; escape(attribute : string) : string; @@ -63,7 +63,7 @@ declare module 'bookshelf' { timestamp(options? : TimestampOptions) : any; toJSON(options? : SerializeOptions) : any; unset(attribute : string) : T; - + // lodash methods invert() : R; keys() : string[]; @@ -74,7 +74,7 @@ declare module 'bookshelf' { pick(...attributes : string[]) : R; values() : any[]; } - + class Model> extends ModelBase { static collection>(models? : T[], options? : CollectionOptions) : Collection; static count(column? : string, options? : SyncOptions) : Promise; @@ -83,7 +83,7 @@ declare module 'bookshelf' { static fetchAll>() : Promise>; /** @deprecated should use `new` objects instead. */ static forge(attributes? : any, options? : ModelOptions) : T; - + belongsTo>(target : {new(...args : any[]) : R}, foreignKey? : string) : R; belongsToMany>(target : {new(...args : any[]) : R}, table? : string, foreignKey? : string, otherKey? : string) : Collection; count(column? : string, options? : SyncOptions) : Promise; @@ -109,7 +109,7 @@ declare module 'bookshelf' { where(properties : {[key : string] : any}) : T; where(key : string, operatorOrValue : string|number|boolean, valueIfOperator? : string|number|boolean) : T; } - + abstract class CollectionBase> extends Events { add(models : T[]|{[key : string] : any}[], options? : CollectionAddOptions) : Collection; at(index : number) : T; @@ -133,7 +133,7 @@ declare module 'bookshelf' { toJSON(options? : SerializeOptions) : any; unshift(model : any, options? : CollectionAddOptions) : void; where(match : {[key : string] : any}, firstOnly : boolean) : T|Collection; - + // lodash methods all(predicate? : Lodash.ListIterator|Lodash.DictionaryIterator|string, thisArg? : any) : boolean; all(predicate? : R) : boolean; @@ -200,13 +200,13 @@ declare module 'bookshelf' { toArray() : T[]; without(...values : any[]) : T[]; } - + class Collection> extends CollectionBase { /** @deprecated use Typescript classes */ static extend(prototypeProperties? : any, classProperties? : any) : Function; /** @deprecated should use `new` objects instead. */ static forge(attributes? : any, options? : ModelOptions) : T; - + attach(ids : any[], options? : SyncOptions) : Promise>; count(column? : string, options? : SyncOptions) : Promise; create(model : {[key : string] : any}, options? : CollectionCreateOptions) : Promise; @@ -222,92 +222,92 @@ declare module 'bookshelf' { updatePivot(attributes : any, options? : PivotOptions) : Promise; withPivot(columns : string[]) : Collection; } - + interface ModelOptions { tableName? : string; hasTimestamps? : boolean; parse? : boolean; } - + interface LoadOptions extends SyncOptions { withRelated: string|any|any[]; } - + interface FetchOptions extends SyncOptions { require? : boolean; columns? : string|string[]; withRelated? : string|any|any[]; } - + interface FetchAllOptions extends SyncOptions { require? : boolean; } - + interface SaveOptions extends SyncOptions { method? : string; defaults? : string; patch? : boolean; require? : boolean; } - + interface SerializeOptions { shallow? : boolean; omitPivot? : boolean; } - + interface SetOptions { unset? : boolean; } - + interface TimestampOptions { method? : string; } - + interface SyncOptions { transacting? : knex.Transaction; debug? : boolean; } - + interface CollectionOptions { comparator? : boolean|string|((a : T, b : T) => number); } - + interface CollectionAddOptions extends EventOptions { at? : number; merge? : boolean; } - + interface CollectionFetchOptions { require? : boolean; withRelated? : string|string[]; } - + interface CollectionFetchOneOptions { require? : boolean; columns? : string|string[]; } - + interface CollectionSetOptions extends EventOptions { add? : boolean; remove? : boolean; merge?: boolean; } - + interface PivotOptions { query? : Function|any; require? : boolean; } - + interface EventOptions { silent? : boolean; } - + interface EventFunction { (model: T, attrs: any, options: any) : Promise|void; } - + interface CollectionCreateOptions extends ModelOptions, SyncOptions, CollectionAddOptions, SaveOptions {} } - + export = Bookshelf; } diff --git a/knex/knex.d.ts b/knex/knex.d.ts index d2afc4aa82..49fb30ae02 100644 --- a/knex/knex.d.ts +++ b/knex/knex.d.ts @@ -39,7 +39,7 @@ declare module "knex" { // // QueryInterface // - + interface QueryInterface { select: Select; as: As; @@ -49,7 +49,7 @@ declare module "knex" { into: Table; table: Table; distinct: Distinct; - + // Joins join: Join; joinRaw: JoinRaw; @@ -61,7 +61,7 @@ declare module "knex" { outerJoin: Join; fullOuterJoin: Join; crossJoin: Join; - + // Wheres where: Where; andWhere: Where; @@ -86,29 +86,29 @@ declare module "knex" { whereNotBetween: WhereBetween; orWhereBetween: WhereBetween; orWhereNotBetween: WhereBetween; - + // Group by groupBy: GroupBy; groupByRaw: RawQueryBuilder; - + // Order by orderBy: OrderBy; orderByRaw: RawQueryBuilder; - + // Union union: Union; unionAll(callback: Function): QueryBuilder; - + // Having having: Having; havingRaw: RawQueryBuilder; orHaving: Having; orHavingRaw: RawQueryBuilder; - + // Paging offset(offset: number): QueryBuilder; limit(limit: number): QueryBuilder; - + // Aggregation count(columnName?: string): QueryBuilder; min(columnName: string): QueryBuilder; @@ -117,43 +117,43 @@ declare module "knex" { avg(columnName: string): QueryBuilder; increment(columnName: string, amount?: number): QueryBuilder; decrement(columnName: string, amount?: number): QueryBuilder; - + // Others first(...columns: string[]): QueryBuilder; - + debug(enabled?: boolean): QueryBuilder; pluck(column: string): QueryBuilder; - + insert(data: any, returning?: string | string[]): QueryBuilder; update(data: any, returning?: string | string[]): QueryBuilder; update(columnName: string, value: Value, returning?: string | string[]): QueryBuilder; returning(column: string): QueryBuilder; - + del(returning?: string | string[]): QueryBuilder; delete(returning?: string | string[]): QueryBuilder; truncate(): QueryBuilder; - + transacting(trx: Transaction): QueryBuilder; connection(connection: any): QueryBuilder; clone(): QueryBuilder; } - + interface As { (columnName: string): QueryBuilder; } - + interface Select extends ColumnNameQueryBuilder { } - + interface Table { (tableName: string): QueryBuilder; (callback: Function): QueryBuilder; } - + interface Distinct extends ColumnNameQueryBuilder { } - + interface Join { (raw: Raw): QueryBuilder; (tableName: string, callback: Function): QueryBuilder; @@ -161,126 +161,126 @@ declare module "knex" { (tableName: string, column1: string, raw: Raw): QueryBuilder; (tableName: string, column1: string, operator: string, column2: string): QueryBuilder; } - + interface JoinRaw { (tableName: string, binding?: Value): QueryBuilder; } - + interface Where extends WhereRaw, WhereWrapped, WhereNull { (object: Object): QueryBuilder; (columnName: string, value: Value): QueryBuilder; (columnName: string, operator: string, value: Value): QueryBuilder; (columnName: string, operator: string, query: QueryBuilder): QueryBuilder; } - + interface WhereRaw extends RawQueryBuilder { (condition: boolean): QueryBuilder; } - + interface WhereWrapped { (callback: Function): QueryBuilder; } - + interface WhereNull { (columnName: string): QueryBuilder; } - + interface WhereIn { (columnName: string, values: Value[]): QueryBuilder; (columnName: string, callback: Function): QueryBuilder; (columnName: string, query: QueryBuilder): QueryBuilder; } - + interface WhereBetween { (columnName: string, range: [Value, Value]): QueryBuilder; } - + interface WhereExists { (callback: Function): QueryBuilder; (query: QueryBuilder): QueryBuilder; } - + interface WhereNull { (columnName: string): QueryBuilder; } - + interface WhereIn { (columnName: string, values: Value[]): QueryBuilder; } - + interface GroupBy extends RawQueryBuilder, ColumnNameQueryBuilder { } - + interface OrderBy { (columnName: string, direction?: string): QueryBuilder; } - + interface Union { (callback: Function, wrap?: boolean): QueryBuilder; (callbacks: Function[], wrap?: boolean): QueryBuilder; (...callbacks: Function[]): QueryBuilder; // (...callbacks: Function[], wrap?: boolean): QueryInterface; } - + interface Having extends RawQueryBuilder, WhereWrapped { (tableName: string, column1: string, operator: string, column2: string): QueryBuilder; } - + // commons - + interface ColumnNameQueryBuilder { (...columnNames: ColumnName[]): QueryBuilder; (columnNames: ColumnName[]): QueryBuilder; } - + interface RawQueryBuilder { (sql: string, ...bindings: Value[]): QueryBuilder; (sql: string, bindings: Value[]): QueryBuilder; (raw: Raw): QueryBuilder; } - + // Raw - + interface Raw extends events.EventEmitter, ChainableInterface { wrap(before: string, after: string): Raw; } - + interface RawBuilder { (value: Value): Raw; (sql: string, ...bindings: Value[]): Raw; (sql: string, bindings: Value[]): Raw; } - + // // QueryBuilder // - + interface QueryBuilder extends QueryInterface, ChainableInterface { or: QueryBuilder; and: QueryBuilder; - + //TODO: Promise? columnInfo(column?: string): Promise; - + forUpdate(): QueryBuilder; forShare(): QueryBuilder; - + toSQL(): Sql; - + on(event: string, callback: Function): QueryBuilder; } - + interface Sql { method: string; options: any; bindings: Value[]; sql: string; } - + // // Chainable interface // - + interface ChainableInterface extends Promise { toQuery(): string; options(options: any): QueryBuilder; @@ -289,16 +289,16 @@ declare module "knex" { pipe(writable: any): QueryBuilder; exec(callback: Function): QueryBuilder; } - + interface Transaction extends QueryBuilder { commit: any; rollback: any; } - + // // Schema builder // - + interface SchemaBuilder { createTable(tableName: string, callback: (tableBuilder: CreateTableBuilder) => any): Promise; renameTable(oldTableName: string, newTableName: string): Promise; @@ -309,7 +309,7 @@ declare module "knex" { dropTableIfExists(tableName: string): Promise; raw(statement: string): SchemaBuilder; } - + interface TableBuilder { increments(columnName?: string): ColumnBuilder; dropColumn(columnName: string): TableBuilder; @@ -336,24 +336,24 @@ declare module "knex" { specificType(columnName: string, type: string): ColumnBuilder; primary(columnNames: string[]) : TableBuilder; index(columnNames: string[], indexName?: string, indexType?: string) : TableBuilder; - unique(columnNames: string[], indexName?: string) : TableBuilder; + unique(columnNames: string[], indexName?: string) : TableBuilder; } - + interface CreateTableBuilder extends TableBuilder { } - + interface MySqlTableBuilder extends CreateTableBuilder { engine(val: string): CreateTableBuilder; charset(val: string): CreateTableBuilder; collate(val: string): CreateTableBuilder; } - + interface AlterTableBuilder extends TableBuilder { } - + interface MySqlAlterTableBuilder extends AlterTableBuilder { } - + interface ColumnBuilder { index(indexName?: string): ColumnBuilder; primary(): ColumnBuilder; @@ -367,34 +367,34 @@ declare module "knex" { nullable(): ColumnBuilder; comment(value: string): ColumnBuilder; } - + interface PostgreSqlColumnBuilder extends ColumnBuilder { index(indexName?: string, indexType?: string): ColumnBuilder; } - + interface ReferencingColumnBuilder { inTable(tableName: string): ColumnBuilder; } - + interface AlterColumnBuilder extends ColumnBuilder { } - + interface MySqlAlterColumnBuilder extends AlterColumnBuilder { first(): AlterColumnBuilder; after(columnName: string): AlterColumnBuilder; } - + // // Configurations // - + interface ColumnInfo { defaultValue: Value; type: string; maxLength: number; nullable: boolean; } - + interface Config { debug?: boolean; client?: string; @@ -404,7 +404,7 @@ declare module "knex" { pool?: PoolConfig; migrations?: MigrationConfig; } - + interface ConnectionConfig { host: string; user: string; @@ -412,13 +412,13 @@ declare module "knex" { database: string; debug?: boolean; } - + /** Used with SQLite3 adapter */ interface Sqlite3ConnectionConfig { filename: string; debug?: boolean; } - + interface SocketConnectionConfig { socketPath: string; user: string; @@ -426,7 +426,7 @@ declare module "knex" { database: string; debug?: boolean; } - + interface PoolConfig { name?: string; create?: Function; @@ -443,7 +443,7 @@ declare module "knex" { validate?: Function; log?: boolean; } - + interface MigrationConfig { database?: string; directory?: string; From 1cd9ab5ab036525229281f58309221885cbe419d Mon Sep 17 00:00:00 2001 From: paarth Date: Sun, 13 Dec 2015 16:50:08 -0500 Subject: [PATCH 240/474] Made all entries in WebPreferences interface optional, reflecting documentation --- github-electron/github-electron.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 7c5fa8b4d6..12d53dcc6b 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -450,14 +450,14 @@ declare module GitHubElectron { interface WebPreferences { nodeIntegration?: boolean; preload?: string; - partition: string; - zoomFactor: number; - javascript: boolean; - webSecurity: boolean; - allowDisplayingInsecureContent: boolean; - allowRunningInsecureContent: boolean; - images: boolean; - textAreasAreResizable: boolean; + partition?: string; + zoomFactor?: number; + javascript?: boolean; + webSecurity?: boolean; + allowDisplayingInsecureContent?: boolean; + allowRunningInsecureContent?: boolean; + images?: boolean; + textAreasAreResizable?: boolean; webgl?: boolean; webaudio?: boolean; plugins?: boolean; From 1bd11135c8be706a519b46753f477e3e3c4029fa Mon Sep 17 00:00:00 2001 From: hinamiyagk Date: Mon, 14 Dec 2015 12:09:18 +0900 Subject: [PATCH 241/474] Add electron.hideInternalModules() --- github-electron/github-electron-main-tests.ts | 4 ++- github-electron/github-electron.d.ts | 27 ++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index ef9c21e52f..8a0d4125f4 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -19,6 +19,8 @@ import { shell } from 'electron'; +require('electron').hideInternalModules(); + import path = require('path'); // Quick start @@ -201,7 +203,7 @@ ipcMain.on('online-status-changed', (event: any, status: any) => { app.on('ready', () => { window = new BrowserWindow({ width: 800, - height: 600, + height: 600, titleBarStyle: 'hidden-inset', }); window.loadURL('https://github.com'); diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 7c5fa8b4d6..5dcaba2ffe 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1312,7 +1312,7 @@ declare module GitHubElectron { */ read(format: string, type?: string): any; } - + interface CrashReporterStartOptions { /** * Default: Electron @@ -1343,7 +1343,7 @@ declare module GitHubElectron { */ extra?: {} } - + interface CrashReporterPayload extends Object { /** * E.g., "electron-crash-service". @@ -1383,17 +1383,17 @@ declare module GitHubElectron { */ upload_file_minidump: File; } - + interface CrashReporter { start(options?: CrashReporterStartOptions): 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. */ getLastCrashReport(): CrashReporterPayload; } - + interface Shell{ /** * Show the given file in a file manager. If possible, select the file. @@ -1469,7 +1469,7 @@ declare module GitHubElectron { */ process: any; } - + interface WebFrame { /** * Changes the zoom factor to the specified factor, zoom factor is @@ -1588,7 +1588,7 @@ declare module GitHubElectron { ENABLE_SAMPLING: number; RECORD_CONTINUOUSLY: number; } - + interface Dialog { /** * @param callback If supplied, the API call will be asynchronous. @@ -1608,7 +1608,7 @@ declare module GitHubElectron { * @returns The index of the clicked button. */ 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 @@ -1616,7 +1616,7 @@ declare module GitHubElectron { */ showErrorBox(title: string, content: string): void; } - + interface GlobalShortcut { /** * Registers a global shortcut of accelerator. @@ -1643,14 +1643,14 @@ declare module GitHubElectron { */ unregisterAll(): void; } - + class RequestFileJob { /** * Create a request job which would query a file of path and set corresponding mime types. */ constructor(path: string); } - + class RequestStringJob { /** * Create a request job which sends a string as response. @@ -1667,7 +1667,7 @@ declare module GitHubElectron { data?: string; }); } - + class RequestBufferJob { /** * Create a request job which accepts a buffer and sends a string as response. @@ -1684,7 +1684,7 @@ declare module GitHubElectron { data?: Buffer; }); } - + interface Protocol { registerProtocol(scheme: string, handler: (request: any) => void): void; unregisterProtocol(scheme: string): void; @@ -1718,6 +1718,7 @@ declare module GitHubElectron { powerMonitor: NodeJS.EventEmitter; protocol: GitHubElectron.Protocol; Tray: typeof GitHubElectron.Tray; + hideInternalModules(): any; } } From 20d5ad78bc140881d443476b4aa658d90c7ded4e Mon Sep 17 00:00:00 2001 From: Wang Zishi Date: Mon, 14 Dec 2015 12:14:05 +0800 Subject: [PATCH 242/474] Add definitions for cookies v0.5.8 for [cookies](https://github.com/pillarjs/cookies) v0.5.8 --- cookies/cookies-tests.ts | 42 +++++++++++++++++ cookies/cookies.d.ts | 98 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 cookies/cookies-tests.ts create mode 100644 cookies/cookies.d.ts diff --git a/cookies/cookies-tests.ts b/cookies/cookies-tests.ts new file mode 100644 index 0000000000..3e3274a4d4 --- /dev/null +++ b/cookies/cookies-tests.ts @@ -0,0 +1,42 @@ +/// +/// + +import * as Cookies from 'cookies'; +import * as http from 'http'; + +const server = http.createServer((req, res) => { + const cookies = new Cookies(req, res); + let unsigned: string, + signed: string, + tampered: string + + if (req.url == "/set") { + cookies + // set a regular cookie + .set("unsigned", "foo", { httpOnly: false }) + + // set a signed cookie + .set("signed", "bar", { signed: true }) + + // mimic a signed cookie, but with a bogus signature + .set("tampered", "baz") + .set("tampered.sig", "bogus") + + res.writeHead(302, { "Location": "/" }) + return res.end("Now let's check.") + } + + unsigned = cookies.get("unsigned") + signed = cookies.get("signed", { signed: true }) + tampered = cookies.get("tampered", { signed: true }) + + res.writeHead(200, { "Content-Type": "text/plain" }) + res.end( + "unsigned expected: foo\n\n" + + "unsigned actual: " + unsigned + "\n\n" + + "signed expected: bar\n\n" + + "signed actual: " + signed + "\n\n" + + "tampered expected: undefined\n\n" + + "tampered: " + tampered + "\n\n" + ) +}) \ No newline at end of file diff --git a/cookies/cookies.d.ts b/cookies/cookies.d.ts new file mode 100644 index 0000000000..24984f7fdd --- /dev/null +++ b/cookies/cookies.d.ts @@ -0,0 +1,98 @@ +// Type definitions for cookie-parser v0.5.1 +// Project: https://github.com/pillarjs/cookies +// Definitions by: Wang Zishi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "cookies" { + import * as http from "http" + + interface ICookies { + /** + * This extracts the cookie with the given name from the + * Cookie header in the request. If such a cookie exists, + * its value is returned. Otherwise, nothing is returned. + */ + get(name: string): string; + /** + * This extracts the cookie with the given name from the + * Cookie header in the request. If such a cookie exists, + * its value is returned. Otherwise, nothing is returned. + */ + get(name: string, opts?: IOptions): string; + + /** + * This sets the given cookie in the response and returns + * the current context to allow chaining.If the value is omitted, + * an outbound header with an expired date is used to delete the cookie. + */ + set(name: string, value: string): ICookies; + /** + * This sets the given cookie in the response and returns + * the current context to allow chaining.If the value is omitted, + * an outbound header with an expired date is used to delete the cookie. + */ + set(name: string, value: string, opts?: IOptions): ICookies; + } + + interface IOptions { + /** + * a number representing the milliseconds from Date.now() for expiry + */ + maxAge?: number; + /** + * a Date object indicating the cookie's expiration + * date (expires at the end of session by default). + */ + expires?: Date; + /** + * a string indicating the path of the cookie (/ by default). + */ + path?: string; + /** + * a string indicating the domain of the cookie (no default). + */ + domain?: string; + /** + * a boolean indicating whether the cookie is only to be sent + * over HTTPS (false by default for HTTP, true by default for HTTPS). + */ + secure?: boolean; + /** + * a boolean indicating whether the cookie is only to be sent + * over HTTPS (use this if you handle SSL not in your node process). + */ + secureProxy?: boolean; + /** + * a boolean indicating whether the cookie is only to be sent over HTTP(S), + * and not made available to client JavaScript (true by default). + */ + httpOnly?: boolean; + /** + * a boolean indicating whether the cookie is to be signed (false by default). + * If this is true, another cookie of the same name with the .sig suffix + * appended will also be sent, with a 27-byte url-safe base64 SHA1 value + * representing the hash of cookie-name=cookie-value against the first Keygrip key. + * This signature key is used to detect tampering the next time a cookie is received. + */ + signed?: boolean; + /** + * a boolean indicating whether to overwrite previously set + * cookies of the same name (false by default). If this is true, + * all cookies set during the same request with the same + * name (regardless of path or domain) are filtered out of + * the Set-Cookie header when setting this cookie. + */ + overwrite?: boolean; + } + + interface CookiesStatic { + new (request: http.IncomingMessage, response: http.ServerResponse): ICookies; + new (request: http.IncomingMessage, response: http.ServerResponse, keys?: Array): ICookies; + } + + const _tmp: CookiesStatic; + + export = _tmp +} \ No newline at end of file From 05e67b229d29cc921dd8fd3c42991c897445f547 Mon Sep 17 00:00:00 2001 From: Panu Horsmalahti Date: Sat, 12 Dec 2015 23:52:03 +0200 Subject: [PATCH 243/474] Add type definitions for cradle. --- cradle/cradle-tests.ts | 185 +++++++++++++++++++++++++++++++++++++++++ cradle/cradle.d.ts | 122 +++++++++++++++++++++++++++ 2 files changed, 307 insertions(+) create mode 100644 cradle/cradle-tests.ts create mode 100644 cradle/cradle.d.ts diff --git a/cradle/cradle-tests.ts b/cradle/cradle-tests.ts new file mode 100644 index 0000000000..655e92a87b --- /dev/null +++ b/cradle/cradle-tests.ts @@ -0,0 +1,185 @@ +/// + +import cradle = require("cradle"); + +cradle.setup({ + host: 'living-room.couch', + cache: true, + raw: false, + forceSave: true +}); + +const connection = new cradle.Connection(); +const connection2 = new(cradle.Connection); +const connection3 = new(cradle.Connection)('173.45.66.92'); + +connection.databases(function(error, response) {}); +connection.config(function(error, response) {}); +connection.databases(function(error, response) {}); +connection.info(function(error, response) {}); +connection.stats(function(error, response) {}); +connection.activeTasks(function(error, response) {}); +connection.uuids(function(error, response) {}); +connection.uuids(10, function(error, response) {}); +connection.replicate({ + source: "database", + target: "targetDatabase" +}, function(error, response) {}); + +const db = connection.database('starwars'); + +db.exists(function (error, exists) { + if (error) { + console.log('error', error); + } else if (exists) { + console.log('the force is with you.'); + } else { + console.log('database does not exists.'); + db.create(function(error){ + /* do something if there's an erroror */ + /* populate design documents */ + }); + } +}); + +db.get<{ + name: string; +}>('vader', function (error, doc) { + doc.name; // 'Darth Vader' +}); + +db.get('luke', function (error, doc) { + doc.prop; +}); + + db.get(['luke', 'vader'], function (error, doc) { + // + }); + +db.save('skywalker', { + force: 'light', + name: 'Luke Skywalker' +}, function (error, res) { + if (error) { + // Handle erroror + } else { + // Handle success + } +}); + +db.save({ + force: 'dark', name: 'Darth' + }, function (err, res) { + // Handle response + }); + +db.save('luke', '1-94B6F82', { + force: 'dark', name: 'Luke' +}, function (err, res) { + // Handle response +}); + +db.save([ + { name: 'Yoda' }, + { name: 'Han Solo' }, + { name: 'Leia' } +], function (err, res) { + // Handle response +}); + +db.merge('luke', {jedi: true}, function (err, res) { + // Luke is now a jedi, + // but remains on the dark side of the force. +}); + +db.view('characters/all', function (err, res) { + res.forEach(function (row: any) { + console.log("%s is on the %s side of the force.", row.name, row.force); + }); +}); + +db.view('characters/all', {group: true, reduce: true} , function (err, res) { + res.forEach(function (row: any) { + console.log("%s is on the %s side of the force.", row.name, row.force); + }); + }); + + db.temporaryView({ + map: function (doc: any) { + // + } + }, function (err, res) { + if (err) console.log(err); + console.log(res); + }); + +db.remove('luke', '1-94B6F82', function (err, res) { + // Handle response +}); + +db.update('my_designdoc/update_handler_name', 'luke', undefined, { my_param: false }, function (err, res) { + // Handle the response, specified by the update handler +}); + +db.changes(function (err, list) { + list.forEach(function (change) { console.log(change) }); +}); + +db.changes({ since: 42 }, function (err, list) { + // +}); + +const feed = db.changes({ since: 42 }); + +feed.on('change', function (change: any) { + console.log(change); +}); + +const idAndRevData = { + id: 'luke', + rev: 'my-rev' +}; + +const attachmentData = { + name: 'fooAttachment.txt', + 'Content-Type': 'text/plain', + body: 'Foo document text' +}; + +db.saveAttachment(idAndRevData, attachmentData, function (err, reply) { + if (err) { + console.dir(err) + return + } + console.dir(reply) +}); + + +db.getAttachment('luke', 'foo.txt', function (err, reply) { + if (err) { + console.dir(err); + return; + } + console.dir(reply); +}); + +db.removeAttachment('luke', 'foo.txt', function (err, reply) { + if (err) { + console.dir(err); + return; + } + console.dir(reply); +}); + +db.info(function(error, response) {}); +db.all(function(error, response) {}); +db.all({ + body: { + keys: ['key1', 'key2'] + } +}, function(error, response) {}); +db.compact(function(error, response) {}); +db.compact('design', function(error, response) {}); +db.viewCleanup(function(error, response) {}); +db.replicate('database', function(error, response) {}); +db.replicate('database', {}, function(error, response) {}); diff --git a/cradle/cradle.d.ts b/cradle/cradle.d.ts new file mode 100644 index 0000000000..6434af26c5 --- /dev/null +++ b/cradle/cradle.d.ts @@ -0,0 +1,122 @@ +// Type definitions for cradle +// Project: https://github.com/flatiron/cradle +// Definitions by: Panu Horsmalahti +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "cradle" { + interface Options { + host?: string; + hostname?: string; + cache?: boolean; + raw?: boolean; + forceSave?: boolean; + auth?: string | { + username: string; + password: string; + } + ca?: string; + secure?: boolean; + retries?: number; + retryTimeout?: number; + maxSockets?: number; + } + + interface Callback { + (error: any, response: any): void; + } + + interface ErrorCallback { + (error: any): void; + } + + export class Connection { + constructor(uri?: string, port?: number, options?: Options); + database(name: string): Database; + databases(Callback: Callback): void; + config(callback: Callback): void; + info(callback: Callback): void; + stats(callback: Callback): void; + activeTasks(callback: Callback): void; + uuids(callback: Callback): void; + uuids(count: number, callback: Callback): void; + replicate(options: { + source: string | { + url: string; + }; + target: string | { + url: string; + }; + cancel?: boolean; + continuous?: boolean; + create_target?: boolean; + doc_ids?: string[]; + filter?: string; + proxy?: string; + query_params?: any; + }, callback: Callback): void; + } + + export interface ChangesOptions { + since: number; + } + + export class Database { + name: string; + get(id: string, callback: (error: any, document: any) => void): void; + get(id: string, callback: (error: any, document: T) => void): void; + get(id: string, rev: string, callback: (error: any, document: any) => void): void; + get(id: string, rev: string, callback: (error: any, document: T) => void): void; + get(ids: string[], callback: Callback): void; + save(document: any, callback: Callback): void; + save(id: string, document: any, callback: Callback): void; + save(id: string, revision: string, document: any, + callback: Callback): void; + save(document: T, callback: Callback): void; + save(id: string, document: T, callback: Callback): void; + save(id: string, revision: string, document: T, + callback: Callback): void; + save(documents: any[], callback: Callback): void; + merge(id: string, document: any, callback: Callback): void; + merge(id: string, document: T, callback: Callback): void; + remove(id: string, revision: string, callback: Callback): void; + update(name: string, id: string, queryObject: any, documentBody: any, + callback: Callback): void; + view(name: string, callback: Callback): void; + view(name: string, options: { + group?: boolean; + reduce?: boolean; + key?: string; + startkey?: any; + endkey?: any; + include_docs?: boolean; + limit?: number; + descending?: boolean; + }, callback: Callback): void; + temporaryView(view: any, callback: Callback): void; + create(callback: ErrorCallback): void; + exists(callback: (error: any, exists: boolean) => void): void; + destroy(callback: ErrorCallback): void; + changes(options: ChangesOptions): any; + changes(callback: (error: any, list: any[]) => void): void; + changes(options: ChangesOptions, callback: (error: any, + list: any[]) => void): void; + saveAttachment(idAndRevData: { + id: string; + rev: string; + }, attachmentData: any, callback: Callback): void; + getAttachment(id: string, attachmentName: string, + callback: Callback): void; + removeAttachment(id: string, attachmentName: string, + callback: Callback): void; + info(callback: Callback): void; + all(callback: Callback): void; + all(options: any, callback: Callback): void; + compact(callback: Callback): void; + compact(design: string, callback: Callback): void; + viewCleanup(callback: Callback): void; + replicate(target: string, callback: Callback): void; + replicate(target: string, options: any, callback: Callback): void; + } + + export function setup(options: Options): void; +} From 6b0270532cfa5f83a309ff2b490a5f83ae3df9c4 Mon Sep 17 00:00:00 2001 From: Max Shmelev Date: Mon, 14 Dec 2015 10:32:03 -0500 Subject: [PATCH 244/474] Add 'opts' function definition --- restify/restify-tests.ts | 2 ++ restify/restify.d.ts | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/restify/restify-tests.ts b/restify/restify-tests.ts index 3e0697c1d4..ca3c5000ef 100644 --- a/restify/restify-tests.ts +++ b/restify/restify-tests.ts @@ -92,12 +92,14 @@ server.put( '/hello', send); server.del( '/hello', send); server.get( '/hello', send); server.head('/hello', send); +server.opts('/hello', send); server.post(/(.*)/, send); server.put( /(.*)/, send); server.del( /(.*)/, send); server.get( /(.*)/, send); server.head(/(.*)/, send); +server.opts(/(.*)/, send); new restify.BadRequestError(); diff --git a/restify/restify.d.ts b/restify/restify.d.ts index d3e5e35f83..c523810eec 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -87,6 +87,11 @@ declare module "restify" { head(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): any; head(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): any; + opts(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[]): any; + opts(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[]): any; + opts(route: any, routeCallBack: RequestHandler, ...routeCallBacks: RequestHandler[][]): any; + opts(route: any, routeCallBack: RequestHandler[], ...routeCallBacks: RequestHandler[][]): any; + name: string; version: string; log: Object; From 4c528224a3028e1206c68b5ac3eb067570292fb8 Mon Sep 17 00:00:00 2001 From: John Grimsey Date: Mon, 14 Dec 2015 17:21:56 +0000 Subject: [PATCH 245/474] Adds email-addresses definitions --- email-addresses/email-addresses.d.ts | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 email-addresses/email-addresses.d.ts diff --git a/email-addresses/email-addresses.d.ts b/email-addresses/email-addresses.d.ts new file mode 100644 index 0000000000..2d734add09 --- /dev/null +++ b/email-addresses/email-addresses.d.ts @@ -0,0 +1,4 @@ +declare module "email-addresses" { + function parseOneAddress(opts: any): Object; + function parseAddressList(opts: any): Object; +} From 6eb5b9091e10bd8b1bb2b22fa3c7c09dfe6fb0e5 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 14 Dec 2015 22:36:44 +0500 Subject: [PATCH 246/474] lodash: signatures of _.isRegExp have been changed --- lodash/lodash-tests.ts | 40 ++++++++++++++++++++++++++++------------ lodash/lodash.d.ts | 8 ++++++++ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2d244b16e5..f493b42607 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5635,18 +5635,34 @@ result = _([]).isPlainObject(); result = _({}).isPlainObject(); // _.isRegExp -result = _.isRegExp(any); -result = _(1).isRegExp(); -result = _([]).isRegExp(); -result = _({}).isRegExp(); -{ - let value: RegExp|string = /^foo$/g; - if (_.isRegExp(value)) { - let regex: RegExp = value; - let index: number = value.exec("foo").index; - } else { - let result: string = value; - } +module TestIsRegExp { + { + let value: number|RegExp; + + if (_.isRegExp(value)) { + let result: RegExp = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isRegExp(any); + result = _(1).isRegExp(); + result = _([]).isRegExp(); + result = _({}).isRegExp(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isRegExp(); + result = _([]).chain().isRegExp(); + result = _({}).chain().isRegExp(); + } } // _.isString diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 8425f1d823..350757ded5 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9605,6 +9605,7 @@ declare module _ { /** * Checks if value is classified as a RegExp object. * @param value The value to check. + * * @return Returns true if value is correctly classified, else false. */ isRegExp(value?: any): value is RegExp; @@ -9617,6 +9618,13 @@ declare module _ { isRegExp(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isRegExp + */ + isRegExp(): LoDashExplicitWrapper; + } + //_.isString interface LoDashStatic { /** From 0402bee151f6524974557d3fe5ea990402e03e29 Mon Sep 17 00:00:00 2001 From: John Grimsey Date: Mon, 14 Dec 2015 17:21:56 +0000 Subject: [PATCH 247/474] - Adds email-addresses definitions - Adds tests and header --- email-addresses/email-addresses-tests.ts | 8 ++++++++ email-addresses/email-addresses.d.ts | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 email-addresses/email-addresses-tests.ts create mode 100644 email-addresses/email-addresses.d.ts diff --git a/email-addresses/email-addresses-tests.ts b/email-addresses/email-addresses-tests.ts new file mode 100644 index 0000000000..b43289d86c --- /dev/null +++ b/email-addresses/email-addresses-tests.ts @@ -0,0 +1,8 @@ +/// + +import addrs = require('email-addresses'); + +var result: Object; + +result = addrs.parseOneAddress('Jack Bowman '); +result = addrs.parseAddressList(['foo@bar.com', 'Foo Bar ']); diff --git a/email-addresses/email-addresses.d.ts b/email-addresses/email-addresses.d.ts new file mode 100644 index 0000000000..ccd0495303 --- /dev/null +++ b/email-addresses/email-addresses.d.ts @@ -0,0 +1,9 @@ +// Type definitions for email-addresses 2.0.1 +// Project: https://github.com/jackbowman/email-addresses +// Definitions by: John Grimsey +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "email-addresses" { + export function parseOneAddress(opts: any): Object; + export function parseAddressList(opts: any): Object; +} From a77e03f09222a03e3ba25c485de29f6bdf2aebb6 Mon Sep 17 00:00:00 2001 From: Rafal Witczak Date: Tue, 1 Dec 2015 19:35:07 -0800 Subject: [PATCH 248/474] TSD definitions for cordova-plugin-mapsforge --- .../cordova-plugin-mapsforge-tests.ts | 73 +++++ .../cordova-plugin-mapsforge.d.ts | 249 ++++++++++++++++++ 2 files changed, 322 insertions(+) create mode 100644 cordova-plugin-mapsforge/cordova-plugin-mapsforge-tests.ts create mode 100644 cordova-plugin-mapsforge/cordova-plugin-mapsforge.d.ts diff --git a/cordova-plugin-mapsforge/cordova-plugin-mapsforge-tests.ts b/cordova-plugin-mapsforge/cordova-plugin-mapsforge-tests.ts new file mode 100644 index 0000000000..52ef78700b --- /dev/null +++ b/cordova-plugin-mapsforge/cordova-plugin-mapsforge-tests.ts @@ -0,0 +1,73 @@ +/// + + +mapsforge.embedded.initialize(["/mnt/sdcard/spain.map",0,0]); //Creates the view +mapsforge.embedded.setCenter(43.360056,-5.845757); //Sets the center of the view +mapsforge.embedded.setMaxZoom(18); +mapsforge.embedded.setZoom(15); + +//Adding a marker +var markerKey: number; +mapsforge.embedded.addMarker([mapsforge.embedded.MARKER_YELLOW,43.360056,-5.845757],function(key){markerKey = key;}); + +//Adding a polyline +var points = [43.360056,-5.845757, 43.160056,-5.645757,43.560056,-5.895757]; +var polylineKey: number; +mapsforge.embedded.addPolyline([mapsforge.embedded.COLOR_GREEN,10,points], function(key){polylineKey = key;}, function(error){alert(error);}); + + + +mapsforge.cache.initialize("/mnt/sdcard/spain.map"); //Initializes the renderer with the offline map + +/*Now you can use the Leaflet code seen before*/ + +mapsforge.cache.setExternalCache(false); //Sets the cache to internal for faster performance + +//Now we set the cache size to 50 MB. This will increase the time between cleanings, but +//it will also make those cleanings slower, since there are a lot more of images to +//delete...so be careful when you choose the cache size +mapsforge.cache.setMaxCacheSize(50); + + + +var L: any; + +interface TilePoint { + x: number; + y: number; + z: number; +} + +interface Tile { + src: string; + _layer: any; + onload: any; + onerror: any; +} + +L.OfflineTileLayer = L.TileLayer.extend({ + getTileUrl : function(tilePoint: TilePoint, tile: Tile) { + var zoom = tilePoint.z, x = tilePoint.x, y = tilePoint.y; + + if (mapsforge.cache) { + mapsforge.cache.getTile([x,y,zoom], function(result) {tile.src=result;}, + function() {tile.src = "path to an error image";}); + }else{ + tile.src = "path to an error image"; + } + }, + + _loadTile: function (tile: Tile, tilePoint: TilePoint) { + tile._layer = this; + tile.onload = this._tileOnLoad; + tile.onerror = this._tileOnError; + + this._adjustTilePoint(tilePoint); + this.getTileUrl(tilePoint, tile); + + this.fire('tileloadstart', { + tile: tile, + url: tile.src + }); + } +}); diff --git a/cordova-plugin-mapsforge/cordova-plugin-mapsforge.d.ts b/cordova-plugin-mapsforge/cordova-plugin-mapsforge.d.ts new file mode 100644 index 0000000000..6314a09fb8 --- /dev/null +++ b/cordova-plugin-mapsforge/cordova-plugin-mapsforge.d.ts @@ -0,0 +1,249 @@ +// Type definitions for cordova-plugin-mapsforge +// Project: https://github.com/afsuarez/mapsforge-cordova-plugin +// Definitions by: rafw87 +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Window { + mapsforge: MapsforgePlugin; +} + +declare var mapsforge: MapsforgePlugin; + +interface MapsforgePlugin { + embedded: MapsforgeEmbeddedPlugin; + cache: MapsforgeCachePlugin; +} + +interface MapsforgeEmbeddedPlugin { + + COLOR_DKGRAY: number|string; + COLOR_CYAN: number|string; + COLOR_BLACK: number|string; + COLOR_BLUE: number|string; + COLOR_GREEN: number|string; + COLOR_RED: number|string; + COLOR_WHITE: number|string; + COLOR_TRANSPARENT: number|string; + COLOR_YELLOW: number|string; + + MARKER_RED: number|string; + MARKER_GREEN: number|string; + MARKER_BLUE: number|string; + MARKER_YELLOW: number|string; + MARKER_BLACK: number|string; + MARKER_WHITE: number|string; + + /** + * The map file path provided must be the absolute file path. You can specify the width and height values for the view that will be added, + * or you can set them to 0 for set the value to MATCH_PARENT. You must call this method before any other method. + * @param args Array in the following form: [String mapFilePath, int viewWidth, int viewHeight]. + * @param success Success callback. + * @param error Error callback + */ + initialize(args: any[], success?: () => void, error?: (message: string) => void): void; + + /** + * To show the map view. + * @param success Success callback. + * @param error Error callback + */ + show(success?: () => void, error?: (message: string) => void): void; + + /** + * To hide the map view. + * @param success Success callback. + * @param error Error callback + */ + hide(success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the center of the map to the given coordinates. + * @param lat Latitude of the new center. + * @param lng Longitude of the new center. + * @param success Success callback. + * @param error Error callback + */ + setCenter(lat: number, lng: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the zoom to the specified value (if it is between the zoom limits). + * @param zoomLevel New zoom level. + * @param success Success callback. + * @param error Error callback + */ + setZoom(zoomLevel: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the maximum zoom level. + * @param maxZoom New maximum zoom level. + * @param success Success callback. + * @param error Error callback + */ + setMaxZoom(maxZoom: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the minimum zoom level. + * @param minZoom New minimum zoom level. + * @param success Success callback. + * @param error Error callback + */ + setMinZoom(minZoom: number, success?: () => void, error?: (message: string) => void): void; + + /** + * The path to the map ile is required, and the path to the render theme may be null in order to apply the default render theme. + * @param args Array in the following form: [String mapFilePath, String renderThemePath] + * @param success Success callback. + * @param error Error callback + */ + setOfflineTileLayer(args: any[], success?: () => void, error?: (message: string) => void): void; + + /** + * + * @param args Array in the following form: [String providerName, String host, String baseUrl, String extension, int port] + * @param success Success callback. + * @param error Error callback + */ + setOnlineTileLayer(args: any[], success?: () => void, error?: (message: string) => void): void; + + /** + * Adds a marker to the map in the specified coordinates and returns the key for that marker to the success function. + * @param arg Array in the following form: [String marker_color, double lat, double lng]. + * The color of the marker should be one of the constants from mapsforge.embedded object; if the marker doesn't exist a green marker will be used instead. + * @param success Success callback. Gets the key of created marker. That key is the one you have to use if you want to delete it. + * @param error Error callback + */ + addMarker(arg: any[], success?: (key: number) => void, error?: (message: string) => void): void; + + /** + * + * @param arg Array in the following form: [int color, int strokeWidth,[double points]]. + * The color can be one of the constants specified before, or the new color you want. + * This function will use the odd positions of the array of points for the latitudes and the even positions for the longitudes. + * Example: [lat1, lng1, lat2, lng2, lat3, lng3]. + * If the length of the array is not even, the function will throw an exception and return the error message to the error function. + * @param success Success callback. Gets the key of created polyline. + * @param error Error callback + */ + addPolyline(arg: any[], success?: (key: number) => void, error?: (message: string) => void): void; + + /** + * Deletes the layer(markers or polylines) with the specified key from the map. + * @param key Key of marker or polyline. + * @param success Success callback. + * @param error Error callback + */ + deleteLayer(key: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Initializes again the map if the onStop method was called. + * @param success Success callback. + * @param error Error callback + */ + onStart(success?: () => void, error?: (message: string) => void): void; + + + /** + * Stops the rendering. Useful for when the app goes to the background. You have to call the onStart method to restart it. + * @param success Success callback. + * @param error Error callback + */ + onStop(success?: () => void, error?: (message: string) => void): void; + + /** + * Stops and cleans the resources that have been used. + * @param success Success callback. + * @param error Error callback + */ + onDestroy(success?: () => void, error?: (message: string) => void): void; +} + +interface MapsforgeCachePlugin { + + /** + * You should call this method before any other one, and provide it with the absolute map file path. + * @param mapFilePath Absolute map file path. + * @param success Success callback. + * @param error Error callback + */ + initialize(mapFilePath: string, success?: () => void, error?: (message: string) => void): void; + + /** + * This method is the one that provides the tiles, generating them if their are not in the cache. + * @param args Array in the following form: [double lat, double lng, byte zoom] + * @param success Success callback. Gets the tile path. + * @param error Error callback + */ + getTile(args: any[], success?: (tilePath: string) => void, error?: (message: string) => void): void; + + /** + * Enables or disables the cache. If disabled, the plugin will generate the tiles always from scratch. Cache is enabled by default. + * @param enabled Cache enabled or disabled. + * @param success Success callback. + * @param error Error callback + */ + setCacheEnabled(enabled: boolean, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets whether or not the cache should be placed in the internal memory or in the SD card. + * By default it is placed in SD card, so devices with not too much memory have a better performance. + * @param external Cache external or internal. + * @param success Success callback. + * @param error Error callback + */ + setExternalCache(external: boolean, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the map file to be used for rendering to the map specified by its absolute path. + * @param absolutePath Absolute map file path. + * @param success Success callback. + * @param error Error callback + */ + setMapFile(absolutePath: string, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the age for the generated images. This means that when the cache is being cleaned, all images younger than the specified value will be kept in the cache in order to avoid deleting images that are being used at the moment. + * @param milliseconds Max cache age in milliseconds. + * @param success Success callback. + * @param error Error callback + */ + setMaxCacheAge(milliseconds: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the maximum size for the cache. This size must be specified in megabytes. If there is not that space available, the cache will fit the maximum size. + * @param sizeInMB Max cache size in megabytes. + * @param success Success callback. + * @param error Error callback + */ + setMaxCacheSize(sizeInMB: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets the tile size. By default the tile size is set to 256. + * @param size Tile size. + * @param success Success callback. + * @param error Error callback + */ + setMaxCacheSize(size: number, success?: () => void, error?: (message: string) => void): void; + + /** + * This method sets the size in megabytes that will remain always available in memory in order to avoid that the application uses all space available. + * @param sizeInMB Size in megabytes that will remain always available in memory. + * @param success Success callback. + * @param error Error callback + */ + setCacheCleaningTrigger(sizeInMB: number, success?: () => void, error?: (message: string) => void): void; + + /** + * Sets a flag to destroy the cache when the onDestroy method is called. + * @param destroy If true, cache will be destroyed when the onDestroy method will be called. + * @param success Success callback. + * @param error Error callback + */ + destroyCacheOnExit(destroy: boolean, success?: () => void, error?: (message: string) => void): void; + + /** + * Deletes the cache depending on the flag state. + * @param success Success callback. + * @param error Error callback + */ + onDestroy(success?: () => void, error?: (message: string) => void): void; +} From d220aeca45e917dd5237fabd997cbeb13bbce849 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Sat, 12 Dec 2015 17:06:39 +0200 Subject: [PATCH 249/474] Added definitions for scrypt-async v1.2.0. --- scrypt-async/scrypt-async-tests.ts | 25 +++++++++++++++++++ scrypt-async/scrypt-async.d.ts | 39 ++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 scrypt-async/scrypt-async-tests.ts create mode 100644 scrypt-async/scrypt-async.d.ts diff --git a/scrypt-async/scrypt-async-tests.ts b/scrypt-async/scrypt-async-tests.ts new file mode 100644 index 0000000000..745d3ae62b --- /dev/null +++ b/scrypt-async/scrypt-async-tests.ts @@ -0,0 +1,25 @@ +// Tests by: Kaur Kuut + +/// + +var callback = function(key: string | number[]) { }; + +scrypt("abc", "def", 10, 8, 32, 1000, callback, "base64"); +scrypt("abc", [4,5,6], 10, 8, 32, 1000, callback, "base64"); +scrypt([1,2,3], "def", 10, 8, 32, 1000, callback, "base64"); +scrypt([1,2,3], [4,5,6], 10, 8, 32, 1000, callback, "base64"); + +scrypt("abc", "def", 10, 8, 32, 1000, callback); +scrypt("abc", [4,5,6], 10, 8, 32, 1000, callback); +scrypt([1,2,3], "def", 10, 8, 32, 1000, callback); +scrypt([1,2,3], [4,5,6], 10, 8, 32, 1000, callback); + +scrypt("abc", "def", 10, 8, 32, callback, "base64"); +scrypt("abc", [4,5,6], 10, 8, 32, callback, "base64"); +scrypt([1,2,3], "def", 10, 8, 32, callback, "base64"); +scrypt([1,2,3], [4,5,6], 10, 8, 32, callback, "base64"); + +scrypt("abc", "def", 10, 8, 32, callback); +scrypt("abc", [4,5,6], 10, 8, 32, callback); +scrypt([1,2,3], "def", 10, 8, 32, callback); +scrypt([1,2,3], [4,5,6], 10, 8, 32, callback); \ No newline at end of file diff --git a/scrypt-async/scrypt-async.d.ts b/scrypt-async/scrypt-async.d.ts new file mode 100644 index 0000000000..618d49e8a5 --- /dev/null +++ b/scrypt-async/scrypt-async.d.ts @@ -0,0 +1,39 @@ +// Type definitions for scrypt-async v1.2.0 +// Project: https://github.com/dchest/scrypt-async-js +// Definitions by: Kaur Kuut +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module ScryptAsync { + interface CallbackFunc { + (key: string): any; + (key: number[]): any; + } + + interface ScryptStatic { + (password: string, salt: string, logN: number, r: number, dkLen: number, interruptStep: number, callback: CallbackFunc, encoding: string): void; + (password: string, salt: number[], logN: number, r: number, dkLen: number, interruptStep: number, callback: CallbackFunc, encoding: string): void; + (password: number[], salt: string, logN: number, r: number, dkLen: number, interruptStep: number, callback: CallbackFunc, encoding: string): void; + (password: number[], salt: number[], logN: number, r: number, dkLen: number, interruptStep: number, callback: CallbackFunc, encoding: string): void; + + (password: string, salt: string, logN: number, r: number, dkLen: number, interruptStep: number, callback: CallbackFunc): void; + (password: string, salt: number[], logN: number, r: number, dkLen: number, interruptStep: number, callback: CallbackFunc): void; + (password: number[], salt: string, logN: number, r: number, dkLen: number, interruptStep: number, callback: CallbackFunc): void; + (password: number[], salt: number[], logN: number, r: number, dkLen: number, interruptStep: number, callback: CallbackFunc): void; + + (password: string, salt: string, logN: number, r: number, dkLen: number, callback: CallbackFunc, encoding: string): void; + (password: string, salt: number[], logN: number, r: number, dkLen: number, callback: CallbackFunc, encoding: string): void; + (password: number[], salt: string, logN: number, r: number, dkLen: number, callback: CallbackFunc, encoding: string): void; + (password: number[], salt: number[], logN: number, r: number, dkLen: number, callback: CallbackFunc, encoding: string): void; + + (password: string, salt: string, logN: number, r: number, dkLen: number, callback: CallbackFunc): void; + (password: string, salt: number[], logN: number, r: number, dkLen: number, callback: CallbackFunc): void; + (password: number[], salt: string, logN: number, r: number, dkLen: number, callback: CallbackFunc): void; + (password: number[], salt: number[], logN: number, r: number, dkLen: number, callback: CallbackFunc): void; + } +} + +declare var scrypt: ScryptAsync.ScryptStatic; + +declare module "scrypt-async" { + export = scrypt; +} \ No newline at end of file From 8adab1a506255d3c821401e1afcf2708156831dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn?= Date: Mon, 14 Dec 2015 22:59:12 +0100 Subject: [PATCH 250/474] Added definitions for protractor-http-mock. --- .../protractor-http-mock-tests.ts | 211 ++++++++++++++++++ .../protractor-http-mock.d.ts | 202 +++++++++++++++++ 2 files changed, 413 insertions(+) create mode 100644 protractor-http-mock/protractor-http-mock-tests.ts create mode 100644 protractor-http-mock/protractor-http-mock.d.ts diff --git a/protractor-http-mock/protractor-http-mock-tests.ts b/protractor-http-mock/protractor-http-mock-tests.ts new file mode 100644 index 0000000000..9fdf0695a5 --- /dev/null +++ b/protractor-http-mock/protractor-http-mock-tests.ts @@ -0,0 +1,211 @@ +/// + +function TestConfig() { + mock.config = { + rootDirectory: 'root', + protractorConfig: 'protractor.conf.js' + }; +} + +function TestCtorOverloads() { + let noParam: mock.ProtractorHttpMock = mock(); + let emptyArray: mock.ProtractorHttpMock = mock([]); + let skipDefaults: mock.ProtractorHttpMock = mock([], true); + + let del: mock.requests.Delete = { + request: { + path: 'path', + method: 'DELETE' + }, + response: { + status: 400, + data: 1 + } + }; + let put: mock.requests.Put = { + request: { + path: 'path', + method: 'PUT' + }, + response: { + status: 400, + data: 1 + } + }; + let mocks: mock.ProtractorHttpMock = mock([del, put]); +} + +function TestTeardown() { + mock.teardown(); +} + +function TestRequestsMade() { + let values: Array; + mock.requestsMade().then(v => values = v); +} + +function TestClearRequests() { + let promiseValue: boolean; + mock.clearRequests().then(value => { + promiseValue = value; + }); +} + +function TestGetRequestDefinitions() { + let getMinium: mock.requests.Get = { + request: { + path: 'path', + method: 'GET' + }, + response: { + data: 1, + status: 500 + } + }; + + let getParams: mock.requests.Get = { + request: { + path: 'path', + method: 'GET', + params: { + param1: 'param1', + param2: 2 + } + }, + response: { + data: 1, + status: 500 + } + }; + + let post: mock.requests.Post = { + request: { + path: 'path', + method: 'POST' + }, + response: { + data: 1, + status: 500 + } + }; + + let getQueryString: mock.requests.Get = { + request: { + path: 'path', + method: 'GET', + queryString: { + query1: 'query1', + query2: 2 + } + }, + response: { + data: 1, + status: 500 + } + }; + + let getHeaders: mock.requests.Get = { + request: { + path: 'path', + method: 'GET', + headers: { + head1: 'head1', + head2: 'head2' + } + }, + response: { + data: 1, + status: 500 + } + }; +} + +function TestPostRequestDefinitions() { + let post: mock.requests.Post = { + request: { + path: 'path', + method: 'POST' + }, + response: { + data: 1, + status: 500 + } + }; + + let postData: mock.requests.PostData = { + request: { + path: 'path', + method: 'POST', + data: 'data' + }, + response: { + data: 1, + status: 500 + } + }; +} + +function TestHeadRequestDefinitions() { + let head: mock.requests.Head = { + request: { + path: 'path', + method: 'HEAD' + }, + response: { + status: 500, + data: 1 + } + }; +} + +function TestDeleteRequestDefinitions() { + let del: mock.requests.Delete = { + request: { + path: 'path', + method: 'DELETE' + }, + response: { + status: 500, + data: 1 + } + }; +} + +function TestPutRequestDefinitions() { + let put: mock.requests.Put = { + request: { + path: 'path', + method: 'PUT' + }, + response: { + status: 500, + data: 1 + } + }; +} + +function TestPatchRequestDefinitions() { + let patch: mock.requests.Patch = { + request: { + path: 'path', + method: 'PATCH' + }, + response: { + status: 500, + data: 1 + } + }; +} + +function TestJsonpRequestDefinitions() { + let jsonp: mock.requests.Jsonp = { + request: { + path: 'path', + method: 'JSONP' + }, + response: { + status: 500, + data: 1 + } + }; +} diff --git a/protractor-http-mock/protractor-http-mock.d.ts b/protractor-http-mock/protractor-http-mock.d.ts new file mode 100644 index 0000000000..446c7b3e94 --- /dev/null +++ b/protractor-http-mock/protractor-http-mock.d.ts @@ -0,0 +1,202 @@ +// Type definitions for protractor-http-mock +// Project: https://github.com/atecarlos/protractor-http-mock +// Definitions by: Crevil +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module mock { + interface ProtractorHttpMock { + /** + * Instantiate mock module. This must be done before the browser connects. + * + * @param mocks An array of mock modules to load into the application. + * @param skipDefaults Set true to skip loading of default mocks. + */ + (mocks?: Array>, skipDefaults?: boolean): ProtractorHttpMock; + + /** + * Clean up. + * Typically done in the afterEach call to ensure the teardown + * is executed regardless of what happens in the test execution. + */ + teardown(): void; + + /** + * Returns a promise that will be resolved with an array of + * all matched HTTP requests. + */ + requestsMade(): webdriver.promise.Promise>; + + /** + * Returns a promise that will be resolved with a true boolean + * when all matched HTTP requests are cleared. + */ + clearRequests(): webdriver.promise.Promise; + + /** + * Module configuration to setup + */ + config: { + /** + * Mocks directory where mock files are located. + * Default: process.cwd() + */ + rootDirectory?: string; + + /** + * Path to protractor configuration file. + * Default: protractor.conf + */ + protractorConfig?: string; + }; + } + + /** + * Matched request. + */ + interface ReceivedRequest { + url: string; + method: string; + } + + module requests { + /** + * Base request mock used for all mocks. + */ + interface BaseRequest { + request: { + method: string; + path: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * GET request mock. + */ + interface Get extends BaseRequest { + request: { + method: string; + path: string; + params?: Object; + queryString?: Object; + headers?: Object; + interceptedRequest?: boolean; + interceptedAnonymousRequest?: boolean; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * POST request mock with payload. + */ + interface PostData extends BaseRequest { + request: { + path: string; + method: string; + data: TPayload; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * POST request mock. + */ + interface Post extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * HEAD request mock. + */ + interface Head extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * HTTP Delete request mock. + */ + interface Delete extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * PUT request mock. + */ + interface Put extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * PATCH request mock. + */ + interface Patch extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + + /** + * JSONP request mock. + */ + interface Jsonp extends BaseRequest { + request: { + path: string; + method: string; + }; + response: { + status: number; + data: TResponse; + }; + } + } +} + +declare var mock: mock.ProtractorHttpMock; + +declare module 'protractor-http-mock' { + export = mock; +} From c4329e1413cd2dfc53c573d4fd08abaf78b547e7 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Mon, 14 Dec 2015 17:02:46 -0800 Subject: [PATCH 251/474] Replaced deprecated properties with new versions. --- threejs/three-orbitcontrols.d.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/threejs/three-orbitcontrols.d.ts b/threejs/three-orbitcontrols.d.ts index 69cde47a72..b904ab3219 100644 --- a/threejs/three-orbitcontrols.d.ts +++ b/threejs/three-orbitcontrols.d.ts @@ -7,10 +7,10 @@ declare module THREE { class OrbitControls { - constructor(object:Camera, domElement?:HTMLElement); + constructor(object: Camera, domElement?: HTMLElement); - object:Camera; - domElement:HTMLElement; + object: Camera; + domElement: HTMLElement; // API enabled: boolean; @@ -19,13 +19,13 @@ declare module THREE { // deprecated center: THREE.Vector3; - noZoom: boolean; + enableZoom: boolean; zoomSpeed: number; minDistance: number; maxDistance: number; - noRotate: boolean; + enableRotate: boolean; rotateSpeed: number; - noPan: boolean; + enablePan: boolean; keyPanSpeed: number; autoRotate: boolean; autoRotateSpeed: number; @@ -33,24 +33,27 @@ declare module THREE { maxPolarAngle: number; minAzimuthAngle: number; maxAzimuthAngle: number; - noKeys: boolean; + enableKeys: boolean; keys: { LEFT: number; UP: number; RIGHT: number; BOTTOM: number; }; mouseButtons: { ORBIT: MOUSE; ZOOM: MOUSE; PAN: MOUSE; }; + enableDamping: boolean; + dampingFactor: number; + rotateLeft(angle?: number): void; rotateUp(angle?: number): void; panLeft(distance?: number): void; panUp(distance?: number): void; - pan( deltaX: number, deltaY: number): void; + pan(deltaX: number, deltaY: number): void; dollyIn(dollyScale: number): void; dollyOut(dollyScale: number): void; update(): void; reset(): void; - getPolarAngle() : number; + getPolarAngle(): number; getAzimuthalAngle(): number; // EventDispatcher mixins - addEventListener(type: string, listener: (event: any) => void ): void; + addEventListener(type: string, listener: (event: any) => void): void; hasEventListener(type: string, listener: (event: any) => void): void; removeEventListener(type: string, listener: (event: any) => void): void; dispatchEvent(event: { type: string; target: any; }): void; From d275c4c26ae677c4653067fd6901eceefbd835cd Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Mon, 14 Dec 2015 17:11:32 -0800 Subject: [PATCH 252/474] Several fixes, and allow CSS-style string where a hex number is allowed. --- threejs/three.d.ts | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index fb890afe6a..b4231f5668 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1227,7 +1227,7 @@ declare module THREE { */ computeBoundingSphere(): void; - merge( geometry: Geometry, matrix: Matrix, materialIndexOffset: number): void; + merge( geometry: Geometry, matrix: Matrix, materialIndexOffset?: number): void; mergeMesh( mesh: Mesh ): void; @@ -1677,7 +1677,7 @@ declare module THREE { * Abstract base class for lights. */ export class Light extends Object3D { - constructor(hex?: number); + constructor(hex?: number|string); color: Color; receiveShadow: boolean; @@ -1727,7 +1727,7 @@ declare module THREE { * This creates a Ambientlight with a color. * @param hex Numeric value of the RGB component of the color. */ - constructor(hex?: number); + constructor(hex?: number|string); clone(recursive?: boolean): AmbientLight; copy(source: AmbientLight): AmbientLight; @@ -1746,7 +1746,7 @@ declare module THREE { */ export class DirectionalLight extends Light { - constructor(hex?: number, intensity?: number); + constructor(hex?: number|string, intensity?: number); /** * Target used for shadow camera orientation. @@ -1766,7 +1766,7 @@ declare module THREE { } export class HemisphereLight extends Light { - constructor(skyColorHex?: number, groundColorHex?: number, intensity?: number); + constructor(skyColorHex?: number|string, groundColorHex?: number|string, intensity?: number); groundColor: Color; intensity: number; @@ -1784,7 +1784,7 @@ declare module THREE { * scene.add( light ); */ export class PointLight extends Light { - constructor(hex?: number, intensity?: number, distance?: number, decay?: number); + constructor(hex?: number|string, intensity?: number, distance?: number, decay?: number); /* * Light's intensity. @@ -1810,7 +1810,7 @@ declare module THREE { * A point light that can cast shadow in one direction. */ export class SpotLight extends Light { - constructor(hex?: number, intensity?: number, distance?: number, angle?: number, exponent?: number, decay?: number); + constructor(hex?: number|string, intensity?: number, distance?: number, angle?: number, exponent?: number, decay?: number); /** * Spotlight focus points at target.position. @@ -2244,7 +2244,7 @@ declare module THREE { } export interface LineBasicMaterialParameters extends MaterialParameters { - color?: number; + color?: number|string; linewidth?: number; linecap?: string; linejoin?: string; @@ -2267,7 +2267,7 @@ declare module THREE { } export interface LineDashedMaterialParameters extends MaterialParameters { - color?: number; + color?: number|string; linewidth?: number; scale?: number; dashSize?: number; @@ -2295,7 +2295,7 @@ declare module THREE { * parameters is an object with one or more properties defining the material's appearance. */ export interface MeshBasicMaterialParameters extends MaterialParameters{ - color?: number; + color?: number|string; opacity?: number; map?: Texture; aoMap?: Texture; @@ -2361,7 +2361,7 @@ declare module THREE { } export interface MeshLambertMaterialParameters extends MaterialParameters{ - color?: number; + color?: number|string; emissive?: number; opacity?: number; map?: Texture; @@ -2433,7 +2433,7 @@ declare module THREE { export interface MeshPhongMaterialParameters extends MaterialParameters { /** geometry color in hexadecimal. Default is 0xffffff. */ - color?: number; + color?: number | string; emissive?: number; specular?: number; shininess?: number; @@ -2461,7 +2461,7 @@ declare module THREE { blending?: Blending; depthTest?: boolean; depthWrite?: boolean; - wireframe?: string; + wireframe?: boolean; wireframeLinewidth?: number; vertexColors?: Colors; skinning?: boolean; @@ -2528,7 +2528,7 @@ declare module THREE { } export interface PointsMaterialParameters extends MaterialParameters{ - color?: number; + color?: number|string; opacity?: number; map?: Texture; size?: number; @@ -2604,7 +2604,7 @@ declare module THREE { } export interface SpriteMaterialParameters extends MaterialParameters { - color?: number; + color?: number|string; opacity?: number; map?: Texture; blending?: Blending; @@ -4470,6 +4470,11 @@ declare module THREE { clearAlpha?: number; devicePixelRatio?: number; + + /** + * default is false. + */ + logarithmicDepthBuffer?: boolean; } @@ -5106,7 +5111,7 @@ declare module THREE { * This class contains the parameters that define linear fog, i.e., that grows exponentially denser with the distance. */ export class FogExp2 implements IFog { - constructor(hex: number, density?: number); + constructor(hex: number|string, density?: number); name: string; color: Color; From 8cbbfe0bc8731b2611322fc57b06f60106bf39d9 Mon Sep 17 00:00:00 2001 From: Wang Zishi Date: Tue, 15 Dec 2015 09:24:48 +0800 Subject: [PATCH 253/474] update definitions --- cookies/cookies.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookies/cookies.d.ts b/cookies/cookies.d.ts index 24984f7fdd..53de9fe090 100644 --- a/cookies/cookies.d.ts +++ b/cookies/cookies.d.ts @@ -20,7 +20,7 @@ declare module "cookies" { * Cookie header in the request. If such a cookie exists, * its value is returned. Otherwise, nothing is returned. */ - get(name: string, opts?: IOptions): string; + get(name: string, opts: IOptions): string; /** * This sets the given cookie in the response and returns @@ -33,7 +33,7 @@ declare module "cookies" { * the current context to allow chaining.If the value is omitted, * an outbound header with an expired date is used to delete the cookie. */ - set(name: string, value: string, opts?: IOptions): ICookies; + set(name: string, value: string, opts: IOptions): ICookies; } interface IOptions { From 2a90bb4dd66299e1b4d1e1512cedf8932689260a Mon Sep 17 00:00:00 2001 From: ravishivt Date: Mon, 14 Dec 2015 17:42:49 -0800 Subject: [PATCH 254/474] Added definitions for protractor.ExpectedConditions Added definitions and tests for ExpectedConditions documented at https://angular.github.io/protractor/#/api?view=ExpectedConditions. --- .../angular-protractor-tests.ts | 21 +++ angular-protractor/angular-protractor.d.ts | 139 ++++++++++++++++++ 2 files changed, 160 insertions(+) diff --git a/angular-protractor/angular-protractor-tests.ts b/angular-protractor/angular-protractor-tests.ts index 45a5d7edc4..0f98aead12 100644 --- a/angular-protractor/angular-protractor-tests.ts +++ b/angular-protractor/angular-protractor-tests.ts @@ -196,6 +196,27 @@ function TestWebDriverUntilModule() { conditionWebElements = protractor.until.elementsLocated(by.className('class')); } +function TestWebDriverExpectedConditionsModule() { + var conditionB: protractor.until.Condition; + var el: protractor.ElementFinder = element(by.id('id')); + + conditionB = protractor.ExpectedConditions.alertIsPresent(); + conditionB = protractor.ExpectedConditions.elementToBeClickable(el); + conditionB = protractor.ExpectedConditions.textToBePresentInElement(el, 'text'); + conditionB = protractor.ExpectedConditions.textToBePresentInElementValue(el, 'text'); + conditionB = protractor.ExpectedConditions.titleContains('text'); + conditionB = protractor.ExpectedConditions.titleIs('text'); + conditionB = protractor.ExpectedConditions.presenceOf(el); + conditionB = protractor.ExpectedConditions.stalenessOf(el); + conditionB = protractor.ExpectedConditions.visibilityOf(el); + conditionB = protractor.ExpectedConditions.invisibilityOf(el); + conditionB = protractor.ExpectedConditions.elementToBeSelected(el); + + conditionB = protractor.ExpectedConditions.not(protractor.ExpectedConditions.alertIsPresent()); + conditionB = protractor.ExpectedConditions.and(protractor.ExpectedConditions.alertIsPresent(), protractor.ExpectedConditions.elementToBeClickable(el)); + conditionB = protractor.ExpectedConditions.or(protractor.ExpectedConditions.alertIsPresent(), protractor.ExpectedConditions.elementToBeClickable(el)); +} + function TestProtractor() { var ptor: protractor.Protractor; var driver: webdriver.WebDriver = new webdriver.Builder(). diff --git a/angular-protractor/angular-protractor.d.ts b/angular-protractor/angular-protractor.d.ts index ff83242381..dc969927ed 100644 --- a/angular-protractor/angular-protractor.d.ts +++ b/angular-protractor/angular-protractor.d.ts @@ -501,6 +501,145 @@ declare module protractor { function titleMatches(regex: RegExp): webdriver.until.Condition; } + module ExpectedConditions { + /** + * Negates the result of a promise. + * + * @param {webdriver.until.Condition} expectedCondition + * @return {!webdriver.until.Condition} An expected condition that returns the negated value. + */ + function not(expectedCondition: webdriver.until.Condition): webdriver.until.Condition; + + /** + * Chain a number of expected conditions using logical_and, short circuiting at the + * first expected condition that evaluates to false. + * + * @param {...webdriver.until.Condition[]} fns An array of expected conditions to 'and' together. + * @return {!webdriver.until.Condition} An expected condition that returns a promise which evaluates + * to the result of the logical and. + */ + function and(...fns: webdriver.until.Condition[]): webdriver.until.Condition; + + /** + * Chain a number of expected conditions using logical_or, short circuiting at the + * first expected condition that evaluates to true. + * + * @param {...webdriver.until.Condition[]} fns An array of expected conditions to 'or' together. + * @return {!webdriver.until.Condition} An expected condition that returns a promise which + * evaluates to the result of the logical or. + */ + function or(...fns: webdriver.until.Condition[]): webdriver.until.Condition; + + /** + * Expect an alert to be present. + * + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether an alert is present. + */ + function alertIsPresent(): webdriver.until.Condition; + + /** + * An Expectation for checking an element is visible and enabled such that you can click it. + * + * @param {ElementFinder} element The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the element is clickable. + */ + function elementToBeClickable(element: ElementFinder): webdriver.until.Condition; + + /** + * An expectation for checking if the given text is present in the element. + * Returns false if the elementFinder does not find an element. + * + * @param {ElementFinder} element The element to check + * @param {string} text The text to verify against + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the text is present in the element. + */ + function textToBePresentInElement(element: ElementFinder, text: string): webdriver.until.Condition; + + /** + * An expectation for checking if the given text is present in the element’s value. + * Returns false if the elementFinder does not find an element. + * + * @param {ElementFinder} element The element to check + * @param {string} text The text to verify against + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the text is present in the element's value. + */ + function textToBePresentInElementValue( + element: ElementFinder, text: string + ): webdriver.until.Condition; + + /** + * An expectation for checking that the title contains a case-sensitive substring. + * + * @param {string} title The fragment of title expected + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the title contains the string. + */ + function titleContains(title: string): webdriver.until.Condition; + + /** + * An expectation for checking the title of a page. + * + * @param {string} title The expected title, which must be an exact match. + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the title equals the string. + */ + function titleIs(title: string): webdriver.until.Condition; + + /** + * An expectation for checking that an element is present on the DOM of a page. This does not necessarily + * mean that the element is visible. This is the opposite of 'stalenessOf'. + * + * @param {ElementFinder} elementFinder The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise + * representing whether the element is present. + */ + function presenceOf(element: ElementFinder): webdriver.until.Condition; + + /** + * An expectation for checking that an element is not attached to the DOM of a page. + * This is the opposite of 'presenceOf'. + * + * @param {ElementFinder} elementFinder The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the element is stale. + */ + function stalenessOf(element: ElementFinder): webdriver.until.Condition; + + /** + * An expectation for checking that an element is present on the DOM of a page and visible. + * Visibility means that the element is not only displayed but also has a height and width that is + * greater than 0. This is the opposite of 'invisibilityOf'. + * + * @param {ElementFinder} elementFinder The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the element is visible. + */ + function visibilityOf(element: ElementFinder): webdriver.until.Condition; + + /** + * An expectation for checking that an element is present on the DOM of a page. This does not necessarily + * mean that the element is visible. This is the opposite of 'stalenessOf'. + * + * @param {ElementFinder} elementFinder The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the element is invisible. + */ + function invisibilityOf(element: ElementFinder): webdriver.until.Condition; + + /** + * An expectation for checking the selection is selected. + * + * @param {ElementFinder} elementFinder The element to check + * @return {!webdriver.until.Condition} An expected condition that returns a promise representing + * whether the element is selected. + */ + function elementToBeSelected(element: ElementFinder): webdriver.until.Condition; + } + //endregion /** From cf172aab99c3139a718aa8e65398a22c53dd7ead Mon Sep 17 00:00:00 2001 From: Sagar Vadodaria Date: Tue, 15 Dec 2015 14:39:20 +0530 Subject: [PATCH 255/474] added missing property As per AngularJs Documentation, (https://docs.angularjs.org/api/ngRoute/provider/$routeProvider) , $routeProvider has a property as well. caseInsensitiveMatch , which can be used to turn off the case sensitive match globally. --- angularjs/angular-route.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 5f426d51c8..eafdf714ce 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -128,6 +128,12 @@ declare module angular.route { } interface IRouteProvider extends IServiceProvider { + /** + * Match routes without being case sensitive + * + * This option defaults to false. If the option is set to true, then the particular route can be matched without being case sensitive + */ + caseInsensitiveMatch?: boolean; /** * Sets route definition that will be used on route change when no other route definition is matched. * From 911b32f0cee09a9f34a7aeb778fae9dba90d9241 Mon Sep 17 00:00:00 2001 From: BSO Date: Tue, 15 Dec 2015 10:14:58 +0100 Subject: [PATCH 256/474] Added constructor using mock files. --- .../protractor-http-mock-tests.ts | 3 ++- protractor-http-mock/protractor-http-mock.d.ts | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/protractor-http-mock/protractor-http-mock-tests.ts b/protractor-http-mock/protractor-http-mock-tests.ts index 9fdf0695a5..6c39f1401a 100644 --- a/protractor-http-mock/protractor-http-mock-tests.ts +++ b/protractor-http-mock/protractor-http-mock-tests.ts @@ -9,7 +9,8 @@ function TestConfig() { function TestCtorOverloads() { let noParam: mock.ProtractorHttpMock = mock(); - let emptyArray: mock.ProtractorHttpMock = mock([]); + let emptyArray: mock.ProtractorHttpMock = mock([]); + let mockFiles: mock.ProtractorHttpMock = mock(['mock1', 'mock2']); let skipDefaults: mock.ProtractorHttpMock = mock([], true); let del: mock.requests.Delete = { diff --git a/protractor-http-mock/protractor-http-mock.d.ts b/protractor-http-mock/protractor-http-mock.d.ts index 446c7b3e94..41c4ef41f8 100644 --- a/protractor-http-mock/protractor-http-mock.d.ts +++ b/protractor-http-mock/protractor-http-mock.d.ts @@ -9,15 +9,22 @@ declare module mock { interface ProtractorHttpMock { /** * Instantiate mock module. This must be done before the browser connects. - * + * * @param mocks An array of mock modules to load into the application. * @param skipDefaults Set true to skip loading of default mocks. */ (mocks?: Array>, skipDefaults?: boolean): ProtractorHttpMock; + /** + * Instantiate mock modules from files. This must be done before the browser connects. + * + * @param mocks An array of mock module names relative to the rootDirectory configuration. + */ + (mocks: Array): ProtractorHttpMock; + /** * Clean up. - * Typically done in the afterEach call to ensure the teardown + * Typically done in the afterEach call to ensure the teardown * is executed regardless of what happens in the test execution. */ teardown(): void; @@ -35,7 +42,7 @@ declare module mock { clearRequests(): webdriver.promise.Promise; /** - * Module configuration to setup + * Module configuration to setup */ config: { /** @@ -51,7 +58,7 @@ declare module mock { protractorConfig?: string; }; } - + /** * Matched request. */ From dabf57f42e7854c15f239ef0b2e81166c0f0e553 Mon Sep 17 00:00:00 2001 From: Ben Joffe Date: Tue, 15 Dec 2015 21:21:41 +1100 Subject: [PATCH 257/474] Fixed THREEJS CubeTextureLoader.load and TextureLoader.load --- threejs/three.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index fb890afe6a..45bc1b4abd 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1959,7 +1959,7 @@ declare module THREE { constructor(manager?: LoadingManager); manager: LoadingManager; - load(url: string, onLoad: (texture: CubeTexture) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; + load(urls: Array, onLoad?: (texture: CubeTexture) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; setCrossOrigin(crossOrigin: string): void; } @@ -2076,7 +2076,7 @@ declare module THREE { * * @param url */ - load(url: string, onLoad: (texture: Texture) => void): Texture; + load(url: string, onLoad?: (texture: Texture) => void): Texture; setCrossOrigin(crossOrigin: string): void; } From 5dc8ee8dce912a84449a8024d34ef0609cf86824 Mon Sep 17 00:00:00 2001 From: Stephen Lautier Date: Tue, 15 Dec 2015 11:29:13 +0100 Subject: [PATCH 258/474] fixed es6 imports to have types properly exported instead of string --- 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 e4f69c688b..0d4048b0a1 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -6,8 +6,8 @@ /// declare module "angular-translate" { - var _: string; - export = _; + import ngt = angular.translate; + export = ngt; } declare module angular.translate { From 09fa17a56f4d1e7318b5d2ab105950d0add62826 Mon Sep 17 00:00:00 2001 From: Martin McWhorter Date: Tue, 15 Dec 2015 10:40:04 +0000 Subject: [PATCH 259/474] Add commonJS support to angular-resource --- angularjs/angular-resource.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 76930196ba..030ddd0c42 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -5,6 +5,10 @@ /// +declare module 'angular-resource' { + var _: string; + export = _; +} /////////////////////////////////////////////////////////////////////////////// // ngResource module (angular-resource.js) From 77e5ef281cd7b71713b32382c63dcc4c75e3c127 Mon Sep 17 00:00:00 2001 From: Laurence C Date: Tue, 15 Dec 2015 11:42:25 +0000 Subject: [PATCH 260/474] Add definitions for SwiftClick --- swiftclick/swiftclick-tests.ts | 7 +++++++ swiftclick/swiftclick.d.ts | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 swiftclick/swiftclick-tests.ts create mode 100644 swiftclick/swiftclick.d.ts diff --git a/swiftclick/swiftclick-tests.ts b/swiftclick/swiftclick-tests.ts new file mode 100644 index 0000000000..237978996e --- /dev/null +++ b/swiftclick/swiftclick-tests.ts @@ -0,0 +1,7 @@ +/// + +var swiftClick = SwiftClick.attach(document.body); + +swiftClick.replaceNodeNamesToTrack(["a", "div", "h1"]); +swiftClick.addNodeNamesToTrack(["li"]); +swiftClick.useCssParser(true); \ No newline at end of file diff --git a/swiftclick/swiftclick.d.ts b/swiftclick/swiftclick.d.ts new file mode 100644 index 0000000000..d00e9f761c --- /dev/null +++ b/swiftclick/swiftclick.d.ts @@ -0,0 +1,20 @@ +// Type definitions for SwiftClick v1.2.0 +// Project: https://github.com/munkychop/swiftclick +// Definitions by: Laurence C +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface SwiftClickObject { + addNodeNamesToTrack(nodeNamesArray: string[]): void; + replaceNodeNamesToTrack(nodeNamesArray: string[]): void; + useCssParser(useParser: boolean): void; +} + +interface SwiftClickStatic { + attach(contextEl: Element): SwiftClickObject; +} + +declare module "swiftclick" { + export = SwiftClick; +} + +declare var SwiftClick: SwiftClickStatic; From f3917c6c0bff6f5c2db8d44a90f4fe19c928224c Mon Sep 17 00:00:00 2001 From: lgrignon Date: Tue, 15 Dec 2015 15:48:20 +0100 Subject: [PATCH 261/474] backbone definitions (splitted PR) --- .../backbone.localstorage-tests.ts | 6 +++ .../backbone.localstorage.d.ts | 51 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 backbone.localstorage/backbone.localstorage-tests.ts create mode 100644 backbone.localstorage/backbone.localstorage.d.ts diff --git a/backbone.localstorage/backbone.localstorage-tests.ts b/backbone.localstorage/backbone.localstorage-tests.ts new file mode 100644 index 0000000000..0d44897a80 --- /dev/null +++ b/backbone.localstorage/backbone.localstorage-tests.ts @@ -0,0 +1,6 @@ +/// + +var store: Store = new Store('testStore'); +store.findAll(); + +store.save(); diff --git a/backbone.localstorage/backbone.localstorage.d.ts b/backbone.localstorage/backbone.localstorage.d.ts new file mode 100644 index 0000000000..122c475876 --- /dev/null +++ b/backbone.localstorage/backbone.localstorage.d.ts @@ -0,0 +1,51 @@ +// Type definitions for backbone.localStorage 1.0.0 +// Project: https://github.com/jeromegn/Backbone.localStorage +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Backbone { + interface Serializer { + serialize(item: any): any; + deserialize(data: any): any; + } + + class LocalStorage { + name: string; + serializer: Serializer; + records: string[]; + + constructor(name: string, serializer?: Serializer); + + save(): void; + + // Add a model, giving it a (hopefully)-unique GUID, if it doesn't already + // have an id of it's own. + create(model: any): any; + + // Update a model by replacing its copy in `this.data`. + update(model: any): any; + + // Retrieve a model from `this.data` by id. + find(model: any): any; + + // Return the array of all models currently in storage. + findAll(): any; + + // Delete a model from `this.data`, returning it. + destroy(model: T): T; + + localStorage(): any; + + // Clear localStorage for specific collection. + _clear(): void; + + _storageSize(): number; + + _itemName(id: any): string; + } +} + +import Store = Backbone.LocalStorage; + From c92a91b9eb4e669bb9c5b9a3d3288647acc75c8a Mon Sep 17 00:00:00 2001 From: Julien Renaux Date: Tue, 15 Dec 2015 10:03:54 -0600 Subject: [PATCH 262/474] Change Connections to string Connections are strings not numbers --- cordova/plugins/NetworkInformation.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cordova/plugins/NetworkInformation.d.ts b/cordova/plugins/NetworkInformation.d.ts index 53093284f1..1ba2ae9e03 100644 --- a/cordova/plugins/NetworkInformation.d.ts +++ b/cordova/plugins/NetworkInformation.d.ts @@ -45,16 +45,16 @@ interface Connection { * Connection.CELL * Connection.NONE */ - type: number + type: string } declare var Connection: { - UNKNOWN: number; - ETHERNET: number; - WIFI: number; - CELL_2G: number; - CELL_3G: number; - CELL_4G: number; - CELL: number; - NONE: number; -} \ No newline at end of file + UNKNOWN: string; + ETHERNET: string; + WIFI: string; + CELL_2G: string; + CELL_3G: string; + CELL_4G: string; + CELL: string; + NONE: string; +} From a04c6d2afafb44fb6ecb77d48f503df720568725 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 15 Dec 2015 22:02:23 +0500 Subject: [PATCH 263/474] lodash: signatures of _.some have been changed --- lodash/lodash-tests.ts | 40 +++++++++++++++++++++++++++++++++ lodash/lodash.d.ts | 50 ++++++++++++++++++++++++++++++++---------- 2 files changed, 78 insertions(+), 12 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2398b8d434..010e244805 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -2694,9 +2694,11 @@ module TestAny { let array: TResult[]; let list: _.List; let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; let listIterator: (value: TResult, index: number, collection: _.List) => boolean; let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => boolean; { let result: boolean; @@ -2719,6 +2721,12 @@ module TestAny { result = _.any(dictionary, ''); result = _.any<{a: number}, TResult>(dictionary, {a: 42}); + result = _.any(numericDictionary); + result = _.any(numericDictionary, numericDictionaryIterator); + result = _.any(numericDictionary, numericDictionaryIterator, any); + result = _.any(numericDictionary, ''); + result = _.any<{a: number}, TResult>(numericDictionary, {a: 42}); + result = _(array).any(); result = _(array).any(listIterator); result = _(array).any(listIterator, any); @@ -2736,6 +2744,12 @@ module TestAny { result = _(dictionary).any(dictionaryIterator, any); result = _(dictionary).any(''); result = _(dictionary).any<{a: number}>({a: 42}); + + result = _(numericDictionary).any(); + result = _(numericDictionary).any(numericDictionaryIterator); + result = _(numericDictionary).any(numericDictionaryIterator, any); + result = _(numericDictionary).any(''); + result = _(numericDictionary).any<{a: number}>({a: 42}); } { @@ -2758,6 +2772,12 @@ module TestAny { result = _(dictionary).chain().any(dictionaryIterator, any); result = _(dictionary).chain().any(''); result = _(dictionary).chain().any<{a: number}>({a: 42}); + + result = _(numericDictionary).chain().any(); + result = _(numericDictionary).chain().any(numericDictionaryIterator); + result = _(numericDictionary).chain().any(numericDictionaryIterator, any); + result = _(numericDictionary).chain().any(''); + result = _(numericDictionary).chain().any<{a: number}>({a: 42}); } } @@ -4378,9 +4398,11 @@ module TestSome { let array: TResult[]; let list: _.List; let dictionary: _.Dictionary; + let numericDictionary: _.NumericDictionary; let listIterator: (value: TResult, index: number, collection: _.List) => boolean; let dictionaryIterator: (value: TResult, key: string, collection: _.Dictionary) => boolean; + let numericDictionaryIterator: (value: TResult, key: number, collection: _.NumericDictionary) => boolean; { let result: boolean; @@ -4403,6 +4425,12 @@ module TestSome { result = _.some(dictionary, ''); result = _.some<{a: number}, TResult>(dictionary, {a: 42}); + result = _.some(numericDictionary); + result = _.some(numericDictionary, numericDictionaryIterator); + result = _.some(numericDictionary, numericDictionaryIterator, any); + result = _.some(numericDictionary, ''); + result = _.some<{a: number}, TResult>(numericDictionary, {a: 42}); + result = _(array).some(); result = _(array).some(listIterator); result = _(array).some(listIterator, any); @@ -4420,6 +4448,12 @@ module TestSome { result = _(dictionary).some(dictionaryIterator, any); result = _(dictionary).some(''); result = _(dictionary).some<{a: number}>({a: 42}); + + result = _(numericDictionary).some(); + result = _(numericDictionary).some(numericDictionaryIterator); + result = _(numericDictionary).some(numericDictionaryIterator, any); + result = _(numericDictionary).some(''); + result = _(numericDictionary).some<{a: number}>({a: 42}); } { @@ -4442,6 +4476,12 @@ module TestSome { result = _(dictionary).chain().some(dictionaryIterator, any); result = _(dictionary).chain().some(''); result = _(dictionary).chain().some<{a: number}>({a: 42}); + + result = _(numericDictionary).chain().some(); + result = _(numericDictionary).chain().some(numericDictionaryIterator); + result = _(numericDictionary).chain().some(numericDictionaryIterator, any); + result = _(numericDictionary).chain().some(''); + result = _(numericDictionary).chain().some<{a: number}>({a: 42}); } } diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 64b4da9509..bdaa88c83c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -4062,7 +4062,16 @@ declare module _ { * @see _.some */ any( - collection: List|Dictionary, + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + any( + collection: List|Dictionary|NumericDictionary, predicate?: string, thisArg?: any ): boolean; @@ -4071,7 +4080,7 @@ declare module _ { * @see _.some */ any( - collection: List|Dictionary, + collection: List|Dictionary|NumericDictionary, predicate?: TObject ): boolean; } @@ -4081,7 +4090,7 @@ declare module _ { * @see _.some */ any( - predicate?: ListIterator, + predicate?: ListIterator|NumericDictionaryIterator, thisArg?: any ): boolean; @@ -4106,7 +4115,7 @@ declare module _ { * @see _.some */ any( - predicate?: ListIterator|DictionaryIterator, + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, thisArg?: any ): boolean; @@ -4131,7 +4140,7 @@ declare module _ { * @see _.some */ any( - predicate?: ListIterator, + predicate?: ListIterator|NumericDictionaryIterator, thisArg?: any ): LoDashExplicitWrapper; @@ -4156,7 +4165,7 @@ declare module _ { * @see _.some */ any( - predicate?: ListIterator|DictionaryIterator, + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, thisArg?: any ): LoDashExplicitWrapper; @@ -7477,7 +7486,16 @@ declare module _ { * @see _.some */ some( - collection: List|Dictionary, + collection: NumericDictionary, + predicate?: NumericDictionaryIterator, + thisArg?: any + ): boolean; + + /** + * @see _.some + */ + some( + collection: List|Dictionary|NumericDictionary, predicate?: string, thisArg?: any ): boolean; @@ -7486,7 +7504,7 @@ declare module _ { * @see _.some */ some( - collection: List|Dictionary, + collection: List|Dictionary|NumericDictionary, predicate?: TObject ): boolean; } @@ -7496,7 +7514,7 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator, + predicate?: ListIterator|NumericDictionaryIterator, thisArg?: any ): boolean; @@ -7521,7 +7539,7 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator|DictionaryIterator, + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, thisArg?: any ): boolean; @@ -7546,7 +7564,7 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator, + predicate?: ListIterator|NumericDictionaryIterator, thisArg?: any ): LoDashExplicitWrapper; @@ -7571,7 +7589,7 @@ declare module _ { * @see _.some */ some( - predicate?: ListIterator|DictionaryIterator, + predicate?: ListIterator|DictionaryIterator|NumericDictionaryIterator, thisArg?: any ): LoDashExplicitWrapper; @@ -13743,6 +13761,10 @@ declare module _ { (value: T, key?: string, collection?: Dictionary): TResult; } + interface NumericDictionaryIterator { + (value: T, key?: number, collection?: Dictionary): TResult; + } + interface ObjectIterator { (element: T, key?: string, collection?: any): TResult; } @@ -13777,6 +13799,10 @@ declare module _ { [index: string]: T; } + interface NumericDictionary { + [index: number]: T; + } + interface StringRepresentable { toString(): string; } From c7f2c236186e7da6b3711bcafc0469786622ffc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Junges?= Date: Tue, 15 Dec 2015 23:00:36 -0200 Subject: [PATCH 264/474] Add support to .component from Angularjs 1.5 --- angularjs/angular.d.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index a489141d54..713e6681dc 100644 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -181,6 +181,13 @@ declare module angular { animation(name: string, animationFactory: Function): IModule; animation(name: string, inlineAnnotatedFunction: any[]): IModule; animation(object: Object): IModule; + /** + * Use this method to register a component. + * + * @param name The name of the component. + * @param options A definition object passed into the component. + */ + component(name: string, options: IComponentOptions): IModule; /** * Use this method to register work which needs to be performed on module loading. * @@ -1619,6 +1626,23 @@ declare module angular { */ totalPendingRequests: number; } + + /////////////////////////////////////////////////////////////////////////// + // Component + // see http://angularjs.blogspot.com.br/2015/11/angularjs-15-beta2-and-14-releases.html + // and http://toddmotto.com/exploring-the-angular-1-5-component-method/ + /////////////////////////////////////////////////////////////////////////// + + interface IComponentOptions { + bindings?: Object, + controller: Function|string, + controllerAs?: string, + isolate?: boolean, + restrict?: string, + template?: Array|Function, + templateUrl?: string, + transclude?: boolean + } /////////////////////////////////////////////////////////////////////////// // Directive From 3746eb32840de17c1f4eb306047c505639194644 Mon Sep 17 00:00:00 2001 From: hinamiyagk Date: Wed, 16 Dec 2015 10:50:52 +0900 Subject: [PATCH 265/474] Fix wrong returning type of electron.hideInternalModules --- github-electron/github-electron.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 5dcaba2ffe..7334d04ae1 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1718,7 +1718,7 @@ declare module GitHubElectron { powerMonitor: NodeJS.EventEmitter; protocol: GitHubElectron.Protocol; Tray: typeof GitHubElectron.Tray; - hideInternalModules(): any; + hideInternalModules(): void; } } From 07b87e60644a79da813e44e8dd7c8ade85f1ce06 Mon Sep 17 00:00:00 2001 From: f111fei Date: Wed, 16 Dec 2015 09:50:54 +0800 Subject: [PATCH 266/474] #7152 [node] parameter type of "signal" in process.kill --- node/node-0.10.d.ts | 2 +- node/node-0.11.d.ts | 2 +- node/node-0.12.d.ts | 2 +- node/node-0.8.8.d.ts | 2 +- node/node.d.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/node/node-0.10.d.ts b/node/node-0.10.d.ts index a4cd5b1a6b..ba170e864d 100644 --- a/node/node-0.10.d.ts +++ b/node/node-0.10.d.ts @@ -176,7 +176,7 @@ declare module NodeJS { visibility: string; }; }; - kill(pid: number, signal?: string): void; + kill(pid:number, signal?: string|number): void; pid: number; title: string; arch: string; diff --git a/node/node-0.11.d.ts b/node/node-0.11.d.ts index 05aee911de..b05e53494e 100644 --- a/node/node-0.11.d.ts +++ b/node/node-0.11.d.ts @@ -176,7 +176,7 @@ declare module NodeJS { visibility: string; }; }; - kill(pid: number, signal?: string): void; + kill(pid:number, signal?: string|number): void; pid: number; title: string; arch: string; diff --git a/node/node-0.12.d.ts b/node/node-0.12.d.ts index 11fd92d245..39f0aa37a9 100644 --- a/node/node-0.12.d.ts +++ b/node/node-0.12.d.ts @@ -256,7 +256,7 @@ declare module NodeJS { visibility: string; }; }; - kill(pid: number, signal?: string): void; + kill(pid:number, signal?: string|number): void; pid: number; title: string; arch: string; diff --git a/node/node-0.8.8.d.ts b/node/node-0.8.8.d.ts index 1972e0cdcf..ea56c73064 100644 --- a/node/node-0.8.8.d.ts +++ b/node/node-0.8.8.d.ts @@ -150,7 +150,7 @@ interface NodeProcess extends EventEmitter { visibility: string; }; }; - kill(pid: number, signal?: string): void; + kill(pid:number, signal?: string|number): void; pid: number; title: string; arch: string; diff --git a/node/node.d.ts b/node/node.d.ts index 06c4bb9600..449583a303 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -256,7 +256,7 @@ declare module NodeJS { visibility: string; }; }; - kill(pid: number, signal?: string): void; + kill(pid:number, signal?: string|number): void; pid: number; title: string; arch: string; From a7054eca4ee3bba7f7924fedc92b1b467bb7467e Mon Sep 17 00:00:00 2001 From: sodatea Date: Wed, 16 Dec 2015 12:23:18 +0800 Subject: [PATCH 267/474] Add definitions for blue-tape 0.1.11 --- blue-tape/blue-tape-tests.ts | 170 +++++++++++++++++++++++++++++++++++ blue-tape/blue-tape.d.ts | 12 +++ 2 files changed, 182 insertions(+) create mode 100644 blue-tape/blue-tape-tests.ts create mode 100644 blue-tape/blue-tape.d.ts diff --git a/blue-tape/blue-tape-tests.ts b/blue-tape/blue-tape-tests.ts new file mode 100644 index 0000000000..a01675a1c5 --- /dev/null +++ b/blue-tape/blue-tape-tests.ts @@ -0,0 +1,170 @@ +/// +/// +/// + +import tape = require('blue-tape'); +import P = require('bluebird'); + +var name: string; +var cb: tape.TestCase; +var opts: tape.TestOptions; +var t: tape.Test; + +tape(cb); +tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + +tape(name, (test: tape.Test) => { + t = test; +}); + +tape.skip(name, cb); +tape.only(name, cb); + + +var sopts: tape.StreamOptions; +var rs: NodeJS.ReadableStream; +rs = tape.createStream(); +rs = tape.createStream(sopts); + + +var htest: typeof tape; +htest = tape.createHarness(); + + +tape(name, (test: tape.Test) => { + var num: number; + var ms: number; + var value: any; + var actual: any; + var expected: any; + var err: any; + var fn = function() {}; + var msg: string; + + var exceptionExpected: RegExp | (() => void); + + test.plan(num); + test.end(); + test.end(err); + + test.fail(msg); + test.pass(msg); + test.timeoutAfter(ms); + test.skip(msg); + + test.ok(value); + test.ok(value, msg); + test.true(value); + test.true(value, msg); + test.assert(value); + test.assert(value, msg); + + test.notOk(value); + test.notOk(value, msg); + test.false(value); + test.false(value, msg); + test.notok(value); + test.notok(value, msg); + + test.error(err, msg); + test.ifError(err, msg); + test.ifErr(err, msg); + test.iferror(err, msg); + + test.equal(actual, expected); + test.equal(actual, expected, msg); + test.equals(actual, expected); + test.equals(actual, expected, msg); + test.isEqual(actual, expected); + test.isEqual(actual, expected, msg); + test.is(actual, expected); + test.is(actual, expected, msg); + test.strictEqual(actual, expected); + test.strictEqual(actual, expected, msg); + test.strictEquals(actual, expected); + test.strictEquals(actual, expected, msg); + + test.notEqual(actual, expected); + test.notEqual(actual, expected, msg); + test.notEquals(actual, expected); + test.notEquals(actual, expected, msg); + test.notStrictEqual(actual, expected); + test.notStrictEqual(actual, expected, msg); + test.notStrictEquals(actual, expected); + test.notStrictEquals(actual, expected, msg); + test.isNotEqual(actual, expected); + test.isNotEqual(actual, expected, msg); + test.isNot(actual, expected); + test.isNot(actual, expected, msg); + test.not(actual, expected); + test.not(actual, expected, msg); + test.doesNotEqual(actual, expected); + test.doesNotEqual(actual, expected, msg); + test.isInequal(actual, expected); + test.isInequal(actual, expected, msg); + + test.deepEqual(actual, expected); + test.deepEqual(actual, expected, msg); + test.deepEquals(actual, expected); + test.deepEquals(actual, expected, msg); + test.isEquivalent(actual, expected); + test.isEquivalent(actual, expected, msg); + test.same(actual, expected); + test.same(actual, expected, msg); + + test.notDeepEqual(actual, expected); + test.notDeepEqual(actual, expected, msg); + test.notEquivalent(actual, expected); + test.notEquivalent(actual, expected, msg); + test.notDeeply(actual, expected); + test.notDeeply(actual, expected, msg); + test.notSame(actual, expected); + test.notSame(actual, expected, msg); + test.isNotDeepEqual(actual, expected); + test.isNotDeepEqual(actual, expected, msg); + test.isNotDeeply(actual, expected); + test.isNotDeeply(actual, expected, msg); + test.isNotEquivalent(actual, expected); + test.isNotEquivalent(actual, expected, msg); + test.isInequivalent(actual, expected); + test.isInequivalent(actual, expected, msg); + + test.deepLooseEqual(actual, expected); + test.deepLooseEqual(actual, expected, msg); + test.looseEqual(actual, expected); + test.looseEqual(actual, expected, msg); + test.looseEquals(actual, expected); + test.looseEquals(actual, expected, msg); + + test.notDeepLooseEqual(actual, expected); + test.notDeepLooseEqual(actual, expected, msg); + test.notLooseEqual(actual, expected); + test.notLooseEqual(actual, expected, msg); + test.notLooseEquals(actual, expected); + test.notLooseEquals(actual, expected, msg); + + test.throws(fn); + test.throws(fn, msg); + test.throws(fn, exceptionExpected); + test.throws(fn, exceptionExpected, msg); + + test.doesNotThrow(fn); + test.doesNotThrow(fn, msg); + test.doesNotThrow(fn, exceptionExpected); + test.doesNotThrow(fn, exceptionExpected, msg); + + test.test(name, (st) => { + t = st; + }); + + test.comment(msg); +}); + +tape('simple delay', (test) => P.delay(1)); + +tape('nested tests with promises', function(test) { + test.test('delay1', () => P.delay(1) ); + test.test('delay2', () => P.delay(1) ); +}); diff --git a/blue-tape/blue-tape.d.ts b/blue-tape/blue-tape.d.ts new file mode 100644 index 0000000000..50bf0aab8d --- /dev/null +++ b/blue-tape/blue-tape.d.ts @@ -0,0 +1,12 @@ +// Type definitions for blue-tape v0.1.11 +// Project: https://github.com/spion/blue-tape +// Definitions by: Haoqun Jiang +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module 'blue-tape' { + import tape = require('tape'); + export = tape; +} From 9b6a4f0c872faa9b2bd768965e61a2e7ad1ce912 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 16 Dec 2015 11:48:44 +0500 Subject: [PATCH 268/474] node: signatures of module "readline" have been changed --- node/node-tests.ts | 102 ++++++++++++++++++++++++++++++++++++++++----- node/node.d.ts | 39 ++++++++++++++--- 2 files changed, 124 insertions(+), 17 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index aa0f55bb69..e21b5d9814 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -421,21 +421,101 @@ module path_tests { } //////////////////////////////////////////////////// -///ReadLine tests : https://nodejs.org/api/readline.html +/// readline tests : https://nodejs.org/api/readline.html //////////////////////////////////////////////////// -var rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, -}); +module readline_tests { + let rl: readline.ReadLine; -rl.setPrompt("$>"); -rl.prompt(); -rl.prompt(true); + { + let options: readline.ReadLineOptions; + let input: NodeJS.ReadableStream; + let output: NodeJS.WritableStream; + let completer: readline.Completer; + let terminal: boolean; -rl.question("do you like typescript?", function(answer: string) { - rl.close(); -}); + let result: readline.ReadLine; + + result = readline.createInterface(options); + result = readline.createInterface(input); + result = readline.createInterface(input, output); + result = readline.createInterface(input, output, completer); + result = readline.createInterface(input, output, completer, terminal); + } + + { + let prompt: string; + + rl.setPrompt(prompt); + } + + { + let preserveCursor: boolean; + + rl.prompt(); + rl.prompt(preserveCursor); + } + + { + let query: string; + let callback: (answer: string) => void; + + rl.question(query, callback); + } + + { + let result: readline.ReadLine; + + result = rl.pause(); + } + + { + let result: readline.ReadLine; + + result = rl.resume(); + } + + { + rl.close(); + } + + { + let data: string|Buffer; + let key: readline.Key; + + rl.write(data); + rl.write(null, key); + } + + { + let stream: NodeJS.WritableStream; + let x: number; + let y: number; + + readline.cursorTo(stream, x, y); + } + + { + let stream: NodeJS.WritableStream; + let dx: number|string; + let dy: number|string; + + readline.moveCursor(stream, dx, dy); + } + + { + let stream: NodeJS.WritableStream; + let dir: number; + + readline.clearLine(stream, dir); + } + + { + let stream: NodeJS.WritableStream; + + readline.clearScreenDown(stream); + } +} ////////////////////////////////////////////////////////////////////// /// Child Process tests: https://nodejs.org/api/child_process.html /// diff --git a/node/node.d.ts b/node/node.d.ts index 879b20d894..63478c451a 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -826,22 +826,49 @@ declare module "readline" { import * as events from "events"; import * as stream from "stream"; + export interface Key { + sequence?: string; + name?: string; + ctrl?: boolean; + meta?: boolean; + shift?: boolean; + } + export interface ReadLine extends events.EventEmitter { setPrompt(prompt: string): void; prompt(preserveCursor?: boolean): void; - question(query: string, callback: Function): void; - pause(): void; - resume(): void; + question(query: string, callback: (answer: string) => void): void; + pause(): ReadLine; + resume(): ReadLine; close(): void; - write(data: any, key?: any): void; + write(data: string|Buffer, key?: Key): void; } + + export interface Completer { + (line: string): CompleterResult; + (line: string, callback: (err: any, result: CompleterResult) => void): any; + } + + export interface CompleterResult { + completions: string[]; + line: string; + } + export interface ReadLineOptions { input: NodeJS.ReadableStream; - output: NodeJS.WritableStream; - completer?: Function; + output?: NodeJS.WritableStream; + completer?: Completer; terminal?: boolean; + historySize?: number; } + + export function createInterface(input: NodeJS.ReadableStream, output?: NodeJS.WritableStream, completer?: Completer, terminal?: boolean): ReadLine; export function createInterface(options: ReadLineOptions): ReadLine; + + export function cursorTo(stream: NodeJS.WritableStream, x: number, y: number): void; + export function moveCursor(stream: NodeJS.WritableStream, dx: number|string, dy: number|string): void; + export function clearLine(stream: NodeJS.WritableStream, dir: number): void; + export function clearScreenDown(stream: NodeJS.WritableStream): void; } declare module "vm" { From e5f4e76f6b9cd219fa2b89d33e03fd2507c60461 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Wed, 16 Dec 2015 09:38:22 +0200 Subject: [PATCH 269/474] Properly name debounce test file --- debounce/{debounce.ts => debounce-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename debounce/{debounce.ts => debounce-tests.ts} (100%) diff --git a/debounce/debounce.ts b/debounce/debounce-tests.ts similarity index 100% rename from debounce/debounce.ts rename to debounce/debounce-tests.ts From 4af65b04e8293bfefccab7218dc5f3c1df8233a4 Mon Sep 17 00:00:00 2001 From: Denis Sokolov Date: Wed, 16 Dec 2015 09:54:46 +0200 Subject: [PATCH 270/474] Fix debounce test syntax --- debounce/debounce-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debounce/debounce-tests.ts b/debounce/debounce-tests.ts index fb0e52b467..947fbcdae5 100644 --- a/debounce/debounce-tests.ts +++ b/debounce/debounce-tests.ts @@ -1,6 +1,6 @@ /// -import debounce = require("debounce"); +import debounce from "debounce"; const doThings = () => 1; From 5d78b33357dde02151413b63ffa569246cab0b2f Mon Sep 17 00:00:00 2001 From: LAN Xingcan Date: Wed, 16 Dec 2015 19:01:52 +0800 Subject: [PATCH 271/474] Allow pass buffer argument for pbkdf2 function --- node/node-0.10.d.ts | 4 ++-- node/node-0.11.d.ts | 4 ++-- node/node-0.12.d.ts | 4 ++-- node/node-0.8.8.d.ts | 4 ++-- node/node.d.ts | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/node/node-0.10.d.ts b/node/node-0.10.d.ts index a4cd5b1a6b..f6aff4f709 100644 --- a/node/node-0.10.d.ts +++ b/node/node-0.10.d.ts @@ -1191,8 +1191,8 @@ declare module "crypto" { setPrivateKey(public_key: string, encoding?: string): void; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer; export function randomBytes(size: number): Buffer; export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; export function pseudoRandomBytes(size: number): Buffer; diff --git a/node/node-0.11.d.ts b/node/node-0.11.d.ts index 05aee911de..8c8959ecd0 100644 --- a/node/node-0.11.d.ts +++ b/node/node-0.11.d.ts @@ -1099,8 +1099,8 @@ declare module "crypto" { setPrivateKey(public_key: string, encoding?: string): void; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer; export function randomBytes(size: number): Buffer; export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; export function pseudoRandomBytes(size: number): Buffer; diff --git a/node/node-0.12.d.ts b/node/node-0.12.d.ts index 11fd92d245..2c411c4a92 100644 --- a/node/node-0.12.d.ts +++ b/node/node-0.12.d.ts @@ -1654,8 +1654,8 @@ declare module "crypto" { setPrivateKey(public_key: string, encoding?: string): void; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer; export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number, digest: string) : Buffer; export function randomBytes(size: number): Buffer; diff --git a/node/node-0.8.8.d.ts b/node/node-0.8.8.d.ts index 1972e0cdcf..c6b2acf508 100644 --- a/node/node-0.8.8.d.ts +++ b/node/node-0.8.8.d.ts @@ -326,7 +326,7 @@ declare module "cluster" { export function disconnect(callback?: Function): void; export var workers: any; - // Event emitter + // Event emitter export function addListener(event: string, listener: Function): void; export function on(event: string, listener: Function): any; export function once(event: string, listener: Function): void; @@ -970,7 +970,7 @@ declare module "crypto" { setPrivateKey(public_key: string, encoding?: string): void; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: string) => any): void; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: string) => any): void; export function randomBytes(size: number, callback?: (err: Error, buf: Buffer) =>void ); } diff --git a/node/node.d.ts b/node/node.d.ts index 879b20d894..e031cbf74c 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1694,10 +1694,10 @@ declare module "crypto" { setPrivateKey(public_key: string, encoding?: string): void; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2(password: string, salt: string, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number) : Buffer; - export function pbkdf2Sync(password: string, salt: string, iterations: number, keylen: number, digest: string) : Buffer; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number) : Buffer; + export function pbkdf2Sync(password: string|Buffer, salt: string|Buffer, iterations: number, keylen: number, digest: string) : Buffer; export function randomBytes(size: number): Buffer; export function randomBytes(size: number, callback: (err: Error, buf: Buffer) =>void ): void; export function pseudoRandomBytes(size: number): Buffer; From 793ee5fa00b4c78fb7619e1137085aa376eade11 Mon Sep 17 00:00:00 2001 From: Eric Nicholson Date: Wed, 16 Dec 2015 09:20:08 -0500 Subject: [PATCH 272/474] Added bluebird mapSeries definitions --- bluebird/bluebird-tests.ts | 97 +++++++++++++++++++++++++++++++++++--- bluebird/bluebird.d.ts | 25 ++++++++++ 2 files changed, 116 insertions(+), 6 deletions(-) diff --git a/bluebird/bluebird-tests.ts b/bluebird/bluebird-tests.ts index bd4f46fc45..5f96d28efc 100644 --- a/bluebird/bluebird-tests.ts +++ b/bluebird/bluebird-tests.ts @@ -607,19 +607,19 @@ Promise.all([fooProm, barProm, fooProm]).then(result => { //TODO fix collection inference -barArrProm = fooProm.map((item: Foo, index: number, arrayLength: number) => { +barArrProm = fooArrProm.map((item: Foo, index: number, arrayLength: number) => { return bar; }); -barArrProm = fooProm.map((item: Foo) => { +barArrProm = fooArrProm.map((item: Foo) => { return bar; }); -barArrProm = fooProm.map((item: Foo, index: number, arrayLength: number) => { +barArrProm = fooArrProm.map((item: Foo, index: number, arrayLength: number) => { return bar; }, { concurrency: 1 }); -barArrProm = fooProm.map((item: Foo) => { +barArrProm = fooArrProm.map((item: Foo) => { return bar; }, { concurrency: 1 @@ -627,10 +627,20 @@ barArrProm = fooProm.map((item: Foo) => { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -barProm = fooProm.reduce((memo: Bar, item: Foo, index: number, arrayLength: number) => { +barArrProm = fooArrProm.mapSeries((item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = fooArrProm.mapSeries((item: Foo) => { + return bar; +}); + + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +barProm = fooArrProm.reduce((memo: Bar, item: Foo, index: number, arrayLength: number) => { return memo; }); -barProm = fooProm.reduce((memo: Bar, item: Foo) => { +barProm = fooArrProm.reduce((memo: Bar, item: Foo) => { return memo; }, bar); @@ -1008,6 +1018,81 @@ barArrProm = Promise.map(fooArr, (item: Foo, index: number, arrayLength: number) concurrency: 1 }); +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// mapSeries() + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArrThen + +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArrThen + +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArrThen, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooThenArr + +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooThenArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// fooArr + +barArrProm = Promise.mapSeries(fooArr, (item: Foo) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArr, (item: Foo) => { + return barThen; +}); +barArrProm = Promise.mapSeries(fooArr, (item: Foo, index: number, arrayLength: number) => { + return bar; +}); +barArrProm = Promise.mapSeries(fooArr, (item: Foo, index: number, arrayLength: number) => { + return barThen; +}); + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // reduce() diff --git a/bluebird/bluebird.d.ts b/bluebird/bluebird.d.ts index f3420957a3..3d205f2ed7 100644 --- a/bluebird/bluebird.d.ts +++ b/bluebird/bluebird.d.ts @@ -315,6 +315,12 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { map(mapper: (item: Q, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; map(mapper: (item: Q, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; + /** + * Same as `Promise.mapSeries(thisPromise, mapper)`. + */ + // TODO type inference from array-resolving promise? + mapSeries(mapper: (item: Q, index: number, arrayLength: number) => U|Promise.Thenable): Promise; + /** * Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. */ @@ -573,6 +579,25 @@ declare class Promise implements Promise.Thenable, Promise.Inspection { static map(values: R[], mapper: (item: R, index: number, arrayLength: number) => Promise.Thenable, options?: Promise.ConcurrencyOption): Promise; static map(values: R[], mapper: (item: R, index: number, arrayLength: number) => U, options?: Promise.ConcurrencyOption): Promise; + /** + * Similar to `map` with concurrency set to 1 but guaranteed to execute in sequential order + * + * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. + * + * *The original array is not modified.* + */ + // promise of array with promises of value + static mapSeries(values: Promise.Thenable[]>, mapper: (item: R, index: number, arrayLength: number) => U|Promise.Thenable): Promise; + + // promise of array with values + static mapSeries(values: Promise.Thenable, mapper: (item: R, index: number, arrayLength: number) => U|Promise.Thenable): Promise; + + // array with promises of value + static mapSeries(values: Promise.Thenable[], mapper: (item: R, index: number, arrayLength: number) => U|Promise.Thenable): Promise; + + // array with values + static mapSeries(values: R[], mapper: (item: R, index: number, arrayLength: number) => U|Promise.Thenable): Promise; + /** * Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. * From f2a49a691651e4fcd3a8d14be5c9bdcde9c374b7 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 16 Dec 2015 09:55:29 -0800 Subject: [PATCH 273/474] Add schemeNumber part of javascript-bignum library --- javascript-bignum/javascript-bignum-tests.ts | 21 ++++++++ javascript-bignum/javascript-bignum.d.ts | 53 ++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 javascript-bignum/javascript-bignum-tests.ts create mode 100644 javascript-bignum/javascript-bignum.d.ts diff --git a/javascript-bignum/javascript-bignum-tests.ts b/javascript-bignum/javascript-bignum-tests.ts new file mode 100644 index 0000000000..57555fcce2 --- /dev/null +++ b/javascript-bignum/javascript-bignum-tests.ts @@ -0,0 +1,21 @@ +/// +let m = SchemeNumber("1"); +let n = SchemeNumber(2); + +let sum: SchemeNumber = SchemeNumber.fn["+"](m, n); +sum = SchemeNumber.fn["+"](m, 1); +sum = SchemeNumber.fn["+"](m, "12"); +sum = SchemeNumber.fn["+"]("12", "25"); + +let floored: SchemeNumber = SchemeNumber.fn.floor(m); + +let str: string = floored.toString(16); +str = floored.toExponential(2); +str = floored.toPrecision(2); +str = floored.toFixed(2); + +let num: number = maxIntegerDigits; +num = VERSION[0]; +num = VERSION.length; + +raise("fake error", "This is not really an error", m); diff --git a/javascript-bignum/javascript-bignum.d.ts b/javascript-bignum/javascript-bignum.d.ts new file mode 100644 index 0000000000..a088837d10 --- /dev/null +++ b/javascript-bignum/javascript-bignum.d.ts @@ -0,0 +1,53 @@ +// Type definitions for javascript-bignum +// Project: https://github.com/jtobey/javascript-bignum +// Definitions by: Nathan Shively-Sanders +// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Documentation: http://john-edwin-tobey.org/Scheme/javascript-bignum/docs/files/schemeNumber-js.html + +// This version only includes typing for schemeNumber, not the full library +declare type SchemeOperator = (...args: (string | SchemeNumber | number)[]) => SchemeNumber; +declare var VERSION: number[]; +declare function raise(conditionType: string, message: string, ...irritants: any[]): void; +declare var maxIntegerDigits: number; +declare interface SchemeFn { + [opname: string]: SchemeOperator; + inexact: SchemeOperator; + exact: SchemeOperator; + max: SchemeOperator; + min: SchemeOperator; + abs: SchemeOperator; + div: SchemeOperator; + mod: SchemeOperator; + div0: SchemeOperator; + mod0: SchemeOperator; + gcd: SchemeOperator; + lcm: SchemeOperator; + numerator: SchemeOperator; + denominator: SchemeOperator; + floor: SchemeOperator; + ceiling: SchemeOperator; + truncate: SchemeOperator; + round: SchemeOperator; + rationalize: SchemeOperator; + exp: SchemeOperator; + log: SchemeOperator; + sin: SchemeOperator; + cos: SchemeOperator; + tan: SchemeOperator; + asin: SchemeOperator; + acos: SchemeOperator; + atan: SchemeOperator; + sqrt: SchemeOperator; + expt: SchemeOperator; + magnitude: SchemeOperator; + angle: SchemeOperator; +} +declare interface SchemeNumber { + (value: string | number): SchemeNumber; + toString(radix: number): string; + toFixed(fractionDigits: number): string; + toExponential(fractionDigits: number): string; + toPrecision(precision: number): string; + fn: SchemeFn; +} +declare var SchemeNumber: SchemeNumber; From 223687fd0d9f082e0be46589967acb09c327c4cf Mon Sep 17 00:00:00 2001 From: WAEL BEN ZID Date: Wed, 16 Dec 2015 22:55:03 +0100 Subject: [PATCH 274/474] BUGFIX in ITemplateOptions definition --- angular-formly/angular-formly.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-formly/angular-formly.d.ts b/angular-formly/angular-formly.d.ts index d52df5e48f..fce793e7e7 100644 --- a/angular-formly/angular-formly.d.ts +++ b/angular-formly/angular-formly.d.ts @@ -72,7 +72,7 @@ declare module AngularFormly { interface ISelectOption { name: string; - value: string; + value?: string; group?: string; } @@ -110,7 +110,7 @@ declare module AngularFormly { [key: string]: any; // types for select/radio fields - options?: ISelectOption | any; + options?: Array; groupProp?: string; // default: group valueProp?: string; // default: value labelProp?: string; // default: name From ea6787006265bcfbb7a051f85dfd2f74506a0a01 Mon Sep 17 00:00:00 2001 From: amritk Date: Wed, 16 Dec 2015 15:25:21 -0800 Subject: [PATCH 275/474] Updated stripe.d.ts Added bank account methods for managed accounts. --- stripe/stripe.d.ts | 48 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/stripe/stripe.d.ts b/stripe/stripe.d.ts index 96d8758bc7..f18dff0ee4 100644 --- a/stripe/stripe.d.ts +++ b/stripe/stripe.d.ts @@ -1,6 +1,6 @@ // Type definitions for stripe // Project: https://stripe.com/ -// Definitions by: Andy Hawkins , Eric J. Smith +// Definitions by: Andy Hawkins , Eric J. Smith , Amrit Kahlon // Definitions: https://github.com/borisyankov/DefinitelyTyped interface StripeStatic { @@ -11,7 +11,8 @@ interface StripeStatic { cardType(cardNumber: string): string; getToken(token: string, responseHandler: (status: number, response: StripeTokenResponse) => void): void; card: StripeCardData; - createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void; + createToken(data: StripeTokenData, responseHandler: (status: number, response: StripeTokenResponse) => void): void; + bankAccount: StripeBankAccount; } interface StripeTokenData { @@ -40,7 +41,10 @@ interface StripeTokenResponse { } interface StripeError { + type: string; + code: string; message: string; + param?: string; } interface StripeCardData { @@ -60,7 +64,45 @@ interface StripeCardData { address_country?: string; } +interface StripeBankAccount +{ + createToken(params: StripeBankTokenParams, stripeResponseHandler: (response: StripeBankTokenResponse) => void): void; + validateRoutingNumber(routingNumber: number | string, countryCode: string): boolean; + validateAccountNumber(accountNumber: number | string, countryCode: string): boolean; +} + +interface StripeBankTokenParams +{ + country: string; + currency: string; + routing_number?: number | string; + account_number?: number | string; + transit_number?: number | string; + institution_number?: number | string; + bsb?: number | string; + sort_code?: string; + iban?: string; +} + +interface StripeBankTokenResponse +{ + id: string; + bank_account: { + country: string; + bank_name: string; + last4: number; + validated: boolean; + object: string; + }; + created: number; + livemode: boolean; + type: string; + object: string; + used: boolean; + error: StripeError; +} + declare var Stripe: StripeStatic; declare module "Stripe" { - export = StripeStatic; + export = StripeStatic; } From b6f9544291b2fc44e33771c699158a3a0543a331 Mon Sep 17 00:00:00 2001 From: amritk Date: Wed, 16 Dec 2015 15:33:27 -0800 Subject: [PATCH 276/474] update stripe.d.ts Added status to bank token creation response --- stripe/stripe.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stripe/stripe.d.ts b/stripe/stripe.d.ts index f18dff0ee4..3fcf771e35 100644 --- a/stripe/stripe.d.ts +++ b/stripe/stripe.d.ts @@ -66,7 +66,7 @@ interface StripeCardData { interface StripeBankAccount { - createToken(params: StripeBankTokenParams, stripeResponseHandler: (response: StripeBankTokenResponse) => void): void; + createToken(params: StripeBankTokenParams, stripeResponseHandler: (status:number, response: StripeBankTokenResponse) => void): void; validateRoutingNumber(routingNumber: number | string, countryCode: string): boolean; validateAccountNumber(accountNumber: number | string, countryCode: string): boolean; } From 8907ae9ff9c1b62b1883190871aafbe0f5574203 Mon Sep 17 00:00:00 2001 From: amritk Date: Wed, 16 Dec 2015 16:26:17 -0800 Subject: [PATCH 277/474] update stripe.d.ts All those extra bank fields are passed as routing number. --- stripe/stripe.d.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/stripe/stripe.d.ts b/stripe/stripe.d.ts index 3fcf771e35..06901ee9f2 100644 --- a/stripe/stripe.d.ts +++ b/stripe/stripe.d.ts @@ -75,13 +75,8 @@ interface StripeBankTokenParams { country: string; currency: string; + account_number: number | string; routing_number?: number | string; - account_number?: number | string; - transit_number?: number | string; - institution_number?: number | string; - bsb?: number | string; - sort_code?: string; - iban?: string; } interface StripeBankTokenResponse From 336361b4e23da3f5e8b2181f9fc715213685d159 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 16 Dec 2015 18:09:23 -0800 Subject: [PATCH 278/474] Added 'temp'. --- temp/temp-tests.ts | 67 ++++++++++++++++++++++++++++++++++++++++++++++ temp/temp.d.ts | 43 +++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 temp/temp-tests.ts create mode 100644 temp/temp.d.ts diff --git a/temp/temp-tests.ts b/temp/temp-tests.ts new file mode 100644 index 0000000000..eddf870a4f --- /dev/null +++ b/temp/temp-tests.ts @@ -0,0 +1,67 @@ +// Author: Daniel Rosenwasser + +/// + +import * as temp from "temp"; + +function testCleanup() { + temp.cleanup(result => { + if (typeof result === "boolean") { + const x = result === true; + } + else { + const { files, dirs } = result; + } + }); +} + +function testCleanupSync() { + const cleanupResult = temp.cleanupSync() + if (typeof cleanupResult === "boolean") { + const x = cleanupResult === true; + } + else { + const { dirs, files } = cleanupResult + } +} + +function testOpen() { + temp.open({ dir: "tempDir", prefix: "pref", suffix: "suff" }, (err, result) => { + const { path, fd } = result; + }); + + temp.open("strPrefix", (err, result) => { + const { path, fd } = result; + }); +} + +function testOpenSync() { + const { fd: openFd1, path: openPath1 } = temp.openSync({ dir: "tempDir", prefix: "pref", suffix: "suff" }); + const { fd: openFd2, path: openPath2 } = temp.openSync("str"); +} + +function testCreateWriteStream() { + const stream = temp.createWriteStream("HelloStreamAffix"); + stream.write("data"); +} + +function testMkDir() { + temp.mkDir("prefix", (err, dirPath) => { + dirPath.length; + }); +} + +function testMkDirSync() { + const result = temp.mkDirSync("prefix"); + result.length; +} + +function testPath() { + temp.path({ suffix: "justSuffix" }, "defaultPrefix"); +} + +function testTrack() { + const tempChained = temp.track(true).track(false); + tempChained.dir; + tempChained.cleanupSync(); +} \ No newline at end of file diff --git a/temp/temp.d.ts b/temp/temp.d.ts new file mode 100644 index 0000000000..ea8f33d9d1 --- /dev/null +++ b/temp/temp.d.ts @@ -0,0 +1,43 @@ +// Type definitions for temp 0.8.3 +// Project: https://www.npmjs.com/package/temp, https://github.com/bruce/node-temp +// Definitions by: Daniel Rosenwasser +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "temp" { + import * as temp from "temp"; + import * as fs from "fs"; + + export interface AffixOptions { + prefix?: string; + suffix?: string; + dir?: string; + } + + export var dir: string; + + export function track(value: boolean): typeof temp; + + export function mkDir(affixes: string, callback?: (err: any, dirPath: string) => void); + export function mkDir(affixes: AffixOptions, callback?: (err: any, dirPath: string) => void); + + export function mkDirSync(affixes: string): string; + export function mkDirSync(affixes: AffixOptions): string; + + export function open(affixes: string, callback?: (err: any, result: {path: string, fd: number}) => void); + export function open(affixes: AffixOptions, callback?: (err: any, result: {path: string, fd: number}) => void); + + export function openSync(affixes: string): { path: string, fd: number }; + export function openSync(affixes: AffixOptions): { path: string, fd: number }; + + export function path(affixes: string, defaultPrefix: string); + export function path(affixes: AffixOptions, defaultPrefix: string); + + export function cleanup(callback?: (result: boolean | {files: number, dirs?: number}) => void); + + export function cleanupSync(): boolean | {files: number, dirs: number}; + + export function createWriteStream(affixes: string): fs.WriteStream; + export function createWriteStream(affixes: AffixOptions): fs.WriteStream; +} \ No newline at end of file From a30d1017ee9f822c332eaba3d128dd0af5f00816 Mon Sep 17 00:00:00 2001 From: amritk Date: Wed, 16 Dec 2015 18:32:12 -0800 Subject: [PATCH 279/474] Update stripe.d.ts --- stripe/stripe.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/stripe/stripe.d.ts b/stripe/stripe.d.ts index 06901ee9f2..27d60d961a 100644 --- a/stripe/stripe.d.ts +++ b/stripe/stripe.d.ts @@ -83,6 +83,7 @@ interface StripeBankTokenResponse { id: string; bank_account: { + id: string; country: string; bank_name: string; last4: number; From 230dcd425bd9e818df6cdc1ff9f29d5368123031 Mon Sep 17 00:00:00 2001 From: Joshua Filby Date: Wed, 16 Dec 2015 21:05:01 -0600 Subject: [PATCH 280/474] Add bcryptjs definitions and tests --- bcryptjs/bcryptjs-tests.ts | 54 +++++++++++++++++++++++++ bcryptjs/bcryptjs.d.ts | 82 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 bcryptjs/bcryptjs-tests.ts create mode 100644 bcryptjs/bcryptjs.d.ts diff --git a/bcryptjs/bcryptjs-tests.ts b/bcryptjs/bcryptjs-tests.ts new file mode 100644 index 0000000000..acfc48e439 --- /dev/null +++ b/bcryptjs/bcryptjs-tests.ts @@ -0,0 +1,54 @@ +/// + +import bcryptjs = require("bcryptjs"); + +let str: string; +let num: number; +let bool: boolean; + +str = bcryptjs.genSaltSync(); +str = bcryptjs.genSaltSync(10); + +bcryptjs.genSalt((err: Error, salt: string) => { + str = salt; +}); +bcryptjs.genSalt(10, (err: Error, salt: string) => { + str = salt; +}); + +str = bcryptjs.hashSync("string"); +str = bcryptjs.hashSync("string", 10); +str = bcryptjs.hashSync("string", "salt"); + +bcryptjs.hash("string", 10, (err: Error, hash: string) => { + str = hash; +}); +bcryptjs.hash("string", 10, (err: Error, hash: string) => { + str = hash; +}, (percent: number) => { + num = percent; +}); + +bcryptjs.hash("string", "salt", (err: Error, hash: string) => { + str = hash; +}); +bcryptjs.hash("string", "salt", (err: Error, hash: string) => { + str = hash; +}, (percent: number) => { + num = percent; +}); + +bool = bcryptjs.compareSync("string1", "string2"); + +bcryptjs.compare("string1", "string2", (err: Error, success: boolean) => { + bool = success; +}); +bcryptjs.compare("string1", "string2", (err: Error, success: boolean) => { + bool = success; +}, (percent: number) => { + num = percent; +}); + +num = bcryptjs.getRounds("string"); + +str = bcryptjs.getSalt("string"); diff --git a/bcryptjs/bcryptjs.d.ts b/bcryptjs/bcryptjs.d.ts new file mode 100644 index 0000000000..3d3128d022 --- /dev/null +++ b/bcryptjs/bcryptjs.d.ts @@ -0,0 +1,82 @@ +// Type definitions for bcryptjs v2.3.0 +// Project: https://github.com/dcodeIO/bcrypt.js +// Definitions by: Joshua Filby +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "bcryptjs" { + + /** + * Sets the pseudo random number generator to use as a fallback if neither node's crypto module nor the Web Crypto API is available. + * Please note: It is highly important that the PRNG used is cryptographically secure and that it is seeded properly! + * @param random Function taking the number of bytes to generate as its sole argument, returning the corresponding array of cryptographically secure random byte values. + */ + export function setRandomFallback(random: (random: number) => number[]): void; + + /** + * Synchronously generates a salt. + * @param rounds Number of rounds to use, defaults to 10 if omitted + * @return Resulting salt + */ + export function genSaltSync(rounds?: number): string; + + /** + * Asynchronously generates a salt. + * @param callback Callback receiving the error, if any, and the resulting salt + */ + export function genSalt(callback: (err: Error, salt: string) => void): void; + + /** + * Asynchronously generates a salt. + * @param rounds Number of rounds to use, defaults to 10 if omitted + * @param callback Callback receiving the error, if any, and the resulting salt + */ + export function genSalt(rounds: number, callback: (err: Error, salt: string) => void): void; + + /** + * Synchronously generates a hash for the given string. + * @param s String to hash + * @param salt Salt length to generate or salt to use, default to 10 + * @return Resulting hash + */ + export function hashSync(s: string, salt?: number | string): string; + + /** + * Asynchronously generates a hash for the given string. + * @param s String to hash + * @param salt Salt length to generate or salt to use + * @param callback Callback receiving the error, if any, and the resulting hash + * @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms. + */ + export function hash(s: string, salt: number | string, callback: (err: Error, hash: string) => void, progressCallback?: (percent: number) => void): void; + + /** + * Synchronously tests a string against a hash. + * @param s String to compare + * @param hash Hash to test against + * @return true if matching, otherwise false + */ + export function compareSync(s: string, hash: string): boolean; + + /** + * Asynchronously compares the given data against the given hash. + * @param s Data to compare + * @param hash Data to be compared to + * @param callback Callback receiving the error, if any, otherwise the result + * @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms. + */ + export function compare(s: string, hash: string, callback: (err: Error, success: boolean) => void, progressCallback?: (percent: number) => void): void; + + /** + * Gets the number of rounds used to encrypt the specified hash. + * @param hash Hash to extract the used number of rounds from + * @return Number of rounds used + */ + export function getRounds(hash: string): number; + + /** + * Gets the salt portion from a hash. Does not validate the hash. + * @param hash Hash to extract the salt from + * @return Extracted salt part + */ + export function getSalt(hash: string): string; +} From 8c0469357cd869d2766948d84a34561c5b8bd5c5 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 16 Dec 2015 23:42:23 -0800 Subject: [PATCH 281/474] Made non-synchronous functions return 'void'. --- temp/temp.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/temp/temp.d.ts b/temp/temp.d.ts index ea8f33d9d1..3d37bf0c5b 100644 --- a/temp/temp.d.ts +++ b/temp/temp.d.ts @@ -19,22 +19,22 @@ declare module "temp" { export function track(value: boolean): typeof temp; - export function mkDir(affixes: string, callback?: (err: any, dirPath: string) => void); - export function mkDir(affixes: AffixOptions, callback?: (err: any, dirPath: string) => void); + export function mkDir(affixes: string, callback?: (err: any, dirPath: string) => void): void; + export function mkDir(affixes: AffixOptions, callback?: (err: any, dirPath: string) => void): void; export function mkDirSync(affixes: string): string; export function mkDirSync(affixes: AffixOptions): string; - export function open(affixes: string, callback?: (err: any, result: {path: string, fd: number}) => void); - export function open(affixes: AffixOptions, callback?: (err: any, result: {path: string, fd: number}) => void); + export function open(affixes: string, callback?: (err: any, result: {path: string, fd: number}) => void): void; + export function open(affixes: AffixOptions, callback?: (err: any, result: {path: string, fd: number}) => void): void; export function openSync(affixes: string): { path: string, fd: number }; export function openSync(affixes: AffixOptions): { path: string, fd: number }; - export function path(affixes: string, defaultPrefix: string); - export function path(affixes: AffixOptions, defaultPrefix: string); + export function path(affixes: string, defaultPrefix: string): void; + export function path(affixes: AffixOptions, defaultPrefix: string): void; - export function cleanup(callback?: (result: boolean | {files: number, dirs?: number}) => void); + export function cleanup(callback?: (result: boolean | {files: number, dirs?: number}) => void): void; export function cleanupSync(): boolean | {files: number, dirs: number}; From 4f03ef7344e97760125f45950a870b09fc3e3081 Mon Sep 17 00:00:00 2001 From: Sven Reglitzki Date: Thu, 17 Dec 2015 10:08:48 +0100 Subject: [PATCH 282/474] Add sandboxed-module definitions --- sandboxed-module/sandboxed-module.d.ts | 103 +++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 sandboxed-module/sandboxed-module.d.ts diff --git a/sandboxed-module/sandboxed-module.d.ts b/sandboxed-module/sandboxed-module.d.ts new file mode 100644 index 0000000000..94fb374508 --- /dev/null +++ b/sandboxed-module/sandboxed-module.d.ts @@ -0,0 +1,103 @@ +// Type definitions for sandboxed-module v2.0.3 +// Project: https://github.com/felixge/node-sandboxed-module +// Definitions by: Sven Reglitzki +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "sandboxed-module" { + + interface SandboxOptions { + /** + * An object containing moduleIds and the values to inject for them when required by the sandboxed module. + * This does not affect children of the sandboxed module. + */ + requires?: Object; + /** + * An object of global variables to inject into the sandboxed module. + */ + globals?: Object; + /** + * An object of local variables to inject into the sandboxed module. + */ + locals?: Object; + /** + * An object of named functions which will transform the source code required with SandboxedModule.require. + * For example, CoffeeScript & istanbul support is implemented with built-in sourceTransformer functions + * (see #registerBuiltInSourceTransformer). + * + * A source transformer receives the source (as it's been transformed thus far) and must return the transformed + * source (whether it's changed or unchanged). + * + * An example source transformer to change all instances of the number "3" to "5" would look like this: + * + * SandboxedModule.require('../fixture/baz', { + * sourceTransformers: { + * turn3sInto5s: function(source) { + * return source.replace(/3/g,'5'); + * } + * } + * }) + */ + sourceTransformers?: Object; + /** + * If false, modules that are required by the sandboxed module will not be sandboxed. By default all modules + * required by the sandboxedModule will be sandboxed using the same options that were used for the original + * sandboxed module. + */ + singleOnly?: boolean; + /** + * If false, the source transformers will not be run against modules required by the sandboxed module. + * By default it will take the same value as {@link SandboxOptions.singleOnly}. + */ + sourceTransformersSingleOnly?: boolean; + } + + class SandboxedModule { + /** + * See {@link SandboxOptions.requires} + */ + required:Object; + /** + * See {@link SandboxOptions.globals} + */ + globals:Object; + /** + * See {@link SandboxOptions.locals} + */ + locals:Object; + /** + * See {@link SandboxOptions.sourceTransformers}. + */ + sourceTransformers:Object; + /** + * The full path to the module. + */ + filename:string; + /** + * The underlaying node.js Module instance. + */ + module:string; + /** + * A getter returning the sandboxedModule.module.exports object. + */ + exports:any; + /** + * Returns a new SandboxedModule where moduleId is a regular module path / id as you would normally pass into + * require(). The new module will be loaded in its own v8 context, but otherwise have access to the normal + * node.js environment. + * + * @param moduleId the ID of the module to load + * @param options the loading options + */ + static load(moduleId:string, options?:SandboxOptions):SandboxedModule + + /** + * Identical to {@link SandboxedModule.load()}, but returns sandboxedModule.exports directly. + * + * @param moduleId the ID of the module to require + * @param options the requiring options + */ + static require(moduleId:string, options?:SandboxOptions):any + } + + export = SandboxedModule; +} From 725408f13522c67f3393be1fc51d1c311fb3ebfb Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Thu, 17 Dec 2015 11:04:10 +0100 Subject: [PATCH 283/474] Add host and port to TlsOptions --- node/node-tests.ts | 7 +++++++ node/node.d.ts | 2 ++ 2 files changed, 9 insertions(+) diff --git a/node/node-tests.ts b/node/node-tests.ts index aa0f55bb69..717220afc1 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -198,6 +198,13 @@ var ctx: tls.SecureContext = tls.createSecureContext({ }); var blah = ctx.context; +var tlsOpts: tls.TlsOptions = { + host: "127.0.0.1", + port: 55 +}; +var tlsSocket = tls.connect(tlsOpts); + + //////////////////////////////////////////////////// // Make sure .listen() and .close() retuern a Server instance diff --git a/node/node.d.ts b/node/node.d.ts index 879b20d894..2b7c2a10da 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1535,6 +1535,8 @@ declare module "tls" { var CLIENT_RENEG_WINDOW: number; export interface TlsOptions { + host?: string; + port?: number; pfx?: any; //string or buffer key?: any; //string or buffer passphrase?: string; From 1ebf010a1eecb2025777b44e5c0387a4c9f0472c Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Thu, 17 Dec 2015 11:31:43 +0100 Subject: [PATCH 284/474] http.RequestOptions.agent can also be a boolean https://nodejs.org/api/http.html#http_http_request_options_callback --- node/node-tests.ts | 10 ++++++++++ node/node.d.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index aa0f55bb69..0215171691 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -226,6 +226,16 @@ module http_tests { }); var agent: http.Agent = http.globalAgent; + + http.request({ + agent: false + }); + http.request({ + agent: agent + }); + http.request({ + agent: undefined + }); } //////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index 879b20d894..f937b53ebf 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -453,7 +453,7 @@ declare module "http" { path?: string; headers?: { [key: string]: any }; auth?: string; - agent?: Agent; + agent?: Agent|boolean; } export interface Server extends events.EventEmitter { From 22997bee704f7d14033b5a1972d3811ad65e576c Mon Sep 17 00:00:00 2001 From: Rogier Schouten Date: Thu, 17 Dec 2015 11:40:40 +0100 Subject: [PATCH 285/474] Add all options to child_process.fork() https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options --- node/node.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node/node.d.ts b/node/node.d.ts index 879b20d894..dfc3cff111 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -907,7 +907,11 @@ declare module "child_process" { export function fork(modulePath: string, args?: string[], options?: { cwd?: string; env?: any; - encoding?: string; + execPath?: string; + execArgv?: string[]; + silent?: boolean; + uid?: number; + gid?: number; }): ChildProcess; export function spawnSync(command: string, args?: string[], options?: { cwd?: string; From 96a1146cdab67999add011ce79611b8544a9dcb2 Mon Sep 17 00:00:00 2001 From: Sven Reglitzki Date: Thu, 17 Dec 2015 12:23:50 +0100 Subject: [PATCH 286/474] Add some tests to sandboxed-module --- sandboxed-module/sandboxed-module-tests.ts | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 sandboxed-module/sandboxed-module-tests.ts diff --git a/sandboxed-module/sandboxed-module-tests.ts b/sandboxed-module/sandboxed-module-tests.ts new file mode 100644 index 0000000000..a2e6ff2c4e --- /dev/null +++ b/sandboxed-module/sandboxed-module-tests.ts @@ -0,0 +1,28 @@ +// Type definitions for sandboxed-module v2.0.3 +// Project: https://github.com/felixge/node-sandboxed-module +// Definitions by: Sven Reglitzki +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +import SandboxedModule = require("sandboxed-module"); + +var sandboxedModule:SandboxedModule = SandboxedModule.load("foo"); +var sandboxedModuleExports:any = SandboxedModule.require("foo"); + +var sandboxedModuleExportsWithOptions:any = SandboxedModule.require("foo", { + requires: { + someDep: {} + }, + globals: { + theAnswer: 42 + }, + locals: { + someLocal: 1 + }, + sourceTransformers: { + identity: (src:string) => src + }, + singleOnly: true, + sourceTransformersSingleOnly: true +}); From 90a746fd3b9f1afb19453ceb3764d7978f3dd14f Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Thu, 17 Dec 2015 16:03:22 +0500 Subject: [PATCH 287/474] lodash: signatures of _.uniq have been changed --- lodash/lodash-tests.ts | 348 ++++++++++++-- lodash/lodash.d.ts | 1011 +++++++++++++++++++++++++++++----------- 2 files changed, 1059 insertions(+), 300 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d661839d54..efdc7ecdcb 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1671,37 +1671,329 @@ module TestUnion { } } -result = _.uniq([1, 2, 1, 3, 1]); -result = _.uniq([1, 1, 2, 2, 3], true); -result = _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function (letter) { - return letter.toLowerCase(); -}); -result = _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function (num) { return this.floor(num); }, Math); -result = <{ x: number; }[]>_.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); +// _.uniq +module TestUniq { + type SampleObject = {a: number; b: string; c: boolean}; -result = _.unique([1, 2, 1, 3, 1]); -result = _.unique([1, 1, 2, 2, 3], true); -result = _.unique(['A', 'b', 'C', 'a', 'B', 'c'], function (letter) { - return letter.toLowerCase(); -}); -result = _.unique([1, 2.5, 3, 1.5, 2, 3.5], function (num) { return this.floor(num); }, Math); -result = <{ x: number; }[]>_.unique([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + let array: SampleObject[]; + let list: _.List; -result = _([1, 2, 1, 3, 1]).uniq().value(); -result = _([1, 1, 2, 2, 3]).uniq(true).value(); -result = _(['A', 'b', 'C', 'a', 'B', 'c']).uniq(function (letter) { - return letter.toLowerCase(); -}).value(); -result = _([1, 2.5, 3, 1.5, 2, 3.5]).uniq(function (num) { return this.floor(num); }, Math).value(); -result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).uniq('x').value(); + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; -result = _([1, 2, 1, 3, 1]).unique().value(); -result = _([1, 1, 2, 2, 3]).unique(true).value(); -result = _(['A', 'b', 'C', 'a', 'B', 'c']).unique(function (letter) { - return letter.toLowerCase(); -}).value(); -result = _([1, 2.5, 3, 1.5, 2, 3.5]).unique(function (num) { return this.floor(num); }, Math).value(); -result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').value(); + { + let result: string[]; + + result = _.uniq('abc'); + result = _.uniq('abc', true); + result = _.uniq('abc', true, stringIterator); + result = _.uniq('abc', true, stringIterator, any); + result = _.uniq('abc', true, stringIterator); + result = _.uniq('abc', true, stringIterator, any); + result = _.uniq('abc', stringIterator); + result = _.uniq('abc', stringIterator, any); + result = _.uniq('abc', stringIterator); + result = _.uniq('abc', stringIterator, any); + } + + { + let result: SampleObject[]; + + result = _.uniq(array); + result = _.uniq(array, true); + result = _.uniq(array, true, listIterator); + result = _.uniq(array, true, listIterator, any); + result = _.uniq(array, true, listIterator); + result = _.uniq(array, true, listIterator, any); + result = _.uniq(array, listIterator); + result = _.uniq(array, listIterator, any); + result = _.uniq(array, listIterator); + result = _.uniq(array, listIterator, any); + result = _.uniq(array, true, 'a'); + result = _.uniq(array, true, 'a', any); + result = _.uniq(array, 'a'); + result = _.uniq(array, 'a', any); + result = _.uniq(array, true, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(array, true, {a: 42}); + result = _.uniq(array, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(array, {a: 42}); + + result = _.uniq(list); + result = _.uniq(list, true); + result = _.uniq(list, true, listIterator); + result = _.uniq(list, true, listIterator, any); + result = _.uniq(list, true, listIterator); + result = _.uniq(list, true, listIterator, any); + result = _.uniq(list, listIterator); + result = _.uniq(list, listIterator, any); + result = _.uniq(list, listIterator); + result = _.uniq(list, listIterator, any); + result = _.uniq(list, true, 'a'); + result = _.uniq(list, true, 'a', any); + result = _.uniq(list, 'a'); + result = _.uniq(list, 'a', any); + result = _.uniq(list, true, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(list, true, {a: 42}); + result = _.uniq(list, {a: 42}); + result = _.uniq<{a: number}, SampleObject>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').uniq(); + result = _('abc').uniq(true); + result = _('abc').uniq(true, stringIterator); + result = _('abc').uniq(true, stringIterator, any); + result = _('abc').uniq(stringIterator); + result = _('abc').uniq(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).uniq(); + result = _(array).uniq(true); + result = _(array).uniq(true, listIterator); + result = _(array).uniq(true, listIterator, any); + result = _(array).uniq(listIterator); + result = _(array).uniq(listIterator, any); + result = _(array).uniq(true, 'a'); + result = _(array).uniq(true, 'a', any); + result = _(array).uniq('a'); + result = _(array).uniq('a', any); + result = _(array).uniq<{a: number}>(true, {a: 42}); + result = _(array).uniq<{a: number}>({a: 42}); + + result = _(list).uniq(); + result = _(list).uniq(true); + result = _(list).uniq(true, listIterator); + result = _(list).uniq(true, listIterator, any); + result = _(list).uniq(true, listIterator); + result = _(list).uniq(true, listIterator, any); + result = _(list).uniq(listIterator); + result = _(list).uniq(listIterator, any); + result = _(list).uniq(listIterator); + result = _(list).uniq(listIterator, any); + result = _(list).uniq(true, 'a'); + result = _(list).uniq(true, 'a', any); + result = _(list).uniq('a'); + result = _(list).uniq('a', any); + result = _(list).uniq(true, {a: 42}); + result = _(list).uniq<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).uniq({a: 42}); + result = _(list).uniq<{a: number}, SampleObject>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().uniq(); + result = _('abc').chain().uniq(true); + result = _('abc').chain().uniq(true, stringIterator); + result = _('abc').chain().uniq(true, stringIterator, any); + result = _('abc').chain().uniq(stringIterator); + result = _('abc').chain().uniq(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().uniq(); + result = _(array).chain().uniq(true); + result = _(array).chain().uniq(true, listIterator); + result = _(array).chain().uniq(true, listIterator, any); + result = _(array).chain().uniq(listIterator); + result = _(array).chain().uniq(listIterator, any); + result = _(array).chain().uniq(true, 'a'); + result = _(array).chain().uniq(true, 'a', any); + result = _(array).chain().uniq('a'); + result = _(array).chain().uniq('a', any); + result = _(array).chain().uniq<{a: number}>(true, {a: 42}); + result = _(array).chain().uniq<{a: number}>({a: 42}); + + result = _(list).chain().uniq(); + result = _(list).chain().uniq(true); + result = _(list).chain().uniq(true, listIterator); + result = _(list).chain().uniq(true, listIterator, any); + result = _(list).chain().uniq(true, listIterator); + result = _(list).chain().uniq(true, listIterator, any); + result = _(list).chain().uniq(listIterator); + result = _(list).chain().uniq(listIterator, any); + result = _(list).chain().uniq(listIterator); + result = _(list).chain().uniq(listIterator, any); + result = _(list).chain().uniq(true, 'a'); + result = _(list).chain().uniq(true, 'a', any); + result = _(list).chain().uniq('a'); + result = _(list).chain().uniq('a', any); + result = _(list).chain().uniq(true, {a: 42}); + result = _(list).chain().uniq<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).chain().uniq({a: 42}); + result = _(list).chain().uniq<{a: number}, SampleObject>({a: 42}); + } +} + +// _.unique +module TestUnique { + type SampleObject = {a: number; b: string; c: boolean}; + + let array: SampleObject[]; + let list: _.List; + + let stringIterator: (value: string, index: number, collection: string) => string; + let listIterator: (value: SampleObject, index: number, collection: _.List) => number; + + { + let result: string[]; + + result = _.unique('abc'); + result = _.unique('abc', true); + result = _.unique('abc', true, stringIterator); + result = _.unique('abc', true, stringIterator, any); + result = _.unique('abc', true, stringIterator); + result = _.unique('abc', true, stringIterator, any); + result = _.unique('abc', stringIterator); + result = _.unique('abc', stringIterator, any); + result = _.unique('abc', stringIterator); + result = _.unique('abc', stringIterator, any); + } + + { + let result: SampleObject[]; + + result = _.unique(array); + result = _.unique(array, true); + result = _.unique(array, true, listIterator); + result = _.unique(array, true, listIterator, any); + result = _.unique(array, true, listIterator); + result = _.unique(array, true, listIterator, any); + result = _.unique(array, listIterator); + result = _.unique(array, listIterator, any); + result = _.unique(array, listIterator); + result = _.unique(array, listIterator, any); + result = _.unique(array, true, 'a'); + result = _.unique(array, true, 'a', any); + result = _.unique(array, 'a'); + result = _.unique(array, 'a', any); + result = _.unique(array, true, {a: 42}); + result = _.unique<{a: number}, SampleObject>(array, true, {a: 42}); + result = _.unique(array, {a: 42}); + result = _.unique<{a: number}, SampleObject>(array, {a: 42}); + + result = _.unique(list); + result = _.unique(list, true); + result = _.unique(list, true, listIterator); + result = _.unique(list, true, listIterator, any); + result = _.unique(list, true, listIterator); + result = _.unique(list, true, listIterator, any); + result = _.unique(list, listIterator); + result = _.unique(list, listIterator, any); + result = _.unique(list, listIterator); + result = _.unique(list, listIterator, any); + result = _.unique(list, true, 'a'); + result = _.unique(list, true, 'a', any); + result = _.unique(list, 'a'); + result = _.unique(list, 'a', any); + result = _.unique(list, true, {a: 42}); + result = _.unique<{a: number}, SampleObject>(list, true, {a: 42}); + result = _.unique(list, {a: 42}); + result = _.unique<{a: number}, SampleObject>(list, {a: 42}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('abc').unique(); + result = _('abc').unique(true); + result = _('abc').unique(true, stringIterator); + result = _('abc').unique(true, stringIterator, any); + result = _('abc').unique(stringIterator); + result = _('abc').unique(stringIterator, any); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).unique(); + result = _(array).unique(true); + result = _(array).unique(true, listIterator); + result = _(array).unique(true, listIterator, any); + result = _(array).unique(listIterator); + result = _(array).unique(listIterator, any); + result = _(array).unique(true, 'a'); + result = _(array).unique(true, 'a', any); + result = _(array).unique('a'); + result = _(array).unique('a', any); + result = _(array).unique<{a: number}>(true, {a: 42}); + result = _(array).unique<{a: number}>({a: 42}); + + result = _(list).unique(); + result = _(list).unique(true); + result = _(list).unique(true, listIterator); + result = _(list).unique(true, listIterator, any); + result = _(list).unique(true, listIterator); + result = _(list).unique(true, listIterator, any); + result = _(list).unique(listIterator); + result = _(list).unique(listIterator, any); + result = _(list).unique(listIterator); + result = _(list).unique(listIterator, any); + result = _(list).unique(true, 'a'); + result = _(list).unique(true, 'a', any); + result = _(list).unique('a'); + result = _(list).unique('a', any); + result = _(list).unique(true, {a: 42}); + result = _(list).unique<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).unique({a: 42}); + result = _(list).unique<{a: number}, SampleObject>({a: 42}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('abc').chain().unique(); + result = _('abc').chain().unique(true); + result = _('abc').chain().unique(true, stringIterator); + result = _('abc').chain().unique(true, stringIterator, any); + result = _('abc').chain().unique(stringIterator); + result = _('abc').chain().unique(stringIterator, any); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().unique(); + result = _(array).chain().unique(true); + result = _(array).chain().unique(true, listIterator); + result = _(array).chain().unique(true, listIterator, any); + result = _(array).chain().unique(listIterator); + result = _(array).chain().unique(listIterator, any); + result = _(array).chain().unique(true, 'a'); + result = _(array).chain().unique(true, 'a', any); + result = _(array).chain().unique('a'); + result = _(array).chain().unique('a', any); + result = _(array).chain().unique<{a: number}>(true, {a: 42}); + result = _(array).chain().unique<{a: number}>({a: 42}); + + result = _(list).chain().unique(); + result = _(list).chain().unique(true); + result = _(list).chain().unique(true, listIterator); + result = _(list).chain().unique(true, listIterator, any); + result = _(list).chain().unique(true, listIterator); + result = _(list).chain().unique(true, listIterator, any); + result = _(list).chain().unique(listIterator); + result = _(list).chain().unique(listIterator, any); + result = _(list).chain().unique(listIterator); + result = _(list).chain().unique(listIterator, any); + result = _(list).chain().unique(true, 'a'); + result = _(list).chain().unique(true, 'a', any); + result = _(list).chain().unique('a'); + result = _(list).chain().unique('a', any); + result = _(list).chain().unique(true, {a: 42}); + result = _(list).chain().unique<{a: number}, SampleObject>(true, {a: 42}); + result = _(list).chain().unique({a: 42}); + result = _(list).chain().unique<{a: number}, SampleObject>({a: 42}); + } +} // _.upzip module TestUnzip { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 4e86afb66b..d53fa00d27 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2837,343 +2837,810 @@ 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; - * (value, index, array). - * - * If a property name is provided for callback the created "_.pluck" style callback will - * return the property value of the given element. - * - * If an object is provided for callback the created "_.where" style callback will return - * true for elements that have the properties of the given object, else false. - * @param array Array to remove duplicates from. - * @param isSorted True if `array` is already sorted, optiona, default = false. - * @param iterator Transform the elements of `array` before comparisons for uniqueness. - * @param context 'this' object in `iterator`, optional. - * @return Copy of `array` where all elements are unique. - **/ - uniq(array: Array, isSorted?: boolean): T[]; - - /** - * @see _.uniq - **/ - uniq(array: List, isSorted?: boolean): T[]; - - /** - * @see _.uniq - **/ - uniq( - array: Array, - isSorted: boolean, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - **/ - uniq( - array: List, - isSorted: boolean, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - **/ - uniq( - array: Array, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - **/ - uniq( - array: List, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - uniq( - array: Array, - isSorted: boolean, - pluckValue: string): T[]; - - /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ + * Creates a duplicate-free version of an array, using SameValueZero for equality comparisons, in which only + * the first occurrence of each element is kept. Providing true for isSorted performs a faster search + * algorithm for sorted arrays. If an iteratee function is provided it’s invoked for each element in the + * array to generate the criterion by which uniqueness is computed. The iteratee is bound to thisArg and + * invoked with three arguments: (value, index, array). + * + * If a property name is provided for iteratee the created _.property style callback returns the property + * value of the given element. + * + * If a value is also provided for thisArg the created _.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. + * + * @alias _.unique + * + * @param array The array to inspect. + * @param isSorted Specify the array is sorted. + * @param iteratee The function invoked per iteration. + * @param thisArg iteratee + * @return Returns the new duplicate-value-free array. + */ uniq( array: List, - isSorted: boolean, - pluckValue: string): T[]; + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - uniq( - array: Array, - pluckValue: string): T[]; + * @see _.uniq + */ + uniq( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ + * @see _.uniq + */ uniq( array: List, - pluckValue: string): T[]; + iteratee?: ListIterator, + thisArg?: any + ): T[]; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( - array: Array, - isSorted: boolean, - whereValue: W): T[]; - - /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( + * @see _.uniq + */ + uniq( array: List, - isSorted: boolean, - whereValue: W): T[]; + iteratee?: ListIterator, + thisArg?: any + ): T[]; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( - array: Array, - whereValue: W): T[]; - - /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( + * @see _.uniq + */ + uniq( array: List, - whereValue: W): T[]; + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; /** - * @see _.uniq - **/ - unique(array: Array, isSorted?: boolean): T[]; - - /** - * @see _.uniq - **/ - unique(array: List, isSorted?: boolean): T[]; - - /** - * @see _.uniq - **/ - unique( - array: Array, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - **/ - unique( + * @see _.uniq + */ + uniq( array: List, - callback: ListIterator, - thisArg?: any): T[]; + iteratee?: string, + thisArg?: any + ): T[]; /** - * @see _.uniq - **/ - unique( - array: Array, - isSorted: boolean, - callback: ListIterator, - thisArg?: any): T[]; - - /** - * @see _.uniq - **/ - unique( + * @see _.uniq + */ + uniq( array: List, - isSorted: boolean, - callback: ListIterator, - thisArg?: any): T[]; + isSorted?: boolean, + iteratee?: Object + ): T[]; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - unique( - array: Array, - isSorted: boolean, - pluckValue: string): T[]; - - /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - unique( + * @see _.uniq + */ + uniq( array: List, - isSorted: boolean, - pluckValue: string): T[]; + isSorted?: boolean, + iteratee?: TWhere + ): T[]; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - unique( - array: Array, - pluckValue: string): T[]; - - /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - unique( + * @see _.uniq + */ + uniq( array: List, - pluckValue: string): T[]; + iteratee?: Object + ): T[]; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( - array: Array, - whereValue?: W): T[]; - - /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( + * @see _.uniq + */ + uniq( array: List, - whereValue?: W): T[]; + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( - array: Array, - isSorted: boolean, - whereValue?: W): T[]; - - /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( - array: List, - isSorted: boolean, - whereValue?: W): T[]; + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; } interface LoDashImplicitArrayWrapper { /** - * @see _.uniq - **/ - uniq(isSorted?: boolean): LoDashImplicitArrayWrapper; - - /** - * @see _.uniq - **/ + * @see _.uniq + */ uniq( - isSorted: boolean, - callback: ListIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - **/ + * @see _.uniq + */ uniq( - callback: ListIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ + * @see _.uniq + */ uniq( - isSorted: boolean, - pluckValue: string): LoDashImplicitArrayWrapper; + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - uniq(pluckValue: string): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( - isSorted: boolean, - whereValue: W): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - uniq( - whereValue: W): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - **/ - unique(isSorted?: boolean): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - **/ + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + uniq( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + //_.unique + interface LoDashStatic { + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: ListIterator, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: string, + thisArg?: any + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + isSorted?: boolean, + iteratee?: TWhere + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: Object + ): T[]; + + /** + * @see _.uniq + */ + unique( + array: List, + iteratee?: TWhere + ): T[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.uniq + */ unique( - isSorted: boolean, - callback: ListIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - **/ + * @see _.uniq + */ unique( - callback: ListIterator, - thisArg?: any): LoDashImplicitArrayWrapper; + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ unique( - isSorted: boolean, - pluckValue: string): LoDashImplicitArrayWrapper; + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param pluckValue _.pluck style callback - **/ - unique(pluckValue: string): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( - isSorted: boolean, - whereValue: W): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; /** - * @see _.uniq - * @param whereValue _.where style callback - **/ - unique( - whereValue: W): LoDashImplicitArrayWrapper; + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashImplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: ListIterator, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: string, + thisArg?: any + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + isSorted?: boolean, + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: Object + ): LoDashExplicitArrayWrapper; + + /** + * @see _.uniq + */ + unique( + iteratee?: TWhere + ): LoDashExplicitArrayWrapper; } //_.unzip From 331d30c38ced4d10efb77d67f3afbdab438411ac Mon Sep 17 00:00:00 2001 From: John Grimsey Date: Thu, 17 Dec 2015 11:42:08 +0000 Subject: [PATCH 288/474] Return type fix --- email-addresses/email-addresses.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/email-addresses/email-addresses.d.ts b/email-addresses/email-addresses.d.ts index a0c4ffb2c3..c8cd74d1a0 100644 --- a/email-addresses/email-addresses.d.ts +++ b/email-addresses/email-addresses.d.ts @@ -4,6 +4,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "email-addresses" { - function parseOneAddress(opts: any): Object; - function parseAddressList(opts: any): Object; + function parseOneAddress(opts: any): any; + function parseAddressList(opts: any): any; } From 4f245aafeb6c138804f25e20b03e10f8f9754038 Mon Sep 17 00:00:00 2001 From: Marcel Ernst Date: Thu, 17 Dec 2015 15:54:50 +0100 Subject: [PATCH 289/474] Fix type for DatePickerProps formatDate --- material-ui/material-ui.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index 2c59d5416b..4b46cee7b8 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -319,7 +319,7 @@ declare namespace __MaterialUI { interface DatePickerProps extends React.Props { autoOk?: boolean; defaultDate?: Date; - formatDate?: string; + formatDate?: (date:Date) => string; hintText?: string; floatingLabelText?: string; hideToolbarYearChange?: boolean; From 76352a94c6e4a51e7f382aebaf0b63d9ac06ae12 Mon Sep 17 00:00:00 2001 From: cither1 Date: Fri, 18 Dec 2015 00:14:39 +0900 Subject: [PATCH 290/474] Modified a method name. --- onsenui/onsenui-tests.ts | 2 +- onsenui/onsenui.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/onsenui/onsenui-tests.ts b/onsenui/onsenui-tests.ts index 58b72da6ea..f0918dc624 100644 --- a/onsenui/onsenui-tests.ts +++ b/onsenui/onsenui-tests.ts @@ -191,7 +191,7 @@ function onsTabbar(tabBar: TabbarView): void { keepPage: true }; tabBar.setActiveTab(2, options); - var activeTab: number = tabBar.getActiveTab(); + var activeTab: number = tabBar.getActiveTabIndex(); tabBar.loadPage('myPage.html'); tabBar.on('eventName', null); tabBar.once('eventName', null); diff --git a/onsenui/onsenui.d.ts b/onsenui/onsenui.d.ts index 287c8e2f51..9eed8c020e 100644 --- a/onsenui/onsenui.d.ts +++ b/onsenui/onsenui.d.ts @@ -634,7 +634,7 @@ interface TabbarView { * @return {Number} The index of the currently active tab * @description Returns tab index on current active tab. If active tab is not found, returns -1 */ - getActiveTab(): number; + getActiveTabIndex(): number; /** * @param {String} url Page URL. Can be either an HTML document or an <ons-template> * @description Displays a new page without changing the active index From 34034aaf69c018354769b0cf68d02f51d580920f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20B=C3=A9arez?= Date: Thu, 17 Dec 2015 18:24:38 +0100 Subject: [PATCH 291/474] Add beforeClose option and isOpened() function --- drop/drop.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drop/drop.d.ts b/drop/drop.d.ts index a48cb8fb3c..1b994c9a1e 100644 --- a/drop/drop.d.ts +++ b/drop/drop.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Drop v0.5.7 +// Type definitions for Drop v1.3.0 // Project: http://github.hubspot.com/drop/ // Definitions by: Adi Dahiya // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -26,6 +26,7 @@ declare module drop { constrainToWindow?: boolean; constrainToScrollParent?: boolean; remove?: boolean; + beforeClose?: () => boolean; tetherOptions?: tether.ITetherOptions; } @@ -37,6 +38,7 @@ declare module drop { close(): void; remove(): void; toggle(): void; + isOpened(): boolean; position(): void; destroy(): void; /* From f83d1a72867c72e1a1b38f11727fed41cb11222e Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 17 Dec 2015 10:25:55 -0800 Subject: [PATCH 292/474] Fix casing for 'mkdir', return type of 'path', optionality of 'track' parameter. --- temp/temp-tests.ts | 21 +++++++++++++++------ temp/temp.d.ts | 14 +++++++------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/temp/temp-tests.ts b/temp/temp-tests.ts index eddf870a4f..be25d357bb 100644 --- a/temp/temp-tests.ts +++ b/temp/temp-tests.ts @@ -11,6 +11,8 @@ function testCleanup() { } else { const { files, dirs } = result; + files.toPrecision(4); + files.toPrecision(4); } }); } @@ -22,16 +24,22 @@ function testCleanupSync() { } else { const { dirs, files } = cleanupResult + dirs.toPrecision(4); + files.toPrecision(4); } } function testOpen() { temp.open({ dir: "tempDir", prefix: "pref", suffix: "suff" }, (err, result) => { const { path, fd } = result; + path.length; + fd.toPrecision(5); }); temp.open("strPrefix", (err, result) => { const { path, fd } = result; + path.length; + fd.toPrecision(5); }); } @@ -45,23 +53,24 @@ function testCreateWriteStream() { stream.write("data"); } -function testMkDir() { - temp.mkDir("prefix", (err, dirPath) => { +function testMkdir() { + temp.mkdir("prefix", (err, dirPath) => { dirPath.length; }); } -function testMkDirSync() { - const result = temp.mkDirSync("prefix"); +function testMkdirSync() { + const result = temp.mkdirSync("prefix"); result.length; } function testPath() { - temp.path({ suffix: "justSuffix" }, "defaultPrefix"); + const p = temp.path({ suffix: "justSuffix" }, "defaultPrefix"); + p.length; } function testTrack() { - const tempChained = temp.track(true).track(false); + const tempChained = temp.track().track(true).track(false); tempChained.dir; tempChained.cleanupSync(); } \ No newline at end of file diff --git a/temp/temp.d.ts b/temp/temp.d.ts index 3d37bf0c5b..7cd51d2be5 100644 --- a/temp/temp.d.ts +++ b/temp/temp.d.ts @@ -17,13 +17,13 @@ declare module "temp" { export var dir: string; - export function track(value: boolean): typeof temp; + export function track(value?: boolean): typeof temp; - export function mkDir(affixes: string, callback?: (err: any, dirPath: string) => void): void; - export function mkDir(affixes: AffixOptions, callback?: (err: any, dirPath: string) => void): void; + export function mkdir(affixes: string, callback?: (err: any, dirPath: string) => void): void; + export function mkdir(affixes: AffixOptions, callback?: (err: any, dirPath: string) => void): void; - export function mkDirSync(affixes: string): string; - export function mkDirSync(affixes: AffixOptions): string; + export function mkdirSync(affixes: string): string; + export function mkdirSync(affixes: AffixOptions): string; export function open(affixes: string, callback?: (err: any, result: {path: string, fd: number}) => void): void; export function open(affixes: AffixOptions, callback?: (err: any, result: {path: string, fd: number}) => void): void; @@ -31,8 +31,8 @@ declare module "temp" { export function openSync(affixes: string): { path: string, fd: number }; export function openSync(affixes: AffixOptions): { path: string, fd: number }; - export function path(affixes: string, defaultPrefix: string): void; - export function path(affixes: AffixOptions, defaultPrefix: string): void; + export function path(affixes: string, defaultPrefix: string): string; + export function path(affixes: AffixOptions, defaultPrefix: string): string; export function cleanup(callback?: (result: boolean | {files: number, dirs?: number}) => void): void; From 5b31421af0081615210b2fda42582c933b484733 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Thu, 17 Dec 2015 20:17:01 +0100 Subject: [PATCH 293/474] Add create-error.js, see https://github.com/tgriesser/create-error --- create-error/create-error-tests.ts | 149 +++++++++++++++++++++++++++++ create-error/create-error.d.ts | 21 ++++ 2 files changed, 170 insertions(+) create mode 100644 create-error/create-error-tests.ts create mode 100644 create-error/create-error.d.ts diff --git a/create-error/create-error-tests.ts b/create-error/create-error-tests.ts new file mode 100644 index 0000000000..76b66adf27 --- /dev/null +++ b/create-error/create-error-tests.ts @@ -0,0 +1,149 @@ +/// +/// +/// + +import * as createError from 'create-error'; +import * as assert from 'assert'; + +// Example taken from https://github.com/tgriesser/create-error/blob/0.3.1/README.md#use + +interface MyCustomError extends createError.Error { + messages: string[]; + someVal: string; +} +var MyCustomError = createError('MyCustomError'); + +interface SubCustomError extends MyCustomError { +} +var SubCustomError = createError(MyCustomError, 'CoolSubError', {messages: []}); + +var sub = new SubCustomError('My Message', {someVal: 'value'}); + +sub instanceof SubCustomError // true +sub instanceof MyCustomError // true +sub instanceof Error // true + +assert.deepEqual(sub.messages, []) // true +assert.equal(sub.someVal, 'value') // true + + +// Taken and adapted from https://github.com/tgriesser/create-error/blob/0.3.1/test/index.js + +var equal = assert.equal; +var deepEqual = assert.deepEqual; + +describe('create-error', function() { + + describe('error creation', function() { + + it('should create a new error', function() { + var TestingError = createError('TestingError'); + var a = new TestingError('msgA'); + var b = new TestingError('msgB'); + equal((a instanceof TestingError), true); + equal((a instanceof Error), true); + equal(a.message, 'msgA'); + equal(b.message, 'msgB'); + equal((a.stack.length > 0), true); + }); + + it('should attach properties in the second argument', function() { + interface TestingError extends createError.Error { + anArray: string[]; + } + var TestingError = createError('TestingError', {anArray: []}); + var a = new TestingError('Test the array'); + deepEqual(a.anArray, []); + }); + + it('should give the name "CustomError" if the name is omitted', function() { + var TestingError = createError(); + var a = new TestingError("msg"); + equal(a.name, 'CustomError'); + }); + + it('should not reference the same property in subsequent errors', function() { + interface TestingError extends createError.Error { + anArray: string[]; + } + var TestingError = createError('TestingError', {anArray: []}); + var a = new TestingError('Test the array'); + a.anArray.push('a'); + var b = new TestingError(''); + deepEqual(b.anArray, []); + }); + + it('should allow for empty objects on the cloned hash', function() { + interface TestingError extends createError.Error { + anEmptyObj: Object; + } + var TestingError = createError('TestingError', {anEmptyObj: Object.create(null)}); + var a = new TestingError('Test the array'); + deepEqual(a.anEmptyObj, Object.create(null)); + }); + + it('attaches attrs in the second arg of the error ctor, #3', function() { + interface RequestError extends createError.Error { + status: number; + } + var RequestError = createError('RequestError', {status: 400}); + var reqErr = new RequestError('404 Error', {status: 404}); + equal(reqErr.status, 404); + equal(reqErr.message, '404 Error'); + equal(reqErr.name, 'RequestError'); + }); + + }); + + describe('subclassing errors', function() { + + it('takes an object in the first argument', function() { + var TestingError = createError('TestingError'); + var SubTestingError = createError(TestingError, 'SubTestingError'); + var x = new SubTestingError(); + equal((x instanceof SubTestingError), true); + equal((x instanceof TestingError), true); + equal((x instanceof Error), true); + }); + + it('attaches the properties appropriately.', function() { + interface SubTestingError extends createError.Error { + key: string[]; + } + var TestingError = createError('TestingError'); + var SubTestingError = createError(TestingError, 'SubTestingError', {key: []}); + var x = new SubTestingError(); + deepEqual(x.key, []); + }); + + it('allows for a default message, #4', function() { + var TestingError = createError('TestingError', {message: 'Error with testing'}); + var x = new TestingError(); + equal(x.message, 'Error with testing'); + }); + + }); + + describe('invalid values sent to the second argument', function() { + + it('should ignore falsy values', function() { + var TestingError = createError('TestingError', ''); + var TestingError2 = createError('TestingError', null); + var TestingError3 = createError('TestingError', void 0); + var a = new TestingError('Test the array'); + var b = new TestingError2('Test the array'); + var c = new TestingError3('Test the array'); + }); + + it('should ignore arrays', function() { + interface TestingError extends createError.Error { + anArray: string[]; + } + var TestingError = createError('TestingError', [{anArray: []}]); + var a = new TestingError('Test the array'); + equal(a.anArray, void 0); + }); + + }); + +}); diff --git a/create-error/create-error.d.ts b/create-error/create-error.d.ts new file mode 100644 index 0000000000..5db02e474a --- /dev/null +++ b/create-error/create-error.d.ts @@ -0,0 +1,21 @@ +// Type definitions for create-error.js 0.3.1 +// Project: https://github.com/tgriesser/create-error +// Definitions by: Tanguy Krotoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'create-error' { + // FIXME See Global type references https://github.com/Microsoft/TypeScript/issues/983 + type Err = Error; + + namespace createError { + interface Error extends Err { + new (message?: string, obj?: any): T; + } + } + + function createError(): createError.Error; + function createError>(name: string, properties?: any): T; + function createError>(Target: createError.Error, name?: string, properties?: any): T; + + export = createError; +} From f05f79fd5836003f29930c96f2a3c6e77bfb81df Mon Sep 17 00:00:00 2001 From: Arthur Cinader Date: Thu, 17 Dec 2015 10:34:51 -0800 Subject: [PATCH 294/474] Add remove() to ionic.modal.IonicModalController Per api: http://ionicframework.com/docs/api/controller/ionicModal/ note the note in the ionic source code: "Be sure to call [remove()](#remove) when you are done with each modal to clean it up and avoid memory leaks." https://github.com/driftyco/ionic/blob/af1bfef327e685585244c6051c4d38b98aa6c62a/js/angular/service/modal.js#L87 --- ionic/ionic-tests.ts | 1 + ionic/ionic.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/ionic/ionic-tests.ts b/ionic/ionic-tests.ts index 9c5cfdad0c..bad5f9d9f1 100644 --- a/ionic/ionic-tests.ts +++ b/ionic/ionic-tests.ts @@ -149,6 +149,7 @@ class IonicTestController { ionicModalController.initialize(modalOptions); ionicModalController.show().then(() => console.log("shown modal")) ionicModalController.hide().then(() => console.log("hid modal")) + ionicModalController.remove().then(() => console.log("removed modal")) var isShown: boolean = ionicModalController.isShown(); this.$ionicModal.fromTemplateUrl("templateUrl", modalOptions) diff --git a/ionic/ionic.d.ts b/ionic/ionic.d.ts index ce097a2265..a3781f26d0 100644 --- a/ionic/ionic.d.ts +++ b/ionic/ionic.d.ts @@ -174,6 +174,7 @@ declare module ionic { initialize(options: IonicModalOptions): void; show(): ng.IPromise; hide(): ng.IPromise; + remove(): ng.IPromise; isShown(): boolean; } From 742aa93d860391a1cfe03a2338c3dd45f5dd2a26 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 15 Dec 2015 00:31:05 +0500 Subject: [PATCH 295/474] node: signatures of module "events" have been changed --- node/node-tests.ts | 48 ++++++++++++++++++++++++++++++++++++++++++++++ node/node.d.ts | 14 ++++++++++---- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index aa0f55bb69..741dd3f481 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -32,6 +32,54 @@ assert.doesNotThrow(() => { if (false) { throw "a hammer at your face"; } }, undefined, "What the...*crunch*"); +//////////////////////////////////////////////////// +/// Events tests : http://nodejs.org/api/events.html +//////////////////////////////////////////////////// + +module events_tests { + let emitter: events.EventEmitter; + let event: string; + let listener: Function; + let any: any; + + { + let result: events.EventEmitter; + + result = emitter.addListener(event, listener); + result = emitter.on(event, listener); + result = emitter.once(event, listener); + result = emitter.removeListener(event, listener); + result = emitter.removeAllListeners(); + result = emitter.removeAllListeners(event); + result = emitter.setMaxListeners(42); + } + + { + let result: number; + + result = events.EventEmitter.defaultMaxListeners; + result = events.EventEmitter.listenerCount(emitter, event); // deprecated + + result = emitter.getMaxListeners(); + result = emitter.listenerCount(event); + } + + { + let result: Function[]; + + result = emitter.listeners(event); + } + + { + let result: boolean; + + result = emitter.emit(event); + result = emitter.emit(event, any); + result = emitter.emit(event, any, any); + result = emitter.emit(event, any, any, any); + } +} + //////////////////////////////////////////////////// /// File system tests : http://nodejs.org/api/fs.html //////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index 879b20d894..1d5722496e 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -173,9 +173,11 @@ declare module NodeJS { once(event: string, listener: Function): EventEmitter; removeListener(event: string, listener: Function): EventEmitter; removeAllListeners(event?: string): EventEmitter; - setMaxListeners(n: number): void; + setMaxListeners(n: number): EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; } export interface ReadableStream extends EventEmitter { @@ -423,17 +425,21 @@ declare module "querystring" { declare module "events" { export class EventEmitter implements NodeJS.EventEmitter { - static listenerCount(emitter: EventEmitter, event: string): number; + static EventEmitter: EventEmitter; + static listenerCount(emitter: EventEmitter, event: string): number; // deprecated + static defaultMaxListeners: number; addListener(event: string, listener: Function): EventEmitter; on(event: string, listener: Function): EventEmitter; once(event: string, listener: Function): EventEmitter; removeListener(event: string, listener: Function): EventEmitter; removeAllListeners(event?: string): EventEmitter; - setMaxListeners(n: number): void; + setMaxListeners(n: number): EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; - } + listenerCount(type: string): number; + } } declare module "http" { From f8b59970de238982359ca96a0f7a548dd94b0c74 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 15 Dec 2015 02:25:57 +0500 Subject: [PATCH 296/474] node: implementations of the interface "EventEmitter" in other modules have been fixed --- eventemitter3/eventemitter3-tests.ts | 5 ++++- github-electron/github-electron.d.ts | 28 +++++++++++++++++++------- imap/imap.d.ts | 4 +++- jake/jake.d.ts | 4 +++- mailparser/mailparser.d.ts | 4 +++- pty.js/pty.js.d.ts | 4 +++- steam/steam.d.ts | 4 +++- stylus/stylus.d.ts | 4 +++- yeoman-generator/yeoman-generator.d.ts | 4 +++- 9 files changed, 46 insertions(+), 15 deletions(-) diff --git a/eventemitter3/eventemitter3-tests.ts b/eventemitter3/eventemitter3-tests.ts index 4fa378bc20..49ae0a24df 100644 --- a/eventemitter3/eventemitter3-tests.ts +++ b/eventemitter3/eventemitter3-tests.ts @@ -35,7 +35,10 @@ class EventEmitterTest { constructor() { this.v = new EventEmitter(); this.v = new EventEmitter3ImportedAsES6Module(); - var n: NodeJS.EventEmitter = this.v; + + // Some methods are missing or incompatible with current implementation (v4.2.x) of NodeJS.EventEmitter + // (e.g. getMaxListenters or listeners) + // var n: NodeJS.EventEmitter = this.v; } listeners() { diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index a9b83b7dc1..ae59a75385 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -70,9 +70,11 @@ declare module GitHubElectron { once(event: string, listener: Function): Screen; removeListener(event: string, listener: Function): Screen; removeAllListeners(event?: string): Screen; - setMaxListeners(n: number): void; + setMaxListeners(n: number): Screen; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * @returns The current absolute position of the mouse pointer. */ @@ -108,9 +110,11 @@ declare module GitHubElectron { once(event: string, listener: Function): WebContents; removeListener(event: string, listener: Function): WebContents; removeAllListeners(event?: string): WebContents; - setMaxListeners(n: number): void; + setMaxListeners(n: number): WebContents; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; constructor(options?: BrowserWindowOptions); /** * @returns All opened browser windows. @@ -522,9 +526,11 @@ declare module GitHubElectron { once(event: string, listener: Function): WebContents; removeListener(event: string, listener: Function): WebContents; removeAllListeners(event?: string): WebContents; - setMaxListeners(n: number): void; + setMaxListeners(n: number): WebContents; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * Loads the url in the window. * @param url Must contain the protocol prefix (e.g., the http:// or file://). @@ -930,9 +936,11 @@ declare module GitHubElectron { once(event: string, listener: Function): App; removeListener(event: string, listener: Function): App; removeAllListeners(event?: string): App; - setMaxListeners(n: number): void; + setMaxListeners(n: number): App; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * 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 @@ -1122,9 +1130,11 @@ declare module GitHubElectron { once(event: string, listener: Function): AutoUpdater; removeListener(event: string, listener: Function): AutoUpdater; removeAllListeners(event?: string): AutoUpdater; - setMaxListeners(n: number): void; + setMaxListeners(n: number): AutoUpdater; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * Set the url and initialize the auto updater. * The url cannot be changed once it is set. @@ -1232,9 +1242,11 @@ declare module GitHubElectron { once(event: string, listener: Function): Tray; removeListener(event: string, listener: Function): Tray; removeAllListeners(event?: string): Tray; - setMaxListeners(n: number): void; + setMaxListeners(n: number): Tray; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * Creates a new tray icon associated with the image. */ @@ -1426,9 +1438,11 @@ declare module GitHubElectron { once(event: string, listener: Function): IpcRenderer; removeListener(event: string, listener: Function): IpcRenderer; removeAllListeners(event?: string): IpcRenderer; - setMaxListeners(n: number): void; + setMaxListeners(n: number): IpcRenderer; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; /** * 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. diff --git a/imap/imap.d.ts b/imap/imap.d.ts index 105e64c85d..4b88279aef 100644 --- a/imap/imap.d.ts +++ b/imap/imap.d.ts @@ -246,9 +246,11 @@ declare module IMAP { once(event: string, listener: Function): this; removeListener(event: string, listener: Function): this; removeAllListeners(event?: string): this; - setMaxListeners(n: number): void; + setMaxListeners(n: number): this; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; // from MessageFunctions /** Searches the currently open mailbox for messages using given criteria. criteria is a list describing what you want to find. For criteria types that require arguments, use an array instead of just the string criteria type name (e.g. ['FROM', 'foo@bar.com']). Prefix criteria types with an "!" to negate. */ diff --git a/jake/jake.d.ts b/jake/jake.d.ts index 95614374cc..84d5c50790 100644 --- a/jake/jake.d.ts +++ b/jake/jake.d.ts @@ -231,9 +231,11 @@ declare module jake{ once(event: string, listener: Function): NodeJS.EventEmitter; removeListener(event: string, listener: Function): NodeJS.EventEmitter; removeAllListeners(event?: string): NodeJS.EventEmitter; - setMaxListeners(n: number): void; + setMaxListeners(n: number): NodeJS.EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; value: any; } diff --git a/mailparser/mailparser.d.ts b/mailparser/mailparser.d.ts index 9e67cc78a9..b45ce05d97 100644 --- a/mailparser/mailparser.d.ts +++ b/mailparser/mailparser.d.ts @@ -78,9 +78,11 @@ declare module 'mailparser' { once(event: string, listener: Function): EventEmitter; removeListener(event: string, listener: Function): EventEmitter; removeAllListeners(event?: string): EventEmitter; - setMaxListeners(n: number): void; + setMaxListeners(n: number): EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; } } diff --git a/pty.js/pty.js.d.ts b/pty.js/pty.js.d.ts index 937dff0c05..ab874a574c 100644 --- a/pty.js/pty.js.d.ts +++ b/pty.js/pty.js.d.ts @@ -85,9 +85,11 @@ declare module 'pty.js' { 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; + setMaxListeners(n: number): NodeJS.EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; } /** diff --git a/steam/steam.d.ts b/steam/steam.d.ts index 3f31aef3f1..5f97735129 100644 --- a/steam/steam.d.ts +++ b/steam/steam.d.ts @@ -52,9 +52,11 @@ declare module Steam { once(event: string, listener: Function): NodeJS.EventEmitter; removeListener(event: string, listener: Function): NodeJS.EventEmitter; removeAllListeners(event?: string): NodeJS.EventEmitter; - setMaxListeners(n: number): void; + setMaxListeners(n: number): NodeJS.EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; } } diff --git a/stylus/stylus.d.ts b/stylus/stylus.d.ts index 5809570b90..b0c8db62f0 100644 --- a/stylus/stylus.d.ts +++ b/stylus/stylus.d.ts @@ -698,9 +698,11 @@ declare module Stylus { once(event: string, listener: Function): Renderer; removeListener(event: string, listener: Function): Renderer; removeAllListeners(event?: string): Renderer; - setMaxListeners(n: number): void; + setMaxListeners(n: number): Renderer; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; //#endregion } diff --git a/yeoman-generator/yeoman-generator.d.ts b/yeoman-generator/yeoman-generator.d.ts index 4ccd98e44a..7604509528 100644 --- a/yeoman-generator/yeoman-generator.d.ts +++ b/yeoman-generator/yeoman-generator.d.ts @@ -42,9 +42,11 @@ declare module yo { once(event: string, listener: Function): NodeJS.EventEmitter; removeListener(event: string, listener: Function): NodeJS.EventEmitter; removeAllListeners(event?: string): NodeJS.EventEmitter; - setMaxListeners(n: number): void; + setMaxListeners(n: number): NodeJS.EventEmitter; + getMaxListeners(): number; listeners(event: string): Function[]; emit(event: string, ...args: any[]): boolean; + listenerCount(type: string): number; async(): any; prompt(opt?:IPromptOptions, callback?:(answers:any)=>void) :void; From a78ed230cdd65f906696480288b7350ffdb1332e Mon Sep 17 00:00:00 2001 From: patrick-mackay Date: Thu, 17 Dec 2015 20:04:14 -0300 Subject: [PATCH 297/474] New definition for ngWYSIWYG Interface definitions for an AngularJS wysiwyg component, developed by https://github.com/psergus. I'm not sure what kind of tests can be created for interface definitions. Let me know if more is needed. --- ngwysiwyg/ngwysiwyg-tests.ts | 16 ++++++++++++++++ ngwysiwyg/ngwysiwyg.d.ts | 14 ++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 ngwysiwyg/ngwysiwyg-tests.ts create mode 100644 ngwysiwyg/ngwysiwyg.d.ts diff --git a/ngwysiwyg/ngwysiwyg-tests.ts b/ngwysiwyg/ngwysiwyg-tests.ts new file mode 100644 index 0000000000..92f33c87f7 --- /dev/null +++ b/ngwysiwyg/ngwysiwyg-tests.ts @@ -0,0 +1,16 @@ +/// + +//import ngWYSIWYG = require("ngWYSIWYG"); + +var options: ngWYSIWYGConfig = { + sanitize: false, + toolbar: [ + { name: "basicStyling", items: ["bold", "italic", "underline", "strikethrough", "subscript", "superscript", "-", "leftAlign", "centerAlign", "rightAlign", "blockJustify", "-"] }, + { name: "paragraph", items: ["orderedList", "unorderedList", "outdent", "indent", "-"] }, + { name: "doers", items: ["removeFormatting", "undo", "redo", "-"] }, + { name: "colors", items: ["fontColor", "backgroundColor", "-"] }, + { name: "links", items: ["image", "hr", "symbols", "link", "unlink", "-"] }, + { name: "tools", items: ["print", "-"] }, + { name: "styling", items: ["font", "size", "format"] }, + ] +}; diff --git a/ngwysiwyg/ngwysiwyg.d.ts b/ngwysiwyg/ngwysiwyg.d.ts new file mode 100644 index 0000000000..0289df60e2 --- /dev/null +++ b/ngwysiwyg/ngwysiwyg.d.ts @@ -0,0 +1,14 @@ +// Type definitions for Marked +// Project: https://github.com/psergus/ngWYSIWYG +// Definitions by: Patrick Mac Kay +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface ngWYSIWYGToolbar { + name: string; + items: string[]; +} + +interface ngWYSIWYGConfig { + sanitize: boolean; + toolbar: ngWYSIWYGToolbar[] +} From 7ca98f443216e1de7fca8d49f2602e1b6b7affbb Mon Sep 17 00:00:00 2001 From: patrick-mackay Date: Thu, 17 Dec 2015 20:36:32 -0300 Subject: [PATCH 298/474] Organization and minor fix Added a module to organize the interfaces. Fix a problem with an optional parameter. Previously was marked as required. --- ngwysiwyg/ngwysiwyg-tests.ts | 6 +++++- ngwysiwyg/ngwysiwyg.d.ts | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ngwysiwyg/ngwysiwyg-tests.ts b/ngwysiwyg/ngwysiwyg-tests.ts index 92f33c87f7..c779e918ea 100644 --- a/ngwysiwyg/ngwysiwyg-tests.ts +++ b/ngwysiwyg/ngwysiwyg-tests.ts @@ -2,7 +2,7 @@ //import ngWYSIWYG = require("ngWYSIWYG"); -var options: ngWYSIWYGConfig = { +var complete: ngWYSIWYG.Config = { sanitize: false, toolbar: [ { name: "basicStyling", items: ["bold", "italic", "underline", "strikethrough", "subscript", "superscript", "-", "leftAlign", "centerAlign", "rightAlign", "blockJustify", "-"] }, @@ -14,3 +14,7 @@ var options: ngWYSIWYGConfig = { { name: "styling", items: ["font", "size", "format"] }, ] }; + +var partial: ngWYSIWYG.Config = { + sanitize: false +}; diff --git a/ngwysiwyg/ngwysiwyg.d.ts b/ngwysiwyg/ngwysiwyg.d.ts index 0289df60e2..9f5ba18ca8 100644 --- a/ngwysiwyg/ngwysiwyg.d.ts +++ b/ngwysiwyg/ngwysiwyg.d.ts @@ -3,12 +3,14 @@ // Definitions by: Patrick Mac Kay // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface ngWYSIWYGToolbar { - name: string; - items: string[]; -} +declare module ngWYSIWYG { + export interface Toolbar { + name: string; + items: string[]; + } -interface ngWYSIWYGConfig { - sanitize: boolean; - toolbar: ngWYSIWYGToolbar[] -} + export interface Config { + sanitize: boolean; + toolbar?: Toolbar[]; + } +} \ No newline at end of file From d2dd0dbfc70f5bd50aab635156620b3a2578a48d Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 18 Dec 2015 05:09:35 +0100 Subject: [PATCH 299/474] Improve jasmine.d.ts - Remove toContainHtml() and toContainText(): they are not part of Jasmine API - Avoid the use of any for toMatch(), toBeLessThan(), toBeGreaterThan(), toBeCloseTo() and toThrowError() --- jasmine-jquery/jasmine-jquery.d.ts | 8 ++++---- jasmine/jasmine.d.ts | 13 ++++++------- knockout/tests/jasmine.extensions.d.ts | 10 ++++++++++ .../tests/knockout-templatingBehaviors-tests.ts | 1 + 4 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 knockout/tests/jasmine.extensions.d.ts diff --git a/jasmine-jquery/jasmine-jquery.d.ts b/jasmine-jquery/jasmine-jquery.d.ts index 903e3f7e29..0e1f2b82b1 100644 --- a/jasmine-jquery/jasmine-jquery.d.ts +++ b/jasmine-jquery/jasmine-jquery.d.ts @@ -195,8 +195,8 @@ declare module jasmine { * // returns true * expect($('

    header

    ')).toContainHtml('
      ') */ - //toContainHtml(html: string): boolean; - + toContainHtml(html: string): boolean; + /** * Check if DOM element has the given Text. * @param text Accepts a string or regular expression @@ -213,8 +213,8 @@ declare module jasmine { * // returns true * expect($('

        header

        ')).toContainText('header') */ - //toContainText(text: string): boolean; - + 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. diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index ed85914884..46a1937f43 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -281,7 +281,7 @@ declare module jasmine { toBe(expected: any, expectationFailOutput?: any): boolean; toEqual(expected: any, expectationFailOutput?: any): boolean; - toMatch(expected: any, expectationFailOutput?: any): boolean; + toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean; toBeDefined(expectationFailOutput?: any): boolean; toBeUndefined(expectationFailOutput?: any): boolean; toBeNull(expectationFailOutput?: any): boolean; @@ -291,13 +291,12 @@ declare module jasmine { toHaveBeenCalled(): boolean; toHaveBeenCalledWith(...params: any[]): boolean; toContain(expected: any, expectationFailOutput?: any): boolean; - toBeLessThan(expected: any, expectationFailOutput?: any): boolean; - toBeGreaterThan(expected: any, expectationFailOutput?: any): boolean; - toBeCloseTo(expected: any, precision: any, expectationFailOutput?: any): boolean; - toContainHtml(expected: string): boolean; - toContainText(expected: string): boolean; + toBeLessThan(expected: number, expectationFailOutput?: any): boolean; + toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean; + toBeCloseTo(expected: number, precision: any, expectationFailOutput?: any): boolean; toThrow(expected?: any): boolean; - toThrowError(expected?: any, message?: string): boolean; + toThrowError(message?: string | RegExp): boolean; + toThrowError(expected?: Error, message?: string | RegExp): boolean; not: Matchers; Any: Any; diff --git a/knockout/tests/jasmine.extensions.d.ts b/knockout/tests/jasmine.extensions.d.ts new file mode 100644 index 0000000000..c3b12213f0 --- /dev/null +++ b/knockout/tests/jasmine.extensions.d.ts @@ -0,0 +1,10 @@ +// Knockout specs depend on custom Jasmine matchers +// See https://github.com/knockout/knockout/blob/v3.4.0/spec/lib/jasmine.extensions.js +// FYI jasmine-jquery.d.ts (https://github.com/velesin/jasmine-jquery) also defines toContainHtml() and toContainText() + +declare module jasmine { + interface Matchers { + toContainHtml(expected: string): boolean; + toContainText(expected: string): boolean; + } +} diff --git a/knockout/tests/knockout-templatingBehaviors-tests.ts b/knockout/tests/knockout-templatingBehaviors-tests.ts index 50ec275724..cd86465b23 100644 --- a/knockout/tests/knockout-templatingBehaviors-tests.ts +++ b/knockout/tests/knockout-templatingBehaviors-tests.ts @@ -1,4 +1,5 @@ /// +/// /// /// From 35801ddb4a4f058eb1611164b91d053993bb175e Mon Sep 17 00:00:00 2001 From: PSHollenberg Date: Fri, 18 Dec 2015 13:26:00 +0100 Subject: [PATCH 300/474] Missing axisOptions mode and monthNames --- flot/jquery.flot.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flot/jquery.flot.d.ts b/flot/jquery.flot.d.ts index 027330eee8..c45558b870 100644 --- a/flot/jquery.flot.d.ts +++ b/flot/jquery.flot.d.ts @@ -92,6 +92,8 @@ declare module jquery.flot { interface axisOptions { show?: boolean; // null or true/false position?: string; // "bottom" or "top" or "left" or "right" + mode?: string; // "time" + monthNames?: string[]; // array of month names color?: any; // null or color spec tickColor?: any; // null or color spec From fec3ea4268b1853f2555f9a018593a79eb9229c5 Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Fri, 18 Dec 2015 13:28:36 +0100 Subject: [PATCH 301/474] Add some missing yeoman methods and fix some wrong ones --- yeoman-generator/yeoman-generator.d.ts | 36 ++++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/yeoman-generator/yeoman-generator.d.ts b/yeoman-generator/yeoman-generator.d.ts index 4ccd98e44a..8ebc4da89b 100644 --- a/yeoman-generator/yeoman-generator.d.ts +++ b/yeoman-generator/yeoman-generator.d.ts @@ -28,6 +28,7 @@ declare module yo { composeWith(namespace: string, options: any, settings?: IComposeSetting): IYeomanGenerator; defaultFor(name: string): void; destinationRoot(rootPath: string): string; + destinationPath(file: string): string; determineAppname(): void; getCollisionFilter(): (output: any) => void; hookFor(name: string, config: IHookConfig): void; @@ -37,6 +38,7 @@ declare module yo { run(args: any, callback?: Function): void; runHooks(callback?: Function): void; sourceRoot(rootPath: string): string; + templatePath(file: string): string; addListener(event: string, listener: Function): NodeJS.EventEmitter; on(event: string, listener: Function): NodeJS.EventEmitter; once(event: string, listener: Function): NodeJS.EventEmitter; @@ -49,18 +51,30 @@ declare module yo { async(): any; prompt(opt?:IPromptOptions, callback?:(answers:any)=>void) :void; log(message: string) : void; - npmInstall(packages: string[], options?:any) :void; + npmInstall(packages: string[], options?: any, cb?: Function) :void; + installDependencies(): void; + spawnCommand(name: string, args?: string[]): void; appname: string; gruntfile: IGruntFileStatic; + options: { [key: string]: any }; } + + export interface IChoice { + name: string; + value: string; + short?: string; + } + export interface IPromptOptions{ - type:string; - name:string; - message:string; - default:string; + type: string; + name: string; + message: string; + choices?: string[] | Function | IChoice[]; + default?: string; + store?: boolean; } - + export interface IGruntFileStatic { loadNpmTasks(pluginName: string): void; insertConfig(name:string, config:any):void; @@ -70,11 +84,11 @@ declare module yo { } export interface IArgumentConfig { - desc: string; - required: boolean; - optional: boolean; - type: any; - defaults: any; + desc?: string; + required?: boolean; + optional?: boolean; + type?: any; + defaults?: any; } export interface IComposeSetting { From 818e6cf2ff8a7b0458fd9f50054ffb37778a93ed Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Fri, 18 Dec 2015 15:07:14 +0100 Subject: [PATCH 302/474] More typing corrections and added tests --- yeoman-generator/yeoman-generator-tests.ts | 64 ++++++++++++++++++++++ yeoman-generator/yeoman-generator.d.ts | 43 ++++++++++----- 2 files changed, 94 insertions(+), 13 deletions(-) diff --git a/yeoman-generator/yeoman-generator-tests.ts b/yeoman-generator/yeoman-generator-tests.ts index 84f0072065..f72dff4e3f 100644 --- a/yeoman-generator/yeoman-generator-tests.ts +++ b/yeoman-generator/yeoman-generator-tests.ts @@ -112,3 +112,67 @@ runContext.inDir('dirPath') .withGenerators(['deps', 'deps']) .withOptions('opts') .withPrompts('answers'); + +// http://yeoman.io/generator/Base.html#destinationPath +generator.destinationPath() === 'string'; +generator.destinationPath('path1') === 'string'; +generator.destinationPath('path1', 'path2') === 'string'; +generator.destinationPath('path1', 'path2', 'path3') === 'string'; + +// http://yeoman.io/generator/Base.html#templatePath +generator.templatePath() === 'string'; +generator.templatePath('path1') === 'string'; +generator.templatePath('path1', 'path2') === 'string'; +generator.templatePath('path1', 'path2', 'path3') === 'string'; + +// http://yeoman.io/generator/Base.html#npmInstall +generator.npmInstall(); +generator.npmInstall('pkg'); +generator.npmInstall([ 'pkg1', 'pkg2' ]); +generator.npmInstall('pkg', {}); +generator.npmInstall('pkg', {}, () => {}); + +// http://yeoman.io/generator/Base.html#installDependencies +generator.installDependencies(); +generator.installDependencies({}); +generator.installDependencies({ npm: true }); +generator.installDependencies({ bower: true }); +generator.installDependencies({ skipMessage: true }); +generator.installDependencies({ callback: () => {} }); + +// http://yeoman.io/generator/Base.html#spawnCommand +generator.spawnCommand('command', []); +generator.spawnCommand('command', [ '-arg' ]); +generator.spawnCommand('command', [], {}); + +// http://yeoman.io/generator/Base.html#spawnCommandSync +generator.spawnCommandSync('command', []); +generator.spawnCommandSync('command', [ '-arg' ]); +generator.spawnCommandSync('command', [], {}); + +// http://yeoman.io/generator/Base.html#option +generator.options['opt'] === 'string'; + +// http://yeoman.io/generator/Base.html#prompt +// https://github.com/SBoudrias/Inquirer.js +generator.prompt({ name: 'Name', message: 'Message' }, (answer) => {}); +generator.prompt({ name: 'Name', message: (answers) => 'Message' }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', choices: [ 'c1', 'c2' ] }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', choices: [ { name: 'Choice 1', value: 'c1' } ] }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', choices: (answers) => [ 'c1', 'c2' ] }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', choices: (answers) => [ { name: 'Choice 1', value: 'c1' } ] }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', choices: (answers) => [ { name: 'Choice 1', value: 'c1', short: '1' } ] }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', default: 'string' }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', default: 10 }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', default: [ 'string' ] }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', default: [ 10 ] }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', default: (answers) => [ 'string' ] }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', default: (answers) => [ 10 ] }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', default: (answers) => 'string' }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', default: (answers) => 10 }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', type: "list" }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', validate: (input) => true }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', validate: (input) => "Error" }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', filter: (input) => input }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', when: (answers) => true }, (answer) => {}); +generator.prompt({ name: 'Name', message: '', when: true }, (answer) => {}); diff --git a/yeoman-generator/yeoman-generator.d.ts b/yeoman-generator/yeoman-generator.d.ts index 8ebc4da89b..b73037ea5a 100644 --- a/yeoman-generator/yeoman-generator.d.ts +++ b/yeoman-generator/yeoman-generator.d.ts @@ -10,6 +10,7 @@ declare module yo { composeWith(namespace: string, options: any, settings?: IComposeSetting): IYeomanGenerator; defaultFor(name: string): void; destinationRoot(rootPath: string): string; + destinationPath(...path: string[]): string; determineAppname(): void; getCollisionFilter(): (output: any) => void; hookFor(name: string, config: IHookConfig): void; @@ -19,8 +20,13 @@ declare module yo { run(args: any, callback?: Function): void; runHooks(callback?: Function): void; sourceRoot(rootPath: string): string; - - + templatePath(...path: string[]): string; + prompt(opt: IPromptOptions | IPromptOptions[], callback: (answers: any) => void): void; + npmInstall(packages?: string[] | string, options?: any, cb?: Function): void; + installDependencies(options?: IInstallDependencyOptions): void; + spawnCommand(name: string, args?: string[], options?: Object): void; + spawnCommandSync(name: string, args?: string[], options?: Object): void; + options: { [key: string]: any }; } export class YeomanGeneratorBase implements IYeomanGenerator, NodeJS.EventEmitter { @@ -28,7 +34,7 @@ declare module yo { composeWith(namespace: string, options: any, settings?: IComposeSetting): IYeomanGenerator; defaultFor(name: string): void; destinationRoot(rootPath: string): string; - destinationPath(file: string): string; + destinationPath(...path: string[]): string; determineAppname(): void; getCollisionFilter(): (output: any) => void; hookFor(name: string, config: IHookConfig): void; @@ -38,7 +44,7 @@ declare module yo { run(args: any, callback?: Function): void; runHooks(callback?: Function): void; sourceRoot(rootPath: string): string; - templatePath(file: string): string; + templatePath(...path: string[]): string; addListener(event: string, listener: Function): NodeJS.EventEmitter; on(event: string, listener: Function): NodeJS.EventEmitter; once(event: string, listener: Function): NodeJS.EventEmitter; @@ -49,17 +55,25 @@ declare module yo { emit(event: string, ...args: any[]): boolean; async(): any; - prompt(opt?:IPromptOptions, callback?:(answers:any)=>void) :void; + prompt(opt: IPromptOptions | IPromptOptions[], callback: (answers: any) => void): void; log(message: string) : void; npmInstall(packages: string[], options?: any, cb?: Function) :void; - installDependencies(): void; - spawnCommand(name: string, args?: string[]): void; + installDependencies(options?: IInstallDependencyOptions): void; + spawnCommand(name: string, args?: string[], options?: Object): void; + spawnCommandSync(name: string, args?: string[], options?: Object): void; appname: string; gruntfile: IGruntFileStatic; options: { [key: string]: any }; } + export interface IInstallDependencyOptions { + npm?: boolean; + bower?: boolean; + skipMessage?: boolean; + callback?: Function; + } + export interface IChoice { name: string; value: string; @@ -67,11 +81,14 @@ declare module yo { } export interface IPromptOptions{ - type: string; + type?: string; name: string; - message: string; - choices?: string[] | Function | IChoice[]; - default?: string; + message: string | ((answers: Object) => string); + choices?: string[] | IChoice[] | ((answers: Object) => (string[] | IChoice[])); + default?: string | number | string[] | number[] | ((answers: Object) => (string | number | string[] | number[])); + validate?: ((input: any) => boolean | string); + filter?: ((input: any) => any); + when?: ((answers: Object) => boolean) | boolean; store?: boolean; } @@ -84,10 +101,10 @@ declare module yo { } export interface IArgumentConfig { - desc?: string; + desc: string; required?: boolean; optional?: boolean; - type?: any; + type: any; defaults?: any; } From 185f8c594d8517f3ed7390c04a20ac5271071e1c Mon Sep 17 00:00:00 2001 From: Marian Palkus Date: Thu, 17 Dec 2015 12:39:09 +0100 Subject: [PATCH 303/474] Added type definitions for enzyme. --- enzyme/enzyme-tests.tsx | 574 ++++++++++++++++++++++++++++++++++++++++ enzyme/enzyme.d.ts | 340 ++++++++++++++++++++++++ 2 files changed, 914 insertions(+) create mode 100644 enzyme/enzyme-tests.tsx create mode 100644 enzyme/enzyme.d.ts diff --git a/enzyme/enzyme-tests.tsx b/enzyme/enzyme-tests.tsx new file mode 100644 index 0000000000..71e82351f7 --- /dev/null +++ b/enzyme/enzyme-tests.tsx @@ -0,0 +1,574 @@ +/// +/// + +import { shallow, mount, render, describeWithDOM, spyLifecycle } from "enzyme"; +import * as React from "react"; +import {Component, ReactElement} from "react"; +import {ShallowWrapper, ReactWrapper, CheerioWrapper} from "enzyme"; + + +// Help classes/interfaces +interface MyComponentProps { + propsProperty: any; +} + +interface MyComponentState { + stateProperty: any; +} + +class MyComponent extends Component { + setState(...args: any[]) { + } +} + +// API +module SpyLifecycleTest { + spyLifecycle(MyComponent); +} + +// ShallowWrapper +module ShallowWrapperTest { + var shallowWrapper: ShallowWrapper = + shallow(); + + var reactElement: ReactElement, + objectVal: Object, + boolVal: Boolean, + stringVal: String; + + function test_find() { + shallowWrapper = shallowWrapper.find('.selector'); + shallowWrapper = shallowWrapper.find(MyComponent); + } + + function test_findWhere() { + shallowWrapper = + shallowWrapper.findWhere((aShallowWrapper: ShallowWrapper) => true); + } + + function test_filter() { + shallowWrapper = shallowWrapper.filter('.selector'); + shallowWrapper = shallowWrapper.filter(MyComponent); + } + + function test_filterWhere() { + shallowWrapper = + shallowWrapper.filterWhere((aShallowWrapper: ShallowWrapper) => true); + } + + function test_contains() { + boolVal = shallowWrapper.contains(
        ); + } + + function test_hasClass() { + boolVal = shallowWrapper.find('.my-button').hasClass('disabled'); + } + + function test_is() { + boolVal = shallowWrapper.is('.some-class'); + } + + function test_not() { + shallowWrapper = shallowWrapper.find('.foo').not('.bar'); + } + + function test_children() { + shallowWrapper = shallowWrapper.children(); + } + + function test_parents() { + shallowWrapper = shallowWrapper.parents(); + } + + function test_parent() { + shallowWrapper = shallowWrapper.parent(); + } + + function test_closest() { + shallowWrapper = shallowWrapper.closest('.selector'); + shallowWrapper = shallowWrapper.closest(MyComponent); + } + + function test_shallow() { + shallowWrapper = shallowWrapper.shallow(); + } + + function test_render() { + var cheerioWrapper: CheerioWrapper = shallowWrapper.render(); + } + + function test_text() { + stringVal = shallowWrapper.text(); + } + + + function test_html() { + stringVal = shallowWrapper.html(); + } + + function test_get() { + reactElement = shallowWrapper.get(1); + } + + function test_at() { + shallowWrapper = shallowWrapper.at(1); + } + + function test_first() { + shallowWrapper = shallowWrapper.first(); + } + + function test_last() { + shallowWrapper = shallowWrapper.last(); + } + + function test_state() { + shallowWrapper.state(); + shallowWrapper.state('key'); + } + + function test_props() { + objectVal = shallowWrapper.props(); + } + + function test_prop() { + shallowWrapper.prop('key'); + } + + + function test_simulate(...args: any[]) { + shallowWrapper.simulate('click'); + shallowWrapper.simulate('click', args); + } + + function test_setState() { + shallowWrapper = shallowWrapper.setState({stateProperty: 'state'}); + } + + function test_setProps() { + shallowWrapper = shallowWrapper.setProps({propsProperty: 'foo'}); + } + + function test_setContext() { + shallowWrapper = shallowWrapper.setContext({name: 'baz'}); + } + + function test_instance() { + var myComponent: MyComponent = shallowWrapper.instance(); + } + + function test_update() { + shallowWrapper = shallowWrapper.update(); + } + + function test_debug() { + stringVal = shallowWrapper.debug(); + } + + function test_type() { + var stringOrFunction: String|Function = shallowWrapper.type(); + } + + function test_forEach() { + shallowWrapper = + shallowWrapper.forEach((aShallowWrapper: ShallowWrapper)=> { + }); + } + + function test_map() { + var arrayVal: Array = + shallowWrapper.map((aShallowWrapper: ShallowWrapper)=> { + }); + } + + function test_reduce() { + const total: number[] = + shallowWrapper.reduce( + (amount: number, n: ShallowWrapper) => amount + n.prop('amount') + ); + } + + function test_reduceRight() { + const total: number[] = + shallowWrapper.reduceRight( + (amount: number, n: ShallowWrapper) => amount + n.prop('amount') + ); + } + + function test_some() { + boolVal = shallowWrapper.some('.selector'); + boolVal = shallowWrapper.some(MyComponent); + } + + function test_someWhere() { + boolVal = shallowWrapper.someWhere((aShallowWrapper: ShallowWrapper) => true); + } + + function test_every() { + boolVal = shallowWrapper.every('.selector'); + boolVal = shallowWrapper.every(MyComponent); + } + + function test_everyWhere() { + boolVal = shallowWrapper.everyWhere((aShallowWrapper: ShallowWrapper) => true); + } +} + + +// ReactWrapper +module ReactWrapperTest { + var reactWrapper: ReactWrapper = + mount(); + + var reactElement: ReactElement, + objectVal: Object, + boolVal: Boolean, + stringVal: String; + + function test_find() { + reactWrapper = reactWrapper.find('.selector'); + reactWrapper = reactWrapper.find(MyComponent); + } + + function test_findWhere() { + reactWrapper = + reactWrapper.findWhere((aReactWrapper: ReactWrapper) => true); + } + + function test_filter() { + reactWrapper = reactWrapper.filter('.selector'); + reactWrapper = reactWrapper.filter(MyComponent); + } + + function test_filterWhere() { + reactWrapper = + reactWrapper.filterWhere((aReactWrapper: ReactWrapper) => true); + } + + function test_contains() { + boolVal = reactWrapper.contains(
        ); + } + + function test_hasClass() { + boolVal = reactWrapper.find('.my-button').hasClass('disabled'); + } + + function test_is() { + boolVal = reactWrapper.is('.some-class'); + } + + function test_not() { + reactWrapper = reactWrapper.find('.foo').not('.bar'); + } + + function test_children() { + reactWrapper = reactWrapper.children(); + } + + function test_parents() { + reactWrapper = reactWrapper.parents(); + } + + function test_parent() { + reactWrapper = reactWrapper.parent(); + } + + function test_closest() { + reactWrapper = reactWrapper.closest('.selector'); + reactWrapper = reactWrapper.closest(MyComponent); + } + + function test_text() { + stringVal = reactWrapper.text(); + } + + function test_html() { + stringVal = reactWrapper.html(); + } + + function test_get() { + reactElement = reactWrapper.get(1); + } + + function test_at() { + reactWrapper = reactWrapper.at(1); + } + + function test_first() { + reactWrapper = reactWrapper.first(); + } + + function test_last() { + reactWrapper = reactWrapper.last(); + } + + function test_state() { + reactWrapper.state(); + reactWrapper.state('key'); + } + + function test_props() { + objectVal = reactWrapper.props(); + } + + function test_prop() { + reactWrapper.prop('key'); + } + + + function test_simulate(...args: any[]) { + reactWrapper.simulate('click'); + reactWrapper.simulate('click', args); + } + + function test_setState() { + reactWrapper = reactWrapper.setState({stateProperty: 'state'}); + } + + function test_setProps() { + reactWrapper = reactWrapper.setProps({propsProperty: 'foo'}); + } + + function test_setContext() { + reactWrapper = reactWrapper.setContext({name: 'baz'}); + } + + function test_instance() { + var myComponent: MyComponent = reactWrapper.instance(); + } + + function test_update() { + reactWrapper = reactWrapper.update(); + } + + function test_debug() { + stringVal = reactWrapper.debug(); + } + + function test_type() { + var stringOrFunction: String|Function = reactWrapper.type(); + } + + function test_forEach() { + reactWrapper = + reactWrapper.forEach((aReactWrapper: ReactWrapper)=> { + }); + } + + function test_map() { + var arrayVal: Array = + reactWrapper.map((aReactWrapper: ReactWrapper)=> { + }); + } + + function test_reduce() { + const total: number[] = + reactWrapper.reduce( + (amount: number, n: ReactWrapper) => amount + n.prop('amount') + ); + } + + function test_reduceRight() { + const total: number[] = + reactWrapper.reduceRight( + (amount: number, n: ReactWrapper) => amount + n.prop('amount') + ); + } + + function test_some() { + boolVal = reactWrapper.some('.selector'); + boolVal = reactWrapper.some(MyComponent); + } + + function test_someWhere() { + boolVal = reactWrapper.someWhere((aReactWrapper: ReactWrapper) => true); + } + + function test_every() { + boolVal = reactWrapper.every('.selector'); + boolVal = reactWrapper.every(MyComponent); + } + + function test_everyWhere() { + boolVal = reactWrapper.everyWhere((aReactWrapper: ReactWrapper) => true); + } +} + +// CheerioWrapper +module CheerioWrapperTest { + var cheerioWrapper: CheerioWrapper = + render(); + + var reactElement: ReactElement, + objectVal: Object, + boolVal: Boolean, + stringVal: String; + + function test_find() { + cheerioWrapper = cheerioWrapper.find('.selector'); + cheerioWrapper = cheerioWrapper.find(MyComponent); + } + + function test_findWhere() { + cheerioWrapper = + cheerioWrapper.findWhere((aCheerioWrapper: CheerioWrapper) => true); + } + + function test_filter() { + cheerioWrapper = cheerioWrapper.filter('.selector'); + cheerioWrapper = cheerioWrapper.filter(MyComponent); + } + + function test_filterWhere() { + cheerioWrapper = + cheerioWrapper.filterWhere((aCheerioWrapper: CheerioWrapper) => true); + } + + function test_contains() { + boolVal = cheerioWrapper.contains(
        ); + } + + function test_hasClass() { + boolVal = cheerioWrapper.find('.my-button').hasClass('disabled'); + } + + function test_is() { + boolVal = cheerioWrapper.is('.some-class'); + } + + function test_not() { + cheerioWrapper = cheerioWrapper.find('.foo').not('.bar'); + } + + function test_children() { + cheerioWrapper = cheerioWrapper.children(); + } + + function test_parents() { + cheerioWrapper = cheerioWrapper.parents(); + } + + function test_parent() { + cheerioWrapper = cheerioWrapper.parent(); + } + + function test_closest() { + cheerioWrapper = cheerioWrapper.closest('.selector'); + cheerioWrapper = cheerioWrapper.closest(MyComponent); + } + + function test_text() { + stringVal = cheerioWrapper.text(); + } + + function test_html() { + stringVal = cheerioWrapper.html(); + } + + function test_get() { + reactElement = cheerioWrapper.get(1); + } + + function test_at() { + cheerioWrapper = cheerioWrapper.at(1); + } + + function test_first() { + cheerioWrapper = cheerioWrapper.first(); + } + + function test_last() { + cheerioWrapper = cheerioWrapper.last(); + } + + function test_state() { + cheerioWrapper.state(); + cheerioWrapper.state('key'); + } + + function test_props() { + objectVal = cheerioWrapper.props(); + } + + function test_prop() { + cheerioWrapper.prop('key'); + } + + + function test_simulate(...args: any[]) { + cheerioWrapper.simulate('click'); + cheerioWrapper.simulate('click', args); + } + + function test_setState() { + cheerioWrapper = cheerioWrapper.setState({stateProperty: 'state'}); + } + + function test_setProps() { + cheerioWrapper = cheerioWrapper.setProps({propsProperty: 'foo'}); + } + + function test_setContext() { + cheerioWrapper = cheerioWrapper.setContext({name: 'baz'}); + } + + function test_instance() { + var myComponent: MyComponent = cheerioWrapper.instance(); + } + + function test_update() { + cheerioWrapper = cheerioWrapper.update(); + } + + function test_debug() { + stringVal = cheerioWrapper.debug(); + } + + function test_type() { + var stringOrFunction: String|Function = cheerioWrapper.type(); + } + + function test_forEach() { + cheerioWrapper = + cheerioWrapper.forEach((aCheerioWrapper: CheerioWrapper)=> { + }); + } + + function test_map() { + var arrayVal: Array = + cheerioWrapper.map((aCheerioWrapper: CheerioWrapper)=> { + }); + } + + function test_reduce() { + const total: number[] = + cheerioWrapper.reduce( + (amount: number, n: CheerioWrapper) => amount + n.prop('amount') + ); + } + + function test_reduceRight() { + const total: number[] = + cheerioWrapper.reduceRight( + (amount: number, n: CheerioWrapper) => amount + n.prop('amount') + ); + } + + function test_some() { + boolVal = cheerioWrapper.some('.selector'); + boolVal = cheerioWrapper.some(MyComponent); + } + + function test_someWhere() { + boolVal = cheerioWrapper.someWhere((aCheerioWrapper: CheerioWrapper) => true); + } + + function test_every() { + boolVal = cheerioWrapper.every('.selector'); + boolVal = cheerioWrapper.every(MyComponent); + } + + function test_everyWhere() { + boolVal = cheerioWrapper.everyWhere((aCheerioWrapper: CheerioWrapper) => true); + } +} diff --git a/enzyme/enzyme.d.ts b/enzyme/enzyme.d.ts new file mode 100644 index 0000000000..dd0c996a7c --- /dev/null +++ b/enzyme/enzyme.d.ts @@ -0,0 +1,340 @@ +// Type definitions for Enzyme v1.2.0 +// Project: https://github.com/airbnb/enzyme +// Definitions by: Marian Palkus , Cap3 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "enzyme" { + + import {ReactElement, Component} from "react"; + + export class ElementClass extends Component { + } + + /** + * Many methods in Enzyme's API accept a selector as an argument. Selectors in Enzyme can fall into one of the + * following three categories: + * + * 1. A Valid CSS Selector + * 2. A React Component Constructor + * 3. A React Component's displayName + */ + export type EnzymeSelector = String | typeof ElementClass; + + interface CommonWrapper { + /** + * Find every node in the render tree that matches the provided selector. + * @param selector The selector to match. + */ + find(selector: EnzymeSelector): T; + + /** + * Finds every node in the render tree that returns true for the provided predicate function. + * @param predicate + */ + findWhere(predicate: (shallowWrapper: ShallowWrapper) => Boolean): T; + + /** + * Removes nodes in the current wrapper that do not match the provided selector. + * @param selector The selector to match. + */ + filter(selector: EnzymeSelector): T; + + /** + * Returns a new wrapper with only the nodes of the current wrapper that, when passed into the provided predicate function, return true. + * @param predicate + */ + filterWhere(predicate: (shallowWrapper: ShallowWrapper) => Boolean): T; + + /** + * Returns whether or not the current wrapper has a node anywhere in it's render tree that looks like the one passed in. + * @param node + */ + contains(node: ReactElement): Boolean; + + /** + * Returns whether or not the current node has a className prop including the passed in class name. + * @param className + */ + hasClass(className: String): Boolean; + + /** + * Returns whether or not the current node matches a provided selector. + * @param selector + */ + is(selector: EnzymeSelector): Boolean; + + /** + * Returns a new wrapper with only the nodes of the current wrapper that don't match the provided selector. + * This method is effectively the negation or inverse of filter. + * @param selector + */ + not(selector: EnzymeSelector): T; + + /** + * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector + * can be provided and it will filter the children by this selector. + * @param [selector] + */ + children(selector?: EnzymeSelector): T; + + /** + * Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the + * current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector. + * + * Note: can only be called on a wrapper of a single node. + * @param [selector] + */ + parents(selector?: EnzymeSelector): T; + + /** + * Returns a wrapper with the direct parent of the node in the current wrapper. + */ + parent(): T; + + /** + * Returns a wrapper of the first element that matches the selector by traversing up through the current node's + * ancestors in the tree, starting with itself. + * + * Note: can only be called on a wrapper of a single node. + * @param selector + */ + closest(selector: EnzymeSelector): T; + + /** + * Returns a string of the rendered text of the current render tree. This function should be looked at with + * skepticism if being used to test what the actual HTML output of the component will be. If that is what you + * would like to test, use enzyme's render function instead. + * + * Note: can only be called on a wrapper of a single node. + */ + text(): String; + + /** + * Returns a string of the rendered HTML markup of the current render tree. + * + * Note: can only be called on a wrapper of a single node. + */ + html(): String; + + /** + * Returns the node at a given index of the current wrapper. + * @param index + */ + get(index: number): ReactElement; + + /** + * Returns a wrapper around the node at a given index of the current wrapper. + * @param index + */ + at(index: number): T; + + /** + * Reduce the set of matched nodes to the first in the set. + */ + first(): T; + + /** + * Reduce the set of matched nodes to the last in the set. + */ + last(): T; + + /** + * Returns the state hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value. + * @param [key] + */ + state(key?: String): any; + + /** + * Returns the props hash for the current node of the wrapper. + * + * NOTE: can only be called on a wrapper of a single node. + */ + props(): Object; + + /** + * Returns the prop value for the node of the current wrapper with the provided key. + * + * NOTE: can only be called on a wrapper of a single node. + * @param key + */ + prop(key: String): any; + + /** + * Simulate events. + * Returns itself. + * @param event + * @param args? + */ + simulate(event: String, ...args: any[]): T; + + /** + * A method to invoke setState() on the root component instance similar to how you might in the definition of + * the component, and re-renders. This method is useful for testing your component in hard to achieve states, + * however should be used sparingly. If possible, you should utilize your component's external API in order to + * get it into whatever state you want to test, in order to be as accurate of a test as possible. This is not + * always practical, however. + * Returns itself. + * + * NOTE: can only be called on a wrapper instance that is also the root instance. + * @param state + */ + setState(state: S): T; + + /** + * A method that sets the props of the root component, and re-renders. Useful for when you are wanting to test + * how the component behaves over time with changing props. Calling this, for instance, will call the + * componentWillReceiveProps lifecycle method. + * + * Similar to setState, this method accepts a props object and will merge it in with the already existing props. + * Returns itself. + * + * NOTE: can only be called on a wrapper instance that is also the root instance. + * @param state + */ + setProps(state: Object): T; + + /** + * A method that sets the context of the root component, and re-renders. Useful for when you are wanting to + * test how the component behaves over time with changing contexts. + * Returns itself. + * + * NOTE: can only be called on a wrapper instance that is also the root instance. + * @param state + */ + setContext(state: Object): T; + + /** + * Gets the instance of the component being rendered as the root node passed into shallow(). + * + * NOTE: can only be called on a wrapper instance that is also the root instance. + */ + instance(): Component; + + /** + * Forces a re-render. Useful to run before checking the render output if something external may be updating + * the state of the component somewhere. + * Returns itself. + * + * NOTE: can only be called on a wrapper instance that is also the root instance. + */ + update(): T; + + /** + * Returns an html-like string of the wrapper for debugging purposes. Useful to print out to the console when + * tests are not passing when you expect them to. + */ + debug(): String; + + /** + * Returns the type of the current node of this wrapper. If it's a composite component, this will be the + * component constructor. If it's native DOM node, it will be a string of the tag name. + * + * Note: can only be called on a wrapper of a single node. + */ + type(): String | Function; + + /** + * Iterates through each node of the current wrapper and executes the provided function with a wrapper around + * the corresponding node passed in as the first argument. + * + * Returns itself. + * @param fn A callback to be run for every node in the collection. Should expect a ShallowWrapper as the first + * argument, and will be run with a context of the original instance. + */ + forEach(fn: (wrapper: ShallowWrapper) => void): T; + + /** + * Maps the current array of nodes to another array. Each node is passed in as a ShallowWrapper to the map + * function. + * Returns an array of the returned values from the mapping function.. + * @param fn A mapping function to be run for every node in the collection, the results of which will be mapped + * to the returned array. Should expect a ShallowWrapper as the first argument, and will be run + * with a context of the original instance. + */ + map(fn: (wrapper: ShallowWrapper) => any): Array; + + /** + * Applies the provided reducing function to every node in the wrapper to reduce to a single value. Each node + * is passed in as a ShallowWrapper, and is processed from left to right. + * @param fn + * @param initialValue + */ + reduce(fn: (prevVal: R, wrapper: ShallowWrapper, index: number) => R, initialValue?: R): R[]; + + /** + * Applies the provided reducing function to every node in the wrapper to reduce to a single value. + * Each node is passed in as a ShallowWrapper, and is processed from right to left. + * @param fn + * @param initialValue + */ + reduceRight(fn: (prevVal: R, wrapper: ShallowWrapper, index: number) => R, initialValue?: R): R[]; + + /** + * Returns whether or not any of the nodes in the wrapper match the provided selector. + * @param selector + */ + some(selector: EnzymeSelector): Boolean; + + /** + * Returns whether or not any of the nodes in the wrapper pass the provided predicate function. + * @param fn + */ + someWhere(fn: (wrapper: ShallowWrapper) => Boolean): Boolean; + + /** + * Returns whether or not all of the nodes in the wrapper match the provided selector. + * @param selector + */ + every(selector: EnzymeSelector): Boolean; + + /** + * Returns whether or not any of the nodes in the wrapper pass the provided predicate function. + * @param fn + */ + everyWhere(fn: (wrapper: ShallowWrapper) => Boolean): Boolean; + + length: number; + } + + export interface ShallowWrapper extends CommonWrapper, P, S> { + shallow(): ShallowWrapper; + + render(): CheerioWrapper; + } + + export interface ReactWrapper extends CommonWrapper, P, S> { + + } + + export interface CheerioWrapper extends CommonWrapper, P, S> { + + } + + /** + * Shallow rendering is useful to constrain yourself to testing a component as a unit, and to ensure that + * your tests aren't indirectly asserting on behavior of child components. + * @param node + * @param [options] + */ + export function shallow(node: ReactElement

        , options?: any): ShallowWrapper; + + /** + * Mounts and renders a react component into the document and provides a testing wrapper around it. + * @param node + * @param [options] + */ + export function mount(node: ReactElement

        , options?: any): ReactWrapper; + + /** + * Render react components to static HTML and analyze the resulting HTML structure. + * @param node + * @param [options] + */ + export function render(node: ReactElement

        , options?: any): CheerioWrapper; + + export function describeWithDOM(description: String, fn: Function): void; + + export function spyLifecycle(component: typeof Component): void; +} \ No newline at end of file From b0170d98761af9f6b66743c36723497ea75d0633 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 18 Dec 2015 19:30:50 +0500 Subject: [PATCH 304/474] lodash: signatures of _.isObject have been changed --- lodash/lodash-tests.ts | 22 ++++++++++++++++++---- lodash/lodash.d.ts | 10 +++++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d661839d54..f29c10e4fb 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5657,10 +5657,24 @@ result = _({}).isNumber(); } // _.isObject -result = _.isObject(any); -result = _(1).isObject(); -result = _([]).isObject(); -result = _({}).isObject(); +module TestIsObject { + { + let result: boolean; + + result = _.isObject(any); + result = _(1).isObject(); + result = _([]).isObject(); + result = _({}).isObject(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isObject(); + result = _([]).chain().isObject(); + result = _({}).chain().isObject(); + } +} // _.isPlainObject result = _.isPlainObject(any); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 4e86afb66b..bd2955462a 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9582,9 +9582,10 @@ declare module _ { /** * 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 Returns true if value is an object, else false. - **/ + */ isObject(value?: any): boolean; } @@ -9595,6 +9596,13 @@ declare module _ { isObject(): boolean; } + interface LoDashExplicitWrapperBase { + /** + * see _.isObject + */ + isObject(): LoDashExplicitWrapper; + } + //_.isPlainObject interface LoDashStatic { /** From 3a25247cd52c5814253a24b620344e9ec33c6109 Mon Sep 17 00:00:00 2001 From: WAEL BEN ZID Date: Fri, 18 Dec 2015 15:44:58 +0100 Subject: [PATCH 305/474] Definition for prettyjson package added --- prettyjson/prettyjson-tests.ts | 18 +++++++++++ prettyjson/prettyjson.d.ts | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 prettyjson/prettyjson-tests.ts create mode 100644 prettyjson/prettyjson.d.ts diff --git a/prettyjson/prettyjson-tests.ts b/prettyjson/prettyjson-tests.ts new file mode 100644 index 0000000000..da82686e1f --- /dev/null +++ b/prettyjson/prettyjson-tests.ts @@ -0,0 +1,18 @@ +/// + +var options: prettyjson.IOptions, + input: string, + output: string; + + +input = 'This is a string'; +output = prettyjson.render(input); + +output = prettyjson.render(input, {}, 4); + +output = prettyjson.render(['first string', ['nested 1', 'nested 2'], 'second string']); + +output = prettyjson.render({param1: 'first string', param2: 'second string'}); + +output = prettyjson.render({first_param: {subparam: 'first string', subparam2: 'another string'}, second_param: 'second string'}); + diff --git a/prettyjson/prettyjson.d.ts b/prettyjson/prettyjson.d.ts new file mode 100644 index 0000000000..43dbf133c4 --- /dev/null +++ b/prettyjson/prettyjson.d.ts @@ -0,0 +1,55 @@ +// Type definitions for prettyjson +// Project: https://github.com/rafeca/prettyjson +// Definitions by: Wael BEN ZID EL GUEBSI +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare module "prettyjson" { + + /** + * Defines prettyjson version + */ + export var version: string; + + /** + * Render pretty json. + * + * @param data {Object} Data to prettify. + * @param options {IOptions} Hash with different options to configure the renderer. + * @param indentation {number} Indentation size. + * + * @return {string} pretty serialized json data ready to display. + */ + export function render(data: Object, options?: IOptions, indentation?: number): string; + + /** + * Render pretty json from a string. + * + * @param data {string} Serialized JSON data to prettify. + * @param options {IOptions} Hash with different options to configure the renderer. + * @param indentation {number} Indentation size. + * + * @return {string} pretty serialized json data ready to display. + */ + export function renderString(data: string, options?: IOptions, indentation?: number): string; + + export interface IOptions { + + /** + * Define behavior for Array objects + */ + emptyArrayMsg ?: string; // default: (empty) + inlineArrays ?: boolean; + + /** + * Color definition + */ + noColor ?: boolean; + keysColor ?: string; + dashColor ?: string; + numberColor ?: string; + stringColor ?: string; + + defaultIndentation ?: number; + } +} From 1a7703a16ced73453adf4b1e5f858af3a399d610 Mon Sep 17 00:00:00 2001 From: WAEL BEN ZID Date: Fri, 18 Dec 2015 15:50:24 +0100 Subject: [PATCH 306/474] Files published in the wrong branch removed --- prettyjson/prettyjson-tests.ts | 18 ----------- prettyjson/prettyjson.d.ts | 55 ---------------------------------- 2 files changed, 73 deletions(-) delete mode 100644 prettyjson/prettyjson-tests.ts delete mode 100644 prettyjson/prettyjson.d.ts diff --git a/prettyjson/prettyjson-tests.ts b/prettyjson/prettyjson-tests.ts deleted file mode 100644 index da82686e1f..0000000000 --- a/prettyjson/prettyjson-tests.ts +++ /dev/null @@ -1,18 +0,0 @@ -/// - -var options: prettyjson.IOptions, - input: string, - output: string; - - -input = 'This is a string'; -output = prettyjson.render(input); - -output = prettyjson.render(input, {}, 4); - -output = prettyjson.render(['first string', ['nested 1', 'nested 2'], 'second string']); - -output = prettyjson.render({param1: 'first string', param2: 'second string'}); - -output = prettyjson.render({first_param: {subparam: 'first string', subparam2: 'another string'}, second_param: 'second string'}); - diff --git a/prettyjson/prettyjson.d.ts b/prettyjson/prettyjson.d.ts deleted file mode 100644 index 43dbf133c4..0000000000 --- a/prettyjson/prettyjson.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -// Type definitions for prettyjson -// Project: https://github.com/rafeca/prettyjson -// Definitions by: Wael BEN ZID EL GUEBSI -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -declare module "prettyjson" { - - /** - * Defines prettyjson version - */ - export var version: string; - - /** - * Render pretty json. - * - * @param data {Object} Data to prettify. - * @param options {IOptions} Hash with different options to configure the renderer. - * @param indentation {number} Indentation size. - * - * @return {string} pretty serialized json data ready to display. - */ - export function render(data: Object, options?: IOptions, indentation?: number): string; - - /** - * Render pretty json from a string. - * - * @param data {string} Serialized JSON data to prettify. - * @param options {IOptions} Hash with different options to configure the renderer. - * @param indentation {number} Indentation size. - * - * @return {string} pretty serialized json data ready to display. - */ - export function renderString(data: string, options?: IOptions, indentation?: number): string; - - export interface IOptions { - - /** - * Define behavior for Array objects - */ - emptyArrayMsg ?: string; // default: (empty) - inlineArrays ?: boolean; - - /** - * Color definition - */ - noColor ?: boolean; - keysColor ?: string; - dashColor ?: string; - numberColor ?: string; - stringColor ?: string; - - defaultIndentation ?: number; - } -} From 33e3ab99b09c3c4b159868ed66db602792aecdec Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Fri, 18 Dec 2015 16:10:09 +0100 Subject: [PATCH 307/474] "generators" is deprecated now. Use "Base" and "NamedBase" directly. --- yeoman-generator/yeoman-generator.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/yeoman-generator/yeoman-generator.d.ts b/yeoman-generator/yeoman-generator.d.ts index b73037ea5a..48fbd835c5 100644 --- a/yeoman-generator/yeoman-generator.d.ts +++ b/yeoman-generator/yeoman-generator.d.ts @@ -205,6 +205,8 @@ declare module yo { var file: any; var assert: IAssert; var test: ITestHelper; + + // "generators" is deprecated module generators { export class NamedBase extends YeomanGeneratorBase implements INamedBase { @@ -215,6 +217,14 @@ declare module yo { static extend(protoProps: IQueueProps, staticProps?: any): IYeomanGenerator; } } + + export class NamedBase extends YeomanGeneratorBase implements INamedBase { + constructor(args: string | string[], options: any); + } + + export class Base extends NamedBase implements IBase { + static extend(protoProps: IQueueProps, staticProps?: any): IYeomanGenerator; + } } declare module "yeoman-generator" { From b967242e17899029877c57e81f6e11b423ab6a2b Mon Sep 17 00:00:00 2001 From: Arthur Xavier Date: Fri, 18 Dec 2015 11:41:14 -0200 Subject: [PATCH 308/474] Add type definitions for lime-js Fix indentation and callback types --- lime-js/lime-js-tests.ts | 35 +++++++ lime-js/lime-js.d.ts | 200 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 235 insertions(+) create mode 100644 lime-js/lime-js-tests.ts create mode 100644 lime-js/lime-js.d.ts diff --git a/lime-js/lime-js-tests.ts b/lime-js/lime-js-tests.ts new file mode 100644 index 0000000000..aa73444b17 --- /dev/null +++ b/lime-js/lime-js-tests.ts @@ -0,0 +1,35 @@ +/// + +var transport = new Lime.WebSocketTransport(true); +var clientChannel = new Lime.ClientChannel(transport, true, true); + +clientChannel.onMessage = (m) => { + // message received callback +}; +clientChannel.onNotification = (n) => { + // notification received callback +}; +clientChannel.onCommand = (c) => { + // command received callback +}; + +transport.onOpen = () => { + var authentication: Lime.Authentication = new Lime.GuestAuthentication(); + Lime.ClientChannelExtensions.establishSession(clientChannel, "none", "none", "test@msging.net", authentication, "test", (err, session) => { + var message: Lime.Message = { + id: "123", + to: "someone@test.net", + type: "text/plain", + content: "Hello, world!" + }; + clientChannel.sendMessage(message); + }); +}; +transport.onClose = () => { + // transport closed callback +}; +transport.onError = (err) => { + // transport error callback +}; + +transport.open("ws://test.net"); diff --git a/lime-js/lime-js.d.ts b/lime-js/lime-js.d.ts new file mode 100644 index 0000000000..7e26733d36 --- /dev/null +++ b/lime-js/lime-js.d.ts @@ -0,0 +1,200 @@ +// Type definitions for lime-js 0.0.3 +// Project: https://github.com/takenet/lime-js +// Definitions by: Arthur Xavier +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare namespace Lime { + + interface Envelope { + id?: string; + from?: string; + to?: string; + pp?: string; + metadata?: any; + } + interface Reason { + code: number; + description?: string; + } + + interface Message extends Envelope { + type: string; + content: any; + } + + interface Notification extends Envelope { + event: string; + reason?: Reason; + } + class NotificationEvent { + static accepted: string; + static validated: string; + static authorized: string; + static dispatched: string; + static received: string; + static consumed: string; + } + + interface Command extends Envelope { + uri?: string; + type?: string; + resource?: any; + method: string; + status?: string; + reason?: Reason; + } + class CommandMethod { + static get: string; + static set: string; + static delete: string; + static observe: string; + static subscribe: string; + } + class CommandStatus { + static success: string; + static failure: string; + } + + interface Session extends Envelope { + state: string; + encryptionOptions?: string[]; + encryption?: string; + compressionOptions?: string[]; + compression?: string; + scheme?: string; + authentication?: any; + reason?: Reason; + } + class SessionState { + static new: string; + static negotiating: string; + static authenticating: string; + static established: string; + static finishing: string; + static finished: string; + static failed: string; + } + class SessionEncryption { + static none: string; + static tls: string; + } + class SessionCompression { + static none: string; + static gzip: string; + } + + class Authentication { + scheme: string; + static guest: string; + static plain: string; + static transport: string; + static key: string; + } + class GuestAuthentication extends Authentication { + scheme: string; + } + class TransportAuthentication extends Authentication { + scheme: string; + } + class PlainAuthentication extends Authentication { + scheme: string; + password: string; + } + class KeyAuthentication extends Authentication { + scheme: string; + key: string; + } + + class Channel { + constructor(transport: Transport, autoReplyPings: boolean, autoNotifyReceipt: boolean); + sendMessage(message: Message): void; + onMessage(message: Message): void; + sendCommand(command: Command): void; + onCommand(command: Command): void; + sendNotification(notification: Notification): void; + onNotification(notification: Notification): void; + sendSession(session: Session): void; + onSession(session: Session): void; + transport: Transport; + remoteNode: string; + localNode: string; + sessionId: string; + state: string; + } + + class ClientChannel extends Channel { + constructor(transport: Transport, autoReplyPings?: boolean, autoNotifyReceipt?: boolean); + startNewSession(): void; + negotiateSession(sessionCompression: string, sessionEncryption: string): void; + authenticateSession(identity: string, authentication: Authentication, instance: string): void; + sendFinishingSession(): void; + onSessionNegotiating(session: Session): void; + onSessionAuthenticating(session: Session): void; + onSessionEstablished(session: Session): void; + onSessionFinished(session: Session): void; + onSessionFailed(session: Session): void; + } + + class ClientChannelExtensions { + static establishSession(clientChannel: ClientChannel, compression: string, encryption: string, identity: string, authentication: Authentication, instance: string, callback: (error: Error, session: Session) => any): void; + } + + interface IMessageChannel { + sendMessage(message: Message): void; + onMessage: (message: Message) => any; + } + interface ICommandChannel { + sendCommand(command: Command): void; + onCommand: (command: Command) => any; + } + interface INotificationChannel { + sendNotification(notification: Notification): void; + onNotification: (notification: Notification) => any; + } + interface ISessionChannel { + sendSession(session: Session): void; + onSession: (session: Session) => any; + } + interface ISessionListener { + (session: Session): void; + } + + interface Transport extends ITransportStateListener { + send(envelope: Envelope): void; + onEnvelope: (envelope: Envelope) => any; + open(uri: string): void; + close(): void; + getSupportedCompression(): string[]; + setCompression(compression: string): void; + compression: string; + getSupportedEncryption(): string[]; + setEncryption(encryption: string): void; + encryption: string; + } + interface ITransportEnvelopeListener { + (envelope: Envelope): void; + } + interface ITransportStateListener { + onOpen: () => void; + onClose: () => void; + onError: (error: string) => void; + } + + class WebSocketTransport implements Transport { + webSocket: WebSocket; + constructor(traceEnabled?: boolean); + send(envelope: Envelope): void; + onEnvelope(envelope: Envelope): void; + open(uri: string): void; + close(): void; + getSupportedCompression(): string[]; + setCompression(compression: string): void; + compression: string; + getSupportedEncryption(): string[]; + setEncryption(encryption: string): void; + encryption: string; + onOpen(): void; + onClose(): void; + onError(error: string): void; + } +} From d47ea42665b7131741e7a16b7c6affd690043818 Mon Sep 17 00:00:00 2001 From: lucyhe Date: Fri, 18 Dec 2015 10:37:09 -0500 Subject: [PATCH 309/474] Add optional status to UserProfile in freedom.d.ts User's can have a status, e.g. "FRIEND" or "LOCAL_INVITED_BY_REMOTE" --- freedom/freedom.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/freedom/freedom.d.ts b/freedom/freedom.d.ts index fa80a530c3..c69b800e9c 100644 --- a/freedom/freedom.d.ts +++ b/freedom/freedom.d.ts @@ -497,6 +497,7 @@ declare module freedom.Social { interface UserProfile { userId: string; name: string; + status?: number; url?: string; // Image URI (e.g. data:image/png;base64,adkwe329...) imageData?: string; From 2321f2da7738733f71a24ca5e9ec1b8153ced3e3 Mon Sep 17 00:00:00 2001 From: Klaus Reimer Date: Fri, 18 Dec 2015 17:05:26 +0100 Subject: [PATCH 310/474] Just use `any` instead of explicit types Inquirer also supports some other stuff like separator objects as choices. It gets too complicated to properly type it because its unclear what other stuff can be used as choices so I just use `any` now. --- yeoman-generator/yeoman-generator.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yeoman-generator/yeoman-generator.d.ts b/yeoman-generator/yeoman-generator.d.ts index 48fbd835c5..27e79943ca 100644 --- a/yeoman-generator/yeoman-generator.d.ts +++ b/yeoman-generator/yeoman-generator.d.ts @@ -84,7 +84,7 @@ declare module yo { type?: string; name: string; message: string | ((answers: Object) => string); - choices?: string[] | IChoice[] | ((answers: Object) => (string[] | IChoice[])); + choices?: any[] | ((answers: Object) => any); default?: string | number | string[] | number[] | ((answers: Object) => (string | number | string[] | number[])); validate?: ((input: any) => boolean | string); filter?: ((input: any) => any); From 4676585cf173721c4df3602e00dc188b8bbf27f7 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 18 Dec 2015 17:22:35 +0100 Subject: [PATCH 311/474] Remove trailing spaces --- errorhandler/errorhandler-tests.ts | 2 +- errorhandler/errorhandler.d.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/errorhandler/errorhandler-tests.ts b/errorhandler/errorhandler-tests.ts index 0ba9edb56f..3b847f87f4 100644 --- a/errorhandler/errorhandler-tests.ts +++ b/errorhandler/errorhandler-tests.ts @@ -14,4 +14,4 @@ app.use(errorhandler({ log: (err, str, req, res) => { const requestWasFresh = req && req.fresh; const responseContentType = res && res.contentType -}})) \ No newline at end of file +}})) diff --git a/errorhandler/errorhandler.d.ts b/errorhandler/errorhandler.d.ts index 8ae5e924ce..f021f96c58 100644 --- a/errorhandler/errorhandler.d.ts +++ b/errorhandler/errorhandler.d.ts @@ -7,18 +7,18 @@ declare module "errorhandler" { import express = require('express'); - + function errorHandler(options?: errorHandler.Options): express.ErrorRequestHandler; - + namespace errorHandler { interface LoggingCallback { (err: Error, str: string, req: express.Request, res: express.Response): void; } - + interface Options { /** * Defaults to true. - * + * * Possible values: * true : Log errors using console.error(str). * false : Only send the error back in the response. @@ -27,6 +27,6 @@ declare module "errorhandler" { log: boolean | LoggingCallback; } } - + export = errorHandler; } From 7e47928c4d7717a576243c4ac4a2c0f66d80b07e Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Fri, 18 Dec 2015 19:49:13 +0100 Subject: [PATCH 312/474] Switch to "import * as": more standard way to do --- api-error-handler/api-error-handler-tests.ts | 4 ++-- api-error-handler/api-error-handler.d.ts | 2 +- errorhandler/errorhandler-tests.ts | 5 +++-- errorhandler/errorhandler.d.ts | 2 +- http-errors/http-errors-tests.ts | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/api-error-handler/api-error-handler-tests.ts b/api-error-handler/api-error-handler-tests.ts index 83df91e862..0d0ca85d97 100644 --- a/api-error-handler/api-error-handler-tests.ts +++ b/api-error-handler/api-error-handler-tests.ts @@ -1,7 +1,7 @@ /// -import errorHandler = require('api-error-handler'); -import express = require('express'); +import * as errorHandler from 'api-error-handler'; +import * as express from 'express'; var api = express.Router(); api.get('/users/:userid', function (req, res, next) { diff --git a/api-error-handler/api-error-handler.d.ts b/api-error-handler/api-error-handler.d.ts index 61a63825d9..d66aabf9b7 100644 --- a/api-error-handler/api-error-handler.d.ts +++ b/api-error-handler/api-error-handler.d.ts @@ -6,7 +6,7 @@ /// declare module 'api-error-handler' { - import express = require('express'); + import * as express from 'express'; function apiErrorHandler(options?: any): express.ErrorRequestHandler; diff --git a/errorhandler/errorhandler-tests.ts b/errorhandler/errorhandler-tests.ts index 3b847f87f4..1316888e32 100644 --- a/errorhandler/errorhandler-tests.ts +++ b/errorhandler/errorhandler-tests.ts @@ -1,7 +1,8 @@ /// -import express = require('express'); -import errorhandler = require('errorhandler'); +import * as express from 'express'; +import * as errorhandler from 'errorhandler'; + var app = express(); app.use(errorhandler()); diff --git a/errorhandler/errorhandler.d.ts b/errorhandler/errorhandler.d.ts index f021f96c58..37d5c3c41d 100644 --- a/errorhandler/errorhandler.d.ts +++ b/errorhandler/errorhandler.d.ts @@ -6,7 +6,7 @@ /// declare module "errorhandler" { - import express = require('express'); + import * as express from 'express'; function errorHandler(options?: errorHandler.Options): express.ErrorRequestHandler; diff --git a/http-errors/http-errors-tests.ts b/http-errors/http-errors-tests.ts index 06b91f13b6..9ee89d6a6d 100644 --- a/http-errors/http-errors-tests.ts +++ b/http-errors/http-errors-tests.ts @@ -1,8 +1,8 @@ /// /// -import createError = require('http-errors'); -import express = require('express'); +import * as createError from 'http-errors'; +import * as express from 'express'; var app = express(); From 9c25433c84251bfe72bf0030a95edbbb2c81c9d5 Mon Sep 17 00:00:00 2001 From: Matt Wistrand Date: Fri, 18 Dec 2015 16:00:21 -0600 Subject: [PATCH 313/474] Update Chai typings to v3.4.0. v3.3.0 introduces the following methods: * isNotTrue * isNotFalse * isAtLeast * isAtMost v3.4.0 introduces: * oneOf assertion. * approximately alias for closeTo. --- chai/chai-3.2.0.d.ts | 388 +++++++++++++++++++++++++++++++++++++++++++ chai/chai-tests.ts | 98 +++++++++++ chai/chai.d.ts | 23 ++- 3 files changed, 504 insertions(+), 5 deletions(-) create mode 100644 chai/chai-3.2.0.d.ts diff --git a/chai/chai-3.2.0.d.ts b/chai/chai-3.2.0.d.ts new file mode 100644 index 0000000000..e68e6fa3b4 --- /dev/null +++ b/chai/chai-3.2.0.d.ts @@ -0,0 +1,388 @@ +// Type definitions for chai 3.2.0 +// Project: http://chaijs.com/ +// Definitions by: Jed Mao , +// Bart van der Schoor , +// Andrew Brown , +// Olivier Chevet +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// + +declare module Chai { + + interface ChaiStatic { + expect: ExpectStatic; + should(): Should; + /** + * Provides a way to extend the internals of Chai + */ + use(fn: (chai: any, utils: any) => void): any; + assert: AssertStatic; + config: Config; + AssertionError: typeof AssertionError; + } + + export interface ExpectStatic extends AssertionStatic { + fail(actual?: any, expected?: any, message?: string, operator?: string): void; + } + + export interface AssertStatic extends Assert { + } + + export interface AssertionStatic { + (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; + any: KeyFilter; + all: KeyFilter; + a: TypeComparison; + an: TypeComparison; + include: Include; + includes: Include; + contain: Include; + contains: Include; + ok: Assertion; + true: Assertion; + false: Assertion; + null: Assertion; + undefined: Assertion; + NaN: Assertion; + exist: Assertion; + empty: Assertion; + arguments: Assertion; + Arguments: Assertion; + equal: Equal; + equals: Equal; + eq: Equal; + eql: Equal; + eqls: Equal; + property: Property; + ownProperty: OwnProperty; + haveOwnProperty: OwnProperty; + ownPropertyDescriptor: OwnPropertyDescriptor; + haveOwnPropertyDescriptor: OwnPropertyDescriptor; + length: Length; + lengthOf: Length; + match: Match; + matches: Match; + string(string: string, message?: string): Assertion; + keys: Keys; + key(string: string): Assertion; + throw: Throw; + throws: Throw; + Throw: Throw; + respondTo: RespondTo; + respondsTo: RespondTo; + itself: Assertion; + satisfy: Satisfy; + satisfies: Satisfy; + closeTo(expected: number, delta: number, message?: string): Assertion; + members: Members; + increase: PropertyChange; + increases: PropertyChange; + decrease: PropertyChange; + decreases: PropertyChange; + change: PropertyChange; + changes: PropertyChange; + extensible: Assertion; + sealed: Assertion; + frozen: Assertion; + + } + + interface LanguageChains { + 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 { + above: NumberComparer; + gt: NumberComparer; + greaterThan: NumberComparer; + least: NumberComparer; + gte: NumberComparer; + below: NumberComparer; + lt: NumberComparer; + lessThan: NumberComparer; + most: NumberComparer; + lte: NumberComparer; + within(start: number, finish: number, message?: string): Assertion; + } + + interface NumberComparer { + (value: number, message?: string): Assertion; + } + + interface TypeComparison { + (type: string, message?: string): Assertion; + instanceof: InstanceOf; + instanceOf: InstanceOf; + } + + interface InstanceOf { + (constructor: Object, message?: string): Assertion; + } + + interface Deep { + equal: Equal; + include: Include; + property: Property; + members: Members; + } + + interface KeyFilter { + keys: Keys; + } + + interface Equal { + (value: any, message?: string): Assertion; + } + + interface Property { + (name: string, value?: any, message?: string): Assertion; + } + + interface OwnProperty { + (name: string, message?: string): Assertion; + } + + interface OwnPropertyDescriptor { + (name: string, descriptor: PropertyDescriptor, message?: string): Assertion; + (name: string, message?: string): Assertion; + } + + interface Length extends LanguageChains, NumericComparison { + (length: number, message?: string): Assertion; + } + + interface Include { + (value: Object, message?: string): Assertion; + (value: string, message?: string): Assertion; + (value: number, message?: string): Assertion; + keys: Keys; + members: Members; + any: KeyFilter; + all: KeyFilter; + } + + interface Match { + (regexp: RegExp|string, message?: string): Assertion; + } + + interface Keys { + (...keys: string[]): Assertion; + (keys: any[]): Assertion; + (keys: Object): Assertion; + } + + interface Throw { + (): 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 RespondTo { + (method: string, message?: string): Assertion; + } + + interface Satisfy { + (matcher: Function, message?: string): Assertion; + } + + interface Members { + (set: any[], message?: string): Assertion; + } + + interface PropertyChange { + (object: Object, prop: string, msg?: string): Assertion; + } + + export interface Assert { + /** + * @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; + + ok(val: any, msg?: string): void; + isOk(val: any, msg?: string): void; + notOk(val: any, msg?: string): void; + isNotOk(val: 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; + + 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; + + isNull(val: any, msg?: string): void; + isNotNull(val: any, msg?: string): void; + + isUndefined(val: any, msg?: string): void; + isDefined(val: any, msg?: string): void; + + isNaN(val: any, msg?: string): void; + isNotNaN(val: any, msg?: string): void; + + isAbove(val: number, abv: number, msg?: string): void; + isBelow(val: number, blw: number, 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; + + isArray(val: any, msg?: string): void; + isNotArray(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; + + 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; + + 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; + + 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; + + 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; + + 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; + //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; + + 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; + + 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; + + sameMembers(set1: any[], set2: any[], msg?: string): void; + sameDeepMembers(set1: any[], set2: any[], msg?: string): void; + includeMembers(superset: any[], subset: any[], msg?: string): void; + + ifError(val: any, msg?: string): void; + + isExtensible(obj: {}, msg?: string): void; + extensible(obj: {}, msg?: string): void; + isNotExtensible(obj: {}, msg?: string): void; + notExtensible(obj: {}, msg?: string): void; + + isSealed(obj: {}, msg?: string): void; + sealed(obj: {}, msg?: string): void; + isNotSealed(obj: {}, msg?: string): void; + notSealed(obj: {}, msg?: string): void; + + isFrozen(obj: Object, msg?: string): void; + frozen(obj: Object, msg?: string): void; + isNotFrozen(obj: Object, msg?: string): void; + notFrozen(obj: Object, msg?: string): void; + + + } + + export interface Config { + includeStack: boolean; + } + + export class AssertionError { + constructor(message: string, _props?: any, ssf?: Function); + name: string; + message: string; + showDiff: boolean; + stack: string; + } +} + +declare var chai: Chai.ChaiStatic; + +declare module "chai" { + export = chai; +} + +interface Object { + should: Chai.Assertion; +} diff --git a/chai/chai-tests.ts b/chai/chai-tests.ts index 9b646b1529..df09aea3e7 100644 --- a/chai/chai-tests.ts +++ b/chai/chai-tests.ts @@ -1166,6 +1166,25 @@ function closeTo() { }, 'blah: expected -10 to be close to 20 +/- 29'); } +function approximately() { + expect(1.5).to.be.approximately(1.0, 0.5); + (1.5).should.be.approximately(1.0, 0.5); + expect(10).to.be.approximately(20, 20); + (10).should.be.approximately(20, 20); + expect(-10).to.be.approximately(20, 30); + (-10).should.be.approximately(20, 30); + + err(() => { + expect(2).to.be.approximately(1.0, 0.5, 'blah'); + (2).should.be.approximately(1.0, 0.5, 'blah'); + }, 'blah: expected 2 to be close to 1 +/- 0.5'); + + err(() => { + expect(-10).to.be.approximately(20, 29, 'blah'); + (-10).should.be.approximately(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([]); @@ -1255,6 +1274,20 @@ function increaseDecreaseChange() { same.should.not.change(obj, "val"); } +function oneOf() { + var obj = { z: 3 }; + + expect(5).to.be.oneOf([1, 5, 4]); + expect('z').to.be.oneOf(['x', 'y', 'z']); + expect(obj).to.be.oneOf([obj]); + + expect(5).to.not.be.oneOf([1, -12, 4]); + expect(5).to.not.be.oneOf([1, [5], 4]); + expect('z').to.not.be.oneOf(['w', 'x', 'y']); + expect('z').to.not.be.oneOf(['x', 'y', ['z']]); + expect(obj).to.not.be.oneOf([{ z: 3 }]); +} + //tdd declare function suite(description: string, action: Function): void; declare function test(description: string, action: Function): void; @@ -1879,6 +1912,20 @@ suite('assert', () => { }, 'expected -10 to be close to 20 +/- 29'); }); + test('approximately', () => { + assert.approximately(1.5, 1.0, 0.5); + assert.approximately(10, 20, 20); + assert.approximately(-10, 20, 30); + + err(() => { + assert.approximately(2, 1.0, 0.5); + }, 'expected 2 to be close to 1 +/- 0.5'); + + err(() => { + assert.approximately(-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], []); @@ -1945,4 +1992,55 @@ suite('assert', () => { test('notFrozen', () => { assert.notFrozen({}); }); test('isNotFrozen', () => { assert.isNotFrozen({}); }); + test('isNotTrue', () => { + assert.isNotTrue(false); + + err(() => { + assert.isNotTrue(true); + }, 'expected true to not be true'); + }); + + test('isNotFalse', () => { + assert.isNotFalse(true); + + err(() => { + assert.isNotFalse(false); + }, 'expected false to not be false'); + }); + + test('isAtLeast', () => { + assert.isAtLeast(5, 3); + assert.isAtLeast(5, 5); + + err(() => { + assert.isAtLeast(3, 5); + }, 'expected 3 to be greater than or equal to 5'); + }); + + test('isAtMost', () => { + assert.isAtMost(3, 5); + assert.isAtMost(5, 5); + + err(() => { + assert.isAtMost(5, 3); + }, 'expected 5 to be less than or equal to 3'); + }); + + test('oneOf', () => { + var obj = { z: 3 }; + + assert.oneOf(5, [1, 5, 4]); + assert.oneOf('z', ['x', 'y', 'z']); + assert.oneOf(obj, [obj]); + + err(() => { + assert.oneOf(5, [1, [5], 4]); + }, 'expected 5 to be one of [1, [5], 4]'); + err(() => { + assert.oneOf('z', ['w', 'x', 'y']); + }, 'expected "z" to be one of [w, x, y]'); + err(() => { + assert.oneOf(obj, [{ z: 3 }]); + }, 'expected { z: 3 } to be one of [{ z: 3 }]'); + }); }); diff --git a/chai/chai.d.ts b/chai/chai.d.ts index e68e6fa3b4..074827b65e 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -1,9 +1,10 @@ -// Type definitions for chai 3.2.0 +// Type definitions for chai 3.4.0 // Project: http://chaijs.com/ // Definitions by: Jed Mao , // Bart van der Schoor , // Andrew Brown , -// Olivier Chevet +// Olivier Chevet , +// Matt Wistrand // Definitions: https://github.com/borisyankov/DefinitelyTyped // @@ -97,7 +98,8 @@ declare module Chai { itself: Assertion; satisfy: Satisfy; satisfies: Satisfy; - closeTo(expected: number, delta: number, message?: string): Assertion; + closeTo: CloseTo; + approximately: CloseTo; members: Members; increase: PropertyChange; increases: PropertyChange; @@ -108,7 +110,7 @@ declare module Chai { extensible: Assertion; sealed: Assertion; frozen: Assertion; - + oneOf(list: any[], message?: string): Assertion; } interface LanguageChains { @@ -155,6 +157,10 @@ declare module Chai { (constructor: Object, message?: string): Assertion; } + interface CloseTo { + (expected: number, delta: number, message?: string): Assertion; + } + interface Deep { equal: Equal; include: Include; @@ -259,6 +265,9 @@ declare module Chai { isTrue(val: any, msg?: string): void; isFalse(val: any, msg?: string): void; + isNotTrue(val: any, msg?: string): void; + isNotFalse(val: any, msg?: string): void; + isNull(val: any, msg?: string): void; isNotNull(val: any, msg?: string): void; @@ -271,6 +280,9 @@ declare module Chai { isAbove(val: number, abv: number, msg?: string): void; isBelow(val: number, blw: number, msg?: string): void; + isAtLeast(val: number, atlst: number, msg?: string): void; + isAtMost(val: number, atmst: number, msg?: string): void; + isFunction(val: any, msg?: string): void; isNotFunction(val: any, msg?: string): void; @@ -339,6 +351,7 @@ declare module Chai { operator(val: any, operator: string, val2: any, msg?: string): void; closeTo(act: number, exp: number, delta: number, msg?: string): void; + approximately(act: number, exp: number, delta: number, msg?: string): void; sameMembers(set1: any[], set2: any[], msg?: string): void; sameDeepMembers(set1: any[], set2: any[], msg?: string): void; @@ -361,7 +374,7 @@ declare module Chai { isNotFrozen(obj: Object, msg?: string): void; notFrozen(obj: Object, msg?: string): void; - + oneOf(inList: any, list: any[], msg?: string): void; } export interface Config { From c6190204d5ae6aab5ac1744bf3cefb270e4cdf52 Mon Sep 17 00:00:00 2001 From: Tim Slatcher Date: Fri, 18 Dec 2015 22:45:39 +0000 Subject: [PATCH 314/474] Fix fixed-data-table typings, Column extends from React.Props so you can supply a key --- fixed-data-table/fixed-data-table-tests.tsx | 34 +++++++++------------ fixed-data-table/fixed-data-table.d.ts | 4 +-- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/fixed-data-table/fixed-data-table-tests.tsx b/fixed-data-table/fixed-data-table-tests.tsx index 916c0e64ad..1f10a9fdb5 100644 --- a/fixed-data-table/fixed-data-table-tests.tsx +++ b/fixed-data-table/fixed-data-table-tests.tsx @@ -143,26 +143,20 @@ class MyTable4 extends React.Component<{}, MyTable4State> { headerHeight={50} width={1000} height={500}> - Name} - cell={ - - } - width={200}/> - - Email} - cell={ - - } - width={200} - /> + { + ["name", "email"].map(field => + {field}} + cell={ + + } + width={200}/> + ) + }

        ); } diff --git a/fixed-data-table/fixed-data-table.d.ts b/fixed-data-table/fixed-data-table.d.ts index 5fb0438a01..219b7e39ff 100644 --- a/fixed-data-table/fixed-data-table.d.ts +++ b/fixed-data-table/fixed-data-table.d.ts @@ -249,7 +249,7 @@ declare module FixedDataTable { /** * Component that defines the attributes of table column. */ - interface ColumnProps { + interface ColumnProps extends __React.Props { /** * The horizontal alignment of the table cell content. * @@ -498,4 +498,4 @@ declare module FixedDataTable { declare module "fixed-data-table" { export = FixedDataTable; -} \ No newline at end of file +} From 4b4c41fbb4a87a3721668f30040ada0a6e6ec3d3 Mon Sep 17 00:00:00 2001 From: Matt Wistrand Date: Fri, 18 Dec 2015 17:33:35 -0600 Subject: [PATCH 315/474] Add test file for chai-3.2.0.d.ts. --- chai/chai-3.2.0-tests.ts | 1948 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 1948 insertions(+) create mode 100644 chai/chai-3.2.0-tests.ts diff --git a/chai/chai-3.2.0-tests.ts b/chai/chai-3.2.0-tests.ts new file mode 100644 index 0000000000..9b646b1529 --- /dev/null +++ b/chai/chai-3.2.0-tests.ts @@ -0,0 +1,1948 @@ +/// +import chai = require('chai'); + +// ReSharper disable WrongExpressionStatement + +var expect = chai.expect; +var assert = chai.assert; +var should = chai.should(); +declare var err: Function; + +function chaiVersion() { + expect(chai).to.have.property('version'); + (<{}>chai).should.have.property('version'); +} + +function assertion() { + expect('test').to.be.a('string'); + 'test'.should.be.a('string'); + expect('foo').to.equal('foo'); + 'foo'.should.equal('foo'); + should.equal('foo', 'foo'); +} + +function fail() { + err(() => { + should.fail('foo', 'bar'); + }, 'expected fail to throw an AssertionError'); + err(() => { + should.fail('foo', 'bar', 'should fail'); + }, 'expected fail to throw an AssertionError'); + err(() => { + should.fail('foo', 'bar', 'should fail', 'equal'); + }, 'expected fail to throw an AssertionError'); + + err(() => { + expect.fail('foo', 'bar'); + }, 'expected fail to throw an AssertionError'); + err(() => { + expect.fail('foo', 'bar', 'should fail'); + }, 'expected fail to throw an AssertionError'); + err(() => { + expect.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 _NaN() { + expect(NaN).to.be.NaN; + expect(12).to.be.not.NaN; + expect("NaN").to.be.not.NaN; + (NaN).should.be.NaN; + (12).should.be.not.NaN; + ("NaN").should.be.not.NaN; +} + +function exist() { + var foo = 'bar'; + expect(foo).to.exist; + should.exist(foo); + expect(void (0)).to.not.exist; + should.not.exist(void (0)); +} + +function argumentsTest() { + 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/); + + expect('foobar').matches(/^foo/); + 'foobar'.should.not.matches(/^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'); +} + +class Buffer { + constructor(arr: number[]) { + } +} +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); +} + +// ReSharper disable once InconsistentNaming +function deepEqual3() { + var a = new Date(1, 2, 3); + var b = new Date(4, 5, 6); + expect(a).to.deep.equal(a); + a.should.deep.equal(a); + expect(a).not.to.deep.equal(b); + a.should.not.deep.equal(b); + expect(a).not.to.deep.equal({}); + a.should.not.deep.equal({}); +} + +function deepInclude() { + expect(['foo', 'bar']).to.deep.include(['bar', 'foo']); + ['foo', 'bar'].should.deep.include(['bar', 'foo']); + expect(['foo', 'bar']).not.to.deep.equal(['foo', 'baz']); + ['foo', 'bar'].should.not.deep.equal(['foo', 'baz']); +} + +class FakeArgs { + length: number; +} + +function empty() { + 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 ownPropertyDescriptor() { + expect('test').to.have.ownPropertyDescriptor('length'); + expect('test').to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); + expect('test').not.to.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); + expect('test').to.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false); + expect('test').to.haveOwnPropertyDescriptor('length').to.contain.keys('value'); + + 'test'.should.have.ownPropertyDescriptor('length'); + 'test'.should.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 4 }); + 'test'.should.not.have.ownPropertyDescriptor('length', { enumerable: false, configurable: false, writable: false, value: 3 }); + 'test'.should.haveOwnPropertyDescriptor('length').to.have.property('enumerable', false); + 'test'.should.haveOwnPropertyDescriptor('length').to.contain.keys('value'); +} + +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); + // alias + + expect(['foo', 'bar']).includes('foo'); + ['foo', 'bar'].should.includes('foo'); + + 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'); + // alias + + expect({ foo: 1, bar: 2, baz: 3 }).contains.keys('baz'); + + expect({ foo: 1, bar: 2 }).to.have.all.keys(['foo', 'bar']); + expect({ foo: 1, bar: 2 }).to.have.any.keys(['foo', 'bar']); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.all.keys('baz'); + ({ foo: 1, bar: 2, baz: 3 }).should.contain.any.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'); +} + +function exxtensible() { + expect({}).to.be.extensible; + expect(Object.preventExtensions({})).to.be.not.extensible; + ({}).should.be.extensible; + Object.preventExtensions({}).should.not.be.extensible; +} +function sealed() { + expect({}).to.be.not.sealed; + expect(Object.seal({})).to.be.sealed; + ({}).should.be.not.sealed; + Object.seal({}).should.be.sealed; +} + +function frozen() { + expect({}).to.be.not.frozen; + expect(Object.freeze({})).to.be.frozen; + ({}).should.be.not.frozen; + Object.freeze({}).should.be.frozen; +} + + +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. + PoorlyConstructedError.prototype = Object.create(Error.prototype); + + var specificError = new RangeError('boo'); + + var goodFn = () => { } + , badFn = () => { throw new Error('testing'); } + , refErrFn = () => { throw new ReferenceError('hello'); } + , ickyErrFn = () => { throw new PoorlyConstructedError(); } + , specificErrFn = () => { throw specificError; }; + + expect(goodFn).to.not.throw(); + goodFn.should.not.throw(); + should.not.throw(goodFn); + expect(goodFn).to.not.throw(Error); + goodFn.should.not.throw(Error); + should.not.throw(goodFn, Error); + expect(goodFn).to.not.throw(specificError); + goodFn.should.not.throw(specificError); + should.not.throw(goodFn, specificError); + + expect(badFn).to.throw(); + badFn.should.throw(); + should.throw(badFn); + expect(badFn).to.throw(Error); + badFn.should.throw(Error); + should.throw(badFn, Error); + expect(badFn).to.not.throw(ReferenceError); + badFn.should.not.throw(ReferenceError); + should.not.throw(badFn, ReferenceError); + expect(badFn).to.not.throw(specificError); + badFn.should.not.throw(specificError); + should.not.throw(badFn, specificError); + + expect(refErrFn).to.throw(); + refErrFn.should.throw(); + should.throw(refErrFn); + expect(refErrFn).to.throw(ReferenceError); + refErrFn.should.throw(ReferenceError); + should.throw(refErrFn, ReferenceError); + expect(refErrFn).to.throw(Error); + refErrFn.should.throw(Error); + should.throw(refErrFn, Error); + expect(refErrFn).to.not.throw(TypeError); + refErrFn.should.not.throw(TypeError); + should.not.throw(refErrFn, TypeError); + expect(refErrFn).to.not.throw(specificError); + refErrFn.should.not.throw(specificError); + should.not.throw(refErrFn, specificError); + + expect(ickyErrFn).to.throw(); + ickyErrFn.should.throw(); + should.throw(ickyErrFn); + expect(ickyErrFn).to.throw(PoorlyConstructedError); + ickyErrFn.should.throw(PoorlyConstructedError); + should.throw(ickyErrFn, PoorlyConstructedError); + expect(ickyErrFn).to.throw(Error); + ickyErrFn.should.throw(Error); + should.throw(ickyErrFn, Error); + expect(ickyErrFn).to.not.throw(specificError); + ickyErrFn.should.not.throw(specificError); + should.not.throw(ickyErrFn, specificError); + expect(specificErrFn).to.throw(specificError); + specificErrFn.should.throw(specificError); + should.throw(ickyErrFn, specificError); + + expect(badFn).to.throw(/testing/); + badFn.should.throw(/testing/); + should.throw(badFn, /testing/); + expect(badFn).to.not.throw(/hello/); + badFn.should.not.throw(/hello/); + should.not.throw(badFn, /hello/); + expect(badFn).to.throw('testing'); + badFn.should.throw('testing'); + should.throw(badFn, 'testing'); + expect(badFn).to.not.throw('hello'); + badFn.should.not.throw('hello'); + should.not.throw(badFn, 'hello'); + + expect(badFn).to.throw(Error, /testing/); + badFn.should.throw(Error, /testing/); + should.throw(badFn, Error, /testing/); + expect(badFn).to.throw(Error, 'testing'); + badFn.should.throw(Error, 'testing'); + should.throw(badFn, Error, 'testing'); + + err(() => { + expect(goodFn).to.throw(); + 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\''); +} + +function use() { + // ReSharper disable once InconsistentNaming + chai.use((_chai) => { + _chai.can.use.any(); + }); +} + +class Klass { + val: number; + constructor() { this.val = 0; } + bar() { } + + static baz() { } +} + +function respondTo() { + var obj = new Klass(); + + expect(Klass).to.respondTo('bar'); + expect(obj).respondsTo('bar'); + Klass.should.respondTo('bar'); + Klass.should.respondsTo('bar'); + expect(Klass).to.not.respondTo('foo'); + Klass.should.not.respondTo('foo'); + expect(Klass).itself.to.respondTo('func'); + expect(Klass).itself.not.to.respondTo('bar'); + + expect(obj).not.to.respondTo('foo'); + obj.should.not.respondTo('foo'); + + err(() => { + expect(Klass).to.respondTo('baz', 'constructor'); + Klass.should.respondTo('baz', 'constructor'); + }, /^(constructor: expected)(.*)(\[Function: Klass\])(.*)(to respond to \'baz\')$/); + + err(() => { + expect(obj).to.respondTo('baz', 'object'); + obj.should.respondTo('baz', 'object'); + }, /^(object: expected)(.*)(\{ foo: \[Function\] \}|\{ Object \()(.*)(to respond to \'baz\')$/); +} + +function satisfy() { + function matcher(num: number) { + return num === 1; + } + + 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]); + + assert.sameMembers([5, 4], [4, 5]); +} +function sameDeepMembers() { + expect([{ id: 5 }, { id: 4 }]).to.have.same.deep.members([{ id: 4 }, { id: 5 }]); + [{ id: 5 }, { id: 4 }].should.have.same.deep.members([{ id: 4 }, { id: 5 }]); + expect([{ id: 5 }, { id: 4 }]).to.have.same.members([{ id: 5 }, { id: 4 }]); + [{ id: 5 }, { id: 4 }].should.have.same.members([{ id: 5 }, { id: 4 }]); + + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([]); + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 6 }, { id: 3 }]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 6 }, { id: 3 }]); + expect([{ id: 5 }, { id: 4 }]).to.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); + [{ id: 5 }, { id: 4 }].should.not.have.same.members([{ id: 5 }, { id: 4 }, { id: 2 }]); + + assert.sameDeepMembers([{ id: 5 }, { id: 4 }], [{ id: 4 }, { id: 5 }]); +} + +function members() { + expect([5, 4]).members([4, 5]); + expect([5, 4]).members([5, 4]); + + expect([5, 4]).not.members([]); + expect([5, 4]).not.members([6, 3]); + expect([5, 4]).not.members([5, 4, 2]); +} + +function increaseDecreaseChange() { + var obj = { val: 10 }; + var inc = () => { obj.val++; }; + var dec = () => { obj.val--; }; + var same = () => { }; + + expect(inc).to.increase(obj, "val"); + expect(inc).increases(obj, "val"); + expect(inc).to.change(obj, "val"); + + expect(dec).to.decrease(obj, "val"); + expect(dec).decreases(obj, "val"); + expect(dec).to.change(obj, "val"); + expect(dec).changes(obj, "val"); + + expect(inc).to.not.decrease(obj, "val"); + expect(dec).to.not.increase(obj, "val"); + expect(same).to.not.increase(obj, "val"); + expect(same).to.not.decrease(obj, "val"); + expect(same).to.not.change(obj, "val"); + + inc.should.increase(obj, "val"); + inc.should.change(obj, "val"); + + dec.should.decrease(obj, "val"); + dec.should.change(obj, "val"); + + inc.should.not.decrease(obj, "val"); + dec.should.not.increase(obj, "val"); + same.should.not.change(obj, "val"); +} + +//tdd +declare function suite(description: string, action: Function): void; +declare function test(description: string, action: Function): void; + +interface FieldObj { + field: any; +} + +class CrashyObject { + inspect(): void { + throw new Error('Arg\'s inspect() called even though the test passed'); + } +} + +suite('assert', () => { + + test('assert', () => { + var foo = 'bar'; + assert(foo === 'bar', 'expected foo to equal `bar`'); + + err(() => { + assert(foo === 'baz', 'expected foo to equal `bar`'); + }, 'expected foo to equal `bar`'); + }); + + test('isTrue', () => { + assert.isTrue(true); + + err(() => { + assert.isTrue(false); + }, 'expected false to be true'); + + err(() => { + assert.isTrue(1); + }, 'expected 1 to be true'); + + err(() => { + assert.isTrue('test'); + }, 'expected \'test\' to be true'); + }); + + test('ok', () => { + assert.ok(true); + assert.ok(1); + assert.ok('test'); + assert.isOk(true); + assert.isOk(1); + assert.isOk('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('notOk', () => { + assert.notOk(false); + assert.notOk(0); + assert.notOk(''); + assert.isNotOk(false); + assert.isNotOk(0); + assert.isNotOk(''); + + err(() => { + assert.notOk(true); + }, 'expected true to be falsy'); + + err(() => { + assert.notOk(1); + }, 'expected 1 to be falsy'); + + err(() => { + assert.notOk('test'); + }, 'expected \'test\' to be falsy'); + }); + + test('isFalse', () => { + assert.isFalse(false); + + err(() => { + assert.isFalse(true); + }, 'expected true to be false'); + + err(() => { + assert.isFalse(0); + }, 'expected 0 to be false'); + }); + + test('equal', () => { + assert.equal(void (0), undefined); + }); + + test('typeof / notTypeOf', () => { + assert.typeOf('test', 'string'); + assert.typeOf(true, 'boolean'); + assert.typeOf(5, 'number'); + + err(() => { + assert.typeOf(5, 'string'); + }, 'expected 5 to be a string'); + + }); + + 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('isNaN', () => { + assert.isNaN(NaN); + + err(() => { + assert.isNaN(12); + }, 'expected 12 to be NaN'); + }); + + test('isNotNaN', () => { + assert.isNotNaN(12); + + err(() => { + assert.isNotNaN(NaN); + }, 'expected NaN to not NaN'); + }); + + 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 ]'); + }); + + + test('isAbove', () => { + assert.isAbove(10, 5); + + err(() => { + assert.isAbove(1, 5); + }, 'expected 1 to be above 5'); + err(() => { + assert.isAbove(5, 5); + }, 'expected 5 to be above 5'); + }); + + test('isBelow', () => { + assert.isBelow(5, 10); + + err(() => { + assert.isBelow(5, 1); + }, 'expected 5 to be above 1'); + err(() => { + assert.isBelow(5, 5); + }, 'expected 5 to be below 5'); + }); + + test('extensible', () => { assert.extensible({}); }); + test('isExtensible', () => { assert.isExtensible({}); }); + test('notExtensible', () => { assert.notExtensible(Object.preventExtensions({})); }); + test('isNotExtensible', () => { assert.isNotExtensible(Object.preventExtensions({})); }); + + test('sealed', () => { assert.sealed(Object.seal({})); }); + test('isSealed', () => { assert.isSealed(Object.seal({})); }); + test('notSealed', () => { assert.notSealed({}); }); + test('isNotSealed', () => { assert.isNotSealed({}); }); + + test('frozen', () => { assert.frozen(Object.freeze({})); }); + test('isFrozen', () => { assert.isFrozen(Object.freeze({})); }); + test('notFrozen', () => { assert.notFrozen({}); }); + test('isNotFrozen', () => { assert.isNotFrozen({}); }); + +}); From e16ce4a79a83a6c31e90c8661903dc2c36ae511d Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Sat, 19 Dec 2015 03:25:03 +0100 Subject: [PATCH 316/474] export HttpError thanks to a namespace --- http-errors/http-errors-tests.ts | 2 + http-errors/http-errors.d.ts | 156 ++++++++++++++++--------------- 2 files changed, 82 insertions(+), 76 deletions(-) diff --git a/http-errors/http-errors-tests.ts b/http-errors/http-errors-tests.ts index 9ee89d6a6d..4403259008 100644 --- a/http-errors/http-errors-tests.ts +++ b/http-errors/http-errors-tests.ts @@ -67,3 +67,5 @@ var err = new createError['404'](); //createError['404'](); // TypeScript should fail with "Did you mean to include 'new'?" //new createError(); // TypeScript should fail with "Only a void function can be called with the 'new' keyword" + +let error: createError.HttpError; diff --git a/http-errors/http-errors.d.ts b/http-errors/http-errors.d.ts index 6f78ff6a73..e15a7cb4e1 100644 --- a/http-errors/http-errors.d.ts +++ b/http-errors/http-errors.d.ts @@ -4,82 +4,86 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module 'http-errors' { - interface HttpError extends Error { - status: number; - statusCode: number; - expose: boolean; + namespace createHttpError { + + // See https://github.com/jshttp/http-errors/blob/1.3.1/index.js#L42 + interface HttpError extends Error { + status: number; + statusCode: number; + expose: boolean; + } + + interface CreateHttpError { + // See https://github.com/Microsoft/TypeScript/issues/227#issuecomment-50092674 + [code: string]: new() => HttpError; + + (...args: Array): HttpError; + + Continue: new() => HttpError; + SwitchingProtocols: new() => HttpError; + Processing: new() => HttpError; + OK: new() => HttpError; + Created: new() => HttpError; + Accepted: new() => HttpError; + NonAuthoritativeInformation: new() => HttpError; + NoContent: new() => HttpError; + ResetContent: new() => HttpError; + PartialContent: new() => HttpError; + MultiStatus: new() => HttpError; + AlreadyReported: new() => HttpError; + IMUsed: new() => HttpError; + MultipleChoices: new() => HttpError; + MovedPermanently: new() => HttpError; + Found: new() => HttpError; + SeeOther: new() => HttpError; + NotModified: new() => HttpError; + UseProxy: new() => HttpError; + Unused: new() => HttpError; + TemporaryRedirect: new() => HttpError; + PermanentRedirect: new() => HttpError; + BadRequest: new() => HttpError; + Unauthorized: new() => HttpError; + PaymentRequired: new() => HttpError; + Forbidden: new() => HttpError; + NotFound: new() => HttpError; + MethodNotAllowed: new() => HttpError; + NotAcceptable: new() => HttpError; + ProxyAuthenticationRequired: new() => HttpError; + RequestTimeout: new() => HttpError; + Conflict: new() => HttpError; + Gone: new() => HttpError; + LengthRequired: new() => HttpError; + PreconditionFailed: new() => HttpError; + PayloadTooLarge: new() => HttpError; + URITooLong: new() => HttpError; + UnsupportedMediaType: new() => HttpError; + RangeNotSatisfiable: new() => HttpError; + ExpectationFailed: new() => HttpError; + ImATeapot: new() => HttpError; + UnprocessableEntity: new() => HttpError; + Locked: new() => HttpError; + FailedDependency: new() => HttpError; + UnorderedCollection: new() => HttpError; + UpgradeRequired: new() => HttpError; + PreconditionRequired: new() => HttpError; + TooManyRequests: new() => HttpError; + RequestHeaderFieldsTooLarge: new() => HttpError; + UnavailableForLegalReasons: new() => HttpError; + InternalServerError: new() => HttpError; + NotImplemented: new() => HttpError; + BadGateway: new() => HttpError; + ServiceUnavailable: new() => HttpError; + GatewayTimeout: new() => HttpError; + HTTPVersionNotSupported: new() => HttpError; + VariantAlsoNegotiates: new() => HttpError; + InsufficientStorage: new() => HttpError; + LoopDetected: new() => HttpError; + BandwidthLimitExceeded: new() => HttpError; + NotExtended: new() => HttpError; + NetworkAuthenticationRequired: new() => HttpError; + } } - interface CreateHttpError { - // See https://github.com/Microsoft/TypeScript/issues/227#issuecomment-50092674 - [code: string]: new() => HttpError; - - (...args: Array): HttpError; - - Continue: new() => HttpError; - SwitchingProtocols: new() => HttpError; - Processing: new() => HttpError; - OK: new() => HttpError; - Created: new() => HttpError; - Accepted: new() => HttpError; - NonAuthoritativeInformation: new() => HttpError; - NoContent: new() => HttpError; - ResetContent: new() => HttpError; - PartialContent: new() => HttpError; - MultiStatus: new() => HttpError; - AlreadyReported: new() => HttpError; - IMUsed: new() => HttpError; - MultipleChoices: new() => HttpError; - MovedPermanently: new() => HttpError; - Found: new() => HttpError; - SeeOther: new() => HttpError; - NotModified: new() => HttpError; - UseProxy: new() => HttpError; - Unused: new() => HttpError; - TemporaryRedirect: new() => HttpError; - PermanentRedirect: new() => HttpError; - BadRequest: new() => HttpError; - Unauthorized: new() => HttpError; - PaymentRequired: new() => HttpError; - Forbidden: new() => HttpError; - NotFound: new() => HttpError; - MethodNotAllowed: new() => HttpError; - NotAcceptable: new() => HttpError; - ProxyAuthenticationRequired: new() => HttpError; - RequestTimeout: new() => HttpError; - Conflict: new() => HttpError; - Gone: new() => HttpError; - LengthRequired: new() => HttpError; - PreconditionFailed: new() => HttpError; - PayloadTooLarge: new() => HttpError; - URITooLong: new() => HttpError; - UnsupportedMediaType: new() => HttpError; - RangeNotSatisfiable: new() => HttpError; - ExpectationFailed: new() => HttpError; - ImATeapot: new() => HttpError; - UnprocessableEntity: new() => HttpError; - Locked: new() => HttpError; - FailedDependency: new() => HttpError; - UnorderedCollection: new() => HttpError; - UpgradeRequired: new() => HttpError; - PreconditionRequired: new() => HttpError; - TooManyRequests: new() => HttpError; - RequestHeaderFieldsTooLarge: new() => HttpError; - UnavailableForLegalReasons: new() => HttpError; - InternalServerError: new() => HttpError; - NotImplemented: new() => HttpError; - BadGateway: new() => HttpError; - ServiceUnavailable: new() => HttpError; - GatewayTimeout: new() => HttpError; - HTTPVersionNotSupported: new() => HttpError; - VariantAlsoNegotiates: new() => HttpError; - InsufficientStorage: new() => HttpError; - LoopDetected: new() => HttpError; - BandwidthLimitExceeded: new() => HttpError; - NotExtended: new() => HttpError; - NetworkAuthenticationRequired: new() => HttpError; - } - - var httpError: CreateHttpError; - export = httpError; + var createHttpError: createHttpError.CreateHttpError; + export = createHttpError; } From b42e2a25b6e7f0314b7cc9ddd51638870e80c424 Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Sat, 19 Dec 2015 03:26:50 +0100 Subject: [PATCH 317/474] export Response thanks to a namespace --- api-error-handler/api-error-handler-tests.ts | 2 ++ api-error-handler/api-error-handler.d.ts | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/api-error-handler/api-error-handler-tests.ts b/api-error-handler/api-error-handler-tests.ts index 0d0ca85d97..fc92cf9a70 100644 --- a/api-error-handler/api-error-handler-tests.ts +++ b/api-error-handler/api-error-handler-tests.ts @@ -9,3 +9,5 @@ api.get('/users/:userid', function (req, res, next) { }); api.use(errorHandler()); + +let res: errorHandler.Response; diff --git a/api-error-handler/api-error-handler.d.ts b/api-error-handler/api-error-handler.d.ts index d66aabf9b7..90318acd00 100644 --- a/api-error-handler/api-error-handler.d.ts +++ b/api-error-handler/api-error-handler.d.ts @@ -8,6 +8,22 @@ declare module 'api-error-handler' { import * as express from 'express'; + namespace apiErrorHandler { + + // Body response: the JSON returned by api-error-handler + // See https://github.com/expressjs/api-error-handler/blob/1.0.0/index.js + interface Response { + status: number; + stack?: string; + message: string; + + // Client errors + code?: any; + name?: string; + type?: any; + } + } + function apiErrorHandler(options?: any): express.ErrorRequestHandler; export = apiErrorHandler; From 95c02169ba8fa58ac1092422efbd2e3174a206f4 Mon Sep 17 00:00:00 2001 From: Jungman Date: Sat, 19 Dec 2015 20:35:43 +0900 Subject: [PATCH 318/474] Add missing properties for webpack --- webpack/webpack-tests.ts | 27 +++++++++++++++++++++++++++ webpack/webpack.d.ts | 5 ++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/webpack/webpack-tests.ts b/webpack/webpack-tests.ts index 27a4a53854..8d794968f2 100644 --- a/webpack/webpack-tests.ts +++ b/webpack/webpack-tests.ts @@ -232,6 +232,33 @@ configuration = { configuration = { output: { chunkFilename: "[chunkhash].bundle.js" } }; +// +// https://webpack.github.io/docs/configuration.html +// + +configuration = { + entry: [ + "./entry1", + "./entry2" + ] +}; + +configuration = { + devtool: "#inline-source-map" +}; + +loader = { + test: /\.jsx$/, + include: [ + path.resolve(__dirname, "app/src"), + path.resolve(__dirname, "app/test") + ], + exclude: [ + path.resolve(__dirname, "node_modules") + ], + loader: "babel-loader" +}; + declare var require: any; declare var path: any; configuration = { diff --git a/webpack/webpack.d.ts b/webpack/webpack.d.ts index f2049bbc94..3889446b28 100644 --- a/webpack/webpack.d.ts +++ b/webpack/webpack.d.ts @@ -6,7 +6,8 @@ declare module "webpack" { namespace webpack { interface Configuration { - entry?: string|Entry; + entry?: string|string[]|Entry; + devtool?: string; output?: Output; module?: Module; plugins?: (Plugin|Function)[]; @@ -28,6 +29,8 @@ declare module "webpack" { } interface Loader { + exclude?: string[]; + include?: string[]; test: RegExp; loader?: string; loaders?: string[]; From 86897d7a5c90e73abbf313a38e58797410e9b1f4 Mon Sep 17 00:00:00 2001 From: Hugo ESQUIBET Date: Sat, 19 Dec 2015 16:47:34 +0100 Subject: [PATCH 319/474] adding react-select typings support from https://github.com/JedWatson/react-select --- react-select/react-select.d.ts | 63 ++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 react-select/react-select.d.ts diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts new file mode 100644 index 0000000000..b79126345b --- /dev/null +++ b/react-select/react-select.d.ts @@ -0,0 +1,63 @@ +/// + +// Typings for https://github.com/JedWatson/react-select +//***Usage*** +// import ReactSelect = require('react-select'); +// + +declare module "react-select" { + // Import React + import React = require("react"); + + interface Option{ + label : string; + value : any; + } + + interface ReactSelectProps extends React.Props{ + addLabelText? : string; + allowCreate? : boolean; + asyncOptions? : ()=>any; + autoload? : boolean; + backspaceRemoves? : boolean; + cacheAsyncResults? : boolean; + className? : string; + clearable? : boolean; + clearAllText? : string; + clearValueText? : string; + delimiter? : string; + disabled? : boolean; + filterOption? : (option,filterString : string)=>any; + filterOptions? : (options:Array,filterString : string,values : Array)=>any; + ignoreCase? : boolean; // default true whether to perform case-insensitive filtering + inputProps? : any; + isLoading? : boolean; + labelKey? : string; + matchPos? : string; + matchProp? : string; + multi? : boolean; + name? : string; + newOptionCreator? : ()=>any; + noResultsText? : string; + onBlur? : (event)=>void; + onChange? : (newValue)=>void; + onFocus? : (event)=>void; + onInputChange? : (inputValue)=>void; + onOptionLabelClick? : (value, event)=>void; + optionRenderer? : ()=>void; + options? : Array