From d8ecb4d77d64a7d5520eeb9d93fdd3d517c99291 Mon Sep 17 00:00:00 2001 From: Gidon Date: Sun, 13 Jul 2014 18:27:15 +0300 Subject: [PATCH 01/40] Fixed typeahead signatures - Updated according to official documentation: see https://github.com/twitter/typeahead.js/blob/master/doc/jquery_typeahead.md - Added one more test (from official samples) --- typeahead/typeahead-tests.ts | 57 ++++++++++++++++++++++++++++++++---- typeahead/typeahead.d.ts | 29 ++++++++---------- 2 files changed, 64 insertions(+), 22 deletions(-) diff --git a/typeahead/typeahead-tests.ts b/typeahead/typeahead-tests.ts index 67fc8d31a..5ce51629d 100644 --- a/typeahead/typeahead-tests.ts +++ b/typeahead/typeahead-tests.ts @@ -8,7 +8,7 @@ declare var Hogan: string; // Countries // Prefetches data, stores it in localStorage, and searches it on the client -$('.example-countries .typeahead').typeahead({ +$('.example-countries .typeahead').typeahead(null, { name: 'countries', prefetch: '../data/countries.json', limit: 10 @@ -16,7 +16,7 @@ $('.example-countries .typeahead').typeahead({ // Open Source Projects by Twitter // Defines a custom template and template engine for rendering suggestions -$('.example-twitter-oss .typeahead').typeahead({ +$('.example-twitter-oss .typeahead').typeahead(null, { name: 'twitter-oss', prefetch: '../data/repos.json', template: [ @@ -29,7 +29,7 @@ $('.example-twitter-oss .typeahead').typeahead({ // Arabic Phrases // Hardcoded list showing Right - To - Left(RTL) support -$('.example-arabic .typeahead').typeahead({ +$('.example-arabic .typeahead').typeahead(null, { name: 'arabic', local: [ "الإنجليزية", @@ -47,7 +47,7 @@ $('.example-arabic .typeahead').typeahead({ // NBA and NHL Teams // Two datasets that are prefetched, stored, and searched on the client -$('.example-sports .typeahead').typeahead([ +$('.example-sports .typeahead').typeahead(null, [ { name: 'nba-teams', prefetch: '../data/nba.json', @@ -62,7 +62,7 @@ $('.example-sports .typeahead').typeahead([ // Best Picture Winners // Prefetches some data then relies on remote requests for suggestions when prefetched data is insufficient -$('.example-films .typeahead').typeahead([ +$('.example-films .typeahead').typeahead(null, [ { name: 'best-picture-winners', remote: '../data/films/queries/%QUERY.json', @@ -85,3 +85,50 @@ $('.example-countries .typeahead').typeahead({ prefetch: '../data/countries.json', limit: 10 }); + + +var substringMatcher = function (strs) { + return function findMatches(q, cb) { + var matches, substrRegex; + + // an array that will be populated with substring matches + matches = []; + + // regex used to determine if a string contains the substring `q` + substrRegex = new RegExp(q, 'i'); + + // iterate through the pool of strings and for any string that + // contains the substring `q`, add it to the `matches` array + $.each(strs, function (i, str) { + if (substrRegex.test(str)) { + // the typeahead jQuery plugin expects suggestions to a + // JavaScript object, refer to typeahead docs for more info + matches.push({ value: str }); + } + }); + + cb(matches); + }; +}; + +var states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', + 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', + 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', + 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', + 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', + 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', + 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', + 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', + 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming' +]; + +$('#the-basics .typeahead').typeahead({ + hint: true, + highlight: true, + minLength: 1 +}, + { + name: 'states', + displayKey: 'value', + source: substringMatcher(states) + }); \ No newline at end of file diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index f6f387986..3f4c61b1d 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -6,21 +6,6 @@ /// interface JQuery { - /** - * Turns an input[type="text"] element into a typeahead. - * - * @constructor - * @param dataset Single dataset - */ - typeahead(dataset: Twitter.Typeahead.Dataset): JQuery; - - /** - * Turns an input[type="text"] element into a typeahead. - * - * @constructor - * @param dataset Array of datasets - */ - typeahead(datasets: Twitter.Typeahead.Dataset[]): JQuery; /** * Destroys previously initialized typeaheads. This entails reverting @@ -57,9 +42,19 @@ interface JQuery { * * @constructor * @param options ('hint' or 'highlight' or 'minLength' all of which are optional) - * @param dataset Array of datasets + * @param datasets Array of datasets */ - typeahead(options: Twitter.Typeahead.Options, dataset: Twitter.Typeahead.Dataset): JQuery; + typeahead(options: Twitter.Typeahead.Options, datasets: Twitter.Typeahead.Dataset[]): JQuery; + + /** + * Accomodates specifying options such as hint and highlight. + * This is in correspondence to the examples mentioned in http://twitter.github.io/typeahead.js/examples/ + * + * @constructor + * @param options ('hint' or 'highlight' or 'minLength' all of which are optional) + * @param datasets One or more datasets passed in as arguments. + */ + typeahead(options: Twitter.Typeahead.Options, ... datasets: Twitter.Typeahead.Dataset[]): JQuery; } declare module Twitter.Typeahead { From 2cc58f14033679b5775c524c3a95f041fd90dc75 Mon Sep 17 00:00:00 2001 From: Gidon Date: Wed, 16 Jul 2014 16:58:46 +0300 Subject: [PATCH 02/40] Updated to typeahead 0.10.4 Updated from 0.9.3 to 0.10.4 API has changed quite a bit. Part of the functionality (prefetch etc) has been taken out from the core lib, and merged into a new lib called Bloodhound. Bloodhound still has to be ts-ed. --- typeahead/typeahead-tests.ts | 99 +++--------- typeahead/typeahead.d.ts | 283 ++++++++++++----------------------- 2 files changed, 116 insertions(+), 266 deletions(-) diff --git a/typeahead/typeahead-tests.ts b/typeahead/typeahead-tests.ts index 5ce51629d..835fbfb57 100644 --- a/typeahead/typeahead-tests.ts +++ b/typeahead/typeahead-tests.ts @@ -6,87 +6,6 @@ // declare var Hogan: string; -// Countries -// Prefetches data, stores it in localStorage, and searches it on the client -$('.example-countries .typeahead').typeahead(null, { - name: 'countries', - prefetch: '../data/countries.json', - limit: 10 -}); - -// Open Source Projects by Twitter -// Defines a custom template and template engine for rendering suggestions -$('.example-twitter-oss .typeahead').typeahead(null, { - name: 'twitter-oss', - prefetch: '../data/repos.json', - template: [ - '

{{language}}

', - '

{{name}}

', - '

{{description}}

' - ].join(''), - engine: Hogan -}); - -// Arabic Phrases -// Hardcoded list showing Right - To - Left(RTL) support -$('.example-arabic .typeahead').typeahead(null, { - name: 'arabic', - local: [ - "الإنجليزية", - "نعم", - "لا", - "مرحبا", - "کيف الحال؟", - "أهلا", - "مع السلامة", - "لا أتكلم العربية", - "لا أفهم", - "أنا جائع" - ] -}); - -// NBA and NHL Teams -// Two datasets that are prefetched, stored, and searched on the client -$('.example-sports .typeahead').typeahead(null, [ - { - name: 'nba-teams', - prefetch: '../data/nba.json', - header: '

NBA Teams

' - }, - { - name: 'nhl-teams', - prefetch: '../data/nhl.json', - header: '

NHL Teams

' - } -]); - -// Best Picture Winners -// Prefetches some data then relies on remote requests for suggestions when prefetched data is insufficient -$('.example-films .typeahead').typeahead(null, [ - { - name: 'best-picture-winners', - remote: '../data/films/queries/%QUERY.json', - prefetch: '../data/films/post_1960.json', - template: '

{{value}} – {{year}}

', - engine: Hogan - } -]); - -// Countries - Modified the first test here to add options -// Specifies options to display hint with a highlight and adds a minimum length restriction for search -// Prefetches data, stores it in localStorage, and searches it on the client -$('.example-countries .typeahead').typeahead({ - hint: true, - highlight: true, - minLength: 2 -}, -{ - name: 'countries', - prefetch: '../data/countries.json', - limit: 10 -}); - - var substringMatcher = function (strs) { return function findMatches(q, cb) { var matches, substrRegex; @@ -131,4 +50,20 @@ $('#the-basics .typeahead').typeahead({ name: 'states', displayKey: 'value', source: substringMatcher(states) - }); \ No newline at end of file + }); + + +// custom templates +$('#custom-templates .typeahead').typeahead(null, { + name: 'best-pictures', + displayKey: 'value', + source: bestPictures.ttAdapter(), + templates: { + empty: [ + '
', + 'unable to find any Best Picture winners that match the current query', + '
' + ].join('\n'), + suggestion: Handlebars.compile('

{{value}} – {{year}}

') + } +}); \ No newline at end of file diff --git a/typeahead/typeahead.d.ts b/typeahead/typeahead.d.ts index 3f4c61b1d..fe8584639 100644 --- a/typeahead/typeahead.d.ts +++ b/typeahead/typeahead.d.ts @@ -1,6 +1,6 @@ -// Type definitions for typeahead.js 0.9.3 +// Type definitions for typeahead.js 0.10.4 // Project: http://twitter.github.io/typeahead.js/ -// Definitions by: Ivaylo Gochkov +// Definitions by: Ivaylo Gochkov , Gidon Junge // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -17,22 +17,55 @@ interface JQuery { typeahead(methodName: 'destroy'): JQuery; /** - * Sets the current query of the typeahead. This is always preferable to - * using $("input.typeahead").val(query), which will result in unexpected - * behavior. To clear the query, simply set it to an empty string. - * - * @constructor - * @param methodName Method 'setQuery' - * @param query The query to be set - */ - typeahead(methodName: 'setQuery', query: string): JQuery; + * Opens the dropdown menu of typeahead. Note that being open does not mean that the menu is visible. + * The menu is only visible when it is open and has content. + * + * @constructor + * @param methodName Method 'open' + */ + typeahead(methodName: 'open'): JQuery; /** - * Accommodates the destroy and setQuery overloads. + * Closes the dropdown menu of typeahead. + * + * @constructor + * @param methodName Method 'close' + */ + typeahead(methodName: 'close'): JQuery; + + /** + * Returns the current value of the typeahead. + * The value is the text the user has entered into the input element. + * + * @constructor + * @param methodName Method 'val' + */ + typeahead(methodName: 'val'): string; + + /** + * Sets the value of the typeahead. This should be used in place of jQuery#val. * * @constructor - * @param methodName Method name ('destroy' or 'setQuery') - * @param query The query to be set in case method 'setQuery' is used. + * @param methodName Method 'val' + * @param query The value to be set + */ + typeahead(methodName: 'val', val: string): JQuery; + + /** + * Accommodates the val overload. + * + * @constructor + * @param methodName Method name ('val') + */ + typeahead(methodName: string): string; + + + /** + * Accommodates multiple overloads. + * + * @constructor + * @param methodName Method name + * @param query The query to be set in case method 'val' is used. */ typeahead(methodName: string, query: string): JQuery; @@ -66,188 +99,70 @@ declare module Twitter.Typeahead { */ interface Dataset { /** - * The string used to identify the dataset. Used by typeahead.js - * to cache intelligently. - */ - name: string; + * The backing data source for suggestions. + * Expected to be a function with the signature (query, cb). + * It is expected that the function will compute the suggestion set (i.e. an array of JavaScript objects) for query and then invoke cb with said set. + * cb can be invoked synchronously or asynchronously. + * + */ + source: (query: string, cb: (result: any) => void) => void; + /** - * The key used to access the value of the datum in the datum object. - * Defaults to value. + * The name of the dataset. + * This will be appended to tt-dataset- to form the class name of the containing DOM element. + * Must only consist of underscores, dashes, letters (a-z), and numbers. + * Defaults to a random number. */ - valueKey?: string; + name?: string; + /** - * The max number of suggestions from the dataset to display - * for a given query. Defaults to 5. - */ - limit?: number; + * For a given suggestion object, determines the string representation of it. + * This will be used when setting the value of the input control after a suggestion is selected. Can be either a key string or a function that transforms a suggestion object into a string. + * Defaults to value. + */ + displayKey?: string; + /** - * The template used to render suggestions. Can be a string or - * a precompiled template. If not provided, suggestions will render - * as their value contained in a

element (i.e.

value

). - */ - template?: any; - /** - * The template engine used to compile/render template if it is a - * string. Any engine can use used as long as it adheres to the - * expected API. Required if template is a string. - */ - engine?: string; - /** - * The header rendered before suggestions in the dropdown menu. - * Can be either a DOM element or HTML. - */ - header?: any; - /** - * The footer rendered after suggestions in the dropdown menu. - * Can be either a DOM element or HTML. - */ - footer?: any; - /** - * An array of datums or strings. - */ - local?: any[]; - /** - * Can be a URL to a JSON file containing an array of datums or, - * if more configurability is needed, a prefetch options object. - */ - prefetch?: any; - /** - * Can be a URL to fetch suggestions from when the data provided by - * local and prefetch is insufficient or, if more configurability is - * needed, a remote options object. - */ - remote?: any; + * A hash of templates to be used when rendering the dataset. + * Note a precompiled template is a function that takes a JavaScript object as its first argument and returns a HTML string. + */ + templates?: Templates; } - /** - * Prefetched data is fetched and processed on initialization. - * If the browser supports localStorage, the processed data will be cached - * there to prevent additional network requests on subsequent page loads. - */ - interface PrefetchOptions { - /** - * A URL to a JSON file containing an array of datums. Required. - */ - url: string; + + interface Templates { /** - * The time (in milliseconds) the prefetched data should be cached - * in localStorage. Defaults to 86400000 (1 day). - */ - ttl?: number; + * Rendered when 0 suggestions are available for the given query. + * Can be either a HTML string or a precompiled template. + * If it's a precompiled template, the passed in context will contain query + */ + empty?: string; /** - * A function that transforms the response body into an array of datums. - * - * @param parsedResponse Response body - */ - filter?: (parsedResponse: any) => Datum[]; + * Rendered at the bottom of the dataset. + * Can be either a HTML string or a precompiled template. + * If it's a precompiled template, the passed in context will contain query and isEmpty. + */ + footer?: string; + + /** + * Rendered at the top of the dataset. + * Can be either a HTML string or a precompiled template. + * If it's a precompiled template, the passed in context will contain query and isEmpty. + */ + header?: string; + + /** + * Used to render a single suggestion. + * If set, this has to be a precompiled template. + * The associated suggestion object will serve as the context. + * Defaults to the value of displayKey wrapped in a p tag i.e.

{{value}}

. + */ + suggestion?: string; + } - /** - * Remote data is only used when the data provided by local and prefetch - * is insufficient. In order to prevent an obscene number of requests - * being made to remote endpoint, typeahead.js rate-limits remote requests. - */ - interface RemoteOptions { - /** - * A URL to make requests to when the data provided by local and - * prefetch is insufficient. Required. - */ - url: string; - - /** - * The type of data you're expecting from the server. Defaults to json. - * @see http://api.jquery.com/jQuery.ajax/ for more info. - */ - dataType?: string; - - /** - * Determines whether or not the browser will cache responses. - * @see http://api.jquery.com/jQuery.ajax/ for more info. - */ - cache?: boolean; - - /** - * Sets a timeout for requests. - * @see http://api.jquery.com/jQuery.ajax/ for more info. - */ - timeout?: number; - - /** - * The pattern in url that will be replaced with the user's query - * when a request is made. Defaults to %QUERY. - */ - wildcard?: string; - - /** - * Overrides the request URL. If set, no wildcard substitution will - * be performed on url. - * - * @param url Replacement URL - * @param uriEncodedQuery Encoded query - * @returns A valid URL - */ - replace?: (url: string, uriEncodedQuery: string) => string; - - /** - * The function used for rate-limiting network requests. - * Can be either 'debounce' or 'throttle'. Defaults to 'debounce'. - */ - rateLimitFn?: string; - - /** - * The time interval in milliseconds that will be used by rateLimitFn. - * Defaults to 300. - */ - rateLimitWait?: number; - - /** - * The max number of parallel requests typeahead.js can have pending. - * Defaults to 6. - */ - maxParallelRequests?: number; - - /** - * A pre-request callback. Can be used to set custom headers. - * @see http://api.jquery.com/jQuery.ajax/ for more info. - */ - beforeSend?: (jqXhr: JQueryXHR, settings: JQueryAjaxSettings) => void; - - /** - * Transforms the response body into an array of datums. - * - * @param parsedResponse Response body - */ - filter?: (parsedResponse: any) => Datum[]; - } - - /** - * The individual units that compose datasets are called datums. - * The canonical form of a datum is an object with a value property and - * a tokens property. - * - * For ease of use, datums can also be represented as a string. - * Strings found in place of datum objects are implicitly converted - * to a datum object. - * - * When datums are rendered as suggestions, the datum object is the - * context passed to the template engine. This means if you include any - * arbitrary properties in datum objects, those properties will be - * available to the template used to render suggestions. - */ - interface Datum { - /** - * The string that represents the underlying value of the datum - */ - value: string; - - /** - * A collection of single-word strings that aid typeahead.js in - * matching datums with a given query. - */ - tokens: string[]; - } /** * When initializing a typeahead, there are a number of options you can configure. From 0421179b561d7cd227cbfd55b09b63ca9eeddca6 Mon Sep 17 00:00:00 2001 From: Gidon Date: Wed, 16 Jul 2014 17:04:51 +0300 Subject: [PATCH 03/40] Fixed Tests for Typeahead --- typeahead/typeahead-tests.ts | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/typeahead/typeahead-tests.ts b/typeahead/typeahead-tests.ts index 835fbfb57..aa8a400b6 100644 --- a/typeahead/typeahead-tests.ts +++ b/typeahead/typeahead-tests.ts @@ -6,9 +6,9 @@ // declare var Hogan: string; -var substringMatcher = function (strs) { - return function findMatches(q, cb) { - var matches, substrRegex; +var substringMatcher = function (strs: any) { + return function findMatches(q: any, cb: any) { + var matches: any, substrRegex: any; // an array that will be populated with substring matches matches = []; @@ -52,18 +52,3 @@ $('#the-basics .typeahead').typeahead({ source: substringMatcher(states) }); - -// custom templates -$('#custom-templates .typeahead').typeahead(null, { - name: 'best-pictures', - displayKey: 'value', - source: bestPictures.ttAdapter(), - templates: { - empty: [ - '
', - 'unable to find any Best Picture winners that match the current query', - '
' - ].join('\n'), - suggestion: Handlebars.compile('

{{value}} – {{year}}

') - } -}); \ No newline at end of file From 05ba8a69a5c48d95ec16d89bb900403300012a4e Mon Sep 17 00:00:00 2001 From: Gidon Date: Thu, 17 Jul 2014 15:43:06 +0300 Subject: [PATCH 04/40] Updated History JS Upgraded to version 1.8, which is now community supported. --- history/history.d.ts | 60 +++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/history/history.d.ts b/history/history.d.ts index a8a3c4004..07a31d011 100644 --- a/history/history.d.ts +++ b/history/history.d.ts @@ -1,13 +1,13 @@ -// Type definitions for History.js -// Project: https://github.com/balupton/History.js -// Definitions by: Boris Yankov +// Type definitions for History.js 1.8.0 +// Project: https://github.com/browserstate/history.js +// Definitions by: Boris Yankov , Gidon Junge // Definitions: https://github.com/borisyankov/DefinitelyTyped interface HistoryAdapter { - bind(element, event, callback); - trigger(element, event); - onDomLoad(callback); + bind(element: any, event: string, callback: () => void); + trigger(element: any, event: string); + onDomLoad(callback: () => void); } // Since History is defined in lib.d.ts as well @@ -17,15 +17,45 @@ interface HistoryAdapter { // var Historyjs: Historyjs = History; interface Historyjs { + enabled: boolean; - pushState(data, title, url); - replaceState(data, title, url); - getState(); - getHash(); + + pushState(data: any, title: string, url: string); + replaceState(data: any, title: string, url: string); + getState(): HistoryState; + getStateByIndex(index: number): HistoryState; + getCurrentIndex(): number; + getHash(): string; + Adapter: HistoryAdapter; - back(); - forward(); - go(X); - log(...messages: any[]); - debug(...messages: any[]); + + back(): void; + forward(): void; + go(x: Number): void; + + log(...messages: any[]): void; + debug(...messages: any[]): void; + + options: HistoryOptions; } + +interface HistoryState { + data?: any; + title?: string; + url: string; +} + +interface HistoryOptions { + hashChangeInterval?: number; + safariPollInterval?: number; + doubleCheckInterval?: number; + disableSuid?: boolean; + storeInterval?: number; + busyDelay?: number; + debug?: boolean; + initialTitle?: string; + html4Mode?: boolean; + delayInit?: number; + + +} \ No newline at end of file From 86c0c56e6e3b28debedf3baf5cb5bf377b8e217a Mon Sep 17 00:00:00 2001 From: cristian-harja Date: Thu, 7 Aug 2014 18:24:18 +0300 Subject: [PATCH 05/40] missing Promise.nodeify() added --- q/Q.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/q/Q.d.ts b/q/Q.d.ts index 617bf0140..f567c5871 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -101,6 +101,11 @@ declare module Q { */ done(onFulfilled?: (value: T) => any, onRejected?: (reason: any) => any, onProgress?: (progress: any) => any): void; + /** + * If callback is a function, assumes it's a Node.js-style callback, and calls it as either callback(rejectionReason) when/if promise becomes rejected, or as callback(null, fulfillmentValue) when/if promise becomes fulfilled. If callback is not a function, simply returns promise. + */ + nodeify(callback: (reason: any, value: any) => void): void; + /** * Returns a promise to get the named property of an object. Essentially equivalent to * @@ -161,7 +166,7 @@ declare module Q { * Returns whether a given promise is in the pending state. When the static version is used on non-promises, the result is always false. */ isPending(): boolean; - + valueOf(): any; /** From 72bd7d59384da174d0f4d98ac575c306967a6b23 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 21 Aug 2014 18:53:33 -0700 Subject: [PATCH 06/40] Added emit function to Dropzone See the docs for some [examples using emit](https://github.com/enyo/dropzone/wiki/FAQ#how-to-show-files-already-stored-on-server) I can't find any other usage so this covers the two events that I am aware of: `addedfile` and `thumbnail` --- dropzone/dropzone.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dropzone/dropzone.d.ts b/dropzone/dropzone.d.ts index 81596d88a..0c754fbd5 100644 --- a/dropzone/dropzone.d.ts +++ b/dropzone/dropzone.d.ts @@ -72,6 +72,8 @@ declare class Dropzone { getRejectedFiles(): DropzoneFile[]; getQueuedFiles(): DropzoneFile[]; getUploadingFiles(): DropzoneFile[]; + + emit(eventName: string, file: DropzoneFile, data?: string); } interface JQuery { From 28428d34bee80c815d226353664a62d97b56ffe0 Mon Sep 17 00:00:00 2001 From: satoru kimura Date: Fri, 22 Aug 2014 14:02:08 +0900 Subject: [PATCH 07/40] Rearranged the order of the methods and properties in this definition, to be consistent with the original JS code. --- threejs/three.d.ts | 1945 ++++++++++++++++++++++++-------------------- 1 file changed, 1041 insertions(+), 904 deletions(-) diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 2eb17c19b..fa6208990 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -8,33 +8,7 @@ interface WebGLRenderingContext {} declare module THREE { export var REVISION: string; - // custom blending equations - // (numbers start from 100 not to clash with other - // mappings to OpenGL constants defined in Texture.js) - export enum BlendingEquation { } - export var AddEquation: BlendingEquation; - export var SubtractEquation: BlendingEquation; - export var ReverseSubtractEquation: BlendingEquation; - - // custom blending destination factors - export enum BlendingDstFactor { } - export var ZeroFactor: BlendingDstFactor; - export var OneFactor: BlendingDstFactor; - export var SrcColorFactor: BlendingDstFactor; - export var OneMinusSrcColorFactor: BlendingDstFactor; - export var SrcAlphaFactor: BlendingDstFactor; - export var OneMinusSrcAlphaFactor: BlendingDstFactor; - export var DstAlphaFactor: BlendingDstFactor; - export var OneMinusDstAlphaFactor: BlendingDstFactor; - - // custom blending source factors - export enum BlendingSrcFactor { } - export var DstColorFactor: BlendingSrcFactor; - export var OneMinusDstColorFactor: BlendingSrcFactor; - export var SrcAlphaSaturateFactor: BlendingSrcFactor; - // GL STATE CONSTANTS - export enum CullFace { } export var CullFaceNone: CullFace; export var CullFaceBack: CullFace; @@ -45,6 +19,12 @@ declare module THREE { export var FrontFaceDirectionCW: FrontFaceDirection; export var FrontFaceDirectionCCW: FrontFaceDirection; + // Shadowing Type + export enum ShadowMapType { } + export var BasicShadowMap: ShadowMapType; + export var PCFShadowMap: ShadowMapType; + export var PCFSoftShadowMap: ShadowMapType; + // MATERIAL CONSTANTS // side @@ -74,11 +54,30 @@ declare module THREE { export var MultiplyBlending: Blending; export var CustomBlending: Blending; - // Shadowing Type - export enum ShadowMapType { } - export var BasicShadowMap: ShadowMapType; - export var PCFShadowMap: ShadowMapType; - export var PCFSoftShadowMap: ShadowMapType; + // custom blending equations + // (numbers start from 100 not to clash with other + // mappings to OpenGL constants defined in Texture.js) + export enum BlendingEquation { } + export var AddEquation: BlendingEquation; + export var SubtractEquation: BlendingEquation; + export var ReverseSubtractEquation: BlendingEquation; + + // custom blending destination factors + export enum BlendingDstFactor { } + export var ZeroFactor: BlendingDstFactor; + export var OneFactor: BlendingDstFactor; + export var SrcColorFactor: BlendingDstFactor; + export var OneMinusSrcColorFactor: BlendingDstFactor; + export var SrcAlphaFactor: BlendingDstFactor; + export var OneMinusSrcAlphaFactor: BlendingDstFactor; + export var DstAlphaFactor: BlendingDstFactor; + export var OneMinusDstAlphaFactor: BlendingDstFactor; + + // custom blending src factors + export enum BlendingSrcFactor { } + export var DstColorFactor: BlendingSrcFactor; + export var OneMinusDstColorFactor: BlendingSrcFactor; + export var SrcAlphaSaturateFactor: BlendingSrcFactor; // TEXTURE CONSTANTS // Operations @@ -94,9 +93,7 @@ declare module THREE { } export var UVMapping: MappingConstructor; export var CubeReflectionMapping: MappingConstructor; - export var CubeRefractionMapping: MappingConstructor; export var SphericalReflectionMapping: MappingConstructor; - export var SphericalRefractionMapping: MappingConstructor; // Wrapping modes export enum Wrapping { } @@ -125,7 +122,6 @@ declare module THREE { // Pixel types export enum PixelType { } - export var UnsignedShort4444Type: PixelType; export var UnsignedShort5551Type: PixelType; export var UnsignedShort565Type: PixelType; @@ -145,6 +141,7 @@ declare module THREE { export var RGBA_S3TC_DXT3_Format: CompressedPixelFormat; export var RGBA_S3TC_DXT5_Format: CompressedPixelFormat; + // Cameras //////////////////////////////////////////////////////////////////////////////////////// /** @@ -171,6 +168,7 @@ declare module THREE { * @param vector point to look at */ lookAt(vector: Vector3): void; + clone(camera?: Camera): Camera; } @@ -335,9 +333,9 @@ declare module THREE { // Core /////////////////////////////////////////////////////////////////////////////////////////////// export class BufferAttribute { - constructor(array: any, itemSize: number); + constructor(array: any, itemSize: number); // array parameter should be TypedArray. - array: any; + array: number[]; itemSize: number; length: number; @@ -352,47 +350,47 @@ declare module THREE { // deprecated export class Int8Attribute extends BufferAttribute{ - constructor(data: any[], itemSize: number); + constructor(data: any, itemSize: number); } // deprecated export class Uint8Attribute extends BufferAttribute { - constructor(data: any[], itemSize: number); + constructor(data: any, itemSize: number); } // deprecated export class Uint8ClampedAttribute extends BufferAttribute { - constructor(data: any[], itemSize: number); + constructor(data: any, itemSize: number); } // deprecated export class Int16Attribute extends BufferAttribute { - constructor(data: any[], itemSize: number); + constructor(data: any, itemSize: number); } // deprecated export class Uint16Attribute extends BufferAttribute { - constructor(data: any[], itemSize: number); + constructor(data: any, itemSize: number); } // deprecated export class Int32Attribute extends BufferAttribute { - constructor(data: any[], itemSize: number); + constructor(data: any, itemSize: number); } // deprecated export class Uint32Attribute extends BufferAttribute { - constructor(data: any[], itemSize: number); + constructor(data: any, itemSize: number); } // deprecated export class Float32Attribute extends BufferAttribute { - constructor(data: any[], itemSize: number); + constructor(data: any, itemSize: number); } // deprecated export class Float64Attribute extends BufferAttribute { - constructor(data: any[], itemSize: number); + constructor(data: any, itemSize: number); } /** @@ -412,7 +410,6 @@ declare module THREE { * Unique number of this buffergeometry instance */ id: number; - uuid: string; name: string; attributes: BufferAttribute[]; @@ -445,6 +442,9 @@ declare module THREE { */ computeBoundingSphere(): void; + // deprecated + computeFaceNormals(): void; + /** * Computes vertex normals by averaging face normals. */ @@ -635,23 +635,21 @@ declare module THREE { */ c: number; - // properties inherits from Face /////////////////////////////////// - /** * Face normal. */ normal: Vector3; - /** - * Face color. - */ - color: Color; - /** * Array of 4 vertex normals. */ vertexNormals: Vector3[]; + /** + * Face color. + */ + color: Color; + /** * Array of 4 vertex normals. */ @@ -716,6 +714,8 @@ declare module THREE { */ id: number; + uuid: string; + /** * Name for this geometry. Default is an empty string. */ @@ -735,13 +735,6 @@ declare module THREE { */ colors: Color[]; - /** - * Array of vertex normals, matching number and order of vertices. - * Normal vectors are nessecary for lighting - * To signal an update in this array, Geometry.normalsNeedUpdate needs to be set to true. - */ -// normals: Vector3[]; - /** * Array of triangles or/and quads. * The array of faces describe how each vertex in the model is connected with each other. @@ -749,13 +742,6 @@ declare module THREE { */ faces: Face3[]; - /** - * Array of face UV layers. - * Each UV layer is an array of UV matching order and number of faces. - * To signal an update in this array, Geometry.uvsNeedUpdate needs to be set to true. - */ -// faceUvs: Vector2[][]; - /** * Array of face UV layers. * Each UV layer is an array of UV matching order and number of vertices in faces. @@ -901,6 +887,8 @@ declare module THREE { */ computeTangents(): void; + computeLineDistances(): void; + /** * Computes bounding box of the geometry, updating {@link Geometry.boundingBox} attribute. */ @@ -920,6 +908,8 @@ declare module THREE { */ mergeVertices(): number; + makeGroups(usesFaceMaterial: boolean, maxVerticesInGroup: number): void; + /** * Creates a new clone of the Geometry. */ @@ -931,10 +921,6 @@ declare module THREE { */ dispose(): void; - computeLineDistances(): void; - - makeGroups(usesFaceMaterial: boolean, maxVerticesInGroup: number): void; - // EventDispatcher mixins addEventListener(type: string, listener: (event: any) => void ): void; @@ -1063,8 +1049,9 @@ declare module THREE { /** * Order of axis for Euler angles. */ + // deprecated eulerOrder: string; - // eulerOrder:EulerOrder; + /** * This updates the position, rotation and scale with the matrix. @@ -1091,6 +1078,13 @@ declare module THREE { */ setRotationFromQuaternion( q: Quaternion ): void; + /** + * Rotate an object along an axis in object space. The axis is assumed to be normalized. + * @param axis A normalized vector in object space. + * @param angle The angle in radians. + */ + rotateOnAxis(axis: Vector3, angle: number): Object3D; + /** * * @param angle @@ -1109,6 +1103,12 @@ declare module THREE { */ rotateZ(angle: number): Object3D; + /** + * @param axis A normalized vector in object space. + * @param distance The distance to translate. + */ + translateOnAxis(axis: Vector3, distance: number): Object3D; + /** * * @param distance @@ -1187,10 +1187,10 @@ declare module THREE { * @param name String to match to the children's Object3d.name property. * @param recursive Boolean whether to search through the children's children. Default is false. */ - getObjectByName(name: string, recursive: boolean): Object3D; + getObjectByName(name: string, recursive?: boolean): Object3D; - getChildByName( name: string, recursive: boolean ): Object3D; + getChildByName( name: string, recursive?: boolean ): Object3D; /** * Updates local transform. @@ -1209,20 +1209,6 @@ declare module THREE { */ clone(object?: Object3D, recursive?: boolean): Object3D; - /** - * @param axis A normalized vector in object space. - * @param distance The distance to translate. - */ - translateOnAxis(axis: Vector3, distance: number): Object3D; - - /** - * Rotate an object along an axis in object space. The axis is assumed to be normalized. - * @param axis A normalized vector in object space. - * @param angle The angle in radians. - */ - rotateOnAxis(axis: Vector3, angle: number): Object3D; - - // EventDispatcher mixins addEventListener(type: string, listener: (event: any) => void ): void; hasEventListener(type: string, listener: (event: any) => void): void; @@ -1279,6 +1265,7 @@ declare module THREE { export class Raycaster { constructor(origin?: Vector3, direction?: Vector3, near?: number, far?: number); + ray: Ray; near: number; far: number; @@ -1324,15 +1311,15 @@ declare module THREE { export class AreaLight extends Light{ constructor(hex: number, intensity?: number); - position: Vector3; - right: Vector3; normal: Vector3; - quadraticAttenuation: number; - height: number; - linearAttenuation: number; - width: number; + right: Vector3; intensity: number; + width: number; + height: number; constantAttenuation: number; + linearAttenuation: number; + quadraticAttenuation: number; + } /** @@ -1350,12 +1337,6 @@ declare module THREE { constructor(hex?: number, intensity?: number); - /** - * Direction of the light is normalized vector from position to (0,0,0). - * Default — new THREE.Vector3(). - */ - position: Vector3; - /** * Target used for shadow camera orientation. */ @@ -1516,7 +1497,6 @@ declare module THREE { export class HemisphereLight extends Light { constructor(skyColorHex?: number, groundColorHex?: number, intensity?: number); - position: Vector3; groundColor: Color; intensity: number; @@ -1534,12 +1514,6 @@ declare module THREE { export class PointLight extends Light { constructor(hex?: number, intensity?: number, distance?: number); - /** - * Light's position. - * Default — new THREE.Vector3(). - */ - position: Vector3; - /* * Light's intensity. * Default - 1.0. @@ -1573,12 +1547,6 @@ declare module THREE { export class SpotLight extends Light { constructor(hex?: number, intensity?: number, distance?: number, angle?: number, exponent?: number); - /** - * Light's position. - * Default — new THREE.Vector3(). - */ - position: Vector3; - /** * Spotlight focus points at target.position. * Default position — (0,0,0). @@ -1668,11 +1636,11 @@ declare module THREE { * Default — 512. */ shadowMapHeight: number; - shadowMatrix: Matrix4; + shadowMap: RenderTarget; shadowMapSize: Vector2; shadowCamera: Camera; - shadowMap: RenderTarget; + shadowMatrix: Matrix4; clone(): SpotLight; } @@ -1734,12 +1702,12 @@ declare module THREE { */ crossOrigin: string; - needsTangents(materials: Material[]): boolean; - updateProgress(progress: Progress): void; - createMaterial(m: Material, texturePath: string): boolean; - initMaterials(materials: Material[], texturePath: string): Material[]; - extractUrlBase(url: string): string; addStatusElement(): HTMLElement; + updateProgress(progress: Progress): void; + extractUrlBase(url: string): string; + initMaterials(materials: Material[], texturePath: string): Material[]; + needsTangents(materials: Material[]): boolean; + createMaterial(m: Material, texturePath: string): boolean; static Handlers:LoaderHandler; } @@ -1756,17 +1724,8 @@ declare module THREE { load(url: string, onLoad: (bufferGeometry: BufferGeometry) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; setCrossOrigin(crossOrigin: string): void; parse(json: any): BufferGeometry; - } - /* - * GeometryLoader class is experimental, and it is not yet included in the compiled source code. - * - export class GeometryLoader { - - } - */ - export class Cache{ constructor(); @@ -1777,12 +1736,22 @@ declare module THREE { remove(key: string): void; clear(): void; } + + /* + * GeometryLoader class is experimental, and it is not yet included in the compiled source code. + * + export class GeometryLoader { + + } + */ + /** * A loader for loading an image. * Unlike other loaders, this one emits events instead of using predefined callbacks. So if you're interested in getting notified when things happen, you need to add listeners to the object. */ export class ImageLoader { constructor(manager?: LoadingManager); + crossOrigin: string; /** @@ -1790,15 +1759,16 @@ declare module THREE { * @param url */ load(url: string, onLoad?: (image: HTMLImageElement) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): HTMLImageElement; + setCrossOrigin(crossOrigin: string): void; } - /** * A loader for loading objects in JSON format. */ export class JSONLoader extends Loader { constructor(showStatus?: boolean); + withCredentials: boolean; /** @@ -1807,12 +1777,13 @@ declare module THREE { * @param texturePath If not specified, textures will be assumed to be in the same folder as the Javascript model file. */ load(url: string, callback: (geometry: JSonLoaderResultGeometry, materials: Material[]) => void , texturePath?: string): void; - parse(json:string, texturePath:string): any; + loadAjaxJSON(context: JSONLoader, url: string, callback: (geometry: Geometry, materials: Material[]) => void , texturePath?: string, callbackProgress?: (progress: Progress) => void ): void; + parse(json:string, texturePath:string): any; } - export class JSonLoaderResultGeometry extends Geometry { + export interface JSonLoaderResultGeometry extends Geometry { animation: AnimationData; } @@ -1883,16 +1854,34 @@ declare module THREE { export class XHRLoader { constructor(manager?: LoadingManager); - cache: Cache; - crossOrigin: string; responseType: string; + crossOrigin: string; load(url: string, onLoad?: (responseText: string) => void, onProgress?: (event: any) => void, onError?: (event: any) => void): void; - setCrossOrigin(crossOrigin: string): void; setResponseType(responseType: string): void; + setCrossOrigin(crossOrigin: string): void; } // Materials ////////////////////////////////////////////////////////////////////////////////// + export interface MaterialParameters { + name?: string; + side?: Side; + opacity?: number; + transparent?: boolean; + blending?: Blending; + blendSrc?: BlendingDstFactor; + blendDst?: BlendingSrcFactor; + blendEquation?: BlendingEquation; + depthTest?: boolean; + depthWrite?: boolean; + polygonOffset?: boolean; + polygonOffsetFactor?: number; + polygonOffsetUnits?: number; + alphaTest?: number; + overdraw?: number; + visible?: boolean; + needsUpdate?: boolean; + } /** * Materials describe the appearance of objects. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer. @@ -1905,11 +1894,19 @@ declare module THREE { */ id: number; + uuid: string; + /** * Material name. Default is an empty string. */ name: string; + /** + * Defines which of the face sides will be rendered - front, back or both. + * Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide. + */ + side: Side; + /** * Opacity. Default is 1. */ @@ -1982,23 +1979,15 @@ declare module THREE { */ visible: boolean; - /** - * Defines which of the face sides will be rendered - front, back or both. - * Default is THREE.FrontSide. Other options are THREE.BackSide and THREE.DoubleSide. - */ - side: Side; - /** * Specifies that the material needs to be updated, WebGL wise. Set it to true if you made changes that need to be reflected in WebGL. * This property is automatically set to true when instancing a new material. */ needsUpdate: boolean; - clone(material?:Material): Material; - - dispose(): void; setValues(values: Object): void; - + clone(material?:Material): Material; + dispose(): void; // EventDispatcher mixins addEventListener(type: string, listener: (event: any) => void ): void; @@ -2007,7 +1996,7 @@ declare module THREE { dispatchEvent(event: { type: string; target: any; }): void; } - export interface LineBasicMaterialParameters { + export interface LineBasicMaterialParameters extends MaterialParameters { color?: number; linewidth?: number; linecap?: string; @@ -2017,8 +2006,8 @@ declare module THREE { } export class LineBasicMaterial extends Material { - constructor(parameters?: LineBasicMaterialParameters); + color: Color; linewidth: number; linecap: string; @@ -2029,86 +2018,87 @@ declare module THREE { clone(): LineBasicMaterial; } - export interface LineDashedMaterialParameters { - scale?: number; + export interface LineDashedMaterialParameters extends MaterialParameters { color?: number; - vertexColors?: boolean; - dashSize?: number; - fog?: boolean; - gapSize?: number; linewidth?: number; + scale?: number; + dashSize?: number; + gapSize?: number; + vertexColors?: Colors; + fog?: boolean; } export class LineDashedMaterial extends Material { constructor(parameters?: LineDashedMaterialParameters); - scale: number; + color: Color; - vertexColors: boolean; - dashSize: number; - fog: boolean; - gapSize: number; linewidth: number; + scale: number; + dashSize: number; + gapSize: number; + vertexColors: Colors; + fog: boolean; clone(): LineDashedMaterial; } - /** * parameters is an object with one or more properties defining the material's appearance. */ - export interface MeshBasicMaterialParameters { + export interface MeshBasicMaterialParameters extends MaterialParameters{ color?: number; - wireframe?: boolean; - wireframeLinewidth?: number; - wireframeLinecap?: string; - wireframeLinejoin?: string; - shading?: Shading; - vertexColors?: Colors; - fog?: boolean; + map?: Texture; lightMap?: Texture; specularMap?: Texture; alphaMap?: Texture; envMap?: Texture; - skinning?: boolean; - morphTargets?: boolean; - map?: Texture; combine?: Combine; reflectivity?: number; refractionRatio?: number; + fog?: boolean; + shading?: Shading; + wireframe?: boolean; + wireframeLinewidth?: number; + wireframeLinecap?: string; + wireframeLinejoin?: string; + vertexColors?: Colors; + skinning?: boolean; + morphTargets?: boolean; } export class MeshBasicMaterial extends Material { constructor(parameters?: MeshBasicMaterialParameters); color: Color; - wireframe: boolean; - wireframeLinewidth: number; - wireframeLinecap: string; - wireframeLinejoin: string; - shading: Shading; - vertexColors: Colors; - fog: boolean; + map: Texture; lightMap: Texture; specularMap: Texture; alphaMap: Texture; envMap: Texture; - skinning: boolean; - morphTargets: boolean; - map: Texture; combine: Combine; reflectivity: number; refractionRatio: number; + fog: boolean; + shading: Shading; + wireframe: boolean; + wireframeLinewidth: number; + wireframeLinecap: string; + wireframeLinejoin: string; + vertexColors: Colors; + skinning: boolean; + morphTargets: boolean; clone(): MeshBasicMaterial; } - export interface MeshDepthMaterialParameters { + export interface MeshDepthMaterialParameters extends MaterialParameters{ wireframe?: boolean; wireframeLinewidth?: number; } export class MeshDepthMaterial extends Material { constructor(parameters?: MeshDepthMaterialParameters); + wireframe: boolean; wireframeLinewidth: number; @@ -2124,30 +2114,30 @@ declare module THREE { clone(): MeshFaceMaterial; } - export interface MeshLambertMaterialParameters { + export interface MeshLambertMaterialParameters extends MaterialParameters{ color?: number; ambient?: number; emissive?: number; + wrapAround?: boolean; + wrapRGB?: Vector3; + map?: Texture; + lightMap?: Texture; + specularMap?: Texture; + alphaMap?: Texture; + envMap?: Texture; + combine?: Combine; + reflectivity?: number; + refractionRatio?: number; + fog?: boolean; shading?: Shading; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; wireframeLinejoin?: string; vertexColors?: Colors; - fog?: boolean; - map?: Texture; - lightMap?: Texture; - specularMap?: Texture; - alphaMap?: Texture; - envMap?: Texture; - reflectivity?: number; - refractionRatio?: number; - combine?: Combine; skinning?: boolean; morphTargets?: boolean; - wrapRGB?: Vector3; morphNormals?: boolean; - wrapAround?: boolean; } export class MeshLambertMaterial extends Material { @@ -2155,119 +2145,119 @@ declare module THREE { color: Color; ambient: Color; emissive: Color; + wrapAround: boolean; + wrapRGB: Vector3; + map: Texture; + lightMap: Texture; + specularMap: Texture; + alphaMap: Texture; + envMap: Texture; + combine: Combine; + reflectivity: number; + refractionRatio: number; + fog: boolean; shading: Shading; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; wireframeLinejoin: string; vertexColors: Colors; - fog: boolean; - map: Texture; - lightMap: Texture; - specularMap: Texture; - alphaMap: Texture; - envMap: Texture; - reflectivity: number; - refractionRatio: number; - combine: Combine; skinning: boolean; morphTargets: boolean; - wrapRGB: Vector3; morphNormals: boolean; - wrapAround: boolean; clone(): MeshLambertMaterial; } - export interface MeshNormalMaterialParameters { - morphTargets?: boolean; + export interface MeshNormalMaterialParameters extends MaterialParameters{ shading?: Shading; wireframe?: boolean; wireframeLinewidth?: number; + morphTargets?: boolean; } export class MeshNormalMaterial extends Material { constructor(parameters?: MeshNormalMaterialParameters); - morphTargets: boolean; + shading: Shading; wireframe: boolean; wireframeLinewidth: number; + morphTargets: boolean; clone(): MeshNormalMaterial; } - export interface MeshPhongMaterialParameters { + export interface MeshPhongMaterialParameters extends MaterialParameters{ color?: number; // diffuse ambient?: number; emissive?: number; specular?: number; shininess?: number; + metal?: boolean; + wrapAround?: boolean; + wrapRGB?: Vector3; + map?: Texture; + lightMap?: Texture; + bumpMap?: Texture; + bumpScale?: number; + normalMap?: Texture; + normalScale?: Vector2; + specularMap?: Texture; + alphaMap?: Texture; + envMap?: Texture; + combine?: Combine; + reflectivity?: number; + refractionRatio?: number; + fog?: boolean; shading?: Shading; wireframe?: boolean; wireframeLinewidth?: number; wireframeLinecap?: string; wireframeLinejoin?: string; vertexColors?: Colors; - fog?: boolean; - map?: Texture; - lightMap?: Texture; - specularMap?: Texture; - alphaMap?: Texture; - envMap?: Texture; - reflectivity?: number; - refractionRatio?: number; - combine?: Combine; skinning?: boolean; morphTargets?: boolean; - normalScale?: Vector2; morphNormals?: boolean; - metal?: boolean; - bumpScale?: number; - wrapAround?: boolean; - perPixel?: boolean; - normalMap?: Texture; - bumpMap?: Texture; - wrapRGB?: Vector3; } export class MeshPhongMaterial extends Material { constructor(parameters?: MeshPhongMaterialParameters); + color: Color; // diffuse ambient: Color; emissive: Color; specular: Color; shininess: number; + metal: boolean; + wrapAround: boolean; + wrapRGB: Vector3; + map: Texture; + lightMap: Texture; + bumpMap: Texture; + bumpScale: number; + normalMap: Texture; + normalScale: Vector2; + specularMap: Texture; + alphaMap: Texture; + envMap: Texture; + combine: Combine; + reflectivity: number; + refractionRatio: number; + fog: boolean; shading: Shading; wireframe: boolean; wireframeLinewidth: number; wireframeLinecap: string; wireframeLinejoin: string; vertexColors: Colors; - fog: boolean; - map: Texture; - lightMap: Texture; - specularMap: Texture; - alphaMap: Texture; - envMap: Texture; - reflectivity: number; - refractionRatio: number; - combine: Combine; skinning: boolean; morphTargets: boolean; - normalScale: Vector2; morphNormals: boolean; - metal: boolean; - bumpScale: number; - wrapAround: boolean; - - normalMap: Texture; - bumpMap: Texture; - wrapRGB: Vector3; clone(): MeshPhongMaterial; } - export interface PointCloudMaterialParameters { + export interface PointCloudMaterialParameters extends MaterialParameters{ color?: number; map?: Texture; size?: number; @@ -2277,7 +2267,6 @@ declare module THREE { } export class PointCloudMaterial extends Material { - constructor(parameters?: PointCloudMaterialParameters); color: Color; @@ -2305,75 +2294,47 @@ declare module THREE { } - export interface ShaderMaterialParameters { + export interface ShaderMaterialParameters extends MaterialParameters{ + defines?: any; uniforms?: any; - fragmentShader?: string; - vertexShader?: string; - morphTargets?: boolean; - lights?: boolean; - morphNormals?: boolean; - wireframe?: boolean; - vertexColors?: Colors; - skinning?: boolean; - fog?: boolean; attributes?: any; + vertexShader?: string; + fragmentShader?: string; shading?: Shading; linewidth?: number; + wireframe?: boolean; wireframeLinewidth?: number; - defines?: any; + fog?: boolean; + lights?: boolean; + vertexColors?: Colors; + skinning?: boolean; + morphTargets?: boolean; + morphNormals?: boolean; } export class ShaderMaterial extends Material { constructor(parameters?: ShaderMaterialParameters); + defines: any; uniforms: any; - fragmentShader: string; - vertexShader: string; - morphTargets: boolean; - lights: boolean; - morphNormals: boolean; - wireframe: boolean; - vertexColors: Colors; - skinning: boolean; - fog: boolean; attributes: any; + vertexShader: string; + fragmentShader: string; shading: Shading; linewidth: number; + wireframe: boolean; wireframeLinewidth: number; - defines: any; + fog: boolean; + lights: boolean; + vertexColors: Colors; + skinning: boolean; + morphTargets: boolean; + morphNormals: boolean; clone(): ShaderMaterial; } - export interface SpriteMaterialParameters { - map?: Texture; - uvScale?: Vector2; - sizeAttenuation?: boolean; - color?: number; - uvOffset?: Vector2; - fog?: boolean; - useScreenCoordinates?: boolean; - scaleByViewport?: boolean; - alignment?: Vector2; - } - - export class SpriteMaterial extends Material { - constructor(parameters?: SpriteMaterialParameters); - - map: Texture; - uvScale: Vector2; - sizeAttenuation: boolean; - color: Color; - uvOffset: Vector2; - fog: boolean; - useScreenCoordinates: boolean; - scaleByViewport: boolean; - alignment: Vector2; - - clone(): SpriteMaterial; - } - - export interface SpriteCanvasMaterialParameters { + export interface SpriteCanvasMaterialParameters extends MaterialParameters{ color?: number; } @@ -2387,67 +2348,87 @@ declare module THREE { clone(): SpriteCanvasMaterial; } + export interface SpriteMaterialParameters extends MaterialParameters{ + color?: number; + map?: Texture; + rotation?: number; + fog?: boolean; + } + + export class SpriteMaterial extends Material { + constructor(parameters?: SpriteMaterialParameters); + + color: Color; + map: Texture; + rotation: number; + fog: boolean; + + clone(): SpriteMaterial; + } + // Math ////////////////////////////////////////////////////////////////////////////////// export class Box2 { constructor(min?: Vector2, max?: Vector2); + max: Vector2; min: Vector2; set(min: Vector2, max: Vector2): Box2; - expandByPoint(point: Vector2): Box2; - clampPoint(point: Vector2, optionalTarget?: Vector2): Vector2; - isIntersectionBox(box: Box2): boolean; setFromPoints(points: Vector2[]): Box2; - size(optionalTarget?: Vector2): Vector2; - union(box: Box2): Box2; - getParameter(point: Vector2): Vector2; - expandByScalar(scalar: number): Box2; - intersect(box: Box2): Box2; - containsBox(box: Box2): boolean; - translate(offset: Vector2): Box2; - empty(): boolean; - clone(): Box2; - equals(box: Box2): boolean; - expandByVector(vector: Vector2): Box2; + setFromCenterAndSize(center: Vector2, size: number): Box2; copy(box: Box2): Box2; makeEmpty(): Box2; + empty(): boolean; center(optionalTarget?: Vector2): Vector2; - distanceToPoint(point: Vector2): number; + size(optionalTarget?: Vector2): Vector2; + expandByPoint(point: Vector2): Box2; + expandByVector(vector: Vector2): Box2; + expandByScalar(scalar: number): Box2; containsPoint(point: Vector2): boolean; - setFromCenterAndSize(center: Vector2, size: number): Box2; + containsBox(box: Box2): boolean; + getParameter(point: Vector2): Vector2; + isIntersectionBox(box: Box2): boolean; + clampPoint(point: Vector2, optionalTarget?: Vector2): Vector2; + distanceToPoint(point: Vector2): number; + intersect(box: Box2): Box2; + union(box: Box2): Box2; + translate(offset: Vector2): Box2; + equals(box: Box2): boolean; + clone(): Box2; } export class Box3 { constructor(min?: Vector3, max?: Vector3); + max: Vector3; min: Vector3; set(min: Vector3, max: Vector3): Box3; - applyMatrix4(matrix: Matrix4): Box3; - expandByPoint(point: Vector3): Box3; - clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - isIntersectionBox(box: Box3): boolean; setFromPoints(points: Vector3[]): Box3; - size(optionalTarget?: Vector3): Vector3; - union(box: Box3): Box3; - getParameter(point: Vector3): Vector3; - expandByScalar(scalar: number): Box3; - intersect(box: Box3): Box3; - containsBox(box: Box3): boolean; - translate(offset: Vector3): Box3; - empty(): boolean; - clone(): Box3; - equals(box: Box3): boolean; - expandByVector(vector: Vector3): Box3; - copy(box: Box3): Box3; - makeEmpty(): Box3; - center(optionalTarget?: Vector3): Vector3; - getBoundingSphere(): Sphere; - distanceToPoint(point: Vector3): number; - containsPoint(point: Vector3): boolean; setFromCenterAndSize(center: Vector3, size: number): Box3; setFromObject(object: Object3D): Box3; + copy(box: Box3): Box3; + makeEmpty(): Box3; + empty(): boolean; + center(optionalTarget?: Vector3): Vector3; + size(optionalTarget?: Vector3): Vector3; + expandByPoint(point: Vector3): Box3; + expandByVector(vector: Vector3): Box3; + expandByScalar(scalar: number): Box3; + containsPoint(point: Vector3): boolean; + containsBox(box: Box3): boolean; + getParameter(point: Vector3): Vector3; + isIntersectionBox(box: Box3): boolean; + clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3; + distanceToPoint(point: Vector3): number; + getBoundingSphere(): Sphere; + intersect(box: Box3): Box3; + union(box: Box3): Box3; + applyMatrix4(matrix: Matrix4): Box3; + translate(offset: Vector3): Box3; + equals(box: Box3): boolean; + clone(): Box3; } export interface HSL { @@ -2488,6 +2469,31 @@ declare module THREE { set(color: Color): Color; set(color: number): Color; set(color: string): Color; + setHex(hex: number): Color; + + /** + * Sets this color from RGB values. + * @param r Red channel value between 0 and 1. + * @param g Green channel value between 0 and 1. + * @param b Blue channel value between 0 and 1. + */ + setRGB(r: number, g: number, b: number): Color; + + /** + * Sets this color from HSL values. + * Based on MochiKit implementation by Bob Ippolito. + * + * @param h Hue channel value between 0 and 1. + * @param s Saturation value channel between 0 and 1. + * @param l Value channel value between 0 and 1. + */ + setHSL(h: number, s: number, l: number): Color; + + /** + * Sets this color from a CSS context style string. + * @param contextStyle Color in CSS context style format. + */ + setStyle(style: string): Color; /** * Copies given color. @@ -2517,14 +2523,6 @@ declare module THREE { */ convertLinearToGamma(): Color; - /** - * Sets this color from RGB values. - * @param r Red channel value between 0 and 1. - * @param g Green channel value between 0 and 1. - * @param b Blue channel value between 0 and 1. - */ - setRGB(r: number, g: number, b: number): Color; - /** * Returns the hexadecimal value of this color. */ @@ -2535,13 +2533,7 @@ declare module THREE { */ getHexString(): string; - setHex(hex: number): Color; - - /** - * Sets this color from a CSS context style string. - * @param contextStyle Color in CSS context style format. - */ - setStyle(style: string): Color; + getHSL(): HSL; /** * Returns the value of this color in CSS context style. @@ -2549,18 +2541,6 @@ declare module THREE { */ getStyle(): string; - /** - * Sets this color from HSL values. - * Based on MochiKit implementation by Bob Ippolito. - * - * @param h Hue channel value between 0 and 1. - * @param s Saturation value channel between 0 and 1. - * @param l Value channel value between 0 and 1. - */ - setHSL(h: number, s: number, l: number): Color; - - getHSL(): HSL; - offsetHSL(h: number, s: number, l: number): Color; add(color: Color): Color; @@ -2570,6 +2550,8 @@ declare module THREE { multiplyScalar(s: number): Color; lerp(color: Color, alpha: number): Color; equals(color: Color): boolean; + fromArray(rgb: number[]): Color; + toArray(): number[]; /** * Clones this color. @@ -2737,12 +2719,14 @@ declare module THREE { set(x: number, y: number, z: number, order?: string): Euler; copy(euler: Euler): Euler; - setFromRotationMatrix(m: Matrix4, order: string): Euler; - setFromQuaternion(q:Quaternion, order: string): Euler; + setFromRotationMatrix(m: Matrix4, order?: string): Euler; + setFromQuaternion(q:Quaternion, order?: string, update?: boolean): Euler; reorder(newOrder: string): Euler; + equals(euler: Euler): boolean; fromArray(xyzo: any[]): Euler; toArray(): any[]; - equals(euler: Euler): boolean; + onChange: () => void; + clone(): Euler; } @@ -2757,13 +2741,15 @@ declare module THREE { */ planes: Plane[]; - setFromMatrix(m: Matrix4): Frustum; - intersectsObject(object: Object3D): boolean; - clone(): Frustum; set(p0?: number, p1?: number, p2?: number, p3?: number, p4?: number, p5?: number): Frustum; copy(frustum: Frustum): Frustum; - containsPoint(point: Vector3): boolean; + setFromMatrix(m: Matrix4): Frustum; + intersectsObject(object: Object3D): boolean; intersectsSphere(sphere: Sphere): boolean; + intersectsBox(box: Box3): boolean; + containsPoint(point: Vector3): boolean; + clone(): Frustum; + } export class Line3 { @@ -2773,19 +2759,21 @@ declare module THREE { set(start?: Vector3, end?: Vector3): Line3; copy(line: Line3): Line3; - clone(): Line3; - equals(line: Line3): boolean; - distance(): number; - distanceSq(): number; - applyMatrix4(matrix: Matrix4): Line3; - at(t: number, optionalTarget?: Vector3): Vector3; center(optionalTarget?: Vector3): Vector3; delta(optionalTarget?: Vector3): Vector3; - closestPointToPoint(point: Vector3, clampToLine?: boolean, optionalTarget?: Vector3): Vector3; + distanceSq(): number; + distance(): number; + at(t: number, optionalTarget?: Vector3): Vector3; closestPointToPointParameter(point: Vector3, clampToLine?: boolean): number; + closestPointToPoint(point: Vector3, clampToLine?: boolean, optionalTarget?: Vector3): Vector3; + applyMatrix4(matrix: Matrix4): Line3; + equals(line: Line3): boolean; + clone(): Line3; } interface Math { + generateUUID(): string; + /** * Clamps the x to be between a and b. * @@ -2814,6 +2802,10 @@ declare module THREE { */ mapLinear(x: number, a1: number, a2: number, b1: number, b2: number): number; + smoothstep(x: number, min: number, max: number): number; + + smootherstep(x: number, min: number, max: number): number; + /** * Random float from 0 to 1 with 16 bits of randomness. * Standard Math.random() creates repetitive patterns when applied over larger space. @@ -2844,9 +2836,7 @@ declare module THREE { radToDeg(radians: number): number; - smoothstep(x: number, min: number, max: number): number; - - smootherstep(x: number, min: number, max: number): number; + isPowerOfTwo(value: number): boolean; } /** @@ -2874,8 +2864,6 @@ declare module THREE { */ copy(m: Matrix): Matrix; - multiplyVector3Array(a: number[]): number[]; - /** * multiplyScalar(s:number):T; */ @@ -2918,29 +2906,29 @@ declare module THREE { */ elements: Float32Array; + set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): Matrix3; + identity(): Matrix3; + copy(m: Matrix3): Matrix3; + applyToVector3Array(array: number[], offset?: number, length?: number): number[]; + multiplyScalar(s: number): Matrix3; + determinant(): number; + getInverse(matrix: Matrix3, throwOnInvertible?: boolean): Matrix3; + getInverse(matrix: Matrix4, throwOnInvertible?: boolean): Matrix3; + /** * Transposes this matrix in place. */ transpose(): Matrix3; + flattenToArrayOffset(array: number[], offset: number): number[]; + getNormalMatrix(m: Matrix4): Matrix3; /** * Transposes this matrix into the supplied array r, and returns itself. */ transposeIntoArray(r: number[]): number[]; - - determinant(): number; - set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): Matrix3; - multiplyScalar(s: number): Matrix3; - // DEPRECATED - multiplyVector3Array(a: number[]): number[]; - applyToVector3Array(array: number[], offset?: number, length?: number): number[]; - flattenToArrayOffset(array: number[], offset: number): number[]; - getNormalMatrix(m: Matrix4): Matrix3; - getInverse(matrix: Matrix3, throwOnInvertible?: boolean): Matrix3; - getInverse(matrix: Matrix4, throwOnInvertible?: boolean): Matrix3; - copy(m: Matrix3): Matrix3; + fromArray(array: number[]): Matrix3; + toArray(): number[]; clone(): Matrix3; - identity(): Matrix3; } /** @@ -2992,7 +2980,8 @@ declare module THREE { * Copies the rotation component of the supplied matrix m into this matrix rotation component. */ extractRotation(m: Matrix4): Matrix4; - + makeRotationFromEuler(euler: Euler): Matrix4; + makeRotationFromQuaternion(q: Quaternion): Matrix4; /** * Constructs a rotation matrix, looking from eye towards center with defined up vector. */ @@ -3018,6 +3007,7 @@ declare module THREE { * Multiplies this matrix by s. */ multiplyScalar(s: number): Matrix4; + applyToVector3Array(array: number[], offset?: number, length?: number): number[]; /** * Computes determinant of this matrix. @@ -3046,25 +3036,12 @@ declare module THREE { */ getInverse(m: Matrix4, throwOnInvertible?: boolean): Matrix4; - makeRotationFromEuler(euler: Euler): Matrix4; - makeRotationFromQuaternion(q: Quaternion): Matrix4; - /** * Multiplies the columns of this matrix by vector v. */ scale(v: Vector3): Matrix4; - /** - * Sets this matrix to the transformation composed of translation, rotation and scale. - */ - compose(translation: Vector3, rotation: Quaternion, scale: Vector3): Matrix4; - - /** - * Decomposes this matrix into the translation, rotation and scale components. - * If parameters are not passed, new instances will be created. - */ - decompose(translation?: Vector3, rotation?: Quaternion, scale?: Vector3): Object[]; // [Vector3, Quaternion, Vector3] - + getMaxScaleOnAxis(): number; /** * Sets this matrix as translation transform. */ @@ -3105,6 +3082,17 @@ declare module THREE { */ makeScale(x: number, y: number, z: number): Matrix4; + /** + * Sets this matrix to the transformation composed of translation, rotation and scale. + */ + compose(translation: Vector3, rotation: Quaternion, scale: Vector3): Matrix4; + + /** + * Decomposes this matrix into the translation, rotation and scale components. + * If parameters are not passed, new instances will be created. + */ + decompose(translation?: Vector3, rotation?: Quaternion, scale?: Vector3): Object[]; // [Vector3, Quaternion, Vector3] + /** * Creates a frustum matrix. */ @@ -3119,17 +3107,12 @@ declare module THREE { * Creates an orthographic projection matrix. */ makeOrthographic(left: number, right: number, top: number, bottom: number, near: number, far: number): Matrix4; - + fromArray(array: number[]): Matrix4; + toArray(): number[]; /** * Clones this matrix. */ clone(): Matrix4; - - // DEPRECATED - multiplyVector3Array(a: number[]): number[]; - applyToVector3Array(array: number[], offset?: number, length?: number): number[]; - - getMaxScaleOnAxis(): number; } export class Plane { @@ -3138,24 +3121,24 @@ declare module THREE { normal: Vector3; constant: number; - normalize(): Plane; set(normal: Vector3, constant: number): Plane; + setComponents(x: number, y: number, z: number, w: number): Plane; + setFromNormalAndCoplanarPoint(normal: Vector3, point: Vector3): Plane; + setFromCoplanarPoints(a: Vector3, b: Vector3, c: Vector3): Plane; copy(plane: Plane): Plane; - applyMatrix4(matrix: Matrix4, optionalNormalMatrix?: Matrix3): Plane; + normalize(): Plane; + negate(): Plane; + distanceToPoint(point: Vector3): number; + distanceToSphere(sphere: Sphere): number; + projectPoint(point: Vector3, optionalTarget?: Vector3): Vector3; orthoPoint(point: Vector3, optionalTarget?: Vector3): Vector3; isIntersectionLine(line: Line3): boolean; intersectLine(line: Line3, optionalTarget?: Vector3): Vector3; - setFromNormalAndCoplanarPoint(normal: Vector3, point: Vector3): Plane; - clone(): Plane; - distanceToPoint(point: Vector3): number; - equals(plane: Plane): boolean; - setComponents(x: number, y: number, z: number, w: number): Plane; - distanceToSphere(sphere: Sphere): number; - setFromCoplanarPoints(a: Vector3, b: Vector3, c: Vector3): Plane; - projectPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - negate(): Plane; - translate(offset: Vector3): Plane; coplanarPoint(optionalTarget?: boolean): Vector3; + applyMatrix4(matrix: Matrix4, optionalNormalMatrix?: Matrix3): Plane; + translate(offset: Vector3): Plane; + equals(plane: Plane): boolean; + clone(): Plane; } /** @@ -3207,11 +3190,16 @@ declare module THREE { * Sets this quaternion from rotation component of m. Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm. */ setFromRotationMatrix(m: Matrix4): Quaternion; - + setFromUnitVectors(vFrom: Vector3, vTo: Vector4): Quaternion; /** * Inverts this quaternion. */ inverse(): Quaternion; + + conjugate(): Quaternion; + dot(v: Vector3): number; + lengthSq(): number; + /** * Computes length of this quaternion. */ @@ -3237,6 +3225,11 @@ declare module THREE { * Deprecated. Use Vector3.applyQuaternion instead */ multiplyVector3(vector: Vector3): Vector3; + slerp(qb: Quaternion, t: number): Quaternion; + equals(v: Quaternion): boolean; + fromArray(n: number[]): Quaternion; + toArray(): number[]; + onChange: () => void; /** * Clones this quaternion. @@ -3247,20 +3240,6 @@ declare module THREE { * Adapted from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/. */ static slerp(qa: Quaternion, qb: Quaternion, qm: Quaternion, t: number): Quaternion; - - slerp(qb: Quaternion, t: number): Quaternion; - - toArray(): number[]; - - equals(v: Quaternion): boolean; - - dot(v: Vector3): number; - - lengthSq(): number; - - fromArray(n: number[]): Quaternion; - - conjugate(): Quaternion; } export class Ray { @@ -3269,25 +3248,24 @@ declare module THREE { origin: Vector3; direction: Vector3; - applyMatrix4(matrix4: Matrix4): Ray; - at(t: number, optionalTarget?: Vector3): Vector3; - clone(): Ray; - closestPointToPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - copy(ray: Ray): Ray; - distanceSqToSegment(v0: Vector3, v1: Vector3, optionalPointOnRay?: Vector3, optionalPointOnSegment?: Vector3): number; - distanceToPlane(plane: Plane): number; - distanceToPoint(point: Vector3): number; - equals(ray: Ray): boolean; - intersectBox(box: Box3, optionalTarget?: Vector3): Vector3; - intersectPlane(plane: Plane, optionalTarget?: Vector3): Vector3; - intersectSphere(sphere: Sphere, optionalTarget?: Vector3): Vector3; - intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, optionalTarget?: Vector3): Vector3; - isIntersectionBox(box: Box3): boolean; - isIntersectionPlane(plane: Plane): boolean; - isIntersectionSphere(sphere: Sphere): boolean; - - recast(t: number): Ray; set(origin: Vector3, direction: Vector3): Ray; + copy(ray: Ray): Ray; + at(t: number, optionalTarget?: Vector3): Vector3; + recast(t: number): Ray; + closestPointToPoint(point: Vector3, optionalTarget?: Vector3): Vector3; + distanceToPoint(point: Vector3): number; + distanceSqToSegment(v0: Vector3, v1: Vector3, optionalPointOnRay?: Vector3, optionalPointOnSegment?: Vector3): number; + isIntersectionSphere(sphere: Sphere): boolean; + intersectSphere(sphere: Sphere, optionalTarget?: Vector3): Vector3; + isIntersectionPlane(plane: Plane): boolean; + distanceToPlane(plane: Plane): number; + intersectPlane(plane: Plane, optionalTarget?: Vector3): Vector3; + isIntersectionBox(box: Box3): boolean; + intersectBox(box: Box3, optionalTarget?: Vector3): Vector3; + intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, optionalTarget?: Vector3): Vector3; + applyMatrix4(matrix4: Matrix4): Ray; + equals(ray: Ray): boolean; + clone(): Ray; } export class Sphere { @@ -3297,18 +3275,19 @@ declare module THREE { radius: number; set(center: Vector3, radius: number): Sphere; - applyMatrix4(matrix: Matrix4): Sphere; - clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - translate(offset: Vector3): Sphere; - clone(): Sphere; - equals(sphere: Sphere): boolean; setFromPoints(points: Vector3[], optionalCenter?: Vector3): Sphere; - distanceToPoint(point: Vector3): number; - getBoundingBox(optionalTarget?: Box3): Box3; - containsPoint(point: Vector3): boolean; copy(sphere: Sphere): Sphere; - intersectsSphere(sphere: Sphere): boolean; empty(): boolean; + containsPoint(point: Vector3): boolean; + distanceToPoint(point: Vector3): number; + intersectsSphere(sphere: Sphere): boolean; + clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3; + getBoundingBox(optionalTarget?: Box3): Box3; + applyMatrix4(matrix: Matrix4): Sphere; + translate(offset: Vector3): Sphere; + equals(sphere: Sphere): boolean; + + clone(): Sphere; } export interface SplineControlPoint { @@ -3371,17 +3350,17 @@ declare module THREE { b: Vector3; c: Vector3; - setFromPointsAndIndices(points: Vector3[], i0: number, i1: number, i2: number): Triangle; set(a: Vector3, b: Vector3, c: Vector3): Triangle; - normal(optionalTarget?: Vector3): Vector3; - barycoordFromPoint(point: Vector3, optionalTarget?: Vector3): Vector3; - clone(): Triangle; + setFromPointsAndIndices(points: Vector3[], i0: number, i1: number, i2: number): Triangle; + copy(triangle: Triangle): Triangle; area(): number; midpoint(optionalTarget?: Vector3): Vector3; - equals(triangle: Triangle): boolean; + normal(optionalTarget?: Vector3): Vector3; plane(optionalTarget?: Vector3): Plane; + barycoordFromPoint(point: Vector3, optionalTarget?: Vector3): Vector3; containsPoint(point: Vector3): boolean; - copy(triangle: Triangle): Triangle; + equals(triangle: Triangle): boolean; + clone(): Triangle; static normal(a: Vector3, b: Vector3, c: Vector3, optionalTarget?: Vector3): Vector3; static barycoordFromPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3, optionalTarget: Vector3): Vector3; @@ -3516,6 +3495,26 @@ declare module THREE { */ set(x: number, y: number): Vector2; + /** + * Sets X component of this vector. + */ + setX(x: number): Vector2; + + /** + * Sets Y component of this vector. + */ + setY(y: number): Vector2; + + /** + * Sets a component of this vector. + */ + setComponent(index: number, value: number): void; + + /** + * Gets a component of this vector. + */ + getComponent(index: number): number; + /** * Copies value of v to this vector. */ @@ -3530,6 +3529,7 @@ declare module THREE { * Sets this vector to a + b. */ addVectors(a: Vector2, b: Vector2): Vector2; + addScalar(s: number): Vector2; /** * Subtracts v from this vector. @@ -3541,24 +3541,34 @@ declare module THREE { */ subVectors(a: Vector2, b: Vector2): Vector2; + multiply(v: Vector2): Vector2; /** * Multiplies this vector by scalar s. */ multiplyScalar(s: number): Vector2; + divide(v: Vector2): Vector2; /** * Divides this vector by scalar s. * Set vector to ( 0, 0 ) if s == 0. */ divideScalar(s: number): Vector2; + min(v: Vector2): Vector2; + + max(v: Vector2): Vector2; + clamp(min: Vector2, max: Vector2): Vector2; + clampScalar(min: number, max: number): Vector2; + floor(): Vector2; + ceil(): Vector2; + round(): Vector2; + roundToZero(): Vector2; + /** * Inverts this vector. */ negate(): Vector2; - - /** * Computes dot product of this vector and v. */ @@ -3594,53 +3604,18 @@ declare module THREE { */ setLength(l: number): Vector2; + lerp(v: Vector2, alpha: number): Vector2; /** * Checks for strict equality of this vector and v. */ equals(v: Vector2): boolean; + fromArray(xy: number[]): Vector2; + toArray(): number[]; /** * Clones this vector. */ clone(): Vector2; - - clamp(min: Vector2, max: Vector2): Vector2; - clampScalar(min: number, max: number): Vector2; - floor(): Vector2; - ceil(): Vector2; - round(): Vector2; - roundToZero(): Vector2; - lerp(v: Vector2, alpha: number): Vector2; - - /** - * Sets a component of this vector. - */ - setComponent(index: number, value: number): void; - - addScalar(s: number): Vector2; - - /** - * Gets a component of this vector. - */ - getComponent(index: number): number; - - fromArray(xy: number[]): Vector2; - - toArray(): number[]; - - min(v: Vector2): Vector2; - - max(v: Vector2): Vector2; - - /** - * Sets X component of this vector. - */ - setX(x: number): Vector2; - - /** - * Sets Y component of this vector. - */ - setY(y: number): Vector2; } /** @@ -3684,6 +3659,9 @@ declare module THREE { */ setZ(z: number): Vector3; + setComponent(index: number, value: number): void; + getComponent(index: number): number; + /** * Copies value of v to this vector. */ @@ -3693,6 +3671,7 @@ declare module THREE { * Adds v to this vector. */ add(a: Object): Vector3; + addScalar(s: number): Vector3; /** * Sets this vector to a + b. @@ -3709,16 +3688,34 @@ declare module THREE { */ subVectors(a: Vector3, b: Vector3): Vector3; + multiply(v: Vector3): Vector3; /** * Multiplies this vector by scalar s. */ multiplyScalar(s: number): Vector3; + multiplyVectors(a: Vector3, b: Vector3): Vector3; + applyEuler(euler: Euler): Vector3; + applyAxisAngle(axis: Vector3, angle: number): Vector3; + applyMatrix3(m: Matrix3): Vector3; + applyMatrix4(m: Matrix4): Vector3; + applyProjection(m: Matrix4): Vector3; + applyQuaternion(q: Quaternion): Vector3; + transformDirection(m: Matrix4): Vector3; + divide(v: Vector3): Vector3; /** * Divides this vector by scalar s. * Set vector to ( 0, 0, 0 ) if s == 0. */ divideScalar(s: number): Vector3; + min(v: Vector3): Vector3; + max(v: Vector3): Vector3; + clamp(min: Vector3, max: Vector3): Vector3; + clampScalar(min: number, max: number): Vector3; + floor(): Vector3; + ceil(): Vector3; + round(): Vector3; + roundToZero(): Vector3; /** * Inverts this vector. @@ -3751,20 +3748,11 @@ declare module THREE { */ normalize(): Vector3; - /** - * Computes distance of this vector to v. - */ - distanceTo(v: Vector3): number; - - /** - * Computes squared distance of this vector to v. - */ - distanceToSquared(v: Vector3): number; - /** * Normalizes this vector and multiplies it by l. */ setLength(l: number): Vector3; + lerp(v: Vector3, alpha: number): Vector3; /** * Sets this vector to cross product of itself and v. @@ -3775,46 +3763,36 @@ declare module THREE { * Sets this vector to cross product of a and b. */ crossVectors(a: Vector3, b: Vector3): Vector3; + projectOnVector(v: Vector3): Vector3; + projectOnPlane(planeNormal: Vector3): Vector3; + reflect(vector: Vector3): Vector3; + angleTo(v: Vector3): number; + + /** + * Computes distance of this vector to v. + */ + distanceTo(v: Vector3): number; + + /** + * Computes squared distance of this vector to v. + */ + distanceToSquared(v: Vector3): number; setFromMatrixPosition(m: Matrix4): Vector3; setFromMatrixScale(m: Matrix4): Vector3; + setFromMatrixColumn(index: number, matrix: Matrix4): Vector3; + /** * Checks for strict equality of this vector and v. */ equals(v: Vector3): boolean; + fromArray(xyz: number[]): Vector3; + toArray(): number[]; + /** * Clones this vector. */ clone(): Vector3; - clamp(min: Vector3, max: Vector3): Vector3; - clampScalar(min: number, max: number): Vector3; - floor(): Vector3; - ceil(): Vector3; - round(): Vector3; - roundToZero(): Vector3; - applyMatrix3(m: Matrix3): Vector3; - applyMatrix4(m: Matrix4): Vector3; - projectOnPlane(planeNormal: Vector3): Vector3; - projectOnVector(v: Vector3): Vector3; - addScalar(s: number): Vector3; - divide(v: Vector3): Vector3; - min(v: Vector3): Vector3; - max(v: Vector3): Vector3; - setComponent(index: number, value: number): void; - transformDirection(m: Matrix4): Vector3; - multiplyVectors(a: Vector3, b: Vector3): Vector3; - getComponent(index: number): number; - applyAxisAngle(axis: Vector3, angle: number): Vector3; - lerp(v: Vector3, alpha: number): Vector3; - angleTo(v: Vector3): number; - setFromMatrixColumn(index: number, matrix: Matrix4): Vector3; - reflect(vector: Vector3): Vector3; - fromArray(xyz: number[]): Vector3; - multiply(v: Vector3): Vector3; - applyProjection(m: Matrix4): Vector3; - toArray(): number[]; - applyEuler(euler: Euler): Vector3; - applyQuaternion(q: Quaternion): Vector3; } /** @@ -3833,6 +3811,30 @@ declare module THREE { * Sets value of this vector. */ set(x: number, y: number, z: number, w: number): Vector4; + + /** + * Sets X component of this vector. + */ + setX(x: number): Vector4; + + /** + * Sets Y component of this vector. + */ + setY(y: number): Vector4; + + /** + * Sets Z component of this vector. + */ + setZ(z: number): Vector4; + + /** + * Sets w component of this vector. + */ + setW(w: number): Vector4; + + setComponent(index: number, value: number): void; + getComponent(index: number): number; + /** * Copies value of v to this vector. */ @@ -3842,6 +3844,7 @@ declare module THREE { * Adds v to this vector. */ add(v: Vector4): Vector4; + addScalar(s: number): Vector4; /** * Sets this vector to a + b. @@ -3862,12 +3865,35 @@ declare module THREE { * Multiplies this vector by scalar s. */ multiplyScalar(s: number): Vector4; + applyMatrix4(m: Matrix4): Vector4; /** * Divides this vector by scalar s. * Set vector to ( 0, 0, 0 ) if s == 0. */ divideScalar(s: number): Vector4; + + /** + * http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm + * @param q is assumed to be normalized + */ + setAxisAngleFromQuaternion(q: Quaternion): Vector4; + + /** + * http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm + * @param m assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) + */ + setAxisAngleFromRotationMatrix(m: Matrix3): Vector4; + + min(v: Vector4): Vector4; + max(v: Vector4): Vector4; + clamp(min: Vector4, max: Vector4): Vector4; + clampScalar(min: number, max: number): Vector4; + floor(): Vector4; + ceil(): Vector4; + round(): Vector4; + roundToZero(): Vector4; + /** * Inverts this vector. */ @@ -3887,6 +3913,7 @@ declare module THREE { * Computes length of this vector. */ length(): number; + lengthManhattan(): number; /** * Normalizes this vector. @@ -3901,62 +3928,19 @@ declare module THREE { * Linearly interpolate between this vector and v with alpha factor. */ lerp(v: Vector4, alpha: number): Vector4; - /** - * Clones this vector. - */ - clone(): Vector4; - clamp(min: Vector4, max: Vector4): Vector4; - clampScalar(min: number, max: number): Vector4; - floor(): Vector4; - ceil(): Vector4; - round(): Vector4; - roundToZero(): Vector4; - applyMatrix4(m: Matrix4): Vector4; - min(v: Vector4): Vector4; - max(v: Vector4): Vector4; - addScalar(s: number): Vector4; /** * Checks for strict equality of this vector and v. */ equals(v: Vector4): boolean; - /** - * http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm - * @param m assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - */ - setAxisAngleFromRotationMatrix(m: Matrix3): Vector4; - - /** - * http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm - * @param q is assumed to be normalized - */ - setAxisAngleFromQuaternion(q: Quaternion): Vector4; - - getComponent(index: number): number; - setComponent(index: number, value: number): void; fromArray(xyzw: number[]): number[]; toArray(): number[]; - lengthManhattan(): number; - /** - * Sets X component of this vector. - */ - setX(x: number): Vector4; /** - * Sets Y component of this vector. + * Clones this vector. */ - setY(y: number): Vector4; - - /** - * Sets Z component of this vector. - */ - setZ(z: number): Vector4; - - /** - * Sets w component of this vector. - */ - setW(w: number): Vector4; + clone(): Vector4; } // Objects ////////////////////////////////////////////////////////////////////////////////// @@ -3970,7 +3954,7 @@ declare module THREE { accumulatedPosWeight: number; accumulatedSclWeight: number; - update(forceUpdate?: boolean): void; + updateMatrixWorld(forceUpdate?: boolean): void; } export class Line extends Object3D { @@ -3980,6 +3964,7 @@ declare module THREE { constructor(geometry?: BufferGeometry, material?: LineDashedMaterial, type?: number); constructor(geometry?: BufferGeometry, material?: LineBasicMaterial, type?: number); constructor(geometry?: BufferGeometry, material?: ShaderMaterial, type?: number); + geometry: Geometry; material: LineBasicMaterial; type: LineType; @@ -3996,11 +3981,12 @@ declare module THREE { constructor(); objects: any[]; + addLevel(object: Object3D, distance?: number): void; getObjectForDistance(distance: number): Object3D; raycast(raycaster: Raycaster, intersects: any): void; update(camera: Camera): void; - clone(): LOD; + clone(object?: LOD): LOD; } export class Mesh extends Object3D { @@ -4010,8 +3996,8 @@ declare module THREE { geometry: Geometry; material: Material; - getMorphTargetIndexByName(name: string): number; updateMorphTargets(): void; + getMorphTargetIndexByName(name: string): number; raycast(raycaster: Raycaster, intersects: any): void; clone(object?: Mesh): Mesh; } @@ -4025,24 +4011,25 @@ declare module THREE { constructor(geometry?: Geometry, material?: MeshPhongMaterial); constructor(geometry?: Geometry, material?: ShaderMaterial); - directionBackwards: boolean; - direction: number; - endKeyframe: number; - mirroredLoop: boolean; - startKeyframe: number; - lastKeyframe: number; - length: number; - time: number; duration: number; // milliseconds + mirroredLoop: boolean; + time: number; + lastKeyframe: number; currentKeyframe: number; + direction: number; + directionBackwards: boolean; + + startKeyframe: number; + endKeyframe: number; + length: number; - setDirectionForward(): void; - playAnimation(label: string, fps: number): void; setFrameRange(start: number, end: number): void; + setDirectionForward(): void; setDirectionBackward(): void; parseAnimations(): void; - updateAnimation(delta: number): void; setAnimationLabel(label: string, start: number, end: number): void; + playAnimation(label: string, fps: number): void; + updateAnimation(delta: number): void; interpolateTargets( a: number, b: number, t: number ): void; clone(object?: MorphAnimMesh): MorphAnimMesh; } @@ -4072,7 +4059,6 @@ declare module THREE { * An instance of Material, defining the object's appearance. Default is a ParticleBasicMaterial with randomised colour. */ material: Material; - sortParticles: boolean; raycast(raycaster: Raycaster, intersects: any): void; @@ -4081,9 +4067,15 @@ declare module THREE { export class Skeleton { constructor(bones: Bone[], boneInverses?: Matrix4[], useVertexTexture?: boolean); - bones: Bone[]; + useVertexTexture: boolean; + identityMatrix: Matrix4; + bones: Bone[]; + boneTextureWidth: number; + boneTextureHeight: number; boneMatrices: Float32Array; + boneTexture: DataTexture; + boneInverses: Matrix4[]; calculateInverses(bone: Bone): void; pose(): void; @@ -4126,8 +4118,8 @@ declare module THREE { export interface Renderer { render(scene: Scene, camera: Camera): void; - setSize(width:number, height:number, updateStyle?:boolean): void; - domElement: HTMLCanvasElement; + setSize(width:number, height:number, updateStyle?:boolean): void; + domElement: HTMLCanvasElement; } export interface CanvasRendererParameters { @@ -4138,26 +4130,31 @@ declare module THREE { export class CanvasRenderer implements Renderer { constructor(parameters?: CanvasRendererParameters); - info: { render: { vertices: number; faces: number; }; }; domElement: HTMLCanvasElement; devicePixelRatio: number; autoClear: boolean; sortObjects: boolean; sortElements: boolean; + info: { render: { vertices: number; faces: number; }; }; - getMaxAnisotropy(): number; - render(scene: Scene, camera: Camera): void; - clear(): void; + supportsVertexTextures(): void; + setFaceCulling(): void; + setSize(width: number, height: number, updateStyle?: boolean): void; + setViewport(x: number, y: number, width: number, height: number): void; + setScissor(): void; + enableScissorTest(): void; setClearColor(color: Color, opacity?: number): void; setClearColor(color: string, opacity?: number): void; setClearColor(color: number, opacity?: number): void; - setFaceCulling(): void; - supportsVertexTextures(): void; - setSize(width: number, height: number, updateStyle?: boolean): void; setClearColorHex(hex: number, alpha?: number): void; getClearColor(): Color; getClearAlpha(): number; - setViewport(x: number, y: number, width: number, height: number): void; + getMaxAnisotropy(): number; + clear(): void; + clearColor(): void; + clearDepth(): void; + clearStencil(): void; + render(scene: Scene, camera: Camera): void; } export interface RendererPlugin { @@ -4240,6 +4237,8 @@ declare module THREE { //context:WebGLRenderingContext; context: any; + devicePixelRatio: number; + /** * Defines whether the renderer should automatically clear its output before rendering. */ @@ -4351,7 +4350,6 @@ declare module THREE { }; shadowMapPlugin: ShadowMapPlugin; - devicePixelRatio: number; /** * Return the WebGL context. @@ -4365,6 +4363,8 @@ declare module THREE { supportsFloatTextures(): boolean; supportsStandardDerivatives(): boolean; supportsCompressedTextureS3TC(): boolean; + getMaxAnisotropy(): number; + getPrecision(): string; /** * Resizes the output canvas to (width, height), and also sets the viewport to fit that size, starting in (0, 0). @@ -4393,6 +4393,17 @@ declare module THREE { setClearColor(color: string, alpha?: number): void; setClearColor(color: number, alpha?: number): void; + /** + * Sets the clear color, using hex for the color and alpha for the opacity. + * + * @example + * // Creates a renderer with black background + * var renderer = new THREE.WebGLRenderer(); + * renderer.setSize(200, 100); + * renderer.setClearColorHex(0x000000, 1); + */ + setClearColorHex(hex: number, alpha: number): void; + /** * Returns a THREE.Color instance with the current clear color. */ @@ -4412,6 +4423,7 @@ declare module THREE { clearColor(): void; clearDepth(): void; clearStencil(): void; + clearTarget(renderTarget:WebGLRenderTarget, color: boolean, depth: boolean, stencil: boolean): void; /** * Initialises the postprocessing plugin, and adds it to the renderPluginsPost array. @@ -4453,26 +4465,12 @@ declare module THREE { * @param frontFace "ccw" or "cw */ setFaceCulling(cullFace?: CullFace, frontFace?: FrontFaceDirection): void; + setMaterialFaces(material: Material): void; setDepthTest(depthTest: boolean): void; setDepthWrite(depthWrite: boolean): void; setBlending(blending: Blending, blendEquation: BlendingEquation, blendSrc: BlendingSrcFactor, blendDst: BlendingDstFactor): void; setTexture(texture: Texture, slot: number): void; setRenderTarget(renderTarget: RenderTarget): void; - getMaxAnisotropy(): number; - getPrecision(): string; - setMaterialFaces(material: Material): void; - clearTarget(renderTarget:WebGLRenderTarget, color: boolean, depth: boolean, stencil: boolean): void; - - /** - * Sets the clear color, using hex for the color and alpha for the opacity. - * - * @example - * // Creates a renderer with black background - * var renderer = new THREE.WebGLRenderer(); - * renderer.setSize(200, 100); - * renderer.setClearColorHex(0x000000, 1); - */ - setClearColorHex(hex: number, alpha: number): void; } export interface RenderTarget { @@ -4492,6 +4490,7 @@ declare module THREE { export class WebGLRenderTarget implements RenderTarget { constructor(width: number, height: number, options?: WebGLRenderTargetOptions); + width: number; height: number; wrapS: Wrapping; @@ -4506,6 +4505,8 @@ declare module THREE { depthBuffer: boolean; stencilBuffer: boolean; generateMipmaps: boolean; + shareDepthFrom: any; + clone(): WebGLRenderTarget; dispose(): void; @@ -4519,134 +4520,132 @@ declare module THREE { export class WebGLRenderTargetCube extends WebGLRenderTarget { constructor(width: number, height: number, options?: WebGLRenderTargetOptions); + activeCubeFace: number; // PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5 } // Renderers / Renderables ///////////////////////////////////////////////////////////////////// - export class RenderableFace { constructor(); - color: Color; - material: Material; - uvs: Vector2[][]; + id: number; v1: RenderableVertex; v2: RenderableVertex; v3: RenderableVertex; normalModel: Vector3; - vertexNormalsLength: number; - z: number; vertexNormalsModel: Vector3[]; + vertexNormalsLength: number; + color: Color; + material: Material; + uvs: Vector2[][]; + z: number; + } export class RenderableLine { constructor(); + id: number; v1: RenderableVertex; v2: RenderableVertex; - z: number; + vertexColors: Color[]; material: Material; + z: number; } export class RenderableObject { constructor(); + id: number; object: Object; z: number; - id: number; } export class RenderableSprite { constructor(); + id: number; + object: Object; + x: number; + y: number; + z: number; + rotation: number; scale: Vector2; material: Material; - object: Object; - y: number; - x: number; - rotation: number; - z: number; } export class RenderableVertex { constructor(); - visible: boolean; - positionScreen: Vector4; + position: Vector3; positionWorld: Vector3; + positionScreen: Vector4; + visible: boolean; copy(vertex: RenderableVertex): void; } - // Renderers / Shaders ///////////////////////////////////////////////////////////////////// // Renderers / Shaders ///////////////////////////////////////////////////////////////////// export interface ShaderChunk { [name: string]: string; - fog_pars_fragment: string; - fog_fragment: string; - envmap_pars_fragment: string; - envmap_fragment: string; - envmap_pars_vertex: string; - worldpos_vertex: string; - envmap_vertex: string; - map_particle_pars_fragment: string; - map_particle_fragment: string; - map_pars_vertex: string; - map_pars_fragment: string; - map_vertex: string; - map_fragment: string; - lightmap_pars_fragment: string; - lightmap_pars_vertex: string; - lightmap_fragment: string; - lightmap_vertex: string; + + alphamap_fragment: string; + alphamap_pars_fragment: string; + alphatest_fragment: string; bumpmap_pars_fragment: string; - normalmap_pars_fragment: string; - specularmap_pars_fragment: string; - specularmap_fragment: string; - lights_lambert_pars_vertex: string; - lights_lambert_vertex: string; - lights_phong_pars_vertex: string; - lights_phong_vertex: string; - lights_phong_pars_fragment: string; - lights_phong_fragment: string; - color_pars_fragment: string; color_fragment: string; + color_pars_fragment: string; color_pars_vertex: string; color_vertex: string; - skinning_pars_vertex: string; - skinbase_vertex: string; - skinning_vertex: string; + default_vertex: string; + defaultnormal_vertex: string; + envmap_fragment: string; + envmap_pars_fragment: string; + envmap_pars_vertex: string; + envmap_vertex: string; + fog_fragment: string; + fog_pars_fragment: string; + + lightmap_fragment: string; + lightmap_pars_fragment: string; + lightmap_pars_vertex: string; + lightmap_vertex: string; + lights_lambert_pars_vertex: string; + lights_lambert_vertex: string; + lights_phong_fragment: string; + lights_phong_pars_fragment: string; + lights_phong_pars_vertex: string; + lights_phong_vertex: string; + linear_to_gamma_fragment: string; + logdepthbuf_fragment: string; + logdepthbuf_pars_fragment: string; + logdepthbuf_pars_vertex: string; + logdepthbuf_vertex: string; + map_fragment: string; + map_pars_fragment: string; + map_pars_vertex: string; + map_particle_fragment: string; + map_particle_pars_fragment: string; + map_vertex: string; + morphnormal_vertex: string; morphtarget_pars_vertex: string; morphtarget_vertex: string; - default_vertex: string; - morphnormal_vertex: string; - skinnormal_vertex: string; - defaultnormal_vertex: string; - shadowmap_pars_fragment: string; + normalmap_pars_fragment: string; shadowmap_fragment: string; + shadowmap_pars_fragment: string; shadowmap_pars_vertex: string; shadowmap_vertex: string; - alphatest_fragment: string; - linear_to_gamma_fragment: string; + skinbase_vertex: string; + skinning_pars_vertex: string; + skinning_vertex: string; + skinnormal_vertex: string; + specularmap_fragment: string; + specularmap_pars_fragment: string; + worldpos_vertex: string; } export var ShaderChunk: ShaderChunk; - export var UniformsUtils: { - merge(uniforms: any[]): any; - clone(uniforms_src: any): any; - }; - - export var UniformsLib: { - common: any; - bump: any; - normalmap: any; - fog: any; - lights: any; - particle: any; - shadowmap: any; - }; - export interface Shader { uniforms: any; vertexShader: string; @@ -4659,15 +4658,28 @@ declare module THREE { lambert: Shader; phong: Shader; particle_basic: Shader; - depth: Shader; dashed: Shader; + depth: Shader; normal: Shader; normalmap: Shader; cube: Shader; depthRGBA: Shader; }; + export var UniformsLib: { + common: any; + bump: any; + normalmap: any; + fog: any; + lights: any; + particle: any; + shadowmap: any; + }; + export var UniformsUtils: { + merge(uniforms: any[]): any; + clone(uniforms_src: any): any; + }; // Renderers / WebGL ///////////////////////////////////////////////////////////////////// export class WebGLProgram{ @@ -4719,6 +4731,7 @@ declare module THREE { */ export class FogExp2 implements IFog { constructor(hex: number, density?: number); + name: string; color: Color; @@ -4746,13 +4759,12 @@ declare module THREE { * If not null, it will force everything in the scene to be rendered with that material. Default is null. */ overrideMaterial: Material; + autoUpdate: boolean; /** * Default is false. */ matrixAutoUpdate: boolean; - - autoUpdate: boolean; } // Textures ///////////////////////////////////////////////////////////////////// @@ -4769,7 +4781,11 @@ declare module THREE { magFilter?: TextureFilter, minFilter?: TextureFilter, anisotropy?: number - ); + ); + + image: { width: number; height: number; }; + mipmaps: ImageData[]; + generateMipmaps: boolean; clone(): CompressedTexture; } @@ -4785,7 +4801,7 @@ declare module THREE { format?: PixelFormat, type?: TextureDataType, anisotropy?: number - ); + ); images: any[]; @@ -4805,7 +4821,9 @@ declare module THREE { magFilter: TextureFilter, minFilter: TextureFilter, anisotropy?: number - ); + ); + + image: { data: ImageData; width: number; height: number; }; clone(): DataTexture; } @@ -4856,33 +4874,33 @@ declare module THREE { anisotropy?: number ); + id: number; + uuid: string; + name: string; image: any; // HTMLImageElement or ImageData ; + mipmaps: ImageData[]; mapping: Mapping; wrapS: Wrapping; wrapT: Wrapping; magFilter: TextureFilter; minFilter: TextureFilter; + anisotropy: number; format: PixelFormat; type: TextureDataType; - anisotropy: number; - needsUpdate: boolean; - repeat: Vector2; offset: Vector2; - name: string; + repeat: Vector2; generateMipmaps: boolean; - flipY: boolean; - mipmaps: ImageData[]; - unpackAlignment: number; premultiplyAlpha: boolean; + flipY: boolean; + unpackAlignment: number; + needsUpdate: boolean; onUpdate: () => void; - id: number; - - clone(): Texture; - dispose(): void; - static DEFAULT_IMAGE: any; static DEFAULT_MAPPING: any; + clone(): Texture; + update(): void; + dispose(): void; // EventDispatcher mixins addEventListener(type: string, listener: (event: any) => void ): void; @@ -4900,23 +4918,23 @@ declare module THREE { } export var FontUtils: { - - divisions: number; - style: string; - weight: string; - face: string; faces: { [weight: string]: { [style: string]: Face3; }; }; + face: string; + weight: string; + style: string; size: number; + divisions: number; + getFace(): Face3; + loadFace(data: TypefaceData): TypefaceData; drawText(text: string): { paths: Path[]; offset: number; }; + extractGlyphPoints(c: string, face: Face3, scale: number, offset: number, path: Path): { offset: number; path: Path; }; + + generateShapes(text: string, parameters?: { size?: number; curveSegments?: number; font?: string; weight?: string; style?: string; }): Shape[]; Triangulate: { (contour: Vector2[], indices: boolean): Vector2[]; area(contour: Vector2[]): number; }; - extractGlyphPoints(c: string, face: Face3, scale: number, offset: number, path: Path): { offset: number; path: Path; }; - generateShapes(text: string, parameters?: { size?: number; curveSegments?: number; font?: string; weight?: string; style?: string; }): Shape[]; - loadFace(data: TypefaceData): TypefaceData; - getFace(): Face3; }; export var GeometryUtils: { @@ -4933,16 +4951,16 @@ declare module THREE { export var ImageUtils: { crossOrigin: string; - generateDataTexture(width: number, height: number, color: Color): DataTexture; loadTexture(url: string, mapping?: Mapping, onLoad?: (texture: Texture) => void, onError?: (message: string) => void): Texture; - loadTextureCube(array: string[], mapping?: Mapping, onLoad?: () => void , onError?: (message: string) => void ): Texture; + loadTextureCube(array: string[], mapping?: Mapping, onLoad?: (texture: Texture) => void , onError?: (message: string) => void ): Texture; getNormalMap(image: HTMLImageElement, depth?: number): HTMLCanvasElement; + generateDataTexture(width: number, height: number, color: Color): DataTexture; }; export var SceneUtils: { createMultiMaterialObject(geometry: Geometry, materials: Material[]): Object3D; - attach(child: Object3D, scene: Scene, parent: Object3D): void; detach(child: Object3D, parent: Object3D, scene: Scene): void; + attach(child: Object3D, scene: Scene, parent: Object3D): void; }; // Extras / Animation ///////////////////////////////////////////////////////////////////// @@ -4979,6 +4997,7 @@ declare module THREE { loop: boolean; weight: number; keyTypes: string[]; + interpolationType: number; play(startTime?: number, weight?: number): void; stop(): void; @@ -5002,21 +5021,6 @@ declare module THREE { update(deltaTimeMS: number): void; }; - export class MorphAnimation { - constructor(mesh: Mesh); - - mesh: Mesh; - frames: number; - currentTime: number; - duration: number; - loop: boolean; - isPlaying: boolean; - - play(): void; - pause(): void; - update(deltaTimeMS: number): void; - } - export class KeyFrameAnimation { constructor(data: any); @@ -5036,102 +5040,20 @@ declare module THREE { getPrevKeyWith(type: string, h: number, key: number): KeyFrame; } - // Extras / Curves ///////////////////////////////////////////////////////////////////// - export class ArcCurve extends EllipseCurve { - constructor(aX: number, aY: number, aRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean ); + export class MorphAnimation { + constructor(mesh: Mesh); + + mesh: Mesh; + frames: number; + currentTime: number; + duration: number; + loop: boolean; + isPlaying: boolean; + + play(): void; + pause(): void; + update(deltaTimeMS: number): void; } - export class ClosedSplineCurve3 extends Curve { - constructor( points:Vector3[] ); - - points:Vector3[]; - - getPoint(t: number): Vector3; - } - export class CubicBezierCurve extends Curve { - constructor( v0: Vector2, v1: Vector2, v2: Vector2, v3: Vector2 ); - - v0: Vector2; - v1: Vector2; - v2: Vector2; - v3: Vector2; - - getPoint(t: number): Vector2; - } - export class CubicBezierCurve3 extends Curve { - constructor( v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3 ); - - v0: Vector3; - v1: Vector3; - v2: Vector3; - v3: Vector3; - - getPoint(t: number): Vector3; - } - export class EllipseCurve extends Curve { - constructor( aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean ); - - aX: number; - aY: number; - xRadius: number; - yRadius: number; - aStartAngle: number; - aEndAngle: number; - aClockwise: boolean; - - getPoint(t: number): Vector2; - } - export class LineCurve extends Curve { - constructor( v1: Vector2, v2: Vector2 ); - - v1: Vector2; - v2: Vector2; - - getPoint(t: number): Vector2; - getPointAt(u: number): Vector2; - getTangent(t: number): Vector2; - } - export class LineCurve3 extends Curve { - constructor( v1: Vector3, v2: Vector3 ); - - v1: Vector3; - v2: Vector3; - - getPoint(t: number): Vector3; - } - export class QuadraticBezierCurve extends Curve { - constructor( v0: Vector2, v1: Vector2, v2: Vector2 ); - - v0: Vector2; - v1: Vector2; - v2: Vector2; - - getPoint(t: number): Vector2; - getTangent(t: number): Vector2; - } - export class QuadraticBezierCurve3 extends Curve { - constructor( v0: Vector3, v1: Vector3, v2: Vector3 ); - - v0: Vector3; - v1: Vector3; - v2: Vector3; - - getPoint(t: number): Vector3; - } - export class SplineCurve extends Curve { - constructor( points: Vector2[] ); - - points:Vector2[]; - - getPoint(t: number): Vector2; - } - export class SplineCurve3 extends Curve { - constructor( points: Vector3[] ); - - points:Vector3[]; - - getPoint(t: number): Vector3; - } - // Extras / Core ///////////////////////////////////////////////////////////////////// @@ -5140,8 +5062,6 @@ declare module THREE { * class Curve<T extends Vector> */ export class Curve { - needsUpdate: boolean; - /** * Returns a vector for point t of the curve where t is between 0 and 1 * getPoint(t: number): T; @@ -5223,29 +5143,31 @@ declare module THREE { bends: Path[]; autoClose: boolean; - getWrapPoints(oldPts: Vector2[], path: Path): Vector2[]; - createPointsGeometry(divisions: number): Geometry; - addWrapPath(bendpath: Path): void; - createGeometry(points: Vector2[]): Geometry; add(curve: Curve): void; - getTransformedSpacedPoints(segments: number, bends?: Path[]): Vector2[]; - createSpacedPointsGeometry(divisions: number): Geometry; - closePath(): void; - getBoundingBox(): BoundingBox; - getCurveLengths(): number; - getTransformedPoints(segments: number, bends?: Path): Vector2[]; checkConnection(): boolean; + closePath(): void; + getPoint(t: number): Vector; + getLength(): number; + getCurveLengths(): number; + getBoundingBox(): BoundingBox; + createPointsGeometry(divisions: number): Geometry; + createSpacedPointsGeometry(divisions: number): Geometry; + createGeometry(points: Vector2[]): Geometry; + addWrapPath(bendpath: Path): void; + getTransformedPoints(segments: number, bends?: Path): Vector2[]; + getTransformedSpacedPoints(segments: number, bends?: Path[]): Vector2[]; + getWrapPoints(oldPts: Vector2[], path: Path): Vector2[]; } export class Gyroscope extends Object3D { constructor(); - scaleWorld: Vector3; translationWorld: Vector3; - quaternionWorld: Quaternion; translationObject: Vector3; - scaleObject: Vector3; + quaternionWorld: Quaternion; quaternionObject: Quaternion; + scaleWorld: Vector3; + scaleObject: Vector3; updateMatrixWorld(force?: boolean): void; } @@ -5283,6 +5205,8 @@ declare module THREE { absarc(aX: number, aY: number, aRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean): void; ellipse(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean): void; absellipse(aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean): void; + getSpacedPoints(divisions?: number, closedPath?: boolean): Vector[]; + getPoints(divisions?: number, closedPath?: boolean): Vector[]; toShapes(): Shape[]; } @@ -5294,22 +5218,120 @@ declare module THREE { holes: Path[]; + extrude(options?: any): ExtrudeGeometry; makeGeometry(options?: any): ShapeGeometry; + getPointsHoles(divisions: number): Vector2[][]; + getSpacedPointsHoles(divisions: number): Vector2[][]; extractAllPoints(divisions: number): { shape: Vector2[]; holes: Vector2[][]; }; - extrude(options?: any): ExtrudeGeometry; extractPoints(divisions: number): Vector2[]; extractAllSpacedPoints(divisions: Vector2): { shape: Vector2[]; holes: Vector2[][]; }; - getPointsHoles(divisions: number): Vector2[][]; - getSpacedPointsHoles(divisions: number): Vector2[][]; + } + // Extras / Curves ///////////////////////////////////////////////////////////////////// + export class ArcCurve extends EllipseCurve { + constructor(aX: number, aY: number, aRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean ); + } + export class ClosedSplineCurve3 extends Curve { + constructor( points?:Vector3[] ); + + points:Vector3[]; + + getPoint(t: number): Vector3; + } + + export class CubicBezierCurve extends Curve { + constructor( v0: Vector2, v1: Vector2, v2: Vector2, v3: Vector2 ); + + v0: Vector2; + v1: Vector2; + v2: Vector2; + v3: Vector2; + + getPoint(t: number): Vector2; + getTangent(t: number): Vector2; + } + export class CubicBezierCurve3 extends Curve { + constructor( v0: Vector3, v1: Vector3, v2: Vector3, v3: Vector3 ); + + v0: Vector3; + v1: Vector3; + v2: Vector3; + v3: Vector3; + + getPoint(t: number): Vector3; + } + export class EllipseCurve extends Curve { + constructor( aX: number, aY: number, xRadius: number, yRadius: number, aStartAngle: number, aEndAngle: number, aClockwise: boolean ); + + aX: number; + aY: number; + xRadius: number; + yRadius: number; + aStartAngle: number; + aEndAngle: number; + aClockwise: boolean; + + getPoint(t: number): Vector2; + } + export class LineCurve extends Curve { + constructor( v1: Vector2, v2: Vector2 ); + + v1: Vector2; + v2: Vector2; + + getPoint(t: number): Vector2; + getPointAt(u: number): Vector2; + getTangent(t: number): Vector2; + } + export class LineCurve3 extends Curve { + constructor( v1: Vector3, v2: Vector3 ); + + v1: Vector3; + v2: Vector3; + + getPoint(t: number): Vector3; + } + export class QuadraticBezierCurve extends Curve { + constructor( v0: Vector2, v1: Vector2, v2: Vector2 ); + + v0: Vector2; + v1: Vector2; + v2: Vector2; + + getPoint(t: number): Vector2; + getTangent(t: number): Vector2; + } + export class QuadraticBezierCurve3 extends Curve { + constructor( v0: Vector3, v1: Vector3, v2: Vector3 ); + + v0: Vector3; + v1: Vector3; + v2: Vector3; + + getPoint(t: number): Vector3; + } + export class SplineCurve extends Curve { + constructor( points?: Vector2[] ); + + points:Vector2[]; + + getPoint(t: number): Vector2; + } + export class SplineCurve3 extends Curve { + constructor( points?: Vector3[] ); + + points:Vector3[]; + + getPoint(t: number): Vector3; + } // Extras / Geomerties ///////////////////////////////////////////////////////////////////// /** @@ -5325,10 +5347,33 @@ declare module THREE { * @param depthSegments — Number of segmented faces along the depth of the sides. */ constructor(width: number, height: number, depth: number, widthSegments?: number, heightSegments?: number, depthSegments?: number); + + parameters: { + width: number; + height: number; + depth: number; + widthSegments: number; + heightSegments: number; + depthSegments: number; + }; + widthSegments: number; + heightSegments: number; + depthSegments: number; } export class CircleGeometry extends Geometry { constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number); + + parameters: { + radius: number; + segments: number; + thetaStart: number; + thetaLength: number; + }; + radius: number; + segments: number; + thetaStart: number; + thetaLength: number; } export class CubeGeometry extends BoxGeometry { @@ -5344,6 +5389,21 @@ declare module THREE { * @param openEnded - A Boolean indicating whether or not to cap the ends of the cylinder. */ constructor(radiusTop?: number, radiusBottom?: number, height?: number, radiusSegments?: number, heightSegments?: number, openEnded?: boolean); + + parameters: { + radiusTop: number; + radiusBottom: number; + height: number; + radialSegments: number; + heightSegments: number; + openEnded: boolean; + }; + radiusTop: number; + radiusBottom: number; + height: number; + radialSegments: number; + heightSegments: number; + openEnded: boolean; } export class ExtrudeGeometry extends Geometry { @@ -5356,14 +5416,29 @@ declare module THREE { export class IcosahedronGeometry extends PolyhedronGeometry { constructor(radius: number, detail: number); + + parameters: { + radius: number; + detail: number; + }; + radius: number; + detail: number; } export class LatheGeometry extends Geometry { - constructor(points: Vector3[], steps?: number, angle?: number); + constructor(points: Vector3[], segments?: number, phiStart?: number, phiLength?: number); + } export class OctahedronGeometry extends PolyhedronGeometry { constructor(radius: number, detail: number); + + parameters: { + radius: number; + detail: number; + }; + radius: number; + detail: number; } export class ParametricGeometry extends Geometry { @@ -5372,6 +5447,17 @@ declare module THREE { export class PlaneGeometry extends Geometry { constructor(width: number, height: number, widthSegments?: number, heightSegments?: number); + + parameters: { + width: number; + height: number; + widthSegments: number; + heightSegments: number; + }; + width: number; + height: number; + widthSegments: number; + heightSegments: number; } export class PolyhedronGeometry extends Geometry { @@ -5381,6 +5467,7 @@ declare module THREE { export class RingGeometry extends Geometry { constructor(innerRadius?: number, outerRadius?: number, thetaSegments?: number, phiSegments?: number, thetaStart?: number, thetaLength?: number); } + export class ShapeGeometry extends Geometry { constructor(shape: Shape, options?: any); constructor(shapes: Shape[], options?: any); @@ -5397,14 +5484,31 @@ declare module THREE { * The geometry is created by sweeping and calculating vertexes around the Y axis (horizontal sweep) and the Z axis (vertical sweep). Thus, incomplete spheres (akin to 'sphere slices') can be created through the use of different values of phiStart, phiLength, thetaStart and thetaLength, in order to define the points in which we start (or end) calculating those vertices. * * @param radius — sphere radius. Default is 50. - * @param segmentsWidth — number of horizontal segments. Minimum value is 3, and the default is 8. - * @param segmentsHeight — number of vertical segments. Minimum value is 2, and the default is 6. + * @param widthSegments — number of horizontal segments. Minimum value is 3, and the default is 8. + * @param heightSegments — number of vertical segments. Minimum value is 2, and the default is 6. * @param phiStart — specify horizontal starting angle. Default is 0. * @param phiLength — specify horizontal sweep angle size. Default is Math.PI * 2. * @param thetaStart — specify vertical starting angle. Default is 0. * @param thetaLength — specify vertical sweep angle size. Default is Math.PI. */ constructor(radius: number, widthSegments?: number, heightSegments?: number, phiStart?: number, phiLength?: number, thetaStart?: number, thetaLength?: number); + + parameters: { + radius: number; + widthSegments: number; + heightSegments: number; + phiStart: number; + phiLength: number; + thetaStart: number; + thetaLength: number; + }; + radius: number; + widthSegments: number; + heightSegments: number; + phiStart: number; + phiLength: number; + thetaStart: number; + thetaLength: number; } export class TetrahedronGeometry extends PolyhedronGeometry { @@ -5429,19 +5533,56 @@ declare module THREE { export class TorusGeometry extends Geometry { constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number); + + parameters: { + radius: number; + tube: number; + radialSegments: number; + tubularSegments: number; + arc: number; + }; + radius: number; + tube: number; + radialSegments: number; + tubularSegments: number; + arc: number; } export class TorusKnotGeometry extends Geometry { constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, p?: number, q?: number, heightScale?: number); + + parameters: { + radius: number; + tube: number; + radialSegments: number; + tubularSegments: number; + p: number; + q: number; + heightScale: number; + }; + radius: number; + tube: number; + radialSegments: number; + tubularSegments: number; + p: number; + q: number; + heightScale: number; } export class TubeGeometry extends Geometry { constructor(path: Path, segments?: number, radius?: number, radiusSegments?: number, closed?: boolean); + parameters: { + path: Path; + segments: number; + radius: number; + radialSegments: number; + closed: boolean; + }; path: Path; segments: number; radius: number; - radiusSegments: number; + radialSegments: number; closed: boolean; tangents: Vector3[]; normals: Vector3[]; @@ -5458,29 +5599,26 @@ declare module THREE { line: Line; cone: Mesh; - setColor(hex: number): void; - setLength(length: number): void; setDirection(dir: Vector3): void; + setLength(length: number): void; + setColor(hex: number): void; } export class AxisHelper extends Line { - constructor(size: number); + constructor(size?: number); } export class BoundingBoxHelper extends Mesh { - constructor(object: Object3D, hex: number); + constructor(object: Object3D, hex?: number); object: Object3D; - vertices: Vector3[]; + box: Box3[]; update(): void; } export class BoxHelper extends Line { - constructor(object: Object3D); - - object: Object3D; - box: Box3; + constructor(object?: Object3D); update(object?: Object3D): void; } @@ -5488,35 +5626,33 @@ declare module THREE { export class CameraHelper extends Line { constructor(camera: Camera); - pointMap: { [id: string]: number[]; }; camera: Camera; + pointMap: { [id: string]: number[]; }; update(): void; } export class DirectionalLightHelper extends Object3D { - constructor(light: Light, size: number); + constructor(light: Light, size?: number); - lightPlane: Line; light: Light; + lightPlane: Line; targetLine: Line; - update(): void; dispose(): void; + update(): void; } export class EdgesHelper extends Line { constructor(object: Object3D, hex?: number); - matrixAutoUpdate: boolean; - matrixWorld: Matrix4; } export class FaceNormalsHelper extends Line { constructor(object: Object3D, size?: number, hex?: number, linewidth?: number); + object: Object3D; size: number; - matrixAutoUpdate: boolean; normalMatrix: Matrix3; update(object?: Object3D): void; @@ -5525,23 +5661,28 @@ declare module THREE { export class GridHelper extends Line { constructor(size: number, step: number); + color1: Color; + color2: Color; + setColors(colorCenterLine: number, colorGrid: number): void; } export class HemisphereLightHelper extends Object3D { constructor(light: Light, sphereSize: number, arrowLength: number, domeSize: number); - lightSphere: Mesh; light: Light; + colors: Color[]; + lightSphere: Mesh; + dispose(): void; update(): void; } export class PointLightHelper extends Object3D { constructor(light: Light, sphereSize: number); - lightSphere: Mesh; light: Light; + dispose(): void; update(): void; } @@ -5550,8 +5691,7 @@ declare module THREE { bones: Bone[]; root: Object3D; - matrixWorld: Matrix4; - matrixAutoUpdate: boolean; + getBoneList(object: Object3D): Bone[]; update(): void; } @@ -5559,18 +5699,18 @@ declare module THREE { export class SpotLightHelper extends Object3D { constructor(light: Light, sphereSize: number, arrowLength: number); - lightSphere: Mesh; light: Light; - lightCone: Mesh; + cone: Mesh; + dispose(): void; update(): void; } export class VertexNormalsHelper extends Line { constructor(object: Object3D, size?: number, hex?: number, linewidth?: number); + object: Object3D; size: number; - matrixAutoUpdate: boolean; normalMatrix: Matrix3; update(object?: Object3D): void; @@ -5579,8 +5719,8 @@ declare module THREE { export class VertexTangentsHelper extends Line { constructor(object: Object3D, size?: number, hex?: number, linewidth?: number); + object: Object3D; size: number; - matrixAutoUpdate: boolean; update(object?: Object3D): void; } @@ -5588,8 +5728,6 @@ declare module THREE { export class WireframeHelper extends Line { constructor(object: Object3D, hex?: number); - matrixAutoUpdate: boolean; - matrixWorld: Matrix4; } // Extras / Objects ///////////////////////////////////////////////////////////////////// @@ -5650,19 +5788,19 @@ declare module THREE { animationsMap: { [name: string]: MorphBlendMeshAnimation; }; animationsList: MorphBlendMeshAnimation[]; - setAnimationWeight(name: string, weight: number): void; - setAnimationFPS(name: string, fps: number): void; createAnimation(name: string, start: number, end: number, fps: number): void; - playAnimation(name: string): void; - update(delta: number): void; autoCreateAnimations(fps: number): void; - setAnimationDuration(name: string, duration: number): void; setAnimationDirectionForward(name: string): void; - getAnimationDuration(name: string): number; - getAnimationTime(name: string): number; setAnimationDirectionBackward(name: string): void; + setAnimationFPS(name: string, fps: number): void; + setAnimationDuration(name: string, duration: number): void; + setAnimationWeight(name: string, weight: number): void; setAnimationTime(name: string, time: number): void; + getAnimationTime(name: string): number; + getAnimationDuration(name: string): number; + playAnimation(name: string): void; stopAnimation(name: string): void; + update(delta: number): void; } // Extras / Renderers / Plugins ///////////////////////////////////////////////////////////////////// @@ -5674,8 +5812,8 @@ declare module THREE { renderTarget: RenderTarget; init(renderer: Renderer): void; - update(scene: Scene, camera: Camera): void; render(scene: Scene, camera: Camera): void; + update(scene: Scene, camera: Camera): void; } export class LensFlarePlugin implements RendererPlugin { @@ -5689,9 +5827,8 @@ declare module THREE { constructor(); init(renderer: Renderer): void; - - update(scene: Scene, camera: Camera): void; render(scene: Scene, camera: Camera): void; + update(scene: Scene, camera: Camera): void; } export class SpritePlugin implements RendererPlugin { From 867cede314770e5ebf2f3db1c973ba255db70f79 Mon Sep 17 00:00:00 2001 From: satoru kimura Date: Mon, 25 Aug 2014 02:05:22 +0900 Subject: [PATCH 08/40] Modified the test code. --- threejs/tests/canvas/canvas_camera_orthographic.ts | 4 ++-- threejs/tests/canvas/canvas_geometry_cube.ts | 6 +++--- threejs/tests/canvas/canvas_materials.ts | 8 ++++---- threejs/three.d.ts | 2 ++ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/threejs/tests/canvas/canvas_camera_orthographic.ts b/threejs/tests/canvas/canvas_camera_orthographic.ts index 0674e6fa4..7391d978b 100644 --- a/threejs/tests/canvas/canvas_camera_orthographic.ts +++ b/threejs/tests/canvas/canvas_camera_orthographic.ts @@ -55,12 +55,12 @@ // Cubes - var geometry = new THREE.BoxGeometry(50, 50, 50); + var geometry2 = new THREE.BoxGeometry(50, 50, 50); var material2 = new THREE.MeshLambertMaterial({ color: 0xffffff, shading: THREE.FlatShading, overdraw: 0.5 }); for (var i = 0; i < 100; i++) { - var cube = new THREE.Mesh(geometry, material2); + var cube = new THREE.Mesh(geometry2, material2); cube.scale.y = Math.floor(Math.random() * 2 + 1); diff --git a/threejs/tests/canvas/canvas_geometry_cube.ts b/threejs/tests/canvas/canvas_geometry_cube.ts index bf5f9ae99..c8f6b377c 100644 --- a/threejs/tests/canvas/canvas_geometry_cube.ts +++ b/threejs/tests/canvas/canvas_geometry_cube.ts @@ -61,12 +61,12 @@ // Plane - var geometry = new THREE.PlaneGeometry(200, 200); - geometry.applyMatrix(new THREE.Matrix4().makeRotationX(- Math.PI / 2)); + var geometry2 = new THREE.PlaneGeometry(200, 200); + geometry2.applyMatrix(new THREE.Matrix4().makeRotationX(- Math.PI / 2)); var material = new THREE.MeshBasicMaterial({ color: 0xe0e0e0, overdraw: 0.5 }); - plane = new THREE.Mesh(geometry, material); + plane = new THREE.Mesh(geometry2, material); scene.add(plane); renderer = new THREE.CanvasRenderer(); diff --git a/threejs/tests/canvas/canvas_materials.ts b/threejs/tests/canvas/canvas_materials.ts index a39a780ca..0d8f8a631 100644 --- a/threejs/tests/canvas/canvas_materials.ts +++ b/threejs/tests/canvas/canvas_materials.ts @@ -50,7 +50,7 @@ // Spheres - var geometry = new THREE.SphereGeometry(100, 14, 7); + var geometry2 = new THREE.SphereGeometry(100, 14, 7); materials = [ @@ -66,9 +66,9 @@ ]; - for (var i = 0, l = geometry.faces.length; i < l; i++) { + for (var i = 0, l = geometry2.faces.length; i < l; i++) { - var face = geometry.faces[i]; + var face = geometry2.faces[i]; if (Math.random() > 0.5) face.materialIndex = Math.floor(Math.random() * materials.length); } @@ -79,7 +79,7 @@ for (var i = 0, l = materials.length; i < l; i++) { - var sphere = new THREE.Mesh(geometry, materials[i]); + var sphere = new THREE.Mesh(geometry2, materials[i]); sphere.position.x = (i % 5) * 200 - 400; sphere.position.z = Math.floor(i / 5) * 200 - 200; diff --git a/threejs/three.d.ts b/threejs/three.d.ts index fa6208990..3bace7645 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -93,7 +93,9 @@ declare module THREE { } export var UVMapping: MappingConstructor; export var CubeReflectionMapping: MappingConstructor; + export var CubeRefractionMapping: MappingConstructor; export var SphericalReflectionMapping: MappingConstructor; + export var SphericalRefractionMapping: MappingConstructor; // Wrapping modes export enum Wrapping { } From 79cc15e42db4b28764105e52ddc96869be68a1b7 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Date: Mon, 25 Aug 2014 03:27:14 -0300 Subject: [PATCH 09/40] augmented scope, fix implicit any tests --- .../angular-ui-bootstrap-tests.ts | 6 ++-- .../angular-ui-bootstrap.d.ts | 32 +++++++++++++++++-- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts index 8ed8be859..608591b58 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts @@ -118,7 +118,7 @@ testApp.config(( }); testApp.controller('TestCtrl', ( - $scope: ng.IScope, + $scope: ng.ui.bootstrap.IModalScope, $log: ng.ILogService, $modal: ng.ui.bootstrap.IModalService, $modalStack: ng.ui.bootstrap.IModalStackService, @@ -147,9 +147,9 @@ testApp.controller('TestCtrl', ( $log.log('modal opened'); }); - modalInstance.result.then(closeResult=> { + modalInstance.result.then((closeResult:any)=> { $log.log('modal closed', closeResult); - }, dismissResult=> { + }, (dismissResult:any)=> { $log.log('modal dismissed', dismissResult); }); diff --git a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts index 2d792d1b1..ad90dc9db 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular UI Bootstrap 0.10.0 +// Type definitions for Angular UI Bootstrap 0.11.0 // Project: https://github.com/angular-ui/bootstrap // Definitions by: Brian Surowiec // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -198,6 +198,22 @@ declare module ng.ui.bootstrap { opened: ng.IPromise; } + interface IModalScope extends ng.IScope { + /** + * Those methods make it easy to close a modal window without a need to create a dedicated controller + */ + + /** + * Dismiss the dialog without assigning a value to the promise output + */ + $dismiss(reason?: any): void; + + /** + * Close the dialog resolving the promise to the given value + */ + $close(result?: any): void; + } + interface IModalSettings { /** * a path to a template representing modal's content @@ -211,9 +227,9 @@ declare module ng.ui.bootstrap { /** * a scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope). - * Defaults to `$rootScope` + * Defaults to `$rootScope`. */ - scope?: any; + scope?: IModalScope; /** * a controller for a modal instance - it can initialize scope used by modal. @@ -246,6 +262,16 @@ declare module ng.ui.bootstrap { * additional CSS class(es) to be added to a modal window template */ windowClass?: string; + + /** + * optional size of modal window. Allowed values: 'sm' (small) or 'lg' (large). Requires Bootstrap 3.1.0 or later + */ + size?: string; + + /** + * a path to a template overriding modal's window template + */ + windowTemplateUrl?: string; } interface IModalStackService { From 5d61f02af8e08fe84b0c004693674a3103dde9ed Mon Sep 17 00:00:00 2001 From: Jakub Olek Date: Tue, 10 Jun 2014 20:26:51 +0200 Subject: [PATCH 10/40] Working on hapi.d.ts --- CONTRIBUTORS.md | 1 + hapi/hapi-tests.ts | 18 ++ hapi/hapi.d.ts | 430 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 449 insertions(+) create mode 100644 hapi/hapi-tests.ts create mode 100644 hapi/hapi.d.ts diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index bb0933af5..e122304b6 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -117,6 +117,7 @@ All definitions files include a header with the author and editors, so at some p * [Google Translate API](https://developers.google.com/translate/) (by [Frank M](https://github.com/sgtfrankieboy)) * [Google Url Shortener](https://developers.google.com/url-shortener/) (by [Frank M](https://github.com/sgtfrankieboy)) * [Hammer.js](http://eightmedia.github.com/hammer.js/) (by [Boris Yankov](https://github.com/borisyankov)) +* [Hapi](http://github.com/spumko/hapi) (by [Hakubo](http://github.com/hakubo)) * [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov)) * [HashMap](https://github.com/flesler/hashmap) (by [Rafał Wrzeszcz](https://wrzasq.pl)) * [HashSet](http://www.timdown.co.uk/jshashtable/jshashset.html) (by [Sergey Gerasimov](https://github.com/gerich-home)) diff --git a/hapi/hapi-tests.ts b/hapi/hapi-tests.ts new file mode 100644 index 000000000..6617387d8 --- /dev/null +++ b/hapi/hapi-tests.ts @@ -0,0 +1,18 @@ +/// + +import Hapi = require('hapi'); + +// Create a server with a host and port +var server = Hapi.createServer('localhost', 8000); + +// Add the route +server.route({ + method: 'GET', + path: '/hello', + handler: function (request, reply) { + reply('hello world'); + } +}); + +// Start the server +server.start(); diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts new file mode 100644 index 000000000..0914a5367 --- /dev/null +++ b/hapi/hapi.d.ts @@ -0,0 +1,430 @@ +// Type definitions for hapi +// Project: http://github.com/spumko/hapi +// Definitions by: Hakubo +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Hapi { + export interface ServerOptions { + app?: any; + cache?: string; + cache?: { + engine: any; + }; + cors?: boolean; + cors?: { + origin?: Array; + isOriginExposed?: boolean; + matchOrigin?: boolean; + maxAge?: number; + headers?: Array; + additionalHeaders?: Array; + methods?: Array; + additionalMethods?: Array; + exposedHeaders?: Array; + additionalExposedHeaders?: Array; + credentials?: boolean; + }; + security?: boolean; + security?: { + hsts?: boolean; + hsts?: { + maxAge: number; + includeSubdomains: boolean; + }; + xframe?: boolean; + xframe?: string; + xframe?: { + rule: string; + source: any; + }; + xss?: boolean; + noOpen?: boolean; + noSniff?: boolean; + }; + debug?: { + request: Array; + }; + files?: { + relativeTo: string; + etagsCacheMaxSize: number; + }; + json?: { + replacer?: Function; + replacer?: Array; + space?: number; + }; + labels?: Array; + load?: { + maxHeapUsedBytes?: number; + maxRssBytes?: number; + maxEventLoopDelay?: number; + sampleInterval?: number; + }; + location?: string; + payload?: { + maxBytes: number; + uploads: string; + }; + plugins?: any; + router?: { + isCaseSensitive?: boolean; + stripTrailingSlash?: boolean; + }; + state?: { + cookies: { + parse?: boolean; + failAction?: string; + clearInvalid?: boolean; + strictHeader?: boolean; + } + }; + timeout?: { + server?: boolean; + server?: number; + client?: boolean; + client?: number; + socket?: boolean; + socket?: number; + }; + tls?: any; //This should be Node.tls + maxSockets?: number; + validation?: any; + views?: ServerView; + } + + export class Pack { + require(name: string, options: {}, callback: Function): void; + } + + interface ServerView { + engines: { + module: string; + compile: (template: string, options: any): (context: any, options: any); + compile: (template: string, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: boolean)))): void; + }; + defaultExtension: string; + path?: string; + partialsPath?: string; + helpersPath?: string; + basePath: string; + layout?: boolean; + layoutPath?: string; + layoutKeyword?: string; + encoding?: string; + isCached?: boolean; + allowAbsolutePaths?: boolean; + allowInsecureAccess?: boolean; + compileOptions?: any; + runtimeOptions?: any; + contentType?: string; + compileMode?: string; + } + + interface RouteOptions { + path: string; + method: string; + vhost?: string; + vhost?: Array; + handler: string; + handler: (); + handler: { + file: string; + file: (request: Request); + file: { + path: string; + filename?: string; + mode?: boolean; + mode?: string; + lookupCompressed: boolean; + }; + directory: { + path: string; + path: Array; + path: (request: Request): string; + path: (request: Request): Array; + index?: boolean; + listing?: boolean; + showHidden?: boolean; + redirectToSlash?: boolean; + lookupCompressed?: boolean; + defaultExtension?: string; + }; + proxy?: { + host?: string; + port?: number; + protocol?: string; + uri?: string; + passThrough?: boolean; + rejectUnauthorized?: boolean; + xforward?: boolean; + redirects?: boolean; + redirects?: number; + timeout?: number; + + mapUri?: (request: Request, callback: (err: any, uri: string, headers: {[key: string]: string}): void): void; + onResponse: ( + err: any, + res: any,//Node Response + req: any,//Node Request + reply: (): void, + settings: any, + ttl: number + ); + ttl: number; + }; + view: string; + view: { + template: string; + context: { + payload: any; + params: any; + query: any; + pre: any; + } + }; + config: { + handler: any; + bind: any; + app: any; + plugins: { + [name: string]: any; + }; + pre: Array<()>; + validate: { + headers: any; + params: any; + query: any; + payload: any; + errorFields?: any; + failAction?: string; + failAction?: (source: string, error: any, next: ()); + }; + payload: { + output: { + data: any; + stream: any; + file: any; + }; + parse?: any; + allow?: string; + allow?: Array; + override?: string; + maxBytes?: number; + uploads?: number; + failAction?: string; + }; + response: { + schema: any; + sample: number; + failAction: string; + }; + cache: { + privacy: string; + expiresIn: number; + expiresAt: number; + }; + auth: string; + auth: boolean; + auth: { + mode: string; + strategies: Array; + payload?: boolean; + payload?: string; + tos?: boolean; + tos?: string; + scope?: string; + scope?: Array; + entity: string; + }; + cors?: boolean; + jsonp?: string; + description?: string; + notes?: string; + notes?: Array; + tags?: Array; + } + }; + } + + export class Server { + app: any; + methods: Array; + info: { + port: number; + host?: string; + protocol?: string; + uri?: string; + }; + listener: any;// Node Http server + load: { + eventLoopDelay: number; + heapUsed: number; + rss: number; + }; + pack: Pack; + plugins: { + [pluginName: string]: any; + }; + + + start(callback?: ()): void; + stop(options?: {timeout: number;}, callback?: ()): void; + route(options: RouteOptions): void; + route(routes: Array): void; + table(host?: string): Array; + log(tags: string, data?: string, timestamp?: number): void; + log(tags: Array, data?: string, timestamp?: number): void; + log(tags: string, data?: any, timestamp?: number): void; + log(tags: Array, data?: any, timestamp?: number): void; + state(name: string, options?: { + ttl: number; + isSecure: boolean; + isHttpOnly: boolean; + path: string; + domain: string; + autoValue: (request: Request, next: (err: any, value: any): void): void; + encoding?: string; + sign: any; + password: string; + iron: any; + }); + views: (options: ServerView): void; + cache: (name: string, options: { + expiresIn: number; + expiresAt: number; + staleIn: number; + staleTimeout: number; + cache: string; + }): void; + + auth: { + scheme: (name: string, scheme: { + name: string; + scheme: (server: Server, options: any): (authenticate: any, payload: any, response: any); + }); + strategy: any; + }; + ext: (event: any, method: string, options?: any): void; + method: (method: Array<{name: string; fn: (); options: any}>): void; + method: (name: string, fn: (), options: any): void; + inject: (options: any, callback: any): void; + handler: (name: string, method: (name: string, options: any): void): void; + } + + export interface Request { + app: any; + auth: { + isAuthenticated: boolean; + credentials: Object; + artifacts: Object; + session: Object + }; + domain: any; + headers: Object; + id: number; + info: { + received: number; + remoteAddress: string; + remotePort: number; + referrer: string; + host: string; + }; + method: string; + mime?: string; + params: any; + path: string; + payload: any; + plugins: Object; + pre: Object; + response: Object; + responses: Object; + query: Object; + raw: { + req: any; //http.ClientRequest + res: any; //http.ClientResponse + }; + route: string; + server: Server; + session: any; + state: Object; + url: Object; + + setUrl? (url: string): void; + setMethod? (method: string): void; + log (tags: string, data?: string, timestamp?: number): void; + log (tags: string, data?: Object, timestamp?: number): void; + log (tags: string[], data?: string, timestamp?: number): void; + log (tags: string[], data?: Object, timestamp?: number): void; + getLog(): string[]; + getLog(tag: string): string[]; + getLog(tags: string[]): string[]; + tail(name?: string): Function; + } + + export interface Response { + statusCode: number; + headers: Object; + source: any; + variety: string; + app: any; + plugins: Object; + settings: { + encoding: string; + charset: string; + location: string; + ttl: number; + stringify: any; + passThrough: boolean; + } + + code (statusCode: number): void; + header (name: string, value: string, options?: { + append: boolean; + separator: string; + override: boolean; + }): void; + type (mimeType: string): void; + bytes (length: number): void; + vary (header: string): void; + location (location: string): void; + created (location: string): void; + redirect (location: string): void; + encoding (encoding: string): void; + charset (charset: string): void; + ttl (ttl: number): void; + state (name: string, value: string, options?: any): void; + unstate (name: string): void; + + replacer (method: Function): void; + replacer (method: Array): void; + spaces (count: number): void; + + temporary (isTemporary: boolean): void; + permanent (isPermanent: boolean): void; + rewritable (isRewritable: boolean): void; + } + + export module reply { + function file(path: string, options: { + filePath: string; + options: { + filename: string; + mode: string + } + }): void; + + function view(template: string, context?: Object, options?: Object): Response; + function close(options?: Object): void; + function proxy(options: Object): void; + + export function reply(result: any): any; + } + + export function createServer (host: string, port: number, options?: ServerOptions): Server; +} + +declare module "hapi" { + export = Hapi; +} From 60bc96cefb2304db0d2f3ad198696157fab065ae Mon Sep 17 00:00:00 2001 From: Jakub Olek Date: Tue, 10 Jun 2014 21:42:36 +0200 Subject: [PATCH 11/40] I have no idea how to do union types for properties and how to use node modules --- hapi/hapi-tests.ts | 10 +- hapi/hapi.d.ts | 394 ++++++++++++++++++++++++--------------------- 2 files changed, 219 insertions(+), 185 deletions(-) diff --git a/hapi/hapi-tests.ts b/hapi/hapi-tests.ts index 6617387d8..fcc870af6 100644 --- a/hapi/hapi-tests.ts +++ b/hapi/hapi-tests.ts @@ -9,10 +9,18 @@ var server = Hapi.createServer('localhost', 8000); server.route({ method: 'GET', path: '/hello', - handler: function (request, reply) { + handler: function (request: Hapi.Request, reply: Function) { reply('hello world'); } }); +server.route([{ + method: 'GET', + path: '/hello2', + handler: function (request: Hapi.Request, reply: Function) { + reply('hello world2'); + } +}]); + // Start the server server.start(); diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index 0914a5367..cf2d966a0 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -8,41 +8,44 @@ declare module Hapi { export interface ServerOptions { app?: any; - cache?: string; - cache?: { - engine: any; - }; - cors?: boolean; - cors?: { - origin?: Array; - isOriginExposed?: boolean; - matchOrigin?: boolean; - maxAge?: number; - headers?: Array; - additionalHeaders?: Array; - methods?: Array; - additionalMethods?: Array; - exposedHeaders?: Array; - additionalExposedHeaders?: Array; - credentials?: boolean; - }; - security?: boolean; - security?: { - hsts?: boolean; - hsts?: { - maxAge: number; - includeSubdomains: boolean; - }; - xframe?: boolean; - xframe?: string; - xframe?: { - rule: string; - source: any; - }; - xss?: boolean; - noOpen?: boolean; - noSniff?: boolean; - }; +// cache?: string; +// cache?: { +// engine: any; +// }; + cache?: any; +// cors?: boolean; +// cors?: { +// origin?: Array; +// isOriginExposed?: boolean; +// matchOrigin?: boolean; +// maxAge?: number; +// headers?: Array; +// additionalHeaders?: Array; +// methods?: Array; +// additionalMethods?: Array; +// exposedHeaders?: Array; +// additionalExposedHeaders?: Array; +// credentials?: boolean; +// }; + cors?: any; +// security?: boolean; +// security?: { +// hsts?: boolean; +// hsts?: { +// maxAge: number; +// includeSubdomains: boolean; +// }; +// xframe?: boolean; +// xframe?: string; +// xframe?: { +// rule: string; +// source: any; +// }; +// xss?: boolean; +// noOpen?: boolean; +// noSniff?: boolean; +// }; + security?: any; debug?: { request: Array; }; @@ -51,8 +54,9 @@ declare module Hapi { etagsCacheMaxSize: number; }; json?: { - replacer?: Function; - replacer?: Array; +// replacer?: () => void; +// replacer?: Array<() => void>; + replacer?: any; space?: number; }; labels?: Array; @@ -81,12 +85,15 @@ declare module Hapi { } }; timeout?: { - server?: boolean; - server?: number; - client?: boolean; - client?: number; - socket?: boolean; - socket?: number; +// server?: boolean; +// server?: number; + server?: any; +// client?: boolean; +// client?: number; + client?: any; +// socket?: boolean; +// socket?: number; + socket?: any; }; tls?: any; //This should be Node.tls maxSockets?: number; @@ -98,11 +105,29 @@ declare module Hapi { require(name: string, options: {}, callback: Function): void; } - interface ServerView { + export interface ServerView { engines: { module: string; - compile: (template: string, options: any): (context: any, options: any); - compile: (template: string, options: any, callback: (err: any, compiled: (context: any, options: any, callback: (err: any, rendered: boolean)))): void; +// compile: ( +// template: string, +// options: any +// ) => void; +// compile: ( +// template: string, +// options: any, +// callback: ( +// err: any, +// compiled: ( +// context: any, +// options: any, +// callback: ( +// err: any, +// rendered: boolean +// ) => void +// ) => void +// ) => void +// ) => void; + compile: any; }; defaultExtension: string; path?: string; @@ -122,135 +147,137 @@ declare module Hapi { compileMode?: string; } - interface RouteOptions { + export interface RouteOptions { path: string; method: string; - vhost?: string; - vhost?: Array; - handler: string; - handler: (); - handler: { - file: string; - file: (request: Request); - file: { - path: string; - filename?: string; - mode?: boolean; - mode?: string; - lookupCompressed: boolean; - }; - directory: { - path: string; - path: Array; - path: (request: Request): string; - path: (request: Request): Array; - index?: boolean; - listing?: boolean; - showHidden?: boolean; - redirectToSlash?: boolean; - lookupCompressed?: boolean; - defaultExtension?: string; - }; - proxy?: { - host?: string; - port?: number; - protocol?: string; - uri?: string; - passThrough?: boolean; - rejectUnauthorized?: boolean; - xforward?: boolean; - redirects?: boolean; - redirects?: number; - timeout?: number; - - mapUri?: (request: Request, callback: (err: any, uri: string, headers: {[key: string]: string}): void): void; - onResponse: ( - err: any, - res: any,//Node Response - req: any,//Node Request - reply: (): void, - settings: any, - ttl: number - ); - ttl: number; - }; - view: string; - view: { - template: string; - context: { - payload: any; - params: any; - query: any; - pre: any; - } - }; - config: { - handler: any; - bind: any; - app: any; - plugins: { - [name: string]: any; - }; - pre: Array<()>; - validate: { - headers: any; - params: any; - query: any; - payload: any; - errorFields?: any; - failAction?: string; - failAction?: (source: string, error: any, next: ()); - }; - payload: { - output: { - data: any; - stream: any; - file: any; - }; - parse?: any; - allow?: string; - allow?: Array; - override?: string; - maxBytes?: number; - uploads?: number; - failAction?: string; - }; - response: { - schema: any; - sample: number; - failAction: string; - }; - cache: { - privacy: string; - expiresIn: number; - expiresAt: number; - }; - auth: string; - auth: boolean; - auth: { - mode: string; - strategies: Array; - payload?: boolean; - payload?: string; - tos?: boolean; - tos?: string; - scope?: string; - scope?: Array; - entity: string; - }; - cors?: boolean; - jsonp?: string; - description?: string; - notes?: string; - notes?: Array; - tags?: Array; - } - }; +// vhost?: string; +// vhost?: Array; + vhost?: any; +// handler: string; +// handler: (request: Request, reply: Function) => void; +// handler: { +// file: string; +// file: (request: Request) => void; +// file: { +// path: string; +// filename?: string; +// mode?: boolean; +// mode?: string; +// lookupCompressed: boolean; +// }; +// directory: { +// path: string; +// path: Array; +// path: (request: Request) => string; +// path: (request: Request) => Array; +// index?: boolean; +// listing?: boolean; +// showHidden?: boolean; +// redirectToSlash?: boolean; +// lookupCompressed?: boolean; +// defaultExtension?: string; +// }; +// proxy?: { +// host?: string; +// port?: number; +// protocol?: string; +// uri?: string; +// passThrough?: boolean; +// rejectUnauthorized?: boolean; +// xforward?: boolean; +// redirects?: boolean; +// redirects?: number; +// timeout?: number; +// +// mapUri?: (request: Request, callback: (err: any, uri: string, headers: {[key: string]: string}) => void) => void; +// onResponse: ( +// err: any, +// res: any,//Node Response +// req: any,//Node Request +// reply: () => void, +// settings: any, +// ttl: number +// ) => void; +// ttl: number; +// }; +// view: string; +// view: { +// template: string; +// context: { +// payload: any; +// params: any; +// query: any; +// pre: any; +// } +// }; +// config: { +// handler: any; +// bind: any; +// app: any; +// plugins: { +// [name: string]: any; +// }; +// pre: Array<() => void>; +// validate: { +// headers: any; +// params: any; +// query: any; +// payload: any; +// errorFields?: any; +// failAction?: string; +// failAction?: (source: string, error: any, next: () => void) => void; +// }; +// payload: { +// output: { +// data: any; +// stream: any; +// file: any; +// }; +// parse?: any; +// allow?: string; +// allow?: Array; +// override?: string; +// maxBytes?: number; +// uploads?: number; +// failAction?: string; +// }; +// response: { +// schema: any; +// sample: number; +// failAction: string; +// }; +// cache: { +// privacy: string; +// expiresIn: number; +// expiresAt: number; +// }; +// auth: string; +// auth: boolean; +// auth: { +// mode: string; +// strategies: Array; +// payload?: boolean; +// payload?: string; +// tos?: boolean; +// tos?: string; +// scope?: string; +// scope?: Array; +// entity: string; +// }; +// cors?: boolean; +// jsonp?: string; +// description?: string; +// notes?: string; +// notes?: Array; +// tags?: Array; +// } +// }; + handler: any; } export class Server { app: any; - methods: Array; + methods: Array<() => void>; info: { port: number; host?: string; @@ -268,9 +295,8 @@ declare module Hapi { [pluginName: string]: any; }; - - start(callback?: ()): void; - stop(options?: {timeout: number;}, callback?: ()): void; + start(callback?: () => void): void; + stop(options?: {timeout: number;}, callback?: () => void): void; route(options: RouteOptions): void; route(routes: Array): void; table(host?: string): Array; @@ -284,14 +310,14 @@ declare module Hapi { isHttpOnly: boolean; path: string; domain: string; - autoValue: (request: Request, next: (err: any, value: any): void): void; + autoValue: (request: Request, next: (err: any, value: any) => void) => void; encoding?: string; sign: any; password: string; iron: any; - }); - views: (options: ServerView): void; - cache: (name: string, options: { + }): void; + views(options: ServerView): void; + cache(name: string, options: { expiresIn: number; expiresAt: number; staleIn: number; @@ -300,17 +326,17 @@ declare module Hapi { }): void; auth: { - scheme: (name: string, scheme: { + scheme(name: string, scheme: { name: string; - scheme: (server: Server, options: any): (authenticate: any, payload: any, response: any); - }); + scheme: (server: Server, options: any) => (authenticate: any, payload: any, response: any) => void; + }): void; strategy: any; }; - ext: (event: any, method: string, options?: any): void; - method: (method: Array<{name: string; fn: (); options: any}>): void; - method: (name: string, fn: (), options: any): void; - inject: (options: any, callback: any): void; - handler: (name: string, method: (name: string, options: any): void): void; + ext(event: any, method: string, options?: any): void; + method(method: Array<{name: string; fn: () => void; options: any}>): void; + method(name: string, fn: () => void, options: any): void; + inject(options: any, callback: any): void; + handler(name: string, method: (name: string, options: any) => void): void; } export interface Request { From cc4e279c3712229f24bd534f0748c67bb55bfa75 Mon Sep 17 00:00:00 2001 From: Jakub Olek Date: Wed, 11 Jun 2014 22:18:55 +0200 Subject: [PATCH 12/40] Fixes for createServer --- hapi/hapi.d.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hapi/hapi.d.ts b/hapi/hapi.d.ts index cf2d966a0..68b366d6d 100644 --- a/hapi/hapi.d.ts +++ b/hapi/hapi.d.ts @@ -107,7 +107,8 @@ declare module Hapi { export interface ServerView { engines: { - module: string; + [extension: string]: string; + module?: string; // compile: ( // template: string, // options: any @@ -127,13 +128,13 @@ declare module Hapi { // ) => void // ) => void // ) => void; - compile: any; + compile?: any; }; - defaultExtension: string; + defaultExtension?: string; path?: string; partialsPath?: string; helpersPath?: string; - basePath: string; + basePath?: string; layout?: boolean; layoutPath?: string; layoutKeyword?: string; From af20aff6bf56fab94b8169d155263a69a3d03a3a Mon Sep 17 00:00:00 2001 From: Jakub Olek Date: Fri, 22 Aug 2014 17:16:59 +0200 Subject: [PATCH 13/40] Fixes for ember --- ember/ember.d.ts | 1090 +++++++++++++++++++++++----------------------- 1 file changed, 545 insertions(+), 545 deletions(-) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 2a0b35e42..e50185fd5 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -38,10 +38,10 @@ declare module EmberTesting { } interface Function { - observes(...string): Function; - observesBefore(...string): Function; - on(...string): Function; - property(...string): Function; + observes(...args: string[]): Function; + observesBefore(...args: string[]): Function; + on(...args: string[]): Function; + property(...args: string[]): Function; } interface String { @@ -50,9 +50,9 @@ interface String { classify(): string; dasherize(): string; decamelize(): string; - fmt(...string): string; + fmt(...args: string[]): string; htmlSafe(): typeof Handlebars.SafeString; - loc(...string): string; + loc(...args: string[]): string; underscore(): string; w(): string[]; } @@ -70,14 +70,14 @@ interface Array { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Ember.Enumerable); - enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: Ember.Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Ember.Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Ember.Enumerable); - enumerableContentDidChange(removing: Ember.Enumerable, adding: Ember.Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Ember.Enumerable): any; + enumerableContentDidChange(start: number, removing: Ember.Enumerable, adding: Ember.Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Ember.Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Ember.Enumerable): any; + enumerableContentDidChange(removing: Ember.Enumerable, adding: Ember.Enumerable): any; enumerableContentWillChange(removing: number, adding: number): any[]; enumerableContentWillChange(removing: Ember.Enumerable, adding: number): any[]; enumerableContentWillChange(removing: number, adding: Ember.Enumerable): any[]; @@ -93,15 +93,15 @@ interface Array { getEach(key: string): any[]; indexOf(object: any, startAt: number): number; insertAt(idx: number, object: any): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; lastIndexOf(object: any, startAt: number): number; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; objectAt(idx: number): any; - objectsAt(...number): any[]; + objectsAt(...args: number[]): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): any[]; + pushObjects(...args: any[]): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; @@ -136,7 +136,7 @@ interface Array { decrementProperty(keyName: string, decrement?: number): number; endPropertyChanges(): any[]; get(keyName: string): any; - getProperties(...string): {}; + getProperties(...args: string[]): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; hasObserverFor(key: string): boolean; @@ -157,13 +157,13 @@ interface ApplicationCreateArguments { customEvents?: {}; rootElement?: string; /** - Basic logging of successful transitions. - **/ - LOG_TRANSITIONS?: boolean; + Basic logging of successful transitions. + **/ + LOG_TRANSITIONS?: boolean; /** - Detailed logging of all routing steps. - **/ - LOG_TRANSITIONS_INTERNAL?: boolean; + Detailed logging of all routing steps. + **/ + LOG_TRANSITIONS_INTERNAL?: boolean; } interface ApplicationInitializerArguments { @@ -177,21 +177,21 @@ interface ApplicationInitializerFunction { interface CoreObjectArguments { /** - An overridable method called when objects are instantiated. By default, does nothing unless it is - overridden during class definition. NOTE: If you do override init for a framework class like Ember.View - or Ember.ArrayController, be sure to call this._super() in your init declaration! If you don't, Ember - may not have an opportunity to do important setup work, and you'll see strange behavior in your application. - **/ - init?: Function; + An overridable method called when objects are instantiated. By default, does nothing unless it is + overridden during class definition. NOTE: If you do override init for a framework class like Ember.View + or Ember.ArrayController, be sure to call this._super() in your init declaration! If you don't, Ember + may not have an opportunity to do important setup work, and you'll see strange behavior in your application. + **/ + init?: Function; /** - Override to implement teardown. - **/ - willDestroy?: Function; + Override to implement teardown. + **/ + willDestroy?: Function; } interface EnumerableConfigurationOptions { - willChange? ; - didChange? ; + willChange?: boolean ; + didChange?: boolean ; } interface ItemIndexEnumerableCallbackTarget { @@ -238,123 +238,123 @@ interface ModifyObserver { declare module Ember { /** - Alias for jQuery. - **/ + Alias for jQuery. + **/ // ReSharper disable once DuplicatingLocalDeclaration var $: JQueryStatic; /** - Creates an Ember.NativeArray from an Array like object. Does not modify the original object. - Ember.A is not needed if Ember.EXTEND_PROTOTYPES is true (the default value). However, it is - recommended that you use Ember.A when creating addons for ember or when you can not garentee - that Ember.EXTEND_PROTOTYPES will be true. - **/ + Creates an Ember.NativeArray from an Array like object. Does not modify the original object. + Ember.A is not needed if Ember.EXTEND_PROTOTYPES is true (the default value). However, it is + recommended that you use Ember.A when creating addons for ember or when you can not garentee + that Ember.EXTEND_PROTOTYPES will be true. + **/ function A(arr?: any[]): NativeArray; /** - An instance of Ember.Application is the starting point for every Ember application. It helps to - instantiate, initialize and coordinate the many objects that make up your app. - **/ + An instance of Ember.Application is the starting point for every Ember application. It helps to + instantiate, initialize and coordinate the many objects that make up your app. + **/ class Application extends Namespace { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; static initializer(arguments?: ApplicationInitializerArguments): void; /** - Call advanceReadiness after any asynchronous setup logic has completed. - Each call to deferReadiness must be matched by a call to advanceReadiness - or the application will never become ready and routing will not begin. - **/ - advanceReadiness(): void; + Call advanceReadiness after any asynchronous setup logic has completed. + Each call to deferReadiness must be matched by a call to advanceReadiness + or the application will never become ready and routing will not begin. + **/ + advanceReadiness(): void; /** - Use this to defer readiness until some condition is true. + Use this to defer readiness until some condition is true. - This allows you to perform asynchronous setup logic and defer - booting your application until the setup has finished. + This allows you to perform asynchronous setup logic and defer + booting your application until the setup has finished. - However, if the setup requires a loading UI, it might be better - to use the router for this purpose. - */ - deferReadiness(): void; + However, if the setup requires a loading UI, it might be better + to use the router for this purpose. + */ + deferReadiness(): void; /** - defines an injection or typeInjection - **/ - inject(factoryNameOrType: string, property: string, injectionName: string): void; + defines an injection or typeInjection + **/ + inject(factoryNameOrType: string, property: string, injectionName: string): void; /** - This injects the test helpers into the window's scope. If a function of the - same name has already been defined it will be cached (so that it can be reset - if the helper is removed with `unregisterHelper` or `removeTestHelpers`). - Any callbacks registered with `onInjectHelpers` will be called once the - helpers have been injected. - **/ - injectTestHelpers(): void; + This injects the test helpers into the window's scope. If a function of the + same name has already been defined it will be cached (so that it can be reset + if the helper is removed with `unregisterHelper` or `removeTestHelpers`). + Any callbacks registered with `onInjectHelpers` will be called once the + helpers have been injected. + **/ + injectTestHelpers(): void; /** - registers a factory for later injection - @param fullName type:name (e.g., 'model:user') - @param factory (e.g., App.Person) - **/ - register(fullName: string, factory: Function, options?: {}): void; + registers a factory for later injection + @param fullName type:name (e.g., 'model:user') + @param factory (e.g., App.Person) + **/ + register(fullName: string, factory: Function, options?: {}): void; /** - This removes all helpers that have been registered, and resets and functions - that were overridden by the helpers. - **/ - removeTestHelpers(): void; + This removes all helpers that have been registered, and resets and functions + that were overridden by the helpers. + **/ + removeTestHelpers(): void; /** - Reset the application. This is typically used only in tests. - **/ - reset(): void; + Reset the application. This is typically used only in tests. + **/ + reset(): void; /** - This hook defers the readiness of the application, so that you can start - the app when your tests are ready to run. It also sets the router's - location to 'none', so that the window's location will not be modified - (preventing both accidental leaking of state between tests and interference - with your testing framework). - **/ - setupForTesting(): void; + This hook defers the readiness of the application, so that you can start + the app when your tests are ready to run. It also sets the router's + location to 'none', so that the window's location will not be modified + (preventing both accidental leaking of state between tests and interference + with your testing framework). + **/ + setupForTesting(): void; /** - The DOM events for which the event dispatcher should listen. - */ + The DOM events for which the event dispatcher should listen. + */ customEvents: {}; /** - The Ember.EventDispatcher responsible for delegating events to this application's views. - **/ + The Ember.EventDispatcher responsible for delegating events to this application's views. + **/ eventDispatcher: EventDispatcher; /** - Set this to provide an alternate class to Ember.DefaultResolver - **/ + Set this to provide an alternate class to Ember.DefaultResolver + **/ resolver: DefaultResolver; /** - The root DOM element of the Application. This can be specified as an - element or a jQuery-compatible selector string. + The root DOM element of the Application. This can be specified as an + element or a jQuery-compatible selector string. - This is the element that will be passed to the Application's, eventDispatcher, - which sets up the listeners for event delegation. Every view in your application - should be a child of the element you specify here. - **/ + This is the element that will be passed to the Application's, eventDispatcher, + which sets up the listeners for event delegation. Every view in your application + should be a child of the element you specify here. + **/ rootElement: HTMLElement; /** - Called when the Application has become ready. - The call will be delayed until the DOM has become ready. - **/ + Called when the Application has become ready. + The call will be delayed until the DOM has become ready. + **/ ready: Function; /** - Application's router. - **/ + Application's router. + **/ Router: Router; } /** - This module implements Observer-friendly Array-like behavior. This mixin is picked up by the - Array class as well as other controllers, etc. that want to appear to be arrays. - **/ + This module implements Observer-friendly Array-like behavior. This mixin is picked up by the + Array class as well as other controllers, etc. that want to appear to be arrays. + **/ class Array implements Enumerable { addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; @@ -365,14 +365,14 @@ declare module Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Enumerable; enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; @@ -387,13 +387,13 @@ declare module Ember { forEach(callback: Function, target?: any): any; getEach(key: string): any[]; indexOf(object: any, startAt: number): number; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; lastIndexOf(object: any, startAt: number): number; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; objectAt(idx: number): any; - objectsAt(...number): any[]; + objectsAt(...args: number[]): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; @@ -405,30 +405,30 @@ declare module Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '@each': EachProxy; + '@each': EachProxy; Boolean: boolean; - '[]': any[]; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; length: number; } /** - Provides a way for you to publish a collection of objects so that you can easily bind to the - collection from a Handlebars #each helper, an Ember.CollectionView, or other controllers. - **/ + Provides a way for you to publish a collection of objects so that you can easily bind to the + collection from a Handlebars #each helper, an Ember.CollectionView, or other controllers. + **/ class ArrayController extends ArrayProxy implements SortableMixin, ControllerMixin { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -438,37 +438,37 @@ declare module Ember { sortAscending: boolean; sortFunction: Comparable; sortProperties: any[]; - replaceRoute(name: string, ...any); - transitionToRoute(name: string, ...any); + replaceRoute(name: string, ...args: any[]): void; + transitionToRoute(name: string, ...args: any[]): void; controllers: {}; needs: string[]; target: any; } /** - Array polyfills to support ES5 features in older browsers. - **/ + Array polyfills to support ES5 features in older browsers. + **/ var ArrayPolyfills: { map: typeof Array.prototype.map; forEach: typeof Array.prototype.forEach; indexOf: typeof Array.prototype.indexOf; }; /** - An ArrayProxy wraps any other object that implements Ember.Array and/or Ember.MutableArray, - forwarding all requests. This makes it very useful for a number of binding use cases or other cases - where being able to swap out the underlying array is useful. - **/ + An ArrayProxy wraps any other object that implements Ember.Array and/or Ember.MutableArray, + forwarding all requests. This makes it very useful for a number of binding use cases or other cases + where being able to swap out the underlying array is useful. + **/ class ArrayProxy extends Object implements MutableArray { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -482,14 +482,14 @@ declare module Ember { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): any[]; enumerableContentWillChange(removing: Enumerable, adding: number): any[]; enumerableContentWillChange(removing: number, adding: Enumerable): any[]; @@ -505,24 +505,24 @@ declare module Ember { getEach(key: string): any[]; indexOf(object: any, startAt: number): number; insertAt(idx: number, object: any): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; lastIndexOf(object: any, startAt: number): number; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; objectAt(idx: number): any; objectAtContent(idx: number): any; - objectsAt(...number): any[]; + objectsAt(...args: number[]): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): any[]; + pushObjects(...args: any[]): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; removeAt(start: number, len: number): any; removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; - replace(idx: number, amt: number, objects: any[]); + replace(idx: number, amt: number, objects: any[]): any; replaceContent(idx: number, amt: number, objects: any[]): void; reverseObjects(): any[]; setEach(key: string, value?: any): any; @@ -535,8 +535,8 @@ declare module Ember { unshiftObject(object: any): any; unshiftObjects(objects: any[]): any[]; without(value: any): any[]; - '[]': any[]; - '@each': EachProxy; + '[]': any[]; + '@each': EachProxy; Boolean: boolean; firstObject: any; hasEnumerableObservers: boolean; @@ -549,9 +549,9 @@ declare module Ember { } var BOOTED: boolean; /** - Connects the properties of two objects so that whenever the value of one property changes, - the other property will be changed also. - **/ + Connects the properties of two objects so that whenever the value of one property changes, + the other property will be changed also. + **/ class Binding { constructor(toPath: string, fromPath: string); connect(obj: any): Binding; @@ -567,45 +567,45 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; triggerAction(opts: {}): boolean; } /** - The internal class used to create text inputs when the {{input}} helper is used - with type of checkbox. See Handlebars.helpers.input for usage details. - **/ + The internal class used to create text inputs when the {{input}} helper is used + with type of checkbox. See Handlebars.helpers.input for usage details. + **/ class Checkbox extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; } /** - An Ember.View descendent responsible for managing a collection (an array or array-like object) - by maintaining a child view object and associated DOM representation for each item in the array - and ensuring that child views and their associated rendered HTML are updated when items in the - array are added, removed, or replaced. - **/ + An Ember.View descendent responsible for managing a collection (an array or array-like object) + by maintaining a child view object and associated DOM representation for each item in the array + and ensuring that child views and their associated rendered HTML are updated when items in the + array are added, removed, or replaced. + **/ class CollectionView extends ContainerView { arrayDidChange(content: any[], start: number, removed: number, added: number): void; arrayWillChange(content: any[], start: number, removed: number): void; @@ -618,29 +618,29 @@ declare module Ember { itemViewClass: View; } /** - Implements some standard methods for comparing objects. Add this mixin to any class - you create that can compare its instances. - **/ + Implements some standard methods for comparing objects. Add this mixin to any class + you create that can compare its instances. + **/ class Comparable { compare(a: any, b: any): number; } /** - A view that is completely isolated. Property access in its templates go to the view object - and actions are targeted at the view object. There is no access to the surrounding context or - outer controller; all contextual information is passed in. - **/ + A view that is completely isolated. Property access in its templates go to the view object + and actions are targeted at the view object. There is no access to the surrounding context or + outer controller; all contextual information is passed in. + **/ class Component extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -648,16 +648,16 @@ declare module Ember { targetObject: Controller; } /** - A computed property transforms an objects function into a property. - By default the function backing the computed property will only be called once and the result - will be cached. You can specify various properties that your computed property is dependent on. - This will force the cached result to be recomputed if the dependencies are modified. - **/ + A computed property transforms an objects function into a property. + By default the function backing the computed property will only be called once and the result + will be cached. You can specify various properties that your computed property is dependent on. + This will force the cached result to be recomputed if the dependencies are modified. + **/ class ComputedProperty { cacheable(aFlag?: boolean): ComputedProperty; get(keyName: string): any; meta(meta: {}): ComputedProperty; - property(...string): ComputedProperty; + property(...args: string[]): ComputedProperty; readOnly(): ComputedProperty; set(keyName: string, newValue: any, oldValue: string): any; // ReSharper disable UsingOfReservedWord @@ -676,11 +676,11 @@ declare module Ember { child(): Container; set(object: {}, key: string, value: any): void; /** - registers a factory for later injection - @param fullName type:name (e.g., 'model:user') - @param factory (e.g., App.Person) - **/ - register(fullName: string, factory: Function, options?: {}): void; + registers a factory for later injection + @param fullName type:name (e.g., 'model:user') + @param factory (e.g., App.Person) + **/ + register(fullName: string, factory: Function, options?: {}): void; unregister(fullName: string): void; resolve(fullName: string): Function; describe(fullName: string): string; @@ -697,42 +697,42 @@ declare module Ember { reset(): void; } /** - An Ember.View subclass that implements Ember.MutableArray allowing programatic - management of its child views. - **/ + An Ember.View subclass that implements Ember.MutableArray allowing programatic + management of its child views. + **/ class ContainerView extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; } class Controller extends Object { } /** - Additional methods for the ControllerMixin. - **/ + Additional methods for the ControllerMixin. + **/ class ControllerMixin { - replaceRoute(name: string, ...any): void; - transitionToRoute(name: string, ...any): void; + replaceRoute(name: string, ...args: any[]): void; + transitionToRoute(name: string, ...args: any[]): void; controllers: {}; needs: string[]; target: any; } /** - Implements some standard methods for copying an object. Add this mixin to any object you - create that can create a copy of itself. This mixin is added automatically to the built-in array. - You should generally implement the copy() method to return a copy of the receiver. - Note that frozenCopy() will only work if you also implement Ember.Freezable. - **/ + Implements some standard methods for copying an object. Add this mixin to any object you + create that can create a copy of itself. This mixin is added automatically to the built-in array. + You should generally implement the copy() method to return a copy of the receiver. + Note that frozenCopy() will only work if you also implement Ember.Freezable. + **/ class Copyable { copy(deep: boolean): Copyable; frozenCopy(): Copyable; @@ -741,64 +741,64 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; /** - Destroys an object by setting the isDestroyed flag and removing its metadata, which effectively - destroys observers and bindings. If you try to set a property on a destroyed object, an exception - will be raised. Note that destruction is scheduled for the end of the run loop and does not - happen immediately. It will set an isDestroying flag immediately. - **/ - destroy(): CoreObject; + Destroys an object by setting the isDestroyed flag and removing its metadata, which effectively + destroys observers and bindings. If you try to set a property on a destroyed object, an exception + will be raised. Note that destruction is scheduled for the end of the run loop and does not + happen immediately. It will set an isDestroying flag immediately. + **/ + destroy(): CoreObject; init(): void; /** - Returns a string representation which attempts to provide more information than Javascript's toString - typically does, in a generic way for all Ember objects (e.g., ""). - **/ - toString(): string; + Returns a string representation which attempts to provide more information than Javascript's toString + typically does, in a generic way for all Ember objects (e.g., ""). + **/ + toString(): string; willDestroy(): void; /** - Defines the properties that will be concatenated from the superclass (instead of overridden). - **/ + Defines the properties that will be concatenated from the superclass (instead of overridden). + **/ concatenatedProperties: any[]; /** - Destroyed object property flag. If this property is true the observers and bindings were - already removed by the effect of calling the destroy() method. - **/ + Destroyed object property flag. If this property is true the observers and bindings were + already removed by the effect of calling the destroy() method. + **/ isDestroyed: boolean; /** - Destruction scheduled flag. The destroy() method has been called. The object stays intact - until the end of the run loop at which point the isDestroyed flag is set. - **/ + Destruction scheduled flag. The destroy() method has been called. The object stays intact + until the end of the run loop at which point the isDestroyed flag is set. + **/ isDestroying: boolean; } /** - An abstract class that exists to give view-like behavior to both Ember's main view class Ember.View - and other classes like Ember._SimpleMetamorphView that don't need the fully functionaltiy of Ember.View. - Unless you have specific needs for CoreView, you will use Ember.View in your applications. - **/ + An abstract class that exists to give view-like behavior to both Ember's main view class Ember.View + and other classes like Ember._SimpleMetamorphView that don't need the fully functionaltiy of Ember.View. + Unless you have specific needs for CoreView, you will use Ember.View in your applications. + **/ class CoreView extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -815,12 +815,12 @@ declare module Ember { } function DEFAULT_GETTER_FUNCTION(name: string): Function; /** - The DefaultResolver defines the default lookup rules to resolve container lookups before consulting - the container for registered items: - templates are looked up on Ember.TEMPLATES - other names are looked up on the application after converting the name. - For example, controller:post looks up App.PostController by default. - **/ + The DefaultResolver defines the default lookup rules to resolve container lookups before consulting + the container for registered items: + templates are looked up on Ember.TEMPLATES + other names are looked up on the application after converting the name. + For example, controller:post looks up App.PostController by default. + **/ class DefaultResolver { resolve(fullName: string): {}; namespace: Application; @@ -836,42 +836,42 @@ declare module Ember { then(resolve: Function, reject: Function): void; } /** - Objects of this type can implement an interface to respond to requests to get and set. - The default implementation handles simple properties. - You generally won't need to create or subclass this directly. - **/ + Objects of this type can implement an interface to respond to requests to get and set. + The default implementation handles simple properties. + You generally won't need to create or subclass this directly. + **/ class Descriptor { } var EMPTY_META: {}; // TODO: define interface var ENV: {}; var EXTEND_PROTOTYPES: boolean; /** - This is the object instance returned when you get the @each property on an array. It uses - the unknownProperty handler to automatically create EachArray instances for property names. - **/ + This is the object instance returned when you get the @each property on an array. It uses + the unknownProperty handler to automatically create EachArray instances for property names. + **/ class EachProxy extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; unknownProperty(keyName: string, value: any): any[]; } /** - This mixin defines the common interface implemented by enumerable objects in Ember. Most of these - methods follow the standard Array iteration API defined up to JavaScript 1.8 (excluding language-specific - features that cannot be emulated in older versions of JavaScript). - This mixin is applied automatically to the Array class on page load, so you can use any of these methods - on simple arrays. If Array already implements one of these methods, the mixin will not override them. - **/ + This mixin defines the common interface implemented by enumerable objects in Ember. Most of these + methods follow the standard Array iteration API defined up to JavaScript 1.8 (excluding language-specific + features that cannot be emulated in older versions of JavaScript). + This mixin is applied automatically to the Array class on page load, so you can use any of these methods + on simple arrays. If Array already implements one of these methods, the mixin will not override them. + **/ class Enumerable { addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; any(callback: Function, target?: any): boolean; @@ -879,14 +879,14 @@ declare module Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Enumerable; enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; @@ -900,7 +900,7 @@ declare module Ember { findBy(key: string, value?: string): any; forEach(callback: Function, target?: any): any; getEach(key: string): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; @@ -913,48 +913,48 @@ declare module Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '[]': any[]; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; } var EnumerableUtils: {}; // TODO: define interface /** - A subclass of the JavaScript Error object for use in Ember. - **/ + A subclass of the JavaScript Error object for use in Ember. + **/ // ReSharper disable once DuplicatingLocalDeclaration var Error: typeof Error; /** - Handles delegating browser events to their corresponding Ember.Views. For example, when you click on - a view, Ember.EventDispatcher ensures that that view's mouseDown method gets called. - **/ + Handles delegating browser events to their corresponding Ember.Views. For example, when you click on + a view, Ember.EventDispatcher ensures that that view's mouseDown method gets called. + **/ class EventDispatcher extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; events: {}; } /** - This mixin allows for Ember objects to subscribe to and emit events. - You can also chain multiple event subscriptions. - **/ + This mixin allows for Ember objects to subscribe to and emit events. + You can also chain multiple event subscriptions. + **/ class Evented { has(name: string): boolean; off(name: string, target: any, method: Function): Evented; on(name: string, target: any, method: Function): Evented; one(name: string, target: any, method: Function): Evented; - trigger(name: string, ...string): void; + trigger(name: string, ...args: string[]): void; } var FROZEN_ERROR: string; class Freezable { @@ -996,32 +996,32 @@ declare module Ember { class Compiler { } class JavaScriptCompiler { } function registerHelper(name: string, fn: Function, inverse?: boolean): void; - function registerPartial(name: string, str): void; - function K(); - function createFrame(object); + function registerPartial(name: string, str: any): void; + function K(): any; + function createFrame(objec: any): any; function Exception(message: string): void; class SafeString { constructor(str: string); static toString(): string; } - function parse(string: string); - function print(ast); - var logger; - function log(level, str): void; - function compile(environment, options?, context?, asObject?); + function parse(string: string): any; + function print(ast: any): void; + var logger: typeof Ember.Logger; + function log(level: string, str: string): void; + function compile(environment: any, options?: any, context?: any, asObject?: any): any; } class HashLocation extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1030,14 +1030,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1046,7 +1046,7 @@ declare module Ember { var IS_BINDING: RegExp; class Instrumentation { getProperties(obj: any, list: any[]): {}; - getProperties(obj: any, ...string): {}; + getProperties(obj: any, ...args: string[]): {}; instrument(name: string, payload: any, callback: Function, binding: any): void; reset(): void; subscribe(pattern: string, object: any): void; @@ -1060,14 +1060,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1094,11 +1094,11 @@ declare module Ember { } var Logger: { assert(param: any): void; - debug(...any): void; - error(...any): void; - info(...any): void; - log(...any): void; - warn(...any): void; + debug(...args: any[]): void; + error(...args: any[]): void; + info(...args: any[]): void; + log(...args: any[]): void; + warn(...args: any[]): void; }; function MANDATORY_SETTER_FUNCTION(value: string): void; var META_KEY: string; @@ -1119,9 +1119,9 @@ declare module Ember { class Mixin { apply(obj: any): any; /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ + Creates an instance of the class. + @param arguments A hash containing values with which to initialize the newly instantiated object. + **/ static create(arguments?: {}): T; detect(obj: any): boolean; reopen(arguments?: {}): T; @@ -1137,14 +1137,14 @@ declare module Ember { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Enumerable; enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; @@ -1160,23 +1160,23 @@ declare module Ember { getEach(key: string): any[]; indexOf(object: any, startAt: number): number; insertAt(idx: number, object: any): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; lastIndexOf(object: any, startAt: number): number; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; objectAt(idx: number): any; - objectsAt(...number): any[]; + objectsAt(...args: number[]): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): any[]; + pushObjects(...args: any[]): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; removeAt(start: number, len: number): any; removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; - replace(idx: number, amt: number, objects: any[]); + replace(idx: number, amt: number, objects: any[]): any; reverseObjects(): any[]; setEach(key: string, value?: any): any; setObjects(objects: any[]): any[]; @@ -1188,8 +1188,8 @@ declare module Ember { unshiftObject(object: any): any; unshiftObjects(objects: any[]): any[]; without(value: any): Enumerable; - '[]': any[]; - '@each': EachProxy; + '[]': any[]; + '@each': EachProxy; Boolean: boolean; firstObject: any; hasEnumerableObservers: boolean; @@ -1209,14 +1209,14 @@ declare module Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Enumerable; enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; @@ -1230,7 +1230,7 @@ declare module Ember { findBy(key: string, value?: string): any; forEach(callback: Function, target?: any): any; getEach(key: string): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; @@ -1245,7 +1245,7 @@ declare module Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '[]': any[]; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -1255,14 +1255,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1280,14 +1280,14 @@ declare module Ember { clear(): any[]; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): any[]; enumerableContentWillChange(removing: Enumerable, adding: number): any[]; enumerableContentWillChange(removing: number, adding: Enumerable): any[]; @@ -1303,23 +1303,23 @@ declare module Ember { getEach(key: string): any[]; indexOf(object: any, startAt: number): number; insertAt(idx: number, object: any): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; lastIndexOf(object: any, startAt: number): number; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; objectAt(idx: number): any; - objectsAt(...number): any[]; + objectsAt(...args: number[]): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): any[]; + pushObjects(...args: any[]): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; removeAt(start: number, len: number): any; removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; - replace(idx: number, amt: number, objects: any[]); + replace(idx: number, amt: number, objects: any[]): any; reverseObjects(): any[]; setEach(key: string, value?: any): any; setObjects(objects: any[]): any[]; @@ -1331,8 +1331,8 @@ declare module Ember { unshiftObject(object: any): any; unshiftObjects(objects: any[]): any[]; without(value: any): any[]; - '[]': any[]; - '@each': EachProxy; + '[]': any[]; + '@each': EachProxy; Boolean: boolean; firstObject: any; hasEnumerableObservers: boolean; @@ -1348,7 +1348,7 @@ declare module Ember { decrementProperty(keyName: string, decrement?: number): number; endPropertyChanges(): any[]; get(keyName: string): any; - getProperties(...string): {}; + getProperties(...args: string[]): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; hasObserverFor(key: string): boolean; @@ -1368,14 +1368,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1383,40 +1383,40 @@ declare module Ember { var ORDER_DEFINITION: string[]; class Object extends CoreObject implements Observable { /** - Creates a subclass of the Object class. - **/ + Creates a subclass of the Object class. + **/ static extend(arguments?: CoreObjectArguments): T; /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ + Creates an instance of the class. + @param arguments A hash containing values with which to initialize the newly instantiated object. + **/ static create(arguments?: {}): T; /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ + Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. + **/ static createWithMixins(arguments?: {}): T; static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ + Augments a constructor's prototype with additional properties and functions. + To add functions and properties to the constructor itself, see reopenClass. + **/ static reopen(arguments?: {}): T; /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ + Augments a constructor's own properties and functions. + To add functions and properties to instances of a constructor by extending the + constructor's prototype see reopen. + **/ static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; @@ -1426,7 +1426,7 @@ declare module Ember { decrementProperty(keyName: string, decrement?: number): number; endPropertyChanges(): Observable; get(keyName: string): any; - getProperties(...string): {}; + getProperties(...args: string[]): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; hasObserverFor(key: string): boolean; @@ -1441,8 +1441,8 @@ declare module Ember { toggleProperty(keyName: string): any; } class ObjectController extends ObjectProxy implements ControllerMixin { - replaceRoute(name: string, ...any): void; - transitionToRoute(name: string, ...any): void; + replaceRoute(name: string, ...args: any[]): void; + transitionToRoute(name: string, ...args: any[]): void; controllers: Object; needs: string[]; target: any; @@ -1451,20 +1451,20 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; /** - The object whose properties will be forwarded. - **/ + The object whose properties will be forwarded. + **/ content: Object; } class Observable { @@ -1474,7 +1474,7 @@ declare module Ember { decrementProperty(keyName: string, decrement?: number): number; endPropertyChanges(): Observable; get(keyName: string): any; - getProperties(...string): {}; + getProperties(...args: string[]): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; hasObserverFor(key: string): boolean; @@ -1528,14 +1528,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1551,26 +1551,26 @@ declare module Ember { render(name: string, options?: RenderOptions): void; renderTemplate(controller: Controller, model: {}): void; // ReSharper disable once InconsistentNaming - replaceWith(name: string, ...Object): void; - send(name: string, ...any): void; + replaceWith(name: string, ...object: any[]): void; + send(name: string, ...args: any[]): void; serialize(model: {}, params: string[]): string; setupController(controller: Controller, model: {}): void; // ReSharper disable once InconsistentNaming - transitionTo(name: string, ...Object): void; + transitionTo(name: string, ...object: any[]): void; actions: ActionsHash; } class Router extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1587,14 +1587,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1613,14 +1613,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1634,14 +1634,14 @@ declare module Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Set; enumerableContentWillChange(removing: Enumerable, adding: number): Set; enumerableContentWillChange(removing: number, adding: Enumerable): Set; @@ -1655,7 +1655,7 @@ declare module Ember { findBy(key: string, value?: string): any; forEach(callback: Function, target?: any): any; getEach(key: string): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; @@ -1670,7 +1670,7 @@ declare module Ember { toArray(): any[]; uniq(): Set; without(value: any): Set; - '[]': any[]; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -1679,13 +1679,13 @@ declare module Ember { freeze(): Set; isFrozen: boolean; add(obj: any): Set; - addEach(...any): Set; + addEach(...args: any[]): Set; clear(): Set; isEqual(obj: Set): boolean; pop(): any; push(obj: any): Set; remove(obj: any): Set; - removeEach(...any): Set; + removeEach(...args: any[]): Set; shift(): any; unshift(obj: any): Set; length: number; @@ -1699,14 +1699,14 @@ declare module Ember { someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; - enumerableContentDidChange(start: number, removing: number, adding: number); - enumerableContentDidChange(start: number, removing: Enumerable, adding: number); - enumerableContentDidChange(start: number, removing: number, adding: Enumerable); - enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable); - enumerableContentDidChange(removing: number, adding: number); - enumerableContentDidChange(removing: Enumerable, adding: number); - enumerableContentDidChange(removing: number, adding: Enumerable); - enumerableContentDidChange(removing: Enumerable, adding: Enumerable); + enumerableContentDidChange(start: number, removing: number, adding: number): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: number): any; + enumerableContentDidChange(start: number, removing: number, adding: Enumerable): any; + enumerableContentDidChange(start: number, removing: Enumerable, adding: Enumerable): any; + enumerableContentDidChange(removing: number, adding: number): any; + enumerableContentDidChange(removing: Enumerable, adding: number): any; + enumerableContentDidChange(removing: number, adding: Enumerable): any; + enumerableContentDidChange(removing: Enumerable, adding: Enumerable): any; enumerableContentWillChange(removing: number, adding: number): Enumerable; enumerableContentWillChange(removing: Enumerable, adding: number): Enumerable; enumerableContentWillChange(removing: number, adding: Enumerable): Enumerable; @@ -1720,7 +1720,7 @@ declare module Ember { findBy(key: string, value?: string): any; forEach(callback: Function, target?: any): any; getEach(key: string): any[]; - invoke(methodName: string, ...any): any[]; + invoke(methodName: string, ...args: any[]): any[]; map: ItemIndexEnumerableCallbackTarget; mapBy(key: string): any[]; nextObject(index: number, previousObject: any, context: any): any; @@ -1735,7 +1735,7 @@ declare module Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '[]': any[]; + '[]': any[]; arrangedContent: any; firstObject: any; hasEnumerableObservers: boolean; @@ -1748,14 +1748,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1763,7 +1763,7 @@ declare module Ember { off(name: string, target: any, method: Function): State; on(name: string, target: any, method: Function): State; one(name: string, target: any, method: Function): State; - trigger(name: string, ...string): void; + trigger(name: string, ...args: string[]): void; getPathsCache(stateManager: {}, path: string): {}; init(): void; setPathsCache(stateManager: {}, path: string, transitions: any): void; @@ -1781,14 +1781,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1804,7 +1804,7 @@ declare module Ember { stateMetaFor(state: State): {}; transitionTo(path: string, context: any): void; triggerSetupContext(transitions: TransitionsHash): void; - unhandledEvent(manager: StateManager, event: string); + unhandledEvent(manager: StateManager, event: string): any; currentPath: string; currentState: State; errorOnUnhandledEvents: boolean; @@ -1816,9 +1816,9 @@ declare module Ember { function classify(str: string): string; function dasherize(str: string): string; function decamelize(str: string): string; - function fmt(...string): string; + function fmt(...args: string[]): string; function htmlSafe(str: string): void; // TODO: @returns Handlebars.SafeStringStatic; - function loc(...string): string; + function loc(...args: string[]): string; function underscore(str: string): string; function w(str: string): string[]; } @@ -1848,14 +1848,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1872,14 +1872,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1911,14 +1911,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1983,8 +1983,8 @@ declare module Ember { function addListener(obj: any, eventName: string, func: Function, method: string, once?: boolean): void; var addObserver: ModifyObserver; /** - Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead. - **/ + Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead. + **/ var alias: typeof deprecateFunc; function aliasMethod(methodName: string): Descriptor; var anyUnprocessedMixins: boolean; @@ -2001,8 +2001,8 @@ declare module Ember { var computed: { (callback: Function): ComputedProperty; alias(dependentKey: string): ComputedProperty; - and(...string): ComputedProperty; - any(...string): ComputedProperty; + and(...args: string[]): ComputedProperty; + any(...args: string[]): ComputedProperty; bool(dependentKey: string): ComputedProperty; defaultTo(defaultPath: string): ComputedProperty; empty(dependentKey: string): ComputedProperty; @@ -2011,13 +2011,13 @@ declare module Ember { gte(dependentKey: string, value: number): ComputedProperty; lt(dependentKey: string, value: number): ComputedProperty; lte(dependentKey: string, value: number): ComputedProperty; - map(...string): ComputedProperty; + map(...args: string[]): ComputedProperty; match(dependentKey: string, regexp: RegExp): ComputedProperty; none(dependentKey: string): ComputedProperty; not(dependentKey: string): ComputedProperty; notEmpty(dependentKey: string): ComputedProperty; oneWay(dependentKey: string): ComputedProperty; - or(...string): ComputedProperty; + or(...args: string[]): ComputedProperty; }; // ReSharper disable DuplicatingLocalDeclaration var config: {}; @@ -2025,9 +2025,9 @@ declare module Ember { function controllerFor(container: Container, controllerName: string, lookupOptions?: {}): Controller; function copy(obj: any, deep: boolean): any; /** - Creates an instance of the CoreObject class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ + Creates an instance of the CoreObject class. + @param arguments A hash containing values with which to initialize the newly instantiated object. + **/ function create(arguments?: {}): CoreObject; function debug(message: string): void; function defineProperty(obj: any, keyName: string, desc: {}): void; @@ -2035,8 +2035,8 @@ declare module Ember { function deprecateFunc(message: string, func: Function): Function; function destroy(obj: any): void; /** - Ember.empty is deprecated. Please use Ember.isEmpty instead. - **/ + Ember.empty is deprecated. Please use Ember.isEmpty instead. + **/ // ReSharper disable once DuplicatingLocalDeclaration var empty: typeof deprecateFunc; function endPropertyChanges(): void; @@ -2049,15 +2049,15 @@ declare module Ember { function get(obj: any, keyName: string): any; function getMeta(obj: any, property: string): any; /** - getPath is deprecated since get now supports paths. - **/ + getPath is deprecated since get now supports paths. + **/ var getPath: typeof deprecateFunc; function getWithDefault(root: string, key: string, defaultValue: any): any; function guidFor(obj: any): string; function handleErrors(func: Function, context: any): any; function hasListeners(context: any, name: string): boolean; function hasOwnProperty(prop: string): boolean; - function immediateObserver(func: Function, ...propertyNames): Function; + function immediateObserver(func: Function, ...propertyNames: any[]): Function; var imports: {}; function inspect(obj: any): string; function instrument(name: string, payload: any, callback: Function, binding: any): void; @@ -2079,13 +2079,13 @@ declare module Ember { function merge(original: any, updates: any): any; function meta(obj: any, writable?: boolean): {}; function metaPath(obj: any, path: string, writable?: boolean): any; - function mixin(obj: any, ...any): any; + function mixin(obj: any, ...args: any[]): any; /** - Ember.none is deprecated. Please use Ember.isNone instead. - **/ + Ember.none is deprecated. Please use Ember.isNone instead. + **/ var none: typeof deprecateFunc; function normalizeTuple(target: any, path: string): any[]; - function observer(func: Function, ...string): Function; + function observer(func: Function, ...args: string[]): Function; function observersFor(obj: any, path: string): any[]; function onLoad(name: string, callback: Function): void; function oneWay(obj: any, to: string, from: string): Binding; @@ -2119,18 +2119,18 @@ declare module Ember { debounce(target: any, method: Function, ...args: any[]): void; debounce(target: any, method: string, ...args: any[]): void; end(): void; - join(target: any, method: Function, ...any): any; - join(target: any, method: string, ...any): any; + join(target: any, method: Function, ...args: any[]): any; + join(target: any, method: string, ...args: any[]): any; later(target: any, method: Function, ...args: any[]): string; later(target: any, method: string, ...args: any[]): string; - next(target: any, method: Function, ...any): number; - next(target: any, method: string, ...any): number; - once(target: any, method: Function, ...any): number; - once(target: any, method: string, ...any): number; - schedule(queue: string, target: any, method: Function, ...any): void; - schedule(queue: string, target: any, method: string, ...any): void; - scheduleOnce(queue: string, target: any, method: Function, ...any): void; - scheduleOnce(queue: string, target: any, method: string, ...any): void; + next(target: any, method: Function, ...args: any[]): number; + next(target: any, method: string, ...args: any[]): number; + once(target: any, method: Function, ...args: any[]): number; + once(target: any, method: string, ...args: any[]): number; + schedule(queue: string, target: any, method: Function, ...args: any[]): void; + schedule(queue: string, target: any, method: string, ...args: any[]): void; + scheduleOnce(queue: string, target: any, method: Function, ...args: any[]): void; + scheduleOnce(queue: string, target: any, method: string, ...args: any[]): void; sync(): void; throttle(target: any, method: Function, ...args: any[]): void; throttle(target: any, method: string, ...args: any[]): void; @@ -2141,8 +2141,8 @@ declare module Ember { function set(obj: any, keyName: string, value: any): any; function setMeta(obj: any, property: string, value: any): void; /** - setPath is deprecated since set now supports paths. - **/ + setPath is deprecated since set now supports paths. + **/ var setPath: typeof deprecateFunc; function setProperties(self: any, hash: {}): any; function subscribe(pattern: string, object: any): void; @@ -2153,8 +2153,8 @@ declare module Ember { function tryInvoke(obj: any, methodName: string, args?: any[]): any; function trySet(obj: any, path: string, value: any): void; /** - trySetPath has been renamed to trySet. - **/ + trySetPath has been renamed to trySet. + **/ var trySetPath: typeof deprecateFunc; function typeOf(item: any): string; function unwatch(obj: any, keyPath: string): void; @@ -2174,8 +2174,8 @@ declare module Ember { // ReSharper disable DuplicatingLocalDeclaration declare module Em { /** - Alias for jQuery. - **/ + Alias for jQuery. + **/ var $: typeof Ember.$; var A: typeof Ember.A; class Application extends Ember.Application { } From 0f37f4b288dcf9de3e1f5f7e4c8a9d1678b576c8 Mon Sep 17 00:00:00 2001 From: Jakub Olek Date: Mon, 25 Aug 2014 14:35:04 +0200 Subject: [PATCH 14/40] remove changes that are not really changes --- ember/ember.d.ts | 774 +++++++++++++++++++++++------------------------ 1 file changed, 387 insertions(+), 387 deletions(-) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index e50185fd5..9ee334738 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -157,13 +157,13 @@ interface ApplicationCreateArguments { customEvents?: {}; rootElement?: string; /** - Basic logging of successful transitions. - **/ - LOG_TRANSITIONS?: boolean; + Basic logging of successful transitions. + **/ + LOG_TRANSITIONS?: boolean; /** - Detailed logging of all routing steps. - **/ - LOG_TRANSITIONS_INTERNAL?: boolean; + Detailed logging of all routing steps. + **/ + LOG_TRANSITIONS_INTERNAL?: boolean; } interface ApplicationInitializerArguments { @@ -177,16 +177,16 @@ interface ApplicationInitializerFunction { interface CoreObjectArguments { /** - An overridable method called when objects are instantiated. By default, does nothing unless it is - overridden during class definition. NOTE: If you do override init for a framework class like Ember.View - or Ember.ArrayController, be sure to call this._super() in your init declaration! If you don't, Ember - may not have an opportunity to do important setup work, and you'll see strange behavior in your application. - **/ - init?: Function; + An overridable method called when objects are instantiated. By default, does nothing unless it is + overridden during class definition. NOTE: If you do override init for a framework class like Ember.View + or Ember.ArrayController, be sure to call this._super() in your init declaration! If you don't, Ember + may not have an opportunity to do important setup work, and you'll see strange behavior in your application. + **/ + init?: Function; /** - Override to implement teardown. - **/ - willDestroy?: Function; + Override to implement teardown. + **/ + willDestroy?: Function; } interface EnumerableConfigurationOptions { @@ -238,123 +238,123 @@ interface ModifyObserver { declare module Ember { /** - Alias for jQuery. - **/ + Alias for jQuery. + **/ // ReSharper disable once DuplicatingLocalDeclaration var $: JQueryStatic; /** - Creates an Ember.NativeArray from an Array like object. Does not modify the original object. - Ember.A is not needed if Ember.EXTEND_PROTOTYPES is true (the default value). However, it is - recommended that you use Ember.A when creating addons for ember or when you can not garentee - that Ember.EXTEND_PROTOTYPES will be true. - **/ + Creates an Ember.NativeArray from an Array like object. Does not modify the original object. + Ember.A is not needed if Ember.EXTEND_PROTOTYPES is true (the default value). However, it is + recommended that you use Ember.A when creating addons for ember or when you can not garentee + that Ember.EXTEND_PROTOTYPES will be true. + **/ function A(arr?: any[]): NativeArray; /** - An instance of Ember.Application is the starting point for every Ember application. It helps to - instantiate, initialize and coordinate the many objects that make up your app. - **/ + An instance of Ember.Application is the starting point for every Ember application. It helps to + instantiate, initialize and coordinate the many objects that make up your app. + **/ class Application extends Namespace { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; static initializer(arguments?: ApplicationInitializerArguments): void; /** - Call advanceReadiness after any asynchronous setup logic has completed. - Each call to deferReadiness must be matched by a call to advanceReadiness - or the application will never become ready and routing will not begin. - **/ - advanceReadiness(): void; + Call advanceReadiness after any asynchronous setup logic has completed. + Each call to deferReadiness must be matched by a call to advanceReadiness + or the application will never become ready and routing will not begin. + **/ + advanceReadiness(): void; /** - Use this to defer readiness until some condition is true. + Use this to defer readiness until some condition is true. - This allows you to perform asynchronous setup logic and defer - booting your application until the setup has finished. + This allows you to perform asynchronous setup logic and defer + booting your application until the setup has finished. - However, if the setup requires a loading UI, it might be better - to use the router for this purpose. - */ - deferReadiness(): void; + However, if the setup requires a loading UI, it might be better + to use the router for this purpose. + */ + deferReadiness(): void; /** - defines an injection or typeInjection - **/ - inject(factoryNameOrType: string, property: string, injectionName: string): void; + defines an injection or typeInjection + **/ + inject(factoryNameOrType: string, property: string, injectionName: string): void; /** - This injects the test helpers into the window's scope. If a function of the - same name has already been defined it will be cached (so that it can be reset - if the helper is removed with `unregisterHelper` or `removeTestHelpers`). - Any callbacks registered with `onInjectHelpers` will be called once the - helpers have been injected. - **/ - injectTestHelpers(): void; + This injects the test helpers into the window's scope. If a function of the + same name has already been defined it will be cached (so that it can be reset + if the helper is removed with `unregisterHelper` or `removeTestHelpers`). + Any callbacks registered with `onInjectHelpers` will be called once the + helpers have been injected. + **/ + injectTestHelpers(): void; /** - registers a factory for later injection - @param fullName type:name (e.g., 'model:user') - @param factory (e.g., App.Person) - **/ - register(fullName: string, factory: Function, options?: {}): void; + registers a factory for later injection + @param fullName type:name (e.g., 'model:user') + @param factory (e.g., App.Person) + **/ + register(fullName: string, factory: Function, options?: {}): void; /** - This removes all helpers that have been registered, and resets and functions - that were overridden by the helpers. - **/ - removeTestHelpers(): void; + This removes all helpers that have been registered, and resets and functions + that were overridden by the helpers. + **/ + removeTestHelpers(): void; /** - Reset the application. This is typically used only in tests. - **/ - reset(): void; + Reset the application. This is typically used only in tests. + **/ + reset(): void; /** - This hook defers the readiness of the application, so that you can start - the app when your tests are ready to run. It also sets the router's - location to 'none', so that the window's location will not be modified - (preventing both accidental leaking of state between tests and interference - with your testing framework). - **/ - setupForTesting(): void; + This hook defers the readiness of the application, so that you can start + the app when your tests are ready to run. It also sets the router's + location to 'none', so that the window's location will not be modified + (preventing both accidental leaking of state between tests and interference + with your testing framework). + **/ + setupForTesting(): void; /** - The DOM events for which the event dispatcher should listen. - */ + The DOM events for which the event dispatcher should listen. + */ customEvents: {}; /** - The Ember.EventDispatcher responsible for delegating events to this application's views. - **/ + The Ember.EventDispatcher responsible for delegating events to this application's views. + **/ eventDispatcher: EventDispatcher; /** - Set this to provide an alternate class to Ember.DefaultResolver - **/ + Set this to provide an alternate class to Ember.DefaultResolver + **/ resolver: DefaultResolver; /** - The root DOM element of the Application. This can be specified as an - element or a jQuery-compatible selector string. + The root DOM element of the Application. This can be specified as an + element or a jQuery-compatible selector string. - This is the element that will be passed to the Application's, eventDispatcher, - which sets up the listeners for event delegation. Every view in your application - should be a child of the element you specify here. - **/ + This is the element that will be passed to the Application's, eventDispatcher, + which sets up the listeners for event delegation. Every view in your application + should be a child of the element you specify here. + **/ rootElement: HTMLElement; /** - Called when the Application has become ready. - The call will be delayed until the DOM has become ready. - **/ + Called when the Application has become ready. + The call will be delayed until the DOM has become ready. + **/ ready: Function; /** - Application's router. - **/ + Application's router. + **/ Router: Router; } /** - This module implements Observer-friendly Array-like behavior. This mixin is picked up by the - Array class as well as other controllers, etc. that want to appear to be arrays. - **/ + This module implements Observer-friendly Array-like behavior. This mixin is picked up by the + Array class as well as other controllers, etc. that want to appear to be arrays. + **/ class Array implements Enumerable { addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; @@ -414,21 +414,21 @@ declare module Ember { length: number; } /** - Provides a way for you to publish a collection of objects so that you can easily bind to the - collection from a Handlebars #each helper, an Ember.CollectionView, or other controllers. - **/ + Provides a way for you to publish a collection of objects so that you can easily bind to the + collection from a Handlebars #each helper, an Ember.CollectionView, or other controllers. + **/ class ArrayController extends ArrayProxy implements SortableMixin, ControllerMixin { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -445,30 +445,30 @@ declare module Ember { target: any; } /** - Array polyfills to support ES5 features in older browsers. - **/ + Array polyfills to support ES5 features in older browsers. + **/ var ArrayPolyfills: { map: typeof Array.prototype.map; forEach: typeof Array.prototype.forEach; indexOf: typeof Array.prototype.indexOf; }; /** - An ArrayProxy wraps any other object that implements Ember.Array and/or Ember.MutableArray, - forwarding all requests. This makes it very useful for a number of binding use cases or other cases - where being able to swap out the underlying array is useful. - **/ + An ArrayProxy wraps any other object that implements Ember.Array and/or Ember.MutableArray, + forwarding all requests. This makes it very useful for a number of binding use cases or other cases + where being able to swap out the underlying array is useful. + **/ class ArrayProxy extends Object implements MutableArray { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -549,9 +549,9 @@ declare module Ember { } var BOOTED: boolean; /** - Connects the properties of two objects so that whenever the value of one property changes, - the other property will be changed also. - **/ + Connects the properties of two objects so that whenever the value of one property changes, + the other property will be changed also. + **/ class Binding { constructor(toPath: string, fromPath: string); connect(obj: any): Binding; @@ -567,45 +567,45 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; triggerAction(opts: {}): boolean; } /** - The internal class used to create text inputs when the {{input}} helper is used - with type of checkbox. See Handlebars.helpers.input for usage details. - **/ + The internal class used to create text inputs when the {{input}} helper is used + with type of checkbox. See Handlebars.helpers.input for usage details. + **/ class Checkbox extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; } /** - An Ember.View descendent responsible for managing a collection (an array or array-like object) - by maintaining a child view object and associated DOM representation for each item in the array - and ensuring that child views and their associated rendered HTML are updated when items in the - array are added, removed, or replaced. - **/ + An Ember.View descendent responsible for managing a collection (an array or array-like object) + by maintaining a child view object and associated DOM representation for each item in the array + and ensuring that child views and their associated rendered HTML are updated when items in the + array are added, removed, or replaced. + **/ class CollectionView extends ContainerView { arrayDidChange(content: any[], start: number, removed: number, added: number): void; arrayWillChange(content: any[], start: number, removed: number): void; @@ -618,29 +618,29 @@ declare module Ember { itemViewClass: View; } /** - Implements some standard methods for comparing objects. Add this mixin to any class - you create that can compare its instances. - **/ + Implements some standard methods for comparing objects. Add this mixin to any class + you create that can compare its instances. + **/ class Comparable { compare(a: any, b: any): number; } /** - A view that is completely isolated. Property access in its templates go to the view object - and actions are targeted at the view object. There is no access to the surrounding context or - outer controller; all contextual information is passed in. - **/ + A view that is completely isolated. Property access in its templates go to the view object + and actions are targeted at the view object. There is no access to the surrounding context or + outer controller; all contextual information is passed in. + **/ class Component extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -648,11 +648,11 @@ declare module Ember { targetObject: Controller; } /** - A computed property transforms an objects function into a property. - By default the function backing the computed property will only be called once and the result - will be cached. You can specify various properties that your computed property is dependent on. - This will force the cached result to be recomputed if the dependencies are modified. - **/ + A computed property transforms an objects function into a property. + By default the function backing the computed property will only be called once and the result + will be cached. You can specify various properties that your computed property is dependent on. + This will force the cached result to be recomputed if the dependencies are modified. + **/ class ComputedProperty { cacheable(aFlag?: boolean): ComputedProperty; get(keyName: string): any; @@ -676,11 +676,11 @@ declare module Ember { child(): Container; set(object: {}, key: string, value: any): void; /** - registers a factory for later injection - @param fullName type:name (e.g., 'model:user') - @param factory (e.g., App.Person) - **/ - register(fullName: string, factory: Function, options?: {}): void; + registers a factory for later injection + @param fullName type:name (e.g., 'model:user') + @param factory (e.g., App.Person) + **/ + register(fullName: string, factory: Function, options?: {}): void; unregister(fullName: string): void; resolve(fullName: string): Function; describe(fullName: string): string; @@ -697,29 +697,29 @@ declare module Ember { reset(): void; } /** - An Ember.View subclass that implements Ember.MutableArray allowing programatic - management of its child views. - **/ + An Ember.View subclass that implements Ember.MutableArray allowing programatic + management of its child views. + **/ class ContainerView extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; } class Controller extends Object { } /** - Additional methods for the ControllerMixin. - **/ + Additional methods for the ControllerMixin. + **/ class ControllerMixin { replaceRoute(name: string, ...args: any[]): void; transitionToRoute(name: string, ...args: any[]): void; @@ -728,11 +728,11 @@ declare module Ember { target: any; } /** - Implements some standard methods for copying an object. Add this mixin to any object you - create that can create a copy of itself. This mixin is added automatically to the built-in array. - You should generally implement the copy() method to return a copy of the receiver. - Note that frozenCopy() will only work if you also implement Ember.Freezable. - **/ + Implements some standard methods for copying an object. Add this mixin to any object you + create that can create a copy of itself. This mixin is added automatically to the built-in array. + You should generally implement the copy() method to return a copy of the receiver. + Note that frozenCopy() will only work if you also implement Ember.Freezable. + **/ class Copyable { copy(deep: boolean): Copyable; frozenCopy(): Copyable; @@ -741,64 +741,64 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; /** - Destroys an object by setting the isDestroyed flag and removing its metadata, which effectively - destroys observers and bindings. If you try to set a property on a destroyed object, an exception - will be raised. Note that destruction is scheduled for the end of the run loop and does not - happen immediately. It will set an isDestroying flag immediately. - **/ - destroy(): CoreObject; + Destroys an object by setting the isDestroyed flag and removing its metadata, which effectively + destroys observers and bindings. If you try to set a property on a destroyed object, an exception + will be raised. Note that destruction is scheduled for the end of the run loop and does not + happen immediately. It will set an isDestroying flag immediately. + **/ + destroy(): CoreObject; init(): void; /** - Returns a string representation which attempts to provide more information than Javascript's toString - typically does, in a generic way for all Ember objects (e.g., ""). - **/ - toString(): string; + Returns a string representation which attempts to provide more information than Javascript's toString + typically does, in a generic way for all Ember objects (e.g., ""). + **/ + toString(): string; willDestroy(): void; /** - Defines the properties that will be concatenated from the superclass (instead of overridden). - **/ + Defines the properties that will be concatenated from the superclass (instead of overridden). + **/ concatenatedProperties: any[]; /** - Destroyed object property flag. If this property is true the observers and bindings were - already removed by the effect of calling the destroy() method. - **/ + Destroyed object property flag. If this property is true the observers and bindings were + already removed by the effect of calling the destroy() method. + **/ isDestroyed: boolean; /** - Destruction scheduled flag. The destroy() method has been called. The object stays intact - until the end of the run loop at which point the isDestroyed flag is set. - **/ + Destruction scheduled flag. The destroy() method has been called. The object stays intact + until the end of the run loop at which point the isDestroyed flag is set. + **/ isDestroying: boolean; } /** - An abstract class that exists to give view-like behavior to both Ember's main view class Ember.View - and other classes like Ember._SimpleMetamorphView that don't need the fully functionaltiy of Ember.View. - Unless you have specific needs for CoreView, you will use Ember.View in your applications. - **/ + An abstract class that exists to give view-like behavior to both Ember's main view class Ember.View + and other classes like Ember._SimpleMetamorphView that don't need the fully functionaltiy of Ember.View. + Unless you have specific needs for CoreView, you will use Ember.View in your applications. + **/ class CoreView extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -815,12 +815,12 @@ declare module Ember { } function DEFAULT_GETTER_FUNCTION(name: string): Function; /** - The DefaultResolver defines the default lookup rules to resolve container lookups before consulting - the container for registered items: - templates are looked up on Ember.TEMPLATES - other names are looked up on the application after converting the name. - For example, controller:post looks up App.PostController by default. - **/ + The DefaultResolver defines the default lookup rules to resolve container lookups before consulting + the container for registered items: + templates are looked up on Ember.TEMPLATES + other names are looked up on the application after converting the name. + For example, controller:post looks up App.PostController by default. + **/ class DefaultResolver { resolve(fullName: string): {}; namespace: Application; @@ -836,42 +836,42 @@ declare module Ember { then(resolve: Function, reject: Function): void; } /** - Objects of this type can implement an interface to respond to requests to get and set. - The default implementation handles simple properties. - You generally won't need to create or subclass this directly. - **/ + Objects of this type can implement an interface to respond to requests to get and set. + The default implementation handles simple properties. + You generally won't need to create or subclass this directly. + **/ class Descriptor { } var EMPTY_META: {}; // TODO: define interface var ENV: {}; var EXTEND_PROTOTYPES: boolean; /** - This is the object instance returned when you get the @each property on an array. It uses - the unknownProperty handler to automatically create EachArray instances for property names. - **/ + This is the object instance returned when you get the @each property on an array. It uses + the unknownProperty handler to automatically create EachArray instances for property names. + **/ class EachProxy extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; unknownProperty(keyName: string, value: any): any[]; } /** - This mixin defines the common interface implemented by enumerable objects in Ember. Most of these - methods follow the standard Array iteration API defined up to JavaScript 1.8 (excluding language-specific - features that cannot be emulated in older versions of JavaScript). - This mixin is applied automatically to the Array class on page load, so you can use any of these methods - on simple arrays. If Array already implements one of these methods, the mixin will not override them. - **/ + This mixin defines the common interface implemented by enumerable objects in Ember. Most of these + methods follow the standard Array iteration API defined up to JavaScript 1.8 (excluding language-specific + features that cannot be emulated in older versions of JavaScript). + This mixin is applied automatically to the Array class on page load, so you can use any of these methods + on simple arrays. If Array already implements one of these methods, the mixin will not override them. + **/ class Enumerable { addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; any(callback: Function, target?: any): boolean; @@ -920,35 +920,35 @@ declare module Ember { } var EnumerableUtils: {}; // TODO: define interface /** - A subclass of the JavaScript Error object for use in Ember. - **/ + A subclass of the JavaScript Error object for use in Ember. + **/ // ReSharper disable once DuplicatingLocalDeclaration var Error: typeof Error; /** - Handles delegating browser events to their corresponding Ember.Views. For example, when you click on - a view, Ember.EventDispatcher ensures that that view's mouseDown method gets called. - **/ + Handles delegating browser events to their corresponding Ember.Views. For example, when you click on + a view, Ember.EventDispatcher ensures that that view's mouseDown method gets called. + **/ class EventDispatcher extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; events: {}; } /** - This mixin allows for Ember objects to subscribe to and emit events. - You can also chain multiple event subscriptions. - **/ + This mixin allows for Ember objects to subscribe to and emit events. + You can also chain multiple event subscriptions. + **/ class Evented { has(name: string): boolean; off(name: string, target: any, method: Function): Evented; @@ -1014,14 +1014,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1030,14 +1030,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1060,14 +1060,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1119,9 +1119,9 @@ declare module Ember { class Mixin { apply(obj: any): any; /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ + Creates an instance of the class. + @param arguments A hash containing values with which to initialize the newly instantiated object. + **/ static create(arguments?: {}): T; detect(obj: any): boolean; reopen(arguments?: {}): T; @@ -1188,8 +1188,8 @@ declare module Ember { unshiftObject(object: any): any; unshiftObjects(objects: any[]): any[]; without(value: any): Enumerable; - '[]': any[]; - '@each': EachProxy; + '[]': any[]; + '@each': EachProxy; Boolean: boolean; firstObject: any; hasEnumerableObservers: boolean; @@ -1255,14 +1255,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1331,8 +1331,8 @@ declare module Ember { unshiftObject(object: any): any; unshiftObjects(objects: any[]): any[]; without(value: any): any[]; - '[]': any[]; - '@each': EachProxy; + '[]': any[]; + '@each': EachProxy; Boolean: boolean; firstObject: any; hasEnumerableObservers: boolean; @@ -1368,14 +1368,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1383,40 +1383,40 @@ declare module Ember { var ORDER_DEFINITION: string[]; class Object extends CoreObject implements Observable { /** - Creates a subclass of the Object class. - **/ + Creates a subclass of the Object class. + **/ static extend(arguments?: CoreObjectArguments): T; /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ + Creates an instance of the class. + @param arguments A hash containing values with which to initialize the newly instantiated object. + **/ static create(arguments?: {}): T; /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ + Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. + **/ static createWithMixins(arguments?: {}): T; static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ + Augments a constructor's prototype with additional properties and functions. + To add functions and properties to the constructor itself, see reopenClass. + **/ static reopen(arguments?: {}): T; /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ + Augments a constructor's own properties and functions. + To add functions and properties to instances of a constructor by extending the + constructor's prototype see reopen. + **/ static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; @@ -1451,20 +1451,20 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; /** - The object whose properties will be forwarded. - **/ + The object whose properties will be forwarded. + **/ content: Object; } class Observable { @@ -1528,14 +1528,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1563,14 +1563,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1587,14 +1587,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1613,14 +1613,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1670,7 +1670,7 @@ declare module Ember { toArray(): any[]; uniq(): Set; without(value: any): Set; - '[]': any[]; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -1735,7 +1735,7 @@ declare module Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '[]': any[]; + '[]': any[]; arrangedContent: any; firstObject: any; hasEnumerableObservers: boolean; @@ -1748,14 +1748,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1781,14 +1781,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1848,14 +1848,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1872,14 +1872,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1911,14 +1911,14 @@ declare module Ember { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** - Iterate over each computed property for the class, passing its name and any - associated metadata (see metaForProperty) to the callback. - **/ + Iterate over each computed property for the class, passing its name and any + associated metadata (see metaForProperty) to the callback. + **/ static eachComputedProperty(callback: Function, binding: {}): void; /** - Returns the original hash that was passed to meta(). - @param key property name - **/ + Returns the original hash that was passed to meta(). + @param key property name + **/ static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; @@ -1983,8 +1983,8 @@ declare module Ember { function addListener(obj: any, eventName: string, func: Function, method: string, once?: boolean): void; var addObserver: ModifyObserver; /** - Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead. - **/ + Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead. + **/ var alias: typeof deprecateFunc; function aliasMethod(methodName: string): Descriptor; var anyUnprocessedMixins: boolean; @@ -2025,9 +2025,9 @@ declare module Ember { function controllerFor(container: Container, controllerName: string, lookupOptions?: {}): Controller; function copy(obj: any, deep: boolean): any; /** - Creates an instance of the CoreObject class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ + Creates an instance of the CoreObject class. + @param arguments A hash containing values with which to initialize the newly instantiated object. + **/ function create(arguments?: {}): CoreObject; function debug(message: string): void; function defineProperty(obj: any, keyName: string, desc: {}): void; @@ -2035,8 +2035,8 @@ declare module Ember { function deprecateFunc(message: string, func: Function): Function; function destroy(obj: any): void; /** - Ember.empty is deprecated. Please use Ember.isEmpty instead. - **/ + Ember.empty is deprecated. Please use Ember.isEmpty instead. + **/ // ReSharper disable once DuplicatingLocalDeclaration var empty: typeof deprecateFunc; function endPropertyChanges(): void; @@ -2049,8 +2049,8 @@ declare module Ember { function get(obj: any, keyName: string): any; function getMeta(obj: any, property: string): any; /** - getPath is deprecated since get now supports paths. - **/ + getPath is deprecated since get now supports paths. + **/ var getPath: typeof deprecateFunc; function getWithDefault(root: string, key: string, defaultValue: any): any; function guidFor(obj: any): string; @@ -2079,10 +2079,10 @@ declare module Ember { function merge(original: any, updates: any): any; function meta(obj: any, writable?: boolean): {}; function metaPath(obj: any, path: string, writable?: boolean): any; - function mixin(obj: any, ...args: any[]): any; + function mixin(obj: any, ...any[]): any; /** - Ember.none is deprecated. Please use Ember.isNone instead. - **/ + Ember.none is deprecated. Please use Ember.isNone instead. + **/ var none: typeof deprecateFunc; function normalizeTuple(target: any, path: string): any[]; function observer(func: Function, ...args: string[]): Function; @@ -2141,8 +2141,8 @@ declare module Ember { function set(obj: any, keyName: string, value: any): any; function setMeta(obj: any, property: string, value: any): void; /** - setPath is deprecated since set now supports paths. - **/ + setPath is deprecated since set now supports paths. + **/ var setPath: typeof deprecateFunc; function setProperties(self: any, hash: {}): any; function subscribe(pattern: string, object: any): void; @@ -2153,8 +2153,8 @@ declare module Ember { function tryInvoke(obj: any, methodName: string, args?: any[]): any; function trySet(obj: any, path: string, value: any): void; /** - trySetPath has been renamed to trySet. - **/ + trySetPath has been renamed to trySet. + **/ var trySetPath: typeof deprecateFunc; function typeOf(item: any): string; function unwatch(obj: any, keyPath: string): void; @@ -2174,8 +2174,8 @@ declare module Ember { // ReSharper disable DuplicatingLocalDeclaration declare module Em { /** - Alias for jQuery. - **/ + Alias for jQuery. + **/ var $: typeof Ember.$; var A: typeof Ember.A; class Application extends Ember.Application { } From dc699cf64643e8637cfc8d9b24595616c1cc2411 Mon Sep 17 00:00:00 2001 From: Jakub Olek Date: Mon, 25 Aug 2014 14:37:52 +0200 Subject: [PATCH 15/40] missing Transition property --- ember/ember.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 9ee334738..19b1b49dd 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -11,12 +11,15 @@ declare var Handlebars: HandlebarsStatic; declare module EmberStates { interface Transition { + abort(): void; addInitialStates(): void; matchContextsToStates(contexts: any[]): void; normalize(manager: Ember.StateManager, contexts: any[]): void; removeUnchangedContexts(manager: Ember.StateManager): void; + retry(): void; sendEvents(eventName: string, sendRecursiveArguments: boolean, isUnhandledPass: boolean): void; sendRecursively(event: string, currentState: Ember.State, isUnhandledPass: boolean): void; + targetName: string; } } From 6e20551e4835bb046c88cd0e23d94e1bf2de749c Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 25 Aug 2014 18:52:25 -0700 Subject: [PATCH 16/40] Added more emit() overloads --- dropzone/dropzone.d.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dropzone/dropzone.d.ts b/dropzone/dropzone.d.ts index 0c754fbd5..5dca7e169 100644 --- a/dropzone/dropzone.d.ts +++ b/dropzone/dropzone.d.ts @@ -73,7 +73,21 @@ declare class Dropzone { getQueuedFiles(): DropzoneFile[]; getUploadingFiles(): DropzoneFile[]; - emit(eventName: string, file: DropzoneFile, data?: string); + emit(eventName: string, file: DropzoneFile, str?: string); + emit(eventName: "thumbnail", file: DropzoneFile, path: string); + emit(eventName: "addedfile", file: DropzoneFile); + emit(eventName: "removedfile", file: DropzoneFile); + emit(eventName: "processing", file: DropzoneFile); + emit(eventName: "canceled", file: DropzoneFile); + emit(eventName: "complete", file: DropzoneFile); + + emit(eventName: string, e: Event); + emit(eventName: "drop", e: Event); + emit(eventName: "dragstart", e: Event); + emit(eventName: "dragend", e: Event); + emit(eventName: "dragenter", e: Event); + emit(eventName: "dragover", e: Event); + emit(eventName: "dragleave", e: Event); } interface JQuery { From 101e436092dde7fcbc9035d79b118e8d10ac32e9 Mon Sep 17 00:00:00 2001 From: MIZUNE Pine Date: Tue, 26 Aug 2014 14:06:08 +0900 Subject: [PATCH 17/40] Add HttpHeader type --- chrome/chrome.d.ts | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index e7e58dbbc..df655e2b8 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2230,13 +2230,19 @@ declare module chrome.webRequest { username: string; password: string; } - + + interface HttpHeader { + name: string; + value?: string; + binaryValue?: ArrayBuffer; + } + interface BlockingResponse { cancel?: boolean; redirectUrl?: string; - responseHeaders?: Object; + responseHeaders?: HttpHeader[]; authCredentials?: AuthCredentials; - requestHeaders?: Object; + requestHeaders?: HttpHeader[]; } interface RequestFilter { @@ -2256,7 +2262,7 @@ declare module chrome.webRequest { ip?: string; statusLine?: string; frameId: number; - responseHeaders?: Object; + responseHeaders?: HttpHeader[]; parentFrameId: number; fromCache: boolean; url: string; @@ -2275,7 +2281,7 @@ declare module chrome.webRequest { statusLine?: string; frameId: number; requestId: string; - responseHeaders: Object; + responseHeaders?: HttpHeader[]; type: string; method: string; } @@ -2285,7 +2291,7 @@ declare module chrome.webRequest { ip?: string; statusLine?: string; frameId: number; - responseHeaders?: Object; + responseHeaders?: HttpHeader[]; parentFrameId: number; fromCache: boolean; url: string; @@ -2307,7 +2313,7 @@ declare module chrome.webRequest { statusLine?: string; frameId: number; challenger: Challenger; - responseHeaders: Object; + responseHeaders?: HttpHeader[]; isProxy: boolean; realm?: string; parentFrameId: number; @@ -2326,7 +2332,7 @@ declare module chrome.webRequest { timeStamp: number; frameId: number; requestId: number; - requestHeaders?: Object; + requestHeaders?: HttpHeader[]; type: string; method: string; } @@ -2350,7 +2356,7 @@ declare module chrome.webRequest { ip?: string; statusLine?: string; frameId: number; - responseHeaders?: Object; + responseHeaders?: HttpHeader[]; parentFrameId: number; fromCache: boolean; url: string; @@ -2368,7 +2374,7 @@ declare module chrome.webRequest { timeStamp: number; frameId: number; requestId: string; - requestHeaders: Object; + requestHeaders?: HttpHeader[]; type: string; method: string; } From d51f7f601a1d4f166d32b08c615600a37d49c7ba Mon Sep 17 00:00:00 2001 From: MIZUNE Pine Date: Tue, 26 Aug 2014 15:01:51 +0900 Subject: [PATCH 18/40] Add length property --- zepto/zepto.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zepto/zepto.d.ts b/zepto/zepto.d.ts index 3608ade9f..ba75e7556 100644 --- a/zepto/zepto.d.ts +++ b/zepto/zepto.d.ts @@ -1106,7 +1106,12 @@ interface ZeptoCollection { * @return **/ size(): number; - + + /** + * Get the number of elements in this collection. + **/ + length: number; + /** * Extract the subset of this array, starting at start index. If end is specified, extract up to but not including end index. * @param start From 76e60effef77c57d860160772752b27d6644630d Mon Sep 17 00:00:00 2001 From: Jakub Olek Date: Tue, 26 Aug 2014 11:51:35 +0200 Subject: [PATCH 19/40] args should have a name --- ember/ember.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 19b1b49dd..878d8a49c 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -2082,7 +2082,7 @@ declare module Ember { function merge(original: any, updates: any): any; function meta(obj: any, writable?: boolean): {}; function metaPath(obj: any, path: string, writable?: boolean): any; - function mixin(obj: any, ...any[]): any; + function mixin(obj: any, ...args: any[]): any; /** Ember.none is deprecated. Please use Ember.isNone instead. **/ From b57a5b10723c02624b877cdaf80d0011f54db1a4 Mon Sep 17 00:00:00 2001 From: Jon Stelly Date: Tue, 26 Aug 2014 08:23:55 -0500 Subject: [PATCH 20/40] Restangular: add generic overloads for get(), getAll() and post() --- restangular/restangular-tests.ts | 4 ++++ restangular/restangular.d.ts | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/restangular/restangular-tests.ts b/restangular/restangular-tests.ts index 9d5aa9fb4..3cfeb8c68 100644 --- a/restangular/restangular-tests.ts +++ b/restangular/restangular-tests.ts @@ -74,9 +74,13 @@ myApp.controller('TestCtrl', ( baseAccounts.post(newAccount); Restangular.allUrl('googlers', 'http://www.google.com/').getList(); + Restangular.allUrl('googlers', 'http://www.google.com/').getList(); Restangular.oneUrl('googlers', 'http://www.google.com/1').get(); + Restangular.oneUrl('googlers', 'http://www.google.com/1').get(); Restangular.one('accounts', 123).one('buildings', 456).get(); + Restangular.one('accounts', 123).one('buildings', 456).get(); Restangular.one('accounts', 123).getList('buildings'); + Restangular.one('accounts', 123).getList('buildings'); baseAccounts.getList().then(function (accounts) { var firstAccount = accounts[0]; diff --git a/restangular/restangular.d.ts b/restangular/restangular.d.ts index a1a7e8a5e..8b8fd9d2f 100644 --- a/restangular/restangular.d.ts +++ b/restangular/restangular.d.ts @@ -99,10 +99,14 @@ declare module restangular { interface IElement extends IService { get(queryParams?: any, headers?: any): IPromise; + get(queryParams?: any, headers?: any): IPromise; getList(subElement?: any, queryParams?: any, headers?: any): ICollectionPromise; + getList(subElement?: any, queryParams?: any, headers?: any): ICollectionPromise; put(queryParams?: any, headers?: any): IPromise; post(subElement: any, elementToPost: any, queryParams?: any, headers?: any): IPromise; + post(subElement: any, elementToPost: T, queryParams?: any, headers?: any): IPromise; post(elementToPost: any, queryParams?: any, headers?: any): IPromise; + post(elementToPost: T, queryParams?: any, headers?: any): IPromise; remove(queryParams?: any, headers?: any): IPromise; head(queryParams?: any, headers?: any): IPromise; trace(queryParams?: any, headers?: any): IPromise; @@ -114,7 +118,9 @@ declare module restangular { interface ICollection extends IService { getList(queryParams?: any, headers?: any): ICollectionPromise; + getList(queryParams?: any, headers?: any): ICollectionPromise; post(elementToPost: any, queryParams?: any, headers?: any): IPromise; + post(elementToPost: T, queryParams?: any, headers?: any): IPromise; head(queryParams?: any, headers?: any): IPromise; trace(queryParams?: any, headers?: any): IPromise; options(queryParams?: any, headers?: any): IPromise; From a32e2bc73114a8ce10d383208272efa2a4a325bc Mon Sep 17 00:00:00 2001 From: Jon Stelly Date: Tue, 26 Aug 2014 08:33:27 -0500 Subject: [PATCH 21/40] Restangular: fix test compilation --- restangular/restangular-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/restangular/restangular-tests.ts b/restangular/restangular-tests.ts index 3cfeb8c68..11d7a086d 100644 --- a/restangular/restangular-tests.ts +++ b/restangular/restangular-tests.ts @@ -22,7 +22,7 @@ myApp.config((RestangularProvider: restangular.IProvider) => { RestangularProvider.setRequestInterceptor(function (element, operation, route, url) { }); - RestangularProvider.addElementTransformer('accounts', false, function (elem) { + RestangularProvider.addElementTransformer('accounts', false, function (elem: any) { elem.accountName = 'Changed'; return elem; }); @@ -108,7 +108,7 @@ myApp.controller('TestCtrl', ( console.log("There was an error saving"); }); - firstAccount.getList("users", {query: "params"}).then(function(users) { + firstAccount.getList("users", {query: "params"}).then(function(users: any) { users.post({userName: 'unknown'}); users.customGET("messages", {param: "myParam"}); @@ -155,7 +155,7 @@ myApp.controller('TestCtrl', ( configurer.setRequestInterceptor(function (element, operation, route, url) { }); - configurer.addElementTransformer('accounts', false, function (elem) { + configurer.addElementTransformer('accounts', false, function (elem: any) { elem.accountName = 'Changed'; return elem; }); From 6165bb68de9ff765ba01cfc3e3042ccd279c2ef8 Mon Sep 17 00:00:00 2001 From: Adriaan Groenenboom Date: Tue, 26 Aug 2014 21:41:47 +0200 Subject: [PATCH 22/40] Add definition for SIPml --- sipml/sipml.d.ts | 150 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 sipml/sipml.d.ts diff --git a/sipml/sipml.d.ts b/sipml/sipml.d.ts new file mode 100644 index 000000000..265f7650a --- /dev/null +++ b/sipml/sipml.d.ts @@ -0,0 +1,150 @@ +// Type definitions for SIPml5 +// Project: http://sipml5.org/ +// Docgen: http://sipml5.org/docgen/symbols/SIPml.html +// Definitions by: Chookies (A. Groenenboom): https://github.com/chookies +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module SIPml { + class Event { + public description: string; + public type: string; + + public getContent(): Object; + public getContentString(): string; + public getContentType(): Object; + public getSipResponseCode(): number; + } + + class EventTarget { + public addEventListener(type: any, listener: any); + public removeEventListener(type: any); + } + + class Session { + public accept(configuration?: Session.Configuration): number; + public getId(): number; + public getRemoteFriendlyName(): string; + public getRemoteUri(): string; + public reject(configuration?: Session.Configuration): number; + public setConfiguration(configuration?: Session.Configuration); + } + + export module Session { + interface Configuration { + audio_remote?: HTMLAudioElement; + bandwidth?: Object; + expires?: number; + from?: string; + sip_caps?: Object[]; + sip_headers?: Object[]; + video_local?: HTMLVideoElement; + video_remote?: HTMLVideoElement; + video_size?: Object; + } + + class Call extends Session { + public acceptTransfer(configuration?: Session.Configuration): number; + public call(to: string, configuration?: Session.Configuration): number; + public dtmf(): number; + public hangup(configuration?: Session.Configuration): number; + public hold(configuration?: Session.Configuration): number; + public info(): number; + public rejectTransfer(): number; + public resume(): number; + public transfer(): number; + } + + class Event extends SIPml.Event { + public session: Session; + + public getTransferDestinationFriendlyName(): string; + } + + class Message { + public send(to: string, content?: any, contentType?: string, configuration?: Session.Configuration): number; + } + + class Publish extends Session { + public publish(content?: any, contentType?: string, configuration?: Session.Configuration): number; + + public unpublish(configuration?: Session.Configuration); + } + + class Registration extends Session { + public register(configuration?: Session.Configuration); + public unregister(configuration?: Session.Configuration); + } + + class Subscribe extends Session { + public subscribe(to: string, configuration?: Session.Configuration): number; + public unsubscribe(configuration?: Session.Configuration): number; + } + } + + class Stack extends EventTarget { + public constructor(configuration?: Stack.Configuration); + public setConfiguration(configuration: Stack.Configuration); + public newSession(type: string, configuration: Stack.Configuration); + public start(): number; + public stop(timeout: number): number; + } + + export module Stack { + interface Configuration { + bandwidth?: Object; + display_name?: string; + enable_click2call?: boolean; + enable_early_ims?: boolean; + enable_media_stream_cache?: boolean; + enable_rtcweb_breaker?: boolean; + events_listener?: Object; + ice_servers?: Object[]; + impi?: string; + impu?: string; + outbound_proxy_url?: string; + password?: string; + realm?: string; + sip_headers?: Object[]; + video_size?: Object; + websocket_proxy_url?: string; + } + + class Event extends SIPml.Event { + public description: string; + public newSession: Session; + public type: string; + } + } + + function getNavigatorFriendlyName(): string; + + function getNavigatorVersion(): string; + + function getSystemFriendlyName(): string; + + function getWebRtc4AllVersion(): string; + + function haveMediaStream(): boolean; + + function init(readyCallback?: (e:any) => any, errorCallback?: (e:any) => any); + + function isInitialized(): boolean; + + function isNavigatorOutdated(): boolean; + + function isReady(): boolean; + + function isScreenShareSupported(): boolean; + + function isWebRtcPluginOutdated(): boolean; + + function isWebRtc4AllSupported(): boolean; + + function isWebRtcSupported(): boolean; + + function isWebSocketSupported(): boolean; + + function setDebugLevel(level: string); + + function setWebRtcType(type: string); +} From b785da8c10866a34eb5e8ac9b1140f7953922183 Mon Sep 17 00:00:00 2001 From: Adriaan Groenenboom Date: Tue, 26 Aug 2014 22:44:50 +0200 Subject: [PATCH 23/40] Added passing test file for SIPml, improved definition Updated contributors file --- CONTRIBUTORS.md | 1 + sipml/sipml-test.ts | 169 ++++++++++++++++++++++++++++++++++++++++++++ sipml/sipml.d.ts | 27 ++++--- 3 files changed, 183 insertions(+), 14 deletions(-) create mode 100644 sipml/sipml-test.ts diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index bb0933af5..18470668f 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -320,6 +320,7 @@ All definitions files include a header with the author and editors, so at some p * [SignalR](http://www.asp.net/signalr) (by [Boris Yankov](https://github.com/borisyankov)) * [simple-cw-node](https://github.com/astronaughts/simple-cw-node) (by [vvakame](https://github.com/vvakame)) * [Sinon](http://sinonjs.org/) (by [William Sears](https://github.com/mrbigdog2u)) +* [SIPml](http://sipml5.org/) (by [Adriaan Groenenboom](https://github.com/chookies)) * [sjcl](http://crypto.stanford.edu/sjcl/) (by [Eugene Chernyshov](https://github.com/Evgenus)) * [SlickGrid](https://github.com/mleibman/SlickGrid) (by [Josh Baldwin](https://github.com/jbaldwin)) * [smoothie](https://github.com/joewalnes/smoothie) (by [Mike H. Hawley](https://github.com/mikehhawley) and [Drew Noakes](https://drewnoakes.com)) diff --git a/sipml/sipml-test.ts b/sipml/sipml-test.ts new file mode 100644 index 000000000..5fed26fc6 --- /dev/null +++ b/sipml/sipml-test.ts @@ -0,0 +1,169 @@ +/// + +/* Code borrowed from http://sipml5.org/docgen/index.html?svn=224 */ + +var acceptMessage = (e: any)=> { + e.newSession.accept(); // e.newSession.reject(); to reject the message + console.info('SMS-content = ' + e.getContentString() + ' and SMS-content-type = ' + e.getContentType()); +}; +var acceptCall = (e:any)=> { + e.newSession.accept(); // e.newSession.reject() to reject the call +}; + + /* Initialize the engine */ +var readyCallback = (e:any)=> { + createSipStack(); // see next section +}; +var errorCallback = (e:any)=> { + console.error('Failed to initialize the engine: ' + e.message); +} +SIPml.init(readyCallback, errorCallback); + +/* Create a SIP stack */ +var sipStack: SIPml.Stack; +var eventsListener = (e:any)=> { + if(e.type == 'started'){ + login(); + } + else if(e.type == 'i_new_message'){ // incoming new SIP MESSAGE (SMS-like) + acceptMessage(e); + } + else if(e.type == 'i_new_call'){ // incoming audio/video call + acceptCall(e); + } +} + +function createSipStack(){ + sipStack = new SIPml.Stack('blaat'); + sipStack = new SIPml.Stack({ + realm: 'example.org', // mandatory: domain name + impi: 'bob', // mandatory: authorization name (IMS Private Identity) + impu: 'sip:bob@example.org', // mandatory: valid SIP Uri (IMS Public Identity) + password: 'mysecret', // optional + display_name: 'Bob legend', // optional + websocket_proxy_url: 'wss://sipml5.org:10062', // optional + outbound_proxy_url: 'udp://example.org:5060', // optional + enable_rtcweb_breaker: false, // optional + events_listener: { events: '*', listener: eventsListener }, // optional: '*' means all events + sip_headers: [ // optional + { name: 'User-Agent', value: 'IM-client/OMA1.0 sipML5-v1.0.0.0' }, + { name: 'Organization', value: 'Doubango Telecom' } + ] + } + ); +} +sipStack.start(); + +/* Register/login */ +var registerSession: SIPml.Session.Registration; +var eventsListener = (e:any)=>{ + console.info('session event = ' + e.type); + if(e.type == 'connected' && e.session == registerSession){ + makeCall(); + sendMessage(); + publishPresence(); + subscribePresence('johndoe'); // watch johndoe's presence status change + } +} +var login = ()=>{ + registerSession = sipStack.newSession('register', { + events_listener: { events: '*', listener: eventsListener } // optional: '*' means all events + }); + registerSession.register(); +} + +/* Making/receiving audio/video call */ +var callSession: SIPml.Session.Call; +var eventsListener = (e:any)=>{ + console.info('session event = ' + e.type); +} +var makeCall = ()=>{ + callSession = sipStack.newSession('call-audiovideo', { + video_local: document.getElementById('video-local'), + video_remote: document.getElementById('video-remote'), + audio_remote: document.getElementById('audio-remote'), + events_listener: { events: '*', listener: eventsListener } // optional: '*' means all events + }); + callSession.call('johndoe'); +} +var acceptCall = (e:any)=>{ + e.newSession.accept(); // e.newSession.reject() to reject the call +} + +/* Send/receive SIP MESSAGE (SMS-like) */ +var messageSession: SIPml.Session.Message; +var eventsListener = (e:any)=>{ + console.info('session event = ' + e.type); +} +var sendMessage = ()=>{ + messageSession = sipStack.newSession('message', { + events_listener: { events: '*', listener: eventsListener } // optional: '*' means all events + }); + messageSession.send('johndoe', 'Pêche à la moule', 'text/plain;charset=utf-8'); +} + +/* Publish presence status */ +var publishSession: SIPml.Session.Publish; +var eventsListener = (e:any)=>{ + console.info('session event = ' + e.type); +} +var publishPresence = ()=>{ + publishSession = sipStack.newSession('publish', { + events_listener: { events: '*', listener: eventsListener } // optional: '*' means all events + }); + var contentType = 'application/pidf+xml'; + var content = '\n' + + '\n' + + '\n' + + '\n'+ + ' open\n' + + ' away\n' + + '\n' + + 'tel:+33600000000\n' + + 'Bonjour de Paris :)\n' + + '\n' + + ''; + + // send the PUBLISH request + publishSession.publish(content, contentType,{ + expires: 200, + sip_caps: [ + { name: '+g.oma.sip-im' }, + { name: '+sip.ice' }, + { name: 'language', value: '\"en,fr\"' } + ], + sip_headers: [ + { name: 'Event', value: 'presence' }, + { name: 'Organization', value: 'Doubango Telecom' } + ] + }); +} + +/* Subscribe for presence status */ +var subscribeSession: SIPml.Session.Subscribe; +var eventsListener = (e:any)=>{ + console.info('session event = ' + e.type); + if(e.type == 'i_notify'){ + console.info('NOTIFY content = ' + e.getContentString()); + console.info('NOTIFY content-type = ' + e.getContentType()); + } +} +var subscribePresence = (to:string)=>{ + subscribeSession = sipStack.newSession('subscribe', { + expires: 200, + events_listener: { events: '*', listener: eventsListener }, + sip_headers: [ + { name: 'Event', value: 'presence' }, // only notify for 'presence' events + { name: 'Accept', value: 'application/pidf+xml' } // supported content types (COMMA-sparated) + ], + sip_caps: [ + { name: '+g.oma.sip-im', value: null }, + { name: '+audio', value: null }, + { name: 'language', value: '\"en,fr\"' } + ] + }); + // start watching for entity's presence status (You may track event type 'connected' to be sure that the request has been accepted by the server) + subscribeSession.subscribe(to); +} diff --git a/sipml/sipml.d.ts b/sipml/sipml.d.ts index 265f7650a..a4fe32784 100644 --- a/sipml/sipml.d.ts +++ b/sipml/sipml.d.ts @@ -1,7 +1,6 @@ // Type definitions for SIPml5 // Project: http://sipml5.org/ -// Docgen: http://sipml5.org/docgen/symbols/SIPml.html -// Definitions by: Chookies (A. Groenenboom): https://github.com/chookies +// Definitions by: A. Groenenboom // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module SIPml { @@ -16,8 +15,8 @@ declare module SIPml { } class EventTarget { - public addEventListener(type: any, listener: any); - public removeEventListener(type: any); + public addEventListener(type: any, listener: Function): void; + public removeEventListener(type: any): void; } class Session { @@ -26,7 +25,7 @@ declare module SIPml { public getRemoteFriendlyName(): string; public getRemoteUri(): string; public reject(configuration?: Session.Configuration): number; - public setConfiguration(configuration?: Session.Configuration); + public setConfiguration(configuration?: Session.Configuration): void; } export module Session { @@ -60,19 +59,19 @@ declare module SIPml { public getTransferDestinationFriendlyName(): string; } - class Message { + class Message extends Session { public send(to: string, content?: any, contentType?: string, configuration?: Session.Configuration): number; } class Publish extends Session { public publish(content?: any, contentType?: string, configuration?: Session.Configuration): number; - public unpublish(configuration?: Session.Configuration); + public unpublish(configuration?: Session.Configuration): void; } class Registration extends Session { - public register(configuration?: Session.Configuration); - public unregister(configuration?: Session.Configuration); + public register(configuration?: Session.Configuration): void; + public unregister(configuration?: Session.Configuration): void; } class Subscribe extends Session { @@ -83,8 +82,8 @@ declare module SIPml { class Stack extends EventTarget { public constructor(configuration?: Stack.Configuration); - public setConfiguration(configuration: Stack.Configuration); - public newSession(type: string, configuration: Stack.Configuration); + public setConfiguration(configuration: Stack.Configuration): number; + public newSession(type: string, configuration: Stack.Configuration): any; public start(): number; public stop(timeout: number): number; } @@ -126,7 +125,7 @@ declare module SIPml { function haveMediaStream(): boolean; - function init(readyCallback?: (e:any) => any, errorCallback?: (e:any) => any); + function init(readyCallback?: (e:any) => any, errorCallback?: (e:any) => any): boolean; function isInitialized(): boolean; @@ -144,7 +143,7 @@ declare module SIPml { function isWebSocketSupported(): boolean; - function setDebugLevel(level: string); + function setDebugLevel(level: string): void; - function setWebRtcType(type: string); + function setWebRtcType(type: string): boolean; } From 508ec64e8e1f693c83fb3b6981045efdb66f24c7 Mon Sep 17 00:00:00 2001 From: Drew Noakes Date: Wed, 27 Aug 2014 20:28:18 +0100 Subject: [PATCH 24/40] Update smoothie charts definitions to version 1.25 of library. --- smoothie/smoothie.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/smoothie/smoothie.d.ts b/smoothie/smoothie.d.ts index 18f0cc0a5..714590f84 100644 --- a/smoothie/smoothie.d.ts +++ b/smoothie/smoothie.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Smoothie Charts 1.21 +// Type definitions for Smoothie Charts 1.25 // Project: https://github.com/joewalnes/smoothie // Definitions by: Drew Noakes , Mike H. Hawley // Definitions: https://github.com/borisyankov/DefinitelyTyped/smoothie @@ -41,6 +41,11 @@ declare module "smoothie" */ constructor(options?: ITimeSeriesOptions); + /** + * Clears all data and state from this TimeSeries object. + */ + clear(): void; + /** * Recalculate the min/max values for this TimeSeries object. * From c3df7fb18e89a0ba36c2457cef735f8e877cbd5a Mon Sep 17 00:00:00 2001 From: Brandon Luong Date: Wed, 27 Aug 2014 23:18:44 -0700 Subject: [PATCH 25/40] update stacklayout x y --- d3/d3.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index a451a0de5..e2bf337e4 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -1102,6 +1102,8 @@ declare module D3 { (layers: T[], index?: number): T[]; values(accessor?: (d: any) => any): StackLayout; offset(offset: string): StackLayout; + x(accessor: (d: any, i: number) => any): StackLayout; + y(accessor: (d: any, i: number) => any): StackLayout; } export interface TreeLayout { From 6375ea80400923fbfb7d1382b1d0d59efbea43e6 Mon Sep 17 00:00:00 2001 From: Biegal Date: Thu, 28 Aug 2014 20:51:56 +0200 Subject: [PATCH 26/40] Definitions for angular-spinner directive --- angular-spinner/angular-spinner-tests.ts | 12 +++++++++++ angular-spinner/angular-spinner.d.ts | 26 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 angular-spinner/angular-spinner-tests.ts create mode 100644 angular-spinner/angular-spinner.d.ts diff --git a/angular-spinner/angular-spinner-tests.ts b/angular-spinner/angular-spinner-tests.ts new file mode 100644 index 000000000..cb50a9c37 --- /dev/null +++ b/angular-spinner/angular-spinner-tests.ts @@ -0,0 +1,12 @@ +/// + +var myApp = angular.module('testModule'); + +module AngularSpinnerTest { + var app = angular.module("angularSpinnerTest", ["angular-spinner"]); + + app.config(['usSpinnerService', function(usSpinnerService: ISpinnerService) { + usSpinnerService.spin('key1'); + usSpinnerService.stop('key2'); + }]); +} diff --git a/angular-spinner/angular-spinner.d.ts b/angular-spinner/angular-spinner.d.ts new file mode 100644 index 000000000..99784d38f --- /dev/null +++ b/angular-spinner/angular-spinner.d.ts @@ -0,0 +1,26 @@ +// Type definitions for angular-spinner.js 0.5.1 +// Project: https://github.com/urish/angular-spinner +// Definitions by: Marcin Biegała +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +/** +* SpinnerService +* see https://github.com/urish/angular-spinner +*/ +interface ISpinnerService { + /** + * Start selected spinner + * + * @param spinner key + */ + spin(key: string): void; + + /** + * Stop selected spinner + * + * @param spinner key + */ + stop(key: string): void; +} From f462e9936494db8159755bb9361081c3686570b0 Mon Sep 17 00:00:00 2001 From: Kensuke Matsuzaki Date: Sun, 24 Aug 2014 16:35:57 +0900 Subject: [PATCH 27/40] Add emscripten --- CONTRIBUTORS.md | 1 + emscripten/emscripten-tests.ts | 69 ++++++++++++ emscripten/emscripten.d.ts | 185 +++++++++++++++++++++++++++++++++ 3 files changed, 255 insertions(+) create mode 100644 emscripten/emscripten-tests.ts create mode 100644 emscripten/emscripten.d.ts diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 10ebf956d..93214257a 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -73,6 +73,7 @@ All definitions files include a header with the author and editors, so at some p * [Elm](http://elm-lang.org) (by [Dénes Harmath](https://github.com/thSoft)) * [ember.js](http://emberjs.com/) (by [Boris Yankov](https://github.com/borisyankov)) * [emissary](https://github.com/atom/emissary) (by [vvakame](https://github.com/vvakame)) +* [Emscripten](http://kripken.github.io/emscripten-site/) (by [Kensuke MATSUZAKI](https://github.com/zakki)) * [EpicEditor](http://epiceditor.com/) (by [Boris Yankov](https://github.com/borisyankov)) * [ES6-Promises](https://github.com/jakearchibald/ES6-Promises) (by [François de Campredon](https://github.com/fdecampredon/)) * [Esprima](http://esprima.org/) (by [Teppei Sato](https://github.com/teppeis)) diff --git a/emscripten/emscripten-tests.ts b/emscripten/emscripten-tests.ts new file mode 100644 index 000000000..2f3a2b09c --- /dev/null +++ b/emscripten/emscripten-tests.ts @@ -0,0 +1,69 @@ +/// + + +/// Module +function ModuleTest(): void { + Module.print = function(text) { alert('stdout: ' + text) }; + + var int_sqrt = Module.cwrap('int_sqrt', 'number', ['number']) + int_sqrt(12) + int_sqrt(28) + + var myTypedArray = new Uint8Array(10); + var buf = Module._malloc(myTypedArray.length*myTypedArray.BYTES_PER_ELEMENT); + Module.HEAPU8.set(myTypedArray, buf); + Module.ccall('my_function', 'number', ['number'], [buf]); + Module._free(buf); +} + +/// FS +function FSTest(): void { + FS.mkdir('/working'); + FS.mount(NODEFS, { root: '.' }, '/working'); + + function myAppStartup(): void { + FS.mkdir('/data'); + FS.mount(IDBFS, {}, '/data'); + + FS.syncfs(true, function (err) { + // handle callback + }); + } + + function myAppShutdown() { + FS.syncfs(function (err) { + // handle callback + }); + } + + var id = FS.makedev(64, 0); + FS.registerDevice(id, {}); + FS.mkdev('/dummy', id); + + FS.writeFile('file', 'foobar'); + FS.symlink('file', 'link'); + + FS.writeFile('/foobar.txt', 'Hello, world'); + FS.unlink('/foobar.txt'); + + FS.writeFile('file', 'foobar'); + FS.symlink('file', 'link'); + + FS.writeFile('forbidden', 'can\'t touch this'); + FS.chmod('forbidden', 0000); + + FS.writeFile('file', 'foobar'); + FS.truncate('file', 3); + + var stream = FS.open('abinaryfile', 'r'); + var buf = new Uint8Array(4); + FS.read(stream, buf, 0, 4, 0); + FS.close(stream); + + var data = new Uint8Array(32); + var stream = FS.open('dummy', 'w+'); + FS.write(stream, data, 0, data.length, 0); + FS.close(stream); + + var lookup = FS.lookupPath("path", { parent: true }); +} diff --git a/emscripten/emscripten.d.ts b/emscripten/emscripten.d.ts new file mode 100644 index 000000000..547f10c76 --- /dev/null +++ b/emscripten/emscripten.d.ts @@ -0,0 +1,185 @@ +// Type definitions for Emscripten +// Project: http://kripken.github.io/emscripten-site/index.html +// Definitions by: Kensuke Matsuzaki +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module Emscripten { + interface FileSystemType { + } +} + +declare module Module { + function print(str: string): void; + function printErr(str: string): void; + var arguments: string[]; + var preInit: { (): void }[]; + var preRun: { (): void }[]; + var postRun: { (): void }[]; + var noExitRuntime: boolean; + + var Runtime: any; + + function ccall(ident: string, returnType: string, argTypes: string[], args: any[]): any; + function cwrap(ident: string, returnType: string, argTypes: string[]): any; + + function setValue(ptr: number, value: any, type: string, noSafe: boolean): void; + function getValue(ptr: number, type: string, noSafe: boolean): any; + + var ALLOC_NORMAL: number; + var ALLOC_STACK: number; + var ALLOC_STATIC: number; + var ALLOC_DYNAMIC: number; + var ALLOC_NONE: number; + + function allocate(slab: any, types: string, allocator: number, ptr: number): number; + function allocate(slab: any, types: string[], allocator: number, ptr: number): number; + + function Pointer_stringify(ptr: number, length?: number): string; + function UTF16ToString(ptr: number): string; + function stringToUTF16(str: string, outPtr: number): void; + function UTF32ToString(ptr: number): string; + function stringToUTF32(str: string, outPtr: number): void; + + // USE_TYPED_ARRAYS == 1 + var HEAP: Int32Array; + var IHEAP: Int32Array; + var FHEAP: Float64Array; + + // USE_TYPED_ARRAYS == 2 + var HEAP8: Int8Array; + var HEAP16: Int16Array; + var HEAP32: Int32Array; + var HEAPU8: Uint8Array; + var HEAPU16: Uint16Array; + var HEAPU32: Uint32Array; + var HEAPF32: Float32Array; + var HEAPF64: Float64Array; + + var TOTAL_STACK: number; + var TOTAL_MEMORY: number; + var FAST_MEMORY: number; + + function addOnPreRun(cb: () => any): void; + function addOnInit(cb: () => any): void; + function addOnPreMain(cb: () => any): void; + function addOnExit(cb: () => any): void; + function addOnPostRun(cb: () => any): void; + + // Tools + function intArrayFromString(stringy: string, dontAddNull?: boolean, length?: number): number[]; + function intArrayToString(array: number[]): string; + function writeStringToMemory(str: string, buffer: number, dontAddNull: boolean): void; + function writeArrayToMemory(array: number[], buffer: number): void; + function writeAsciiToMemory(str: string, buffer: number, dontAddNull: boolean): void; + + function addRunDependency(id: any): void; + function removeRunDependency(id: any): void; + + + var preloadedImages: any; + var preloadedAudios: any; + + function _malloc(size: number): number; + function _free(ptr: number): void; +} + +declare module FS { + interface Lookup { + path: string; + node: FSNode; + } + + interface FSStream {} + interface FSNode {} + interface ErrnoError {} + + var ignorePermissions: boolean; + var trackingDelegate: any; + var tracking: any; + var genericErrors: any; + + // + // paths + // + function lookupPath(path: string, opts: any): Lookup; + function getPath(node: FSNode): string; + + // + // nodes + // + function isFile(mode: number): boolean; + function isDir(mode: number): boolean; + function isLink(mode: number): boolean; + function isChrdev(mode: number): boolean; + function isBlkdev(mode: number): boolean; + function isFIFO(mode: number): boolean; + function isSocket(mode: number): boolean; + + // + // devices + // + function major(dev: number): number; + function minor(dev: number): number; + function makedev(ma: number, mi: number): number; + function registerDevice(dev: number, ops: any): void; + + // + // core + // + function syncfs(populate: boolean, callback: (e: any) => any): void; + function syncfs( callback: (e: any) => any, populate?: boolean): void; + function mount(type: Emscripten.FileSystemType, opts: any, mountpoint: string): any; + function unmount(mountpoint: string): void; + + function mkdir(path: string, mode?: number): any; + function mkdev(path: string, mode?: number, dev?: number): any; + function symlink(oldpath: string, newpath: string): any; + function rename(old_path: string, new_path: string): void; + function rmdir(path: string): void; + function readdir(path: string): any; + function unlink(path: string): void; + function readlink(path: string): string; + function stat(path: string, dontFollow?: boolean): any; + function lstat(path: string): any; + function chmod(path: string, mode: number, dontFollow?: boolean): void; + function lchmod(path: string, mode: number): void; + function fchmod(fd: number, mode: number): void; + function chown(path: string, uid: number, gid: number, dontFollow?: boolean): void; + function lchown(path: string, uid: number, gid: number): void; + function fchown(fd: number, uid: number, gid: number): void; + function truncate(path: string, len: number): void; + function ftruncate(fd: number, len: number): void; + function utime(path: string, atime: number, mtime: number): void; + function open(path: string, flags: string, mode?: number, fd_start?: number, fd_end?: number): FSStream; + function close(stream: FSStream): void; + function llseek(stream: FSStream, offset: number, whence: number): any; + function read(stream: FSStream, buffer: ArrayBufferView, offset: number, length: number, position?: number): number; + function write(stream: FSStream, buffer: ArrayBufferView, offset: number, length: number, position?: number, canOwn?: boolean): number; + function allocate(stream: FSStream, offset: number, length: number): void; + function mmap(stream: FSStream, buffer: ArrayBufferView, offset: number, length: number, position: number, prot: number, flags: number): any; + function ioctl(stream: FSStream, cmd: any, arg: any): any; + function readFile(path: string, opts?: {encoding: string; flags: string}): any; + function writeFile(path: string, data: ArrayBufferView, opts?: {encoding: string; flags: string}): void; + function writeFile(path: string, data: string, opts?: {encoding: string; flags: string}): void; + + // + // module-level FS code + // + function cwd(): string; + function chdir(path: string): void; + function init(input: () => number, output: (c: number) => any, error: (c: number) => any): void; + + function createLazyFile(parent: string, name: string, url: string, canRead: boolean, canWrite: boolean): FSNode; + function createLazyFile(parent: FSNode, name: string, url: string, canRead: boolean, canWrite: boolean): FSNode; + + function createPreloadedFile(parent: string, name: string, url: string, canRead: boolean, canWrite: boolean, onload?: ()=> void, onerror?: ()=>void, dontCreateFile?:boolean, canOwn?: boolean): void; + function createPreloadedFile(parent: FSNode, name: string, url: string, canRead: boolean, canWrite: boolean, onload?: ()=> void, onerror?: ()=>void, dontCreateFile?:boolean, canOwn?: boolean): void; +} + +declare var MEMFS: Emscripten.FileSystemType; +declare var NODEFS: Emscripten.FileSystemType; +declare var IDBFS: Emscripten.FileSystemType; + +interface Math { + imul(a: number, b: number): number; +} From 2c861a8a1dfa46fc962b4124036b83a580e85f28 Mon Sep 17 00:00:00 2001 From: cristian-harja Date: Fri, 29 Aug 2014 10:38:29 +0200 Subject: [PATCH 28/40] Silly mistake in pull request #2643 --- 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 c7c294a1f..1352115e3 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -104,7 +104,7 @@ declare module Q { /** * If callback is a function, assumes it's a Node.js-style callback, and calls it as either callback(rejectionReason) when/if promise becomes rejected, or as callback(null, fulfillmentValue) when/if promise becomes fulfilled. If callback is not a function, simply returns promise. */ - nodeify(callback: (reason: any, value: any) => void): void; + nodeify(callback: (reason: any, value: any) => void): Promise; /** * Returns a promise to get the named property of an object. Essentially equivalent to From f1d96e63ce3e8070502c5f62e134cbac5b404476 Mon Sep 17 00:00:00 2001 From: Biegal Date: Fri, 29 Aug 2014 18:11:44 +0200 Subject: [PATCH 29/40] Updated CONTRIBUTORS.md --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index bb0933af5..4e5dddb6c 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -13,6 +13,7 @@ All definitions files include a header with the author and editors, so at some p * [AngularFire](https://www.firebase.com/docs/angular/reference.html) (by [Dénes Harmath](https://github.com/thSoft)) * [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes)) * [angularLocalStorage](https://github.com/agrublev/angularLocalStorage) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) +* [angular-spinner](https://github.com/urish/angular-spinner) (by [Marcin Biegała](https://github.com/Biegal)) * [AngularUI](http://angular-ui.github.io/) (by [Michel Salib](https://github.com/michelsalib)) * [Angular Hotkeys](https://github.com/chieffancypants/angular-hotkeys/) (by [Jason Zhao](https://github.com/jlz27)) * [Angular Protractor](https://github.com/angular/protractor) (by [Bill Armstrong](https://github.com/BillArmstrong)) From ddfdf46397b3894ef98a70b4de1bbccbf39a381b Mon Sep 17 00:00:00 2001 From: MIZUNE Pine Date: Sat, 30 Aug 2014 10:22:37 +0900 Subject: [PATCH 30/40] Add md5 --- md5/md5-test.ts | 9 +++++++++ md5/md5.d.ts | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 md5/md5-test.ts create mode 100644 md5/md5.d.ts diff --git a/md5/md5-test.ts b/md5/md5-test.ts new file mode 100644 index 000000000..036ad9c2a --- /dev/null +++ b/md5/md5-test.ts @@ -0,0 +1,9 @@ +/// + +var hash: string; +hash = CybozuLabs.MD5.calc("abc"); +hash = CybozuLabs.MD5.calc("abc", CybozuLabs.MD5.BY_ASCII); +hash = CybozuLabs.MD5.calc("abc", CybozuLabs.MD5.BY_UTF16); + +var version: string; +version = CybozuLabs.MD5.VERSION; \ No newline at end of file diff --git a/md5/md5.d.ts b/md5/md5.d.ts new file mode 100644 index 000000000..207a30699 --- /dev/null +++ b/md5/md5.d.ts @@ -0,0 +1,11 @@ +// Type definitions for CybozuLabs.MD5 +// Project: http://labs.cybozu.co.jp/blog/mitsunari/2007/07/md5js_1.html +// Definitions by: MIZUNE Pine +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module CybozuLabs.MD5 { + var VERSION: string; + var BY_ASCII: number; + var BY_UTF16: number; + function calc(str: string, option?: number): string; +} \ No newline at end of file From 1f44589a3acbcdf697ac3ace6c57fef03c156500 Mon Sep 17 00:00:00 2001 From: satoru kimura Date: Sat, 30 Aug 2014 17:47:16 +0900 Subject: [PATCH 31/40] Added definitions for Physijs. --- CONTRIBUTORS.md | 1 + physijs/physijs-tests.ts | 15 ++ physijs/physijs-tests.ts.tscparams | 2 + physijs/physijs.d.ts | 250 ++++++++++++++++++++++++++ physijs/tests/body.ts | 160 +++++++++++++++++ physijs/tests/collisions.ts | 171 ++++++++++++++++++ physijs/tests/compound.ts | 238 +++++++++++++++++++++++++ physijs/tests/constraints_car.ts | 257 +++++++++++++++++++++++++++ physijs/tests/heightfield.ts | 189 ++++++++++++++++++++ physijs/tests/jenga.ts | 236 ++++++++++++++++++++++++ physijs/tests/memorytest-compound.ts | 171 ++++++++++++++++++ physijs/tests/memorytest-convex.ts | 164 +++++++++++++++++ physijs/tests/memorytest.ts | 164 +++++++++++++++++ physijs/tests/shapes.ts | 238 +++++++++++++++++++++++++ physijs/tests/vehicle.ts | 254 ++++++++++++++++++++++++++ 15 files changed, 2510 insertions(+) create mode 100644 physijs/physijs-tests.ts create mode 100644 physijs/physijs-tests.ts.tscparams create mode 100644 physijs/physijs.d.ts create mode 100644 physijs/tests/body.ts create mode 100644 physijs/tests/collisions.ts create mode 100644 physijs/tests/compound.ts create mode 100644 physijs/tests/constraints_car.ts create mode 100644 physijs/tests/heightfield.ts create mode 100644 physijs/tests/jenga.ts create mode 100644 physijs/tests/memorytest-compound.ts create mode 100644 physijs/tests/memorytest-convex.ts create mode 100644 physijs/tests/memorytest.ts create mode 100644 physijs/tests/shapes.ts create mode 100644 physijs/tests/vehicle.ts diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fda65cb32..a2a7e5e49 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -290,6 +290,7 @@ All definitions files include a header with the author and editors, so at some p * [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto)) * [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker)) * [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov)) +* [Physijs](http://chandlerprall.github.io/Physijs/) (by [gyoh_k](https://github.com/gyohk)) * [PixiJS](https://github.com/GoodBoyDigital/pixi.js) (by [Pedro Casaubon](https://github.com/xperiments)) * [Platform](https://github.com/bestiejs/platform.js) (by [Jake Hickman](https://github.com/JakeH)) * [PouchDB](http://pouchdb.com) (by [Bill Sears](https://github.com/MrBigDog2U/)) diff --git a/physijs/physijs-tests.ts b/physijs/physijs-tests.ts new file mode 100644 index 000000000..35591c12d --- /dev/null +++ b/physijs/physijs-tests.ts @@ -0,0 +1,15 @@ +///////////////////////////////////////////////////////////// +// https://github.com/chandlerprall/Physijs/tree/master/examples +////////////////////////////////////////////////////////////// + +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// diff --git a/physijs/physijs-tests.ts.tscparams b/physijs/physijs-tests.ts.tscparams new file mode 100644 index 000000000..3b6942a9d --- /dev/null +++ b/physijs/physijs-tests.ts.tscparams @@ -0,0 +1,2 @@ +"" + diff --git a/physijs/physijs.d.ts b/physijs/physijs.d.ts new file mode 100644 index 000000000..8a63b5ad4 --- /dev/null +++ b/physijs/physijs.d.ts @@ -0,0 +1,250 @@ +// Type definitions for Physijs +// Project: http://chandlerprall.github.io/Physijs/ +// Definitions by: Satoru Kimura +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +/// + +declare module Physijs { + export function noConflict():Object; + export function createMaterial(material: THREE.Material, friction?: number, restitution?: number): Material; + + export interface Material extends THREE.Material{ + _physijs: { + id: number; + friction: number; + restriction: number + }; + } + + export interface Constraint { + getDefinition(): any; + } + + export interface PointConstraintDefinition { + type: string; + id: number; + objecta: THREE.Object3D; + objectb: THREE.Object3D; + positiona: THREE.Vector3; + positionb: THREE.Vector3; + } + + export class PointConstraint implements Constraint { + constructor(objecta: THREE.Object3D, objectb: THREE.Object3D, position?: THREE.Vector3); + + getDefinition(): PointConstraintDefinition; + } + + export interface HingeConstraintDefinition { + type: string; + id: number; + objecta: THREE.Object3D; + objectb: THREE.Object3D; + positiona: THREE.Vector3; + positionb: THREE.Vector3; + axis: THREE.Vector3; + } + + export class HingeConstraint implements Constraint { + constructor(objecta: THREE.Object3D, objectb: THREE.Object3D, position: THREE.Vector3, axis?: THREE.Vector3); + + getDefinition(): HingeConstraintDefinition; + setLimits( low: number, high: number, bias_factor: number, relaxation_factor: number ): void; + enableAngularMotor( velocity: number, acceleration: number ): void; + disableMotor(): void; + } + + export interface SliderConstraintDefinition { + type: string; + id: number; + objecta: THREE.Object3D; + objectb: THREE.Object3D; + positiona: THREE.Vector3; + positionb: THREE.Vector3; + axis: THREE.Vector3; + } + + export class SliderConstraint implements Constraint { + constructor(objecta: THREE.Object3D, objectb: THREE.Object3D, position: THREE.Vector3, axis?: THREE.Vector3); + + getDefinition(): SliderConstraintDefinition; + setLimits( lin_lower: number, lin_upper: number, ang_lower: number, ang_upper: number ): void; + setRestitution( linear: number, angular: number ): void; + enableLinearMotor( velocity: number, acceleration: number): void; + disableLinearMotor(): void; + enableAngularMotor( velocity: number, acceleration: number ): void; + disableAngularMotor(): void; + } + + export interface ConeTwistConstraintDefinition { + type: string; + id: number; + objecta: THREE.Object3D; + objectb: THREE.Object3D; + positiona: THREE.Vector3; + positionb: THREE.Vector3; + axisa: THREE.Vector3; + axisb: THREE.Vector3; + } + + export class ConeTwistConstraint implements Constraint { + constructor(objecta: THREE.Object3D, objectb: THREE.Object3D, position: THREE.Vector3); + + getDefinition(): ConeTwistConstraintDefinition; + setLimit( x: number, y: number, z: number ): void; + enableMotor(): void; + setMaxMotorImpulse( max_impulse: number ): void; + setMotorTarget( target: THREE.Vector3 ): void; + setMotorTarget( target: THREE.Euler ): void; + setMotorTarget( target: THREE.Matrix4 ): void; + disableMotor(): void; + + } + + export interface DOFConstraintDefinition { + type: string; + id: number; + objecta: THREE.Object3D; + objectb: THREE.Object3D; + positiona: THREE.Vector3; + positionb: THREE.Vector3; + axisa: THREE.Vector3; + axisb: THREE.Vector3; + } + + export class DOFConstraint implements Constraint { + constructor(objecta: THREE.Object3D, objectb: THREE.Object3D, position?: THREE.Vector3); + + getDefinition(): DOFConstraintDefinition; + setLinearLowerLimit(limit: THREE.Vector3): void; + setLinearUpperLimit(limit: THREE.Vector3): void; + setAngularLowerLimit(limit: THREE.Vector3): void; + setAngularUpperLimit(limit: THREE.Vector3): void; + enableAngularMotor( which: number ): void; + configureAngularMotor( which: number, low_angle: number, high_angle: number, velocity: number, max_force: number ): void; + disableAngularMotor( which: number ): void; + } + export var scripts: { + worker: string; + ammo: string; + }; + + export interface SceneParameters { + ammo?: string; + fixedTimeStep?: number; + rateLimit?: boolean; + } + + export class Scene extends THREE.Scene { + constructor(param?: SceneParameters); + + addConstraint(constraint:Constraint, show_marker?:boolean):void; + onSimulationResume():void; + removeConstraint(constraint:Constraint):void; + execute(cmd:string, params:any):void; + add(object:THREE.Object3D):void; + remove(object:THREE.Object3D):void; + setFixedTimeStep(fixedTimeStep:number):void; + setGravity(gravity:number):void; + simulate(timeStep?:number, maxSubSteps?:number):boolean; + + + // Eventable mixins + addEventListener( event_name: string, callback: (event: any) => void ): void; + removeEventListener( event_name: string, callback: (event: any) => void): void; + dispatchEvent( event_name: string ): void; + + // (extends from Object3D) + dispatchEvent( event: { type: string; target: any; } ): void; + } + + export class Mesh extends THREE.Mesh { + constructor(geometry:THREE.Geometry, material?:THREE.Material, mass?:number); + + applyCentralImpulse(force:THREE.Vector3):void; + applyImpulse(force:THREE.Vector3, offset:THREE.Vector3):void; + applyCentralForce(force:THREE.Vector3):void; + applyForce(force:THREE.Vector3, offset:THREE.Vector3):void; + getAngularVelocity():THREE.Vector3; + setAngularVelocity(velocity:THREE.Vector3):void; + getLinearVelocity():THREE.Vector3; + setLinearVelocity(velocity:THREE.Vector3):void; + setAngularFactor(factor:THREE.Vector3):void; + setLinearFactor(factor:THREE.Vector3):void; + setDamping(linear:number, angular:number):void; + setCcdMotionThreshold(threshold:number):void; + setCcdSweptSphereRadius(radius:number):void; + + + // Eventable mixins + addEventListener( event_name: string, callback: (event: any) => void ): void; + removeEventListener( event_name: string, callback: (event: any) => void): void; + dispatchEvent( event_name: string ): void; + + // (extends from Object3D) + dispatchEvent( event: { type: string; target: any; } ): void; + } + + export class PlaneMesh extends Mesh { + constructor(geometry:THREE.Geometry, material:THREE.Material, mass?:number); + + } + + export class HeightfieldMesh extends Mesh { + constructor(geometry:THREE.Geometry, material:THREE.Material, mass?:number, xdiv?:number, ydiv?:number); + } + + export class BoxMesh extends Mesh { + constructor(geometry:THREE.Geometry, material:THREE.Material, mass?:number); + } + + export class SphereMesh extends Mesh { + constructor(geometry:THREE.Geometry, material:THREE.Material, mass?:number); + } + + export class CylinderMesh extends Mesh { + constructor(geometry:THREE.Geometry, material:THREE.Material, mass?:number); + } + + export class CapsuleMesh extends Mesh { + constructor(geometry:THREE.Geometry, material:THREE.Material, mass?:number); + } + + export class ConeMesh extends Mesh { + constructor(geometry:THREE.Geometry, material:THREE.Material, mass?:number); + } + + export class ConcaveMesh extends Mesh { + constructor(geometry:THREE.Geometry, material:THREE.Material, mass?:number); + } + + export class ConvexMesh extends Mesh { + constructor(geometry:THREE.Geometry, material:THREE.Material, mass?:number); + } + + export class Vehicle { + constructor(mesh:Mesh, tuning?:VehicleTuning); + + mesh:THREE.Mesh; + wheels:THREE.Mesh[]; + + addWheel(wheel_geometry:THREE.Geometry, wheel_material:THREE.Material, connection_point:THREE.Vector3, wheel_direction:THREE.Vector3, wheel_axle:THREE.Vector3, suspension_rest_length:number, wheel_radius:number, is_front_wheel:boolean, tuning?:VehicleTuning): void; + setSteering(amount: number, wheel?: THREE.Mesh): void; + setBrake(amount: number, wheel?: THREE.Mesh): void; + applyEngineForce(amount: number, wheel?: THREE.Mesh): void; + } + + export class VehicleTuning { + constructor(suspension_stiffness?:number, suspension_compression?:number, suspension_damping?:number, max_suspension_travel?:number, friction_slip?:number, max_suspension_force?:number); + + suspension_stiffness:number; + suspension_compression:number; + suspension_damping:number; + max_suspension_travel:number; + friction_slip:number; + max_suspension_force:number; + } +} + diff --git a/physijs/tests/body.ts b/physijs/tests/body.ts new file mode 100644 index 000000000..acf9df500 --- /dev/null +++ b/physijs/tests/body.ts @@ -0,0 +1,160 @@ +/// +/// + + +Physijs.scripts.worker = '../physijs_worker.js'; +Physijs.scripts.ammo = 'examples/js/ammo.js'; + +var initScene, render, applyForce, setMousePosition, mouse_position, + ground_material, box_material, + projector, renderer, render_stats, physics_stats, scene, ground, light, camera, box, boxes = []; + +initScene = function() { + projector = new THREE.Projector; + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.shadowMapEnabled = true; + renderer.shadowMapSoft = true; + document.getElementById( 'viewport' ).appendChild( renderer.domElement ); + + render_stats = new Stats(); + render_stats.domElement.style.position = 'absolute'; + render_stats.domElement.style.top = '1px'; + render_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( render_stats.domElement ); + + physics_stats = new Stats(); + physics_stats.domElement.style.position = 'absolute'; + physics_stats.domElement.style.top = '50px'; + physics_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( physics_stats.domElement ); + + scene = new Physijs.Scene(); + scene.setGravity(new THREE.Vector3( 0, -30, 0 )); + scene.addEventListener( + 'update', + function() { + applyForce(); + scene.simulate( undefined, 1 ); + physics_stats.update(); + } + ); + + camera = new THREE.PerspectiveCamera( + 35, + window.innerWidth / window.innerHeight, + 1, + 1000 + ); + camera.position.set( 60, 50, 60 ); + camera.lookAt( scene.position ); + scene.add( camera ); + + // Light + light = new THREE.DirectionalLight( 0xFFFFFF ); + light.position.set( 20, 40, -15 ); + light.target.position.copy( scene.position ); + light.castShadow = true; + light.shadowCameraLeft = -60; + light.shadowCameraTop = -60; + light.shadowCameraRight = 60; + light.shadowCameraBottom = 60; + light.shadowCameraNear = 20; + light.shadowCameraFar = 200; + light.shadowBias = -.0001 + light.shadowMapWidth = light.shadowMapHeight = 2048; + light.shadowDarkness = .7; + scene.add( light ); + + // Materials + ground_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/rocks.jpg' ) }), + .8, // high friction + .4 // low restitution + ); + ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping; + ground_material.map.repeat.set( 3, 3 ); + + box_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/plywood.jpg' ) }), + .4, // low friction + .6 // high restitution + ); + box_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping; + box_material.map.repeat.set( .25, .25 ); + + // Ground + ground = new Physijs.BoxMesh( + new THREE.BoxGeometry(100, 1, 100), + ground_material, + 0 // mass + ); + ground.receiveShadow = true; + scene.add( ground ); + + for ( var i = 0; i < 10; i++ ) { + box = new Physijs.BoxMesh( + new THREE.BoxGeometry( 4, 4, 4 ), + box_material + ); + box.position.set( + Math.random() * 50 - 25, + 10 + Math.random() * 5, + Math.random() * 50 - 25 + ); + box.rotation.set( + Math.random() * Math.PI * 2, + Math.random() * Math.PI * 2, + Math.random() * Math.PI * 2 + ); + box.scale.set( + Math.random() * 1 + .5, + Math.random() * 1 + .5, + Math.random() * 1 + .5 + ); + box.castShadow = true; + scene.add( box ); + boxes.push( box ); + } + + renderer.domElement.addEventListener( 'mousemove', setMousePosition ); + + requestAnimationFrame( render ); + scene.simulate(); +}; + +render = function() { + requestAnimationFrame( render ); + renderer.render( scene, camera ); + render_stats.update(); +}; + +setMousePosition = function( evt ) { + // Find where mouse cursor intersects the ground plane + var vector = new THREE.Vector3( + ( evt.clientX / renderer.domElement.clientWidth ) * 2 - 1, + -( ( evt.clientY / renderer.domElement.clientHeight ) * 2 - 1 ), + .5 + ); + projector.unprojectVector( vector, camera ); + vector.sub( camera.position ).normalize(); + + var coefficient = (box.position.y - camera.position.y) / vector.y + mouse_position = camera.position.clone().add( vector.multiplyScalar( coefficient ) ); +}; + +applyForce = function() { + if (!mouse_position) return; + var strength = 35, distance, effect, offset, box; + + for ( var i = 0; i < boxes.length; i++ ) { + box = boxes[i]; + distance = mouse_position.distanceTo( box.position ), + effect = mouse_position.clone().sub( box.position ).normalize().multiplyScalar( strength / distance ).negate(), + offset = mouse_position.clone().sub( box.position ); + box.applyImpulse( effect, offset ); + } +}; + +window.onload = initScene; diff --git a/physijs/tests/collisions.ts b/physijs/tests/collisions.ts new file mode 100644 index 000000000..bc43a60d6 --- /dev/null +++ b/physijs/tests/collisions.ts @@ -0,0 +1,171 @@ +/// +/// + + +Physijs.scripts.worker = '../physijs_worker.js'; +Physijs.scripts.ammo = 'examples/js/ammo.js'; + +var initScene, render, _boxes = [], spawnBox, + renderer, render_stats, physics_stats, scene, ground_material, ground, light, camera; + +initScene = function() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.shadowMapEnabled = true; + renderer.shadowMapSoft = true; + document.getElementById( 'viewport' ).appendChild( renderer.domElement ); + + render_stats = new Stats(); + render_stats.domElement.style.position = 'absolute'; + render_stats.domElement.style.top = '0px'; + render_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( render_stats.domElement ); + + physics_stats = new Stats(); + physics_stats.domElement.style.position = 'absolute'; + physics_stats.domElement.style.top = '50px'; + physics_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( physics_stats.domElement ); + + scene = new Physijs.Scene; + scene.setGravity(new THREE.Vector3( 0, -30, 0 )); + scene.addEventListener( + 'update', + function() { + scene.simulate( undefined, 1 ); + physics_stats.update(); + } + ); + + camera = new THREE.PerspectiveCamera( + 35, + window.innerWidth / window.innerHeight, + 1, + 1000 + ); + camera.position.set( 60, 50, 60 ); + camera.lookAt( scene.position ); + scene.add( camera ); + + // Light + light = new THREE.DirectionalLight( 0xFFFFFF ); + light.position.set( 20, 40, -15 ); + light.target.position.copy( scene.position ); + light.castShadow = true; + light.shadowCameraLeft = -60; + light.shadowCameraTop = -60; + light.shadowCameraRight = 60; + light.shadowCameraBottom = 60; + light.shadowCameraNear = 20; + light.shadowCameraFar = 200; + light.shadowBias = -.0001 + light.shadowMapWidth = light.shadowMapHeight = 2048; + light.shadowDarkness = .7; + scene.add( light ); + + // Ground + ground_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/rocks.jpg' ) }), + .8, // high friction + .3 // low restitution + ); + ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping; + ground_material.map.repeat.set( 3, 3 ); + + ground = new Physijs.BoxMesh( + new THREE.BoxGeometry(100, 1, 100), + ground_material, + 0 // mass + ); + ground.receiveShadow = true; + scene.add( ground ); + + spawnBox(); + + requestAnimationFrame( render ); + scene.simulate(); +}; + +spawnBox = (function() { + + var box_geometry = new THREE.BoxGeometry( 4, 4, 4 ), + handleCollision = function( collided_with, linearVelocity, angularVelocity ) { + var target = this; + target.collisions = 0; + switch (++target.collisions) { + + case 1: + target.material.color.setHex(0xcc8855); + break; + + case 2: + target.material.color.setHex(0xbb9955); + break; + + case 3: + target.material.color.setHex(0xaaaa55); + break; + + case 4: + target.material.color.setHex(0x99bb55); + break; + + case 5: + target.material.color.setHex(0x88cc55); + break; + + case 6: + target.material.color.setHex(0x77dd55); + break; + } + }, + createBox = function() { + var box, material; + + material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/plywood.jpg' ) }), + .6, // medium friction + .3 // low restitution + ); + material.map.wrapS = material.map.wrapT = THREE.RepeatWrapping; + material.map.repeat.set( .5, .5 ); + + //material = new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/rocks.jpg' ) }); + + box = new Physijs.BoxMesh( + box_geometry, + material + ); + + box.collisions = 0; + + box.position.set( + Math.random() * 15 - 7.5, + 25, + Math.random() * 15 - 7.5 + ); + + box.rotation.set( + Math.random() * Math.PI, + Math.random() * Math.PI, + Math.random() * Math.PI + ); + + box.castShadow = true; + box.addEventListener( 'collision', handleCollision ); + box.addEventListener( 'ready', spawnBox ); + scene.add( box ); + }; + + return function() { + setTimeout( createBox, 1000 ); + }; +})(); + +render = function() { + requestAnimationFrame( render ); + renderer.render( scene, camera ); + render_stats.update(); +}; + +window.onload = initScene; \ No newline at end of file diff --git a/physijs/tests/compound.ts b/physijs/tests/compound.ts new file mode 100644 index 000000000..bfd103ca7 --- /dev/null +++ b/physijs/tests/compound.ts @@ -0,0 +1,238 @@ +/// +/// + + +Physijs.scripts.worker = '../physijs_worker.js'; +Physijs.scripts.ammo = 'examples/js/ammo.js'; + +var initScene, render, renderer, render_stats, physics_stats, scene, ground, light, camera, spawnChair, + ground_material, chair_material; + +initScene = function() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.shadowMapEnabled = true; + renderer.shadowMapSoft = true; + document.getElementById( 'viewport' ).appendChild( renderer.domElement ); + + render_stats = new Stats(); + render_stats.domElement.style.position = 'absolute'; + render_stats.domElement.style.top = '0px'; + render_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( render_stats.domElement ); + + physics_stats = new Stats(); + physics_stats.domElement.style.position = 'absolute'; + physics_stats.domElement.style.top = '50px'; + physics_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( physics_stats.domElement ); + + scene = new Physijs.Scene; + scene.setGravity(new THREE.Vector3( 0, -50, 0 )); + scene.addEventListener( + 'update', + function() { + scene.simulate( undefined, 2 ); + physics_stats.update(); + } + ); + + camera = new THREE.PerspectiveCamera( + 35, + window.innerWidth / window.innerHeight, + 1, + 1000 + ); + camera.position.set( 60, 50, 60 ); + camera.lookAt( scene.position ); + scene.add( camera ); + + // Light + light = new THREE.DirectionalLight( 0xFFFFFF ); + light.position.set( 20, 40, -15 ); + light.target.position.copy( scene.position ); + light.castShadow = true; + light.shadowCameraLeft = -60; + light.shadowCameraTop = -60; + light.shadowCameraRight = 60; + light.shadowCameraBottom = 60; + light.shadowCameraNear = 20; + light.shadowCameraFar = 200; + light.shadowBias = -.0001 + light.shadowMapWidth = light.shadowMapHeight = 2048; + light.shadowDarkness = .7; + scene.add( light ); + + // Materials + ground_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/rocks.jpg' ) }), + .8, // high friction + .4 // low restitution + ); + ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping; + ground_material.map.repeat.set( 3, 3 ); + + chair_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/wood.jpg' ) }), + .6, // medium friction + .2 // low restitution + ); + chair_material.map.wrapS = chair_material.map.wrapT = THREE.RepeatWrapping; + chair_material.map.repeat.set( .25, .25 ); + + // Ground + ground = new Physijs.BoxMesh( + new THREE.BoxGeometry(100, 1, 100), + ground_material, + 0 // mass + );; + ground.receiveShadow = true; + scene.add( ground ); + + spawnChair(); + + requestAnimationFrame( render ); + scene.simulate(); +}; + +spawnChair = (function() { + var buildBack, buildLegs, doSpawn; + + buildBack = function() { + var back, _object; + + back = new Physijs.BoxMesh( + new THREE.BoxGeometry( 5, 1, .5 ), + chair_material + ); + back.position.y = 5; + back.position.z = -2.5; + back.castShadow = true; + back.receiveShadow = true; + + // rungs - relative to back + _object = new Physijs.BoxMesh( + new THREE.BoxGeometry( 1, 5, .5 ), + chair_material + ); + _object.position.y = -3; + _object.position.x = -2; + _object.castShadow = true; + _object.receiveShadow = true; + back.add( _object ); + + _object = new Physijs.BoxMesh( + new THREE.BoxGeometry( 1, 5, .5 ), + chair_material + ); + _object.position.y = -3; + _object.castShadow = true; + _object.receiveShadow = true; + back.add( _object ); + + _object = new Physijs.BoxMesh( + new THREE.BoxGeometry( 1, 5, .5 ), + chair_material + ); + _object.position.y = -3; + _object.position.x = 2; + _object.castShadow = true; + _object.receiveShadow = true; + back.add( _object ); + + return back; + }; + + buildLegs = function() { + var leg, _leg; + + // back left + leg = new Physijs.BoxMesh( + new THREE.BoxGeometry( .5, 4, .5 ), + chair_material + ); + leg.position.x = 2.25; + leg.position.z = -2.25; + leg.position.y = -2.5; + leg.castShadow = true; + leg.receiveShadow = true; + + // back right - relative to back left leg + _leg = new Physijs.BoxMesh( + new THREE.BoxGeometry( .5, 4, .5 ), + chair_material + ); + _leg.position.x = -4.5; + _leg.castShadow = true; + _leg.receiveShadow = true; + leg.add( _leg ); + + // front left - relative to back left leg + _leg = new Physijs.BoxMesh( + new THREE.BoxGeometry( .5, 4, .5 ), + chair_material + ); + _leg.position.z = 4.5; + _leg.castShadow = true; + _leg.receiveShadow = true; + leg.add( _leg ); + + // front right - relative to back left leg + _leg = new Physijs.BoxMesh( + new THREE.BoxGeometry( .5, 4, .5 ), + chair_material + ); + _leg.position.x = -4.5; + _leg.position.z = 4.5; + _leg.castShadow = true; + _leg.receiveShadow = true; + leg.add( _leg ); + + return leg; + }; + + doSpawn = function() { + var chair, back, legs; + + // seat of the chair + chair = new Physijs.BoxMesh( + new THREE.BoxGeometry( 5, 1, 5 ), + chair_material + ); + chair.castShadow = true; + chair.receiveShadow = true; + + // back - relative to chair ( seat ) + back = buildBack(); + chair.add( back ); + + // legs - relative to chair ( seat ) + legs = buildLegs(); + chair.add( legs ); + + chair.position.y = 20; + chair.position.x = Math.random() * 50 - 25; + chair.position.z = Math.random() * 50 - 25; + + chair.rotation.set( + Math.random() * Math.PI * 2, + Math.random() * Math.PI * 2, + Math.random() * Math.PI * 2 + ); + + chair.addEventListener( 'ready', spawnChair ); + scene.add( chair ); + }; + + return function() { + setTimeout( doSpawn, 500 ); + }; +})(); + +render = function() { + requestAnimationFrame( render ); + renderer.render( scene, camera ); + render_stats.update(); +}; + +window.onload = initScene; diff --git a/physijs/tests/constraints_car.ts b/physijs/tests/constraints_car.ts new file mode 100644 index 000000000..b74c44449 --- /dev/null +++ b/physijs/tests/constraints_car.ts @@ -0,0 +1,257 @@ +/// +/// + + +Physijs.scripts.worker = '../physijs_worker.js'; +Physijs.scripts.ammo = 'examples/js/ammo.js'; + +var initScene, render, + ground_material, car_material, wheel_material, wheel_geometry, + projector, renderer, render_stats, physics_stats, scene, ground_geometry, ground, light, camera, + car: any = {}; + +initScene = function() { + projector = new THREE.Projector; + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.shadowMapEnabled = true; + renderer.shadowMapSoft = true; + document.getElementById( 'viewport' ).appendChild( renderer.domElement ); + + render_stats = new Stats(); + render_stats.domElement.style.position = 'absolute'; + render_stats.domElement.style.top = '0px'; + render_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( render_stats.domElement ); + + physics_stats = new Stats(); + physics_stats.domElement.style.position = 'absolute'; + physics_stats.domElement.style.top = '50px'; + physics_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( physics_stats.domElement ); + + scene = new Physijs.Scene; + scene.setGravity(new THREE.Vector3( 0, -30, 0 )); + scene.addEventListener( + 'update', + function() { + scene.simulate( undefined, 2 ); + physics_stats.update(); + } + ); + + camera = new THREE.PerspectiveCamera( + 35, + window.innerWidth / window.innerHeight, + 1, + 1000 + ); + camera.position.set( 60, 50, 60 ); + camera.lookAt( scene.position ); + scene.add( camera ); + + // Light + light = new THREE.DirectionalLight( 0xFFFFFF ); + light.position.set( 20, 40, -15 ); + light.target.position.copy( scene.position ); + light.castShadow = true; + light.shadowCameraLeft = -60; + light.shadowCameraTop = -60; + light.shadowCameraRight = 60; + light.shadowCameraBottom = 60; + light.shadowCameraNear = 20; + light.shadowCameraFar = 200; + light.shadowBias = -.0001 + light.shadowMapWidth = light.shadowMapHeight = 2048; + light.shadowDarkness = .7; + scene.add( light ); + + // Materials + ground_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/rocks.jpg' ) }), + .8, // high friction + .4 // low restitution + ); + ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping; + ground_material.map.repeat.set( 3, 3 ); + + // Ground + ground = new Physijs.BoxMesh( + new THREE.BoxGeometry(100, 1, 100), + ground_material, + 0 // mass + ); + ground.receiveShadow = true; + scene.add( ground ); + + + // Car + car_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ color: 0xff6666 }), + .8, // high friction + .2 // low restitution + ); + + wheel_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ color: 0x444444 }), + .8, // high friction + .5 // medium restitution + ); + wheel_geometry = new THREE.CylinderGeometry( 2, 2, 1, 8 ); + + car.body = new Physijs.BoxMesh( + new THREE.BoxGeometry( 10, 5, 7 ), + car_material, + 1000 + ); + car.body.position.y = 10; + car.body.receiveShadow = car.body.castShadow = true; + scene.add( car.body ); + + car.wheel_fl = new Physijs.CylinderMesh( + wheel_geometry, + wheel_material, + 500 + ); + car.wheel_fl.rotation.x = Math.PI / 2; + car.wheel_fl.position.set( -3.5, 6.5, 5 ); + car.wheel_fl.receiveShadow = car.wheel_fl.castShadow = true; + scene.add( car.wheel_fl ); + car.wheel_fl_constraint = new Physijs.DOFConstraint( + car.wheel_fl, car.body, new THREE.Vector3( -3.5, 6.5, 5 ) + ); + scene.addConstraint( car.wheel_fl_constraint ); + car.wheel_fl_constraint.setAngularLowerLimit({ x: 0, y: -Math.PI / 8, z: 1 }); + car.wheel_fl_constraint.setAngularUpperLimit({ x: 0, y: Math.PI / 8, z: 0 }); + + car.wheel_fr = new Physijs.CylinderMesh( + wheel_geometry, + wheel_material, + 500 + ); + car.wheel_fr.rotation.x = Math.PI / 2; + car.wheel_fr.position.set( -3.5, 6.5, -5 ); + car.wheel_fr.receiveShadow = car.wheel_fr.castShadow = true; + scene.add( car.wheel_fr ); + car.wheel_fr_constraint = new Physijs.DOFConstraint( + car.wheel_fr, car.body, new THREE.Vector3( -3.5, 6.5, -5 ) + ); + scene.addConstraint( car.wheel_fr_constraint ); + car.wheel_fr_constraint.setAngularLowerLimit({ x: 0, y: -Math.PI / 8, z: 1 }); + car.wheel_fr_constraint.setAngularUpperLimit({ x: 0, y: Math.PI / 8, z: 0 }); + + car.wheel_bl = new Physijs.CylinderMesh( + wheel_geometry, + wheel_material, + 500 + ); + car.wheel_bl.rotation.x = Math.PI / 2; + car.wheel_bl.position.set( 3.5, 6.5, 5 ); + car.wheel_bl.receiveShadow = car.wheel_bl.castShadow = true; + scene.add( car.wheel_bl ); + car.wheel_bl_constraint = new Physijs.DOFConstraint( + car.wheel_bl, car.body, new THREE.Vector3( 3.5, 6.5, 5 ) + ); + scene.addConstraint( car.wheel_bl_constraint ); + car.wheel_bl_constraint.setAngularLowerLimit({ x: 0, y: 0, z: 0 }); + car.wheel_bl_constraint.setAngularUpperLimit({ x: 0, y: 0, z: 0 }); + + car.wheel_br = new Physijs.CylinderMesh( + wheel_geometry, + wheel_material, + 500 + ); + car.wheel_br.rotation.x = Math.PI / 2; + car.wheel_br.position.set( 3.5, 6.5, -5 ); + car.wheel_br.receiveShadow = car.wheel_br.castShadow = true; + scene.add( car.wheel_br ); + car.wheel_br_constraint = new Physijs.DOFConstraint( + car.wheel_br, car.body, new THREE.Vector3( 3.5, 6.5, -5 ) + ); + scene.addConstraint( car.wheel_br_constraint ); + car.wheel_br_constraint.setAngularLowerLimit({ x: 0, y: 0, z: 0 }); + car.wheel_br_constraint.setAngularUpperLimit({ x: 0, y: 0, z: 0 }); + + document.addEventListener( + 'keydown', + function( ev ) { + switch( ev.keyCode ) { + case 37: + // Left + car.wheel_fl_constraint.configureAngularMotor( 1, -Math.PI / 2, Math.PI / 2, 1, 200 ); + car.wheel_fr_constraint.configureAngularMotor( 1, -Math.PI / 2, Math.PI / 2, 1, 200 ); + car.wheel_fl_constraint.enableAngularMotor( 1 ); + car.wheel_fr_constraint.enableAngularMotor( 1 ); + break; + + case 39: + // Right + car.wheel_fl_constraint.configureAngularMotor( 1, -Math.PI / 2, Math.PI / 2, -1, 200 ); + car.wheel_fr_constraint.configureAngularMotor( 1, -Math.PI / 2, Math.PI / 2, -1, 200 ); + car.wheel_fl_constraint.enableAngularMotor( 1 ); + car.wheel_fr_constraint.enableAngularMotor( 1 ); + break; + + case 38: + // Up + car.wheel_bl_constraint.configureAngularMotor( 2, 1, 0, 5, 2000 ); + car.wheel_br_constraint.configureAngularMotor( 2, 1, 0, 5, 2000 ); + car.wheel_bl_constraint.enableAngularMotor( 2 ); + car.wheel_br_constraint.enableAngularMotor( 2 ); + break; + + case 40: + // Down + car.wheel_bl_constraint.configureAngularMotor( 2, 1, 0, -5, 2000 ); + car.wheel_br_constraint.configureAngularMotor( 2, 1, 0, -5, 2000 ); + car.wheel_bl_constraint.enableAngularMotor( 2 ); + //car.wheel_br_constraint.enableAngularMotor( 2 ); + break; + } + } + ); + + document.addEventListener( + 'keyup', + function( ev ) { + switch( ev.keyCode ) { + case 37: + // Left + car.wheel_fl_constraint.disableAngularMotor( 1 ); + car.wheel_fr_constraint.disableAngularMotor( 1 ); + break; + + case 39: + // Right + car.wheel_fl_constraint.disableAngularMotor( 1 ); + car.wheel_fr_constraint.disableAngularMotor( 1 ); + break; + + case 38: + // Up + car.wheel_bl_constraint.disableAngularMotor( 2 ); + car.wheel_br_constraint.disableAngularMotor( 2 ); + break; + + case 40: + // Down + car.wheel_bl_constraint.disableAngularMotor( 2 ); + car.wheel_br_constraint.disableAngularMotor( 2 ); + break; + } + } + ); + + + requestAnimationFrame( render ); + scene.simulate(); +}; + +render = function() { + requestAnimationFrame( render ); + renderer.render( scene, camera ); + render_stats.update(); +}; + +window.onload = initScene; diff --git a/physijs/tests/heightfield.ts b/physijs/tests/heightfield.ts new file mode 100644 index 000000000..19d0e8c78 --- /dev/null +++ b/physijs/tests/heightfield.ts @@ -0,0 +1,189 @@ +/// +/// + +var TWEEN: any; +var SimplexNoise: any; + + +Physijs.scripts.worker = '../physijs_worker.js'; +Physijs.scripts.ammo = 'examples/js/ammo.js'; + +var initScene, render, createShape, NoiseGen, + renderer, render_stats, physics_stats, scene, light, ground, ground_geometry, ground_material, camera; + +initScene = function() { + TWEEN.start(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.shadowMapEnabled = true; + renderer.shadowMapSoft = true; + document.getElementById( 'viewport' ).appendChild( renderer.domElement ); + + render_stats = new Stats(); + render_stats.domElement.style.position = 'absolute'; + render_stats.domElement.style.top = '0px'; + render_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( render_stats.domElement ); + + physics_stats = new Stats(); + physics_stats.domElement.style.position = 'absolute'; + physics_stats.domElement.style.top = '50px'; + physics_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( physics_stats.domElement ); + + scene = new Physijs.Scene({ fixedTimeStep: 1 / 120 }); + scene.setGravity(new THREE.Vector3( 0, -30, 0 )); + scene.addEventListener( + 'update', + function() { + scene.simulate( undefined, 2 ); + physics_stats.update(); + } + ); + + camera = new THREE.PerspectiveCamera( + 35, + window.innerWidth / window.innerHeight, + 1, + 1000 + ); + camera.position.set( 60, 50, 60 ); + camera.lookAt( scene.position ); + scene.add( camera ); + + // Light + light = new THREE.DirectionalLight( 0xFFFFFF ); + light.position.set( 20, 40, -15 ); + light.target.position.copy( scene.position ); + light.castShadow = true; + light.shadowCameraLeft = -60; + light.shadowCameraTop = -60; + light.shadowCameraRight = 60; + light.shadowCameraBottom = 60; + light.shadowCameraNear = 20; + light.shadowCameraFar = 200; + light.shadowBias = -.0001 + light.shadowMapWidth = light.shadowMapHeight = 2048; + light.shadowDarkness = .7; + scene.add( light ); + + // Materials + ground_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/grass.png' ) }), + .8, // high friction + .4 // low restitution + ); + ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping; + ground_material.map.repeat.set( 2.5, 2.5 ); + + // Ground + NoiseGen = new SimplexNoise; + + ground_geometry = new THREE.PlaneGeometry( 75, 75, 50, 50 ); + for ( var i = 0; i < ground_geometry.vertices.length; i++ ) { + var vertex = ground_geometry.vertices[i]; + vertex.z = NoiseGen.noise( vertex.x / 10, vertex.y / 10 ) * 2; + } + ground_geometry.computeFaceNormals(); + ground_geometry.computeVertexNormals(); + + // If your plane is not square as far as face count then the HeightfieldMesh + // takes two more arguments at the end: # of x faces and # of y faces that were passed to THREE.PlaneMaterial + ground = new Physijs.HeightfieldMesh( + ground_geometry, + ground_material, + 0, // mass + 50, + 50 + ); + ground.rotation.x = Math.PI / -2; + ground.receiveShadow = true; + scene.add( ground ); + + requestAnimationFrame( render ); + scene.simulate(); + + createShape(); +}; + +render = function() { + requestAnimationFrame( render ); + renderer.render( scene, camera ); + render_stats.update(); +}; + +createShape = (function() { + var addshapes = true, + shapes = 0, + box_geometry = new THREE.BoxGeometry( 3, 3, 3 ), + sphere_geometry = new THREE.SphereGeometry( 1.5, 32, 32 ), + cylinder_geometry = new THREE.CylinderGeometry( 2, 2, 1, 32 ), + cone_geometry = new THREE.CylinderGeometry( 0, 2, 4, 32 ), + octahedron_geometry = new THREE.OctahedronGeometry( 1.7, 1 ), + torus_geometry = new THREE.TorusKnotGeometry ( 1.7, .2, 32, 4 ), + doCreateShape; + + setTimeout( + function addListener() { + var button = document.getElementById( 'stop' ); + if ( button ) { + button.addEventListener( 'click', function() { addshapes = false; } ); + } else { + setTimeout( addListener ); + } + } + ); + + doCreateShape = function() { + var shape, material = new THREE.MeshLambertMaterial({ opacity: 0, transparent: true }); + + switch ( Math.floor(Math.random() * 2) ) { + case 0: + shape = new Physijs.BoxMesh( + box_geometry, + material + ); + break; + + case 1: + shape = new Physijs.SphereMesh( + sphere_geometry, + material, + undefined + ); + break; + } + + shape.material.color.setRGB( Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100 ); + shape.castShadow = true; + shape.receiveShadow = true; + + shape.position.set( + Math.random() * 30 - 15, + 20, + Math.random() * 30 - 15 + ); + + shape.rotation.set( + Math.random() * Math.PI, + Math.random() * Math.PI, + Math.random() * Math.PI + ); + + if ( addshapes ) { + shape.addEventListener( 'ready', createShape ); + } + scene.add( shape ); + + new TWEEN.Tween(shape.material).to({opacity: 1}, 500).start(); + + document.getElementById('shapecount').textContent = (++shapes) + ' shapes created'; + }; + + return function() { + setTimeout( doCreateShape, 250 ); + }; +})(); + +window.onload = initScene; \ No newline at end of file diff --git a/physijs/tests/jenga.ts b/physijs/tests/jenga.ts new file mode 100644 index 000000000..05bbd7861 --- /dev/null +++ b/physijs/tests/jenga.ts @@ -0,0 +1,236 @@ +/// +/// + + +Physijs.scripts.worker = '../physijs_worker.js'; +Physijs.scripts.ammo = 'examples/js/ammo.js'; + +var initScene, initEventHandling, render, createTower, + renderer, render_stats, physics_stats, scene, dir_light, am_light, camera, + table, blocks = [], table_material, block_material, intersect_plane, _i, + selected_block = null, mouse_pos = new THREE.Vector3(), block_offset = new THREE.Vector3(), _v3 = new THREE.Vector3(); + +initScene = function() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.shadowMapEnabled = true; + renderer.shadowMapSoft = true; + document.getElementById( 'viewport' ).appendChild( renderer.domElement ); + + render_stats = new Stats(); + render_stats.domElement.style.position = 'absolute'; + render_stats.domElement.style.top = '1px'; + render_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( render_stats.domElement ); + + physics_stats = new Stats(); + physics_stats.domElement.style.position = 'absolute'; + physics_stats.domElement.style.top = '50px'; + physics_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( physics_stats.domElement ); + + scene = new Physijs.Scene({ fixedTimeStep: 1 / 120 }); + scene.setGravity(new THREE.Vector3( 0, -30, 0 )); + scene.addEventListener( + 'update', + function() { + + if ( selected_block !== null ) { + + _v3.copy( mouse_pos ).add( block_offset ).sub( selected_block.position ).multiplyScalar( 5 ); + _v3.y = 0; + selected_block.setLinearVelocity( _v3 ); + + // Reactivate all of the blocks + _v3.set( 0, 0, 0 ); + for ( _i = 0; _i < blocks.length; _i++ ) { + blocks[_i].applyCentralImpulse( _v3 ); + } + } + + scene.simulate( undefined, 1 ); + physics_stats.update(); + } + ); + + camera = new THREE.PerspectiveCamera( + 35, + window.innerWidth / window.innerHeight, + 1, + 1000 + ); + camera.position.set( 25, 20, 25 ); + camera.lookAt(new THREE.Vector3( 0, 7, 0 )); + scene.add( camera ); + + // ambient light + am_light = new THREE.AmbientLight( 0x444444 ); + scene.add( am_light ); + + // directional light + dir_light = new THREE.DirectionalLight( 0xFFFFFF ); + dir_light.position.set( 20, 30, -5 ); + dir_light.target.position.copy( scene.position ); + dir_light.castShadow = true; + dir_light.shadowCameraLeft = -30; + dir_light.shadowCameraTop = -30; + dir_light.shadowCameraRight = 30; + dir_light.shadowCameraBottom = 30; + dir_light.shadowCameraNear = 20; + dir_light.shadowCameraFar = 200; + dir_light.shadowBias = -.001 + dir_light.shadowMapWidth = dir_light.shadowMapHeight = 2048; + dir_light.shadowDarkness = .5; + scene.add( dir_light ); + + // Materials + table_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/wood.jpg' ), ambient: 0xFFFFFF }), + .9, // high friction + .2 // low restitution + ); + table_material.map.wrapS = table_material.map.wrapT = THREE.RepeatWrapping; + table_material.map.repeat.set( 5, 5 ); + + block_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/plywood.jpg' ), ambient: 0xFFFFFF }), + .4, // medium friction + .4 // medium restitution + ); + block_material.map.wrapS = block_material.map.wrapT = THREE.RepeatWrapping; + block_material.map.repeat.set( 1, .5 ); + + // Table + table = new Physijs.BoxMesh( + new THREE.BoxGeometry(50, 1, 50), + table_material, + 0 + ); + table.position.y = -.5; + table.receiveShadow = true; + scene.add( table ); + + createTower(); + + intersect_plane = new THREE.Mesh( + new THREE.PlaneGeometry( 150, 150 ), + new THREE.MeshBasicMaterial({ opacity: 0, transparent: true }) + ); + intersect_plane.rotation.x = Math.PI / -2; + scene.add( intersect_plane ); + + initEventHandling(); + + requestAnimationFrame( render ); + scene.simulate(); +}; + +render = function() { + requestAnimationFrame( render ); + renderer.render( scene, camera ); + render_stats.update(); +}; + +createTower = (function() { + var block_length = 6, block_height = 1, block_width = 1.5, block_offset = 2, + block_geometry = new THREE.BoxGeometry( block_length, block_height, block_width ); + + return function() { + var i, j, rows = 16, + block; + + for ( i = 0; i < rows; i++ ) { + for ( j = 0; j < 3; j++ ) { + block = new Physijs.BoxMesh( block_geometry, block_material ); + block.position.y = (block_height / 2) + block_height * i; + if ( i % 2 === 0 ) { + block.rotation.y = Math.PI / 2.01; // #TODO: There's a bug somewhere when this is to close to 2 + block.position.x = block_offset * j - ( block_offset * 3 / 2 - block_offset / 2 ); + } else { + block.position.z = block_offset * j - ( block_offset * 3 / 2 - block_offset / 2 ); + } + block.receiveShadow = true; + block.castShadow = true; + scene.add( block ); + blocks.push( block ); + } + } + } +})(); + +initEventHandling = (function() { + var _vector = new THREE.Vector3, + projector = new THREE.Projector(), + handleMouseDown, handleMouseMove, handleMouseUp; + + handleMouseDown = function( evt ) { + var ray, intersections; + + _vector.set( + ( evt.clientX / window.innerWidth ) * 2 - 1, + -( evt.clientY / window.innerHeight ) * 2 + 1, + 1 + ); + + projector.unprojectVector( _vector, camera ); + + ray = new THREE.Raycaster( camera.position, _vector.sub( camera.position ).normalize() ); + intersections = ray.intersectObjects( blocks ); + + if ( intersections.length > 0 ) { + selected_block = intersections[0].object; + + _vector.set( 0, 0, 0 ); + selected_block.setAngularFactor( _vector ); + selected_block.setAngularVelocity( _vector ); + selected_block.setLinearFactor( _vector ); + selected_block.setLinearVelocity( _vector ); + + mouse_pos.copy( intersections[0].point ); + block_offset.subVectors( selected_block.position, mouse_pos ); + + intersect_plane.position.y = mouse_pos.y; + } + }; + + handleMouseMove = function( evt ) { + + var ray, intersection, + i, scalar; + + if ( selected_block !== null ) { + + _vector.set( + ( evt.clientX / window.innerWidth ) * 2 - 1, + -( evt.clientY / window.innerHeight ) * 2 + 1, + 1 + ); + projector.unprojectVector( _vector, camera ); + + ray = new THREE.Raycaster( camera.position, _vector.sub( camera.position ).normalize() ); + intersection = ray.intersectObject( intersect_plane ); + mouse_pos.copy( intersection[0].point ); + } + + }; + + handleMouseUp = function( evt ) { + + if ( selected_block !== null ) { + _vector.set( 1, 1, 1 ); + selected_block.setAngularFactor( _vector ); + selected_block.setLinearFactor( _vector ); + + selected_block = null; + } + + }; + + return function() { + renderer.domElement.addEventListener( 'mousedown', handleMouseDown ); + renderer.domElement.addEventListener( 'mousemove', handleMouseMove ); + renderer.domElement.addEventListener( 'mouseup', handleMouseUp ); + }; +})(); + +window.onload = initScene; diff --git a/physijs/tests/memorytest-compound.ts b/physijs/tests/memorytest-compound.ts new file mode 100644 index 000000000..0455b71f2 --- /dev/null +++ b/physijs/tests/memorytest-compound.ts @@ -0,0 +1,171 @@ +/// +/// + + +Physijs.scripts.worker = '../physijs_worker.js'; +Physijs.scripts.ammo = 'examples/js/ammo.js'; + +var initScene, render, _boxes = [], spawnBox, inc_ready, renderer, render_stats, physics_stats, scene, ground_material, ground, light, camera; + +var cubes = []; +var total_cubes = 0; +var total_ready = 0; +var max_on_screen = 100; +var spawn_per_tick = 25; + +initScene = function() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.shadowMapEnabled = true; + renderer.shadowMapSoft = true; + document.getElementById( 'viewport' ).appendChild( renderer.domElement ); + + render_stats = new Stats(); + render_stats.domElement.style.position = 'absolute'; + render_stats.domElement.style.top = '0px'; + render_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( render_stats.domElement ); + + physics_stats = new Stats(); + physics_stats.domElement.style.position = 'absolute'; + physics_stats.domElement.style.top = '50px'; + physics_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( physics_stats.domElement ); + + scene = new Physijs.Scene; + scene.setGravity(new THREE.Vector3( 0, -30, 0 )); + scene.addEventListener( + 'update', + function() { + scene.simulate( undefined, 1 ); + physics_stats.update(); + while(cubes.length > max_on_screen) { + scene.remove(cubes[0]); + cubes[0].geometry.dispose(); + cubes[0].material.dispose(); + cubes.splice( 0, 1 ); + } + document.getElementById( 'totalcubecount' ).textContent = ( total_cubes.toString() ); + document.getElementById( 'currentcubecount' ).textContent = ( cubes.length.toString() ); + document.getElementById( 'totalobjects' ).textContent = ( scene.__objects.length ); + if(total_cubes > total_ready){ + return; + } + for (var i=0;i +/// + + +Physijs.scripts.worker = '../physijs_worker.js'; +Physijs.scripts.ammo = 'examples/js/ammo.js'; + +var initScene, render, _boxes = [], spawnBox, inc_ready, renderer, render_stats, physics_stats, scene, ground_material, ground, light, camera; + +var cubes = []; +var total_cubes = 0; +var total_ready = 0; +var max_on_screen = 100; +var spawn_per_tick = 25; + +initScene = function() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.shadowMapEnabled = true; + renderer.shadowMapSoft = true; + document.getElementById( 'viewport' ).appendChild( renderer.domElement ); + + render_stats = new Stats(); + render_stats.domElement.style.position = 'absolute'; + render_stats.domElement.style.top = '0px'; + render_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( render_stats.domElement ); + + physics_stats = new Stats(); + physics_stats.domElement.style.position = 'absolute'; + physics_stats.domElement.style.top = '50px'; + physics_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( physics_stats.domElement ); + + scene = new Physijs.Scene; + scene.setGravity(new THREE.Vector3( 0, -30, 0 )); + scene.addEventListener( + 'update', + function() { + scene.simulate( undefined, 1 ); + physics_stats.update(); + while(cubes.length > max_on_screen) { + scene.remove(cubes[0]); + cubes[0].geometry.dispose(); + cubes[0].material.dispose(); + cubes.splice( 0, 1 ); + } + document.getElementById( 'totalcubecount' ).textContent = ( total_cubes.toString() ); + document.getElementById( 'currentcubecount' ).textContent = ( cubes.length.toString() ); + document.getElementById( 'totalobjects' ).textContent = ( scene.__objects.length ); + if(total_cubes > total_ready){ + return; + } + for (var i=0;i +/// + + +Physijs.scripts.worker = '../physijs_worker.js'; +Physijs.scripts.ammo = 'examples/js/ammo.js'; + +var initScene, render, _boxes = [], spawnBox, inc_ready, renderer, render_stats, physics_stats, scene, ground_material, ground, light, camera; + +var cubes = []; +var total_cubes = 0; +var total_ready = 0; +var max_on_screen = 100; +var spawn_per_tick = 25; + +initScene = function() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.shadowMapEnabled = true; + renderer.shadowMapSoft = true; + document.getElementById( 'viewport' ).appendChild( renderer.domElement ); + + render_stats = new Stats(); + render_stats.domElement.style.position = 'absolute'; + render_stats.domElement.style.top = '0px'; + render_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( render_stats.domElement ); + + physics_stats = new Stats(); + physics_stats.domElement.style.position = 'absolute'; + physics_stats.domElement.style.top = '50px'; + physics_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( physics_stats.domElement ); + + scene = new Physijs.Scene; + scene.setGravity(new THREE.Vector3( 0, -30, 0 )); + scene.addEventListener( + 'update', + function() { + scene.simulate( undefined, 1 ); + physics_stats.update(); + while(cubes.length > max_on_screen) { + scene.remove(cubes[0]); + cubes[0].geometry.dispose(); + cubes[0].material.dispose(); + cubes.splice( 0, 1 ); + } + document.getElementById( 'totalcubecount' ).textContent = ( total_cubes.toString() ); + document.getElementById( 'currentcubecount' ).textContent = ( cubes.length.toString() ); + document.getElementById( 'totalobjects' ).textContent = ( scene.__objects.length ); + if(total_cubes > total_ready){ + return; + } + for (var i=0;i +/// + + +var TWEEN: any; +var SimplexNoise: any; + + +Physijs.scripts.worker = '../physijs_worker.js'; +Physijs.scripts.ammo = 'examples/js/ammo.js'; + +var initScene, render, createShape, + renderer, render_stats, physics_stats, scene, light, ground, ground_material, camera; + +initScene = function() { + TWEEN.start(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.shadowMapEnabled = true; + renderer.shadowMapSoft = true; + document.getElementById( 'viewport' ).appendChild( renderer.domElement ); + + render_stats = new Stats(); + render_stats.domElement.style.position = 'absolute'; + render_stats.domElement.style.top = '0px'; + render_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( render_stats.domElement ); + + physics_stats = new Stats(); + physics_stats.domElement.style.position = 'absolute'; + physics_stats.domElement.style.top = '50px'; + physics_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( physics_stats.domElement ); + + scene = new Physijs.Scene({ fixedTimeStep: 1 / 120 }); + scene.setGravity(new THREE.Vector3( 0, -30, 0 )); + scene.addEventListener( + 'update', + function() { + scene.simulate( undefined, 2 ); + physics_stats.update(); + } + ); + + camera = new THREE.PerspectiveCamera( + 35, + window.innerWidth / window.innerHeight, + 1, + 1000 + ); + camera.position.set( 60, 50, 60 ); + camera.lookAt( scene.position ); + scene.add( camera ); + + // Light + light = new THREE.DirectionalLight( 0xFFFFFF ); + light.position.set( 20, 40, -15 ); + light.target.position.copy( scene.position ); + light.castShadow = true; + light.shadowCameraLeft = -60; + light.shadowCameraTop = -60; + light.shadowCameraRight = 60; + light.shadowCameraBottom = 60; + light.shadowCameraNear = 20; + light.shadowCameraFar = 200; + light.shadowBias = -.0001 + light.shadowMapWidth = light.shadowMapHeight = 2048; + light.shadowDarkness = .7; + scene.add( light ); + + // Materials + ground_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/rocks.jpg' ) }), + .8, // high friction + .4 // low restitution + ); + ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping; + ground_material.map.repeat.set( 2.5, 2.5 ); + + // Ground + ground = new Physijs.BoxMesh( + new THREE.BoxGeometry(50, 1, 50), + //new THREE.PlaneGeometry(50, 50), + ground_material, + 0 // mass + ); + ground.receiveShadow = true; + scene.add( ground ); + + // Bumpers + var bumper, + bumper_geom = new THREE.BoxGeometry(2, 1, 50); + + bumper = new Physijs.BoxMesh( bumper_geom, ground_material, 0 ); + bumper.position.y = 1; + bumper.position.x = -24; + bumper.receiveShadow = true; + bumper.castShadow = true; + scene.add( bumper ); + + bumper = new Physijs.BoxMesh( bumper_geom, ground_material, 0 ); + bumper.position.y = 1; + bumper.position.x = 24; + bumper.receiveShadow = true; + bumper.castShadow = true; + scene.add( bumper ); + + bumper = new Physijs.BoxMesh( bumper_geom, ground_material, 0 ); + bumper.position.y = 1; + bumper.position.z = -24; + bumper.rotation.y = Math.PI / 2; + bumper.receiveShadow = true; + bumper.castShadow = true; + scene.add( bumper ); + + bumper = new Physijs.BoxMesh( bumper_geom, ground_material, 0 ); + bumper.position.y = 1; + bumper.position.z = 24; + bumper.rotation.y = Math.PI / 2; + bumper.receiveShadow = true; + bumper.castShadow = true; + scene.add( bumper ); + + requestAnimationFrame( render ); + scene.simulate(); + + createShape(); +}; + +render = function() { + requestAnimationFrame( render ); + renderer.render( scene, camera ); + render_stats.update(); +}; + +createShape = (function() { + var addshapes = true, + shapes = 0, + box_geometry = new THREE.BoxGeometry( 3, 3, 3 ), + sphere_geometry = new THREE.SphereGeometry( 1.5, 32, 32 ), + cylinder_geometry = new THREE.CylinderGeometry( 2, 2, 1, 32 ), + cone_geometry = new THREE.CylinderGeometry( 0, 2, 4, 32 ), + octahedron_geometry = new THREE.OctahedronGeometry( 1.7, 1 ), + torus_geometry = new THREE.TorusKnotGeometry ( 1.7, .2, 32, 4 ), + doCreateShape; + + setTimeout( + function addListener() { + var button = document.getElementById( 'stop' ); + if ( button ) { + button.addEventListener( 'click', function() { addshapes = false; } ); + } else { + setTimeout( addListener ); + } + } + ); + + doCreateShape = function() { + var shape, material = new THREE.MeshLambertMaterial({ opacity: 0, transparent: true }); + + switch ( Math.floor(Math.random() * 6) ) { + case 0: + shape = new Physijs.BoxMesh( + box_geometry, + material + ); + break; + + case 1: + shape = new Physijs.SphereMesh( + sphere_geometry, + material, + undefined + ); + break; + + case 2: + shape = new Physijs.CylinderMesh( + cylinder_geometry, + material + ); + break; + + case 3: + shape = new Physijs.ConeMesh( + cone_geometry, + material + ); + break; + + case 4: + shape = new Physijs.ConvexMesh( + octahedron_geometry, + material + ); + break; + + case 5: + shape = new Physijs.ConvexMesh( + torus_geometry, + material + ); + break; + } + + shape.material.color.setRGB( Math.random() * 100 / 100, Math.random() * 100 / 100, Math.random() * 100 / 100 ); + shape.castShadow = true; + shape.receiveShadow = true; + + shape.position.set( + Math.random() * 30 - 15, + 20, + Math.random() * 30 - 15 + ); + + shape.rotation.set( + Math.random() * Math.PI, + Math.random() * Math.PI, + Math.random() * Math.PI + ); + + if ( addshapes ) { + shape.addEventListener( 'ready', createShape ); + } + scene.add( shape ); + + new TWEEN.Tween(shape.material).to({opacity: 1}, 500).start(); + + document.getElementById( 'shapecount' ).textContent = ( ++shapes ) + ' shapes created'; + }; + + return function() { + setTimeout( doCreateShape, 250 ); + }; +})(); + +window.onload = initScene; diff --git a/physijs/tests/vehicle.ts b/physijs/tests/vehicle.ts new file mode 100644 index 000000000..1b11066fe --- /dev/null +++ b/physijs/tests/vehicle.ts @@ -0,0 +1,254 @@ +/// +/// + +var TWEEN: any; +var SimplexNoise: any; + + +Physijs.scripts.worker = '../physijs_worker.js'; +Physijs.scripts.ammo = 'examples/js/ammo.js'; + +var initScene, render, + ground_material, box_material, + projector, renderer, render_stats, physics_stats, scene, ground, light, camera, + vehicle_body, vehicle; + +initScene = function() { + projector = new THREE.Projector; + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize( window.innerWidth, window.innerHeight ); + renderer.shadowMapEnabled = true; + renderer.shadowMapSoft = true; + document.getElementById( 'viewport' ).appendChild( renderer.domElement ); + + render_stats = new Stats(); + render_stats.domElement.style.position = 'absolute'; + render_stats.domElement.style.top = '1px'; + render_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( render_stats.domElement ); + + physics_stats = new Stats(); + physics_stats.domElement.style.position = 'absolute'; + physics_stats.domElement.style.top = '50px'; + physics_stats.domElement.style.zIndex = 100; + document.getElementById( 'viewport' ).appendChild( physics_stats.domElement ); + + scene = new Physijs.Scene; + scene.setGravity(new THREE.Vector3( 0, -30, 0 )); + scene.addEventListener( + 'update', + function() { + + if ( input && vehicle ) { + if ( input.direction !== null ) { + input.steering += input.direction / 50; + if ( input.steering < -.6 ) input.steering = -.6; + if ( input.steering > .6 ) input.steering = .6; + } + vehicle.setSteering( input.steering, 0 ); + vehicle.setSteering( input.steering, 1 ); + + if ( input.power === true ) { + vehicle.applyEngineForce( 300 ); + } else if ( input.power === false ) { + vehicle.setBrake( 20, 2 ); + vehicle.setBrake( 20, 3 ); + } else { + vehicle.applyEngineForce( 0 ); + } + } + + scene.simulate( undefined, 2 ); + physics_stats.update(); + } + ); + + camera = new THREE.PerspectiveCamera( + 35, + window.innerWidth / window.innerHeight, + 1, + 1000 + ); + scene.add( camera ); + + // Light + light = new THREE.DirectionalLight( 0xFFFFFF ); + light.position.set( 20, 20, -15 ); + light.target.position.copy( scene.position ); + light.castShadow = true; + light.shadowCameraLeft = -150; + light.shadowCameraTop = -150; + light.shadowCameraRight = 150; + light.shadowCameraBottom = 150; + light.shadowCameraNear = 20; + light.shadowCameraFar = 400; + light.shadowBias = -.0001 + light.shadowMapWidth = light.shadowMapHeight = 2048; + light.shadowDarkness = .7; + scene.add( light ); + + + var input; + + + // Materials + ground_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/rocks.jpg' ) }), + .8, // high friction + .4 // low restitution + ); + ground_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping; + ground_material.map.repeat.set( 3, 3 ); + + box_material = Physijs.createMaterial( + new THREE.MeshLambertMaterial({ map: THREE.ImageUtils.loadTexture( 'images/plywood.jpg' ) }), + .4, // low friction + .6 // high restitution + ); + box_material.map.wrapS = ground_material.map.wrapT = THREE.RepeatWrapping; + box_material.map.repeat.set( .25, .25 ); + + // Ground + var NoiseGen = new SimplexNoise; + + var ground_geometry = new THREE.PlaneGeometry( 300, 300, 100, 100 ); + for ( var i = 0; i < ground_geometry.vertices.length; i++ ) { + var vertex = ground_geometry.vertices[i]; + //vertex.y = NoiseGen.noise( vertex.x / 30, vertex.z / 30 ) * 1; + } + ground_geometry.computeFaceNormals(); + ground_geometry.computeVertexNormals(); + + // If your plane is not square as far as face count then the HeightfieldMesh + // takes two more arguments at the end: # of x faces and # of z faces that were passed to THREE.PlaneMaterial + ground = new Physijs.HeightfieldMesh( + ground_geometry, + ground_material, + 0 // mass + ); + ground.rotation.x = -Math.PI / 2; + ground.receiveShadow = true; + scene.add( ground ); + + for ( i = 0; i < 50; i++ ) { + var size = Math.random() * 2 + .5; + var box = new Physijs.BoxMesh( + new THREE.BoxGeometry( size, size, size ), + box_material + ); + box.castShadow = box.receiveShadow = true; + box.position.set( + Math.random() * 25 - 50, + 5, + Math.random() * 25 - 50 + ); + scene.add( box ) + } + + + var loader = new THREE.JSONLoader(); + + loader.load( "models/mustang.js", function( car, car_materials ) { + loader.load( "models/mustang_wheel.js", function( wheel, wheel_materials ) { + var mesh = new Physijs.BoxMesh( + car, + new THREE.MeshFaceMaterial( car_materials ) + ); + mesh.position.y = 2; + mesh.castShadow = mesh.receiveShadow = true; + + vehicle = new Physijs.Vehicle(mesh, new Physijs.VehicleTuning( + 10.88, + 1.83, + 0.28, + 500, + 10.5, + 6000 + )); + scene.add( vehicle ); + + var wheel_material = new THREE.MeshFaceMaterial( wheel_materials ); + + for ( var i = 0; i < 4; i++ ) { + vehicle.addWheel( + wheel, + wheel_material, + new THREE.Vector3( + i % 2 === 0 ? -1.6 : 1.6, + -1, + i < 2 ? 3.3 : -3.2 + ), + new THREE.Vector3( 0, -1, 0 ), + new THREE.Vector3( -1, 0, 0 ), + 0.5, + 0.7, + i < 2 ? false : true + ); + } + + input = { + power: null, + direction: null, + steering: 0 + }; + document.addEventListener('keydown', function( ev ) { + switch ( ev.keyCode ) { + case 37: // left + input.direction = 1; + break; + + case 38: // forward + input.power = true; + break; + + case 39: // right + input.direction = -1; + break; + + case 40: // back + input.power = false; + break; + } + }); + document.addEventListener('keyup', function( ev ) { + switch ( ev.keyCode ) { + case 37: // left + input.direction = null; + break; + + case 38: // forward + input.power = null; + break; + + case 39: // right + input.direction = null; + break; + + case 40: // back + input.power = null; + break; + } + }); + }); + }); + + requestAnimationFrame( render ); + scene.simulate(); +}; + + +render = function() { + requestAnimationFrame( render ); + if ( vehicle ) { + camera.position.copy( vehicle.mesh.position ).add( new THREE.Vector3( 40, 25, 40 ) ); + camera.lookAt( vehicle.mesh.position ); + + light.target.position.copy( vehicle.mesh.position ); + light.position.addVectors( light.target.position, new THREE.Vector3( 20, 20, -15 ) ); + } + renderer.render( scene, camera ); + render_stats.update(); +}; + +window.onload = initScene; From f2a81070eafc70f412e93e2a722bbf89cc0c3f57 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sat, 30 Aug 2014 15:52:38 +0100 Subject: [PATCH 32/40] add definitions for jquery-handsontable --- CONTRIBUTORS.md | 1 + jquery-handsontable/jquery-handsontable.d.ts | 950 +++++++++++++++++++ 2 files changed, 951 insertions(+) create mode 100644 jquery-handsontable/jquery-handsontable.d.ts diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index fda65cb32..1ff7a943e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -199,6 +199,7 @@ All definitions files include a header with the author and editors, so at some p * [jQuery.Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) (by [Boris Yankov](https://github.com/borisyankov)) * [jQuery.Watermark](http://jquery-watermark.googlecode.com) (by [Anwar Javed](https://github.com/anwarjaved)) * [jQuery.base64](https://github.com/yatt/jquery.base64) (by [Shinya Mochizuki](https://github.com/enrapt-mochizuki)) +* [jquery-handsontable](https://github.com/handsontable/jquery-handsontable) (by [Ted John](https://github.com/intelorca)) * [js-git](https://github.com/creationix/js-git) (by [Bart van der Schoor](https://github.com/Bartvds)) * [js-url](https://github.com/websanova/js-url) (by [MIZUNE Pine](https://github.com/pine613)) * [js-yaml](https://github.com/nodeca/js-yaml) (by [Bart van der Schoor](https://github.com/Bartvds/)) diff --git a/jquery-handsontable/jquery-handsontable.d.ts b/jquery-handsontable/jquery-handsontable.d.ts new file mode 100644 index 000000000..dbb0d23d6 --- /dev/null +++ b/jquery-handsontable/jquery-handsontable.d.ts @@ -0,0 +1,950 @@ +// Type definitions for jquery-handsontable +// Project: http://handsontable.com +// Definitions by: Ted John +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Handsontable { + interface CellPosition { + row: number; + col: number; + } + + interface Options { + /** + * Initial data source that will be bound to the data grid by reference (editing data grid alters the data source. See Understanding binding as reference. + */ + data?: any; + + /** + * Width of the grid. Can be a number or a function that returns a number. + */ + width?: any; + + /** + * Height of the grid. Can be a number or a function that returns a number. + */ + height?: any; + + /** + * Minimum number of rows. At least that many of rows will be created during initialization. + */ + minRows?: number; + + /** + * Minimum number of columns. At least that many of columns will be created during initialization. + */ + minCols?: number; + + /** + * Maximum number of rows. + */ + maxRows?: number; + + /** + * Maximum number of columns. + */ + maxCols?: number; + + /** + * Initial number of rows. Notice: This option only has effect in Handsontable constructor and only if data option is not provided. + */ + startRows?: number; + + /** + * Initial number of rows. Notice: This option only has effect in Handsontable constructor and only if data option is not provided. + */ + startCols?: number; + + /** + * Setting true or false will enable or disable the default row headers (1, 2, 3). You can also define an array ['One', 'Two', 'Three', ...] or a function to define the headers. If a function is set the index of the rowis passed as a parameter. + */ + rowHeaders?: any; + + /** + * Setting true or false will enable or disable the default column headers (A, B, C). You can also define an array ['One', 'Two', 'Three', ...] or a function to define the headers. If a function is set the index of the column is passed as a parameter. + */ + colHeaders?: any; + + /** + * Defines column widths in pixels. Accepts number, string (that will be converted to number), array of numbers (if you want to define column width separately for each column) or a function (if you want to set column width dynamically on each render). + */ + colWidths?: any; + + /** + * Defines the cell properties and data binding for certain columns. Notice: Using this option sets a fixed number of columns (options startCols, minCols, maxCols will be ignored). + * @see https://github.com/handsontable/jquery-handsontable/wiki/Options below for more detailed explanation. + * @see http://handsontable.com/demo/datasources.html for examples + */ + columns?: any[]; + + /** + * Defines the cell properties for given row, col, prop coordinates. + * See Cells section below for more detailed explanation. + */ + cells?: (row: number, col: number, prop: string) => void; + + /** + * Defines the structure of a new row when data source is an object. + * @see http://handsontable.com/demo/datasources.html for examples. + */ + dataSchema?: any; + + /** + * When set to 1 (or more), Handsontable will add a new row at the end of grid if there are no more empty rows. + */ + minSpareRows?: number; + + /** + * When set to 1 (or more), Handsontable will add a new column at the end of grid if there are no more empty columns. + */ + minSpareCols?: number; + + /** + * If true, selection of multiple cells using keyboard or mouse is allowed. + */ + multiSelect?: boolean; + + /** + * Enables the fill handle (drag-down and copy-down) functionality, which shows the small rectangle in bottom right corner of the selected area, that let's you expand values to the adjacent cells. + * Possible values: true (to enable in all directions), "vertical" or "horizontal" (to enable in one direction), false (to disable completely). Setting to true enables the fillHandle plugin, which, + */ + fillHandle?: any; + + /** + * Defines if the right-click context menu should be enabled. Context menu allows to create new row or column at any place in the grid. + * Possible values: true (to enable basic options), false (to disable completely) or array of any available strings: ["row_above", "row_below", "col_left", "col_right", "remove_row", "remove_col", "undo", "redo", "sep1", "sep2", "sep3"]. + * @see http://handsontable.com/demo/contextmenu.html for examples. + */ + contextMenu?: any; + + /** + * If true, undo/redo functionality is enabled. + */ + undo?: boolean; + + /** + * If true, mouse click outside the grid will deselect the current selection. + */ + outsideClickDeselects?: boolean; + + /** + * If true, ENTER begins editing mode (like Google Docs). If false, ENTER moves to next row (like Excel) and adds new row if necessary. TAB adds new column if necessary. + */ + enterBeginsEditing?: boolean; + + /** + * Defines cursor move after ENTER is pressed (SHIFT+ENTER uses negative vector). Can be an object or a function that returns an object. The event argument passed to the function is a jQuery.Event object received after a ENTER key has been pressed. This event object can be used to check whether user pressed ENTER or SHIFT + ENTER. + */ + enterMoves?: any; + + /** + * Defines cursor move after TAB is pressed (SHIFT+TAB uses negative vector). Can be an object or a function that returns an object. The event argument passed to the function is a jQuery.Event object received after a TAB key has been pressed. This event object can be used to check whether user pressed TAB or SHIFT + TAB. + */ + tabMoves?: any; + + /** + * If true, pressing TAB or right arrow in the last column will move to first column in next row. + */ + autoWrapRow?: boolean; + + /** + * If true, pressing ENTER or down arrow in the last row will move to first row in next column. + */ + autoWrapCol?: boolean; + + /** + * Autocomplete definitions. + * @see demo/autocomplete.html for examples and definitions. + */ + autoComplete?: any[]; + + /** + * Maximum number of rows than can be copied to clipboard using CTRL+C. + */ + copyRowsLimit?: number; + + /** + * Maximum number of columns than can be copied to clipboard using CTRL+C. + */ + copyColsLimit?: number; + + /** + * Defines paste (CTRL+V) behavior. Default value "overwrite" will paste clipboard value over current selection. + * When set to "shift_down", clipboard data will be pasted in place of current selection, while all selected cells are moved down. + * When set to "shift_right", clipboard data will be pasted in place of current selection, while all selected cells are moved right. + */ + pasteMode?: string; + + /** + * Column stretching mode. Possible values: "none", "last", "all". + */ + stretchH?: string; + + /** + * Lets you overwrite the default isEmptyRow method. + */ + isEmptyRow? (row): boolean; + + /** + * Lets you overwrite the default isEmptyCol method. + */ + isEmptyCol? (col): boolean; + + /** + * Turn on Manual column resize, if set to a boolean or define initial column resized widths, if set to an array of numbers. + */ + manualColumnResize?: any; + + /** + * Turn on Manual column move, if set to a boolean or define initial column order, if set to an array of column indexes. + */ + manualColumnMove?: any; + + /** + * Turn on Column sorting. + */ + columnSorting?: boolean; + + /** + * Turn on saving the state of column sorting, columns positions and columns sizes in local storage. For more information see How to save data localy. + */ + persistentState?: boolean; + + /** + * Class name for all visible rows in current selection. + */ + currentRowClassName?: string; + + /** + * Class name for all visible columns in current selection. + */ + currentColClassName?: string; + + /** + * Allows to specify the number of rows fixed (aka freezed) on the top of the table. + */ + fixedRowsTop?: number; + + /** + * Allows to specify the number of columns fixed (aka freezed) on the left side of the table. + */ + fixedColumnsLeft?: number; + + /** + * Setting to true enables selecting just a fragment of the text within a single cell or between adjacent cells. + */ + fragmentSelection?: boolean; + + /** + * Setting to true word wrapping of the cell text content that does not fit in the fixed column width. + */ + wordWrap?: boolean; + + /** + * CSS class name cells configured with wordWrap: false. + */ + noWordWrapClassName?: string; + + /** + * When set to an non-empty string, displayed as the cell content for empty cells. + */ + placeholder?: any; + + /** + * CSS class name for cells that have a placeholder in use. + */ + placeholderCellClassName?: string; + + /** + * CSS class name for cells that did not pass validation. + */ + invalidCellClassName?: string; + + /** + * CSS class name for read-only cells. + */ + readOnlyCellClassName?: string; + + /** + * Setting to true enables the debug mode, currently used to test the correctness of the row and column header fixed positioning on a layer above the master table. + */ + debug?: boolean; + + /** + * When set to true, the table is rerendered when it is detected that it was made visible in DOM. + */ + observeDOMVisibility?: boolean; + + /** + * Setting to true enables the autoColumnSize plugin, which makes sure each column gets enough space to show its content. + */ + autoColumnSize?: boolean; + + /** + * Setting to true enables the observeChanges plugin, which automatically renders the table when a change in the data source is observed. + */ + observeChanges?: boolean; + + /** + * Setting to true enables the manualRowResize plugin, which allows to resize the row height with your mouse. + */ + manualRowResize?: boolean; + + /** + * Setting to true enables the copyPaste plugin, which enables the copying and pasting to the clipboard. + */ + copyPaste?: boolean; + + /** + * Setting to true enables the search plugin (see demo). + */ + search?: boolean; + + /** + * Setting to true or array enables the mergeCells plugin, which enables the merging of the cells. (see demo). You can provide the merged cells on the pageload if you feed the mergeCells option with an array. + */ + mergeCells?: any; + + /** + * Callback fired before Walkontable instance is initiated. + */ + beforeInitWalkontable?: Function; + + /** + * Callback fired before Handsontable instance is initiated. + * Note: this can be set only by global PluginHooks instance. + */ + beforeInit?: Function; + + /** + * Callback fired before Handsontable table is rendered. Parameters: + * - isForced is true if rendering was triggered by a change of settings or data; or false if rendering was triggered by scrolling or moving selection. + */ + beforeRender?: (isForced: boolean) => void; + + /** + * Callback fired before one or more cells is changed. Its main purpose is to alter changes silently before input. Parameters: + * - changes is a 2D array containing information about each of the edited cells [ [row, prop, oldVal, newVal], ... ]. + * - To disregard a single change, set changes[i] to null or remove it from array using changes.splice(i, 1). + * - To alter a single change, overwrite the desired value to changes[i][3]. + * - To cancel all edit, return false from the callback or set array length to 0 (changes.length = 0). + * - source is the name of a source of changes. + */ + beforeChange?: (changes: any[][], source: string) => void; + + beforeChangeRender?: Function; + + /** + * Callback fired before sorting the table. The column argument is a relative (displayed) index of a column that is about to be sorted. To get the absolute column index, just add the current column offset. You can get the offset by using colOffset() method. + */ + beforeColumnSort?: (column: number, order: boolean) => void; + + /** + * Callback fired before setting single value from the data source array. + */ + beforeSet?: (v: Object) => void; + + /** + * Callback fired before getting cell settings. + */ + beforeGetCellMeta?: (row: number, col: number, cellProperties: Object) => void; + + /** + * Parameters: + * - start is an object containing information about first filled cell: { row : 2, col : 0 }. + * - end is an object containing information about last filled cell: { row : 4, col : 1 }. + * - data is an 2D array containing information about fill pattern: [ ["1", "Ted"], ["1", "John"] ]. + */ + beforeAutofill?: (start: CellPosition, end: CellPosition, data: string[][]) => void; + + /** + * Callback fired before keydown event is handled. It can be used to overwrite default key bindings. Caution - in your beforeKeyDown handler you need to call event.stopImmediatePropagation() to prevent default key behavior. + */ + beforeKeyDown?: (event: KeyboardEvent) => void; + + /** + * A plugin hook executed before validator function, only if validator function is defined. This can be used to manipulate value of changed cell before it is applied to the validator function. NOTICE: this will not affect values of changes. This will change value ONLY for validation! + */ + beforeValidate?: (value: any, row; number, prop: string, source: string) => void; + + /** + * Callback fired after Handsontable instance is initiated. + */ + afterInit?: Function; + + /** + * Callback fired after new data is loaded (by loadData method) into the data source array. + */ + afterLoadData?: Function; + + /** + * Callback fired after Handsontable table is rendered. Parameters: + * - isForced is true if rendering was triggered by a change of settings or data; or false if rendering was triggered by scrolling or moving selection. + */ + afterRender?: (isForced: boolean) => void; + + /** + * Callback fired after one or more cells is changed. Its main use case is to save the input. Parameters: + * - changes is a 2D array containing information about each of the edited cells [ [row, prop, oldVal, newVal], ... ]. + * - source is one of the strings: "alter", "empty", "edit", "populateFromArray", "loadData", "autofill", "paste". + * Note: for performance reasons, the changes array is null for "loadData" source. + */ + afterChange?: (changes: any[], source: string) => void; + + /** + * Callback fired after sorting the table. The column argument is a relative (displayed) index of a column that is about to be sorted. To get the absolute column index, just add the current column offset. You can get the offset by using colOffset() method. + */ + afterColumnSort?: (column: number, order: boolean) => void; + + /** + * Callback fired while one or more cells are being selected (on mouse move). Parameters: + * - r selection start row + * - c selection start column + * - r2 selection end row + * - c2 selection end column + */ + afterSelection?: (r: number, c: number, r2: number, c2: number) => void; + + /** + * The same as above, but data source object property name is used instead of the column number. + */ + afterSelectionByProp?: (r: number, p: string, r2: number, p2: string) => void; + + /** + * Callback fired while one or more cells are being selected (on mouse up). Parameters: + * - r selection start row + * - c selection start column + * - r2 selection end row + * - c2 selection end column + */ + afterSelectionEnd?: (r: number, c: number, r2: number, c2: number) => void; + + /** + * The same as above, but data source object property name is used instead of the column number. + */ + afterSelectionEndByProp?: (r: number, p: string, r2: number, p2: string) => void; + + /** + * Event called when current cell is deselected. + */ + afterDeselect?: Function; + + /** + * Callback fired after getting cell settings. + */ + afterGetCellMeta?: (row: number, col: number, cellProperties: Object) => void; + + /** + * Callback fired after getting info about column header. + */ + afterGetColHeader?: (col: number, TH: HTMLTableHeaderCellElement) => void; + + /** + * Callback fired after calculating column width. + */ + afterGetColWidth?: (col: number, response: Object) => void; + + /** + * Callback fired after destroing Handsontable instance. + */ + afterDestroy?: Function; + + /** + * Callback is fired when a new row is created. Parameters: + * - index represents the index of first newly created row in the data source array. + * - amount number of newly created rows in the data source array. + */ + afterCreateRow?: (index: number, amount: number) => void; + + /** + * Callback is fired when a new column is created. Parameters: + * - index represents the index of first newly created column in the data source array. + * - amount number of newly created columns in the data source array. + */ + afterCreateCol?: (index: number, amount: number) => void; + + /** + * Callback is fired when one or more rows are about to be removed. Parameters: + * - index is an index of starter row. + * - amount is an anount of rows to be removed. + */ + beforeRemoveRow?: (index: number, amount: number) => void; + + /** + * Callback is fired when one or more rows are removed. Parameters: + * - index is an index of starter row. + * - amount is an anount of removed rows. + */ + afterRemoveRow?: (index: number, amount: number) => void; + + /** + * Callback is fired when one or more columns are about to be removed. Parameters: + * - index is an index of starter column. + * - amount is an anount of columns to be removed. + */ + beforeRemoveCol?: (index: number, amount: number) => void; + + /** + * Callback is fired when one or more columns are removed. Parameters: + * - index is an index of starter column. + * - amount is an anount of removed columns. + */ + afterRemoveCol?: (index: number, amount: number) => void; + + /** + * Callback is fired after changing column size. + */ + afterColumnResize?: (col: number, size: number) => void; + + /** + * Callback is fired after changing column placement. + */ + afterColumnMove?: (oldIndex: number, newIndex: number) => void; + + /** + * Callback fired if copyRowsLimit or copyColumnsLimit was reached. + */ + afterCopyLimit?: (selectedRowsCount: number, selectedColsCount: number, copyRowsLimit: number, copyColsLimit: number) => void; + + /** + * A plugin hook executed after validator function, only if validator function is defined. Validation result is the first parameter. This can be used to determinate if validation passed successfully or not. You can cancel current change by returning false. + */ + afterValidate?: (isValid: boolean, value: any, row: number, prop: string, source: string) => boolean; + + /** + * Callback fired before setting range is ended. Parameters: + * - coords is WalkontableCellCoords array + */ + beforeSetRangeEnd?: (coords: any[]) => void; + + afterUpdateSettings?: Function; + + afterRenderer?: (TD: HTMLTableDataCellElement, row: number, col: number, prop: string, value: string, cellProperties: Object) => void; + + /** + * Callback fired after clicking on a cell or row/column header. + * In case the row/column header was clicked, the index is negative. For example clicking on the row header of cell (0, 0) results with afterOnCellMouseDown called with coords {row: 0, col: -1}. + */ + afterOnCellMouseDown?: (event: MouseEvent, coords: CellPosition, TD: HTMLTableDataCellElement) => void; + + /** + * Callback fired after hovering a cell or row/column header with the mouse cursor. + * In case the row/column header was hovered, the index is negative. For example clicking on the row header of cell (0, 0) results with afterOnCellMouseOver called with coords {row: 0, col: -1}. + */ + afterOnCellMouseOver?: (event: MouseEvent, coords: CellPosition, TD: HTMLTableDataCellElement) => void; + + /** + * Callback fired after. + */ + afterOnCellCornerMouseDown?: (event: MouseEvent) => void; + + afterScrollVertically?: Function; + + afterScrollHorizontally?: Function; + + /** + * Callback fired after reset cell's meta. + */ + afterCellMetaReset?: Function; + + /** + * Callback fired after modify column's width. + */ + modifyColWidth?: (width: number, col: number) => void; + + /** + * Callback fired after modify hight of row. + */ + modifyRowHeight?: (height: number, row: number) => void; + + /** + * Callback fired after row modify. + */ + modifyRow?: (row: number) => void; + + /** + * Callback fired after column modify. + */ + modifyCol?: (col: number) => void; + + afterSetCellMeta?: Function; + + /** + * Deprecated! Now event is called afterSelection. + */ + onSelection?: (r: number, p: number, r2: number, p2: number) => void; + + /** + * Deprecated! Now event is called afterSelectionByProp. + */ + onSelectionByProp?: (r: number, p: number, r2: number, p2: number) => void; + + /** + * Deprecated! Now event is called afterSelectionEnd. + */ + onSelectionEnd?: (r: number, p: number, r2: number, p2: number) => void; + + /** + * Deprecated! Now event is called afterSelectionEndByProp. + */ + onSelectionEndByProp?: (r: number, p: number, r2: number, p2: number) => void; + + /** + * Deprecated! Now event is called beforeChange. + */ + onBeforeChange?: (changes: any[], source: string) => void; + + /** + * Deprecated! Now event is called afterChange. + */ + onChange?: (changes: any[], source: string) => void; + + /** + * Deprecated! Now event is called afterCopyLimit. + */ + onCopyLimit?: (selectedRowsCount: number, selectedColsCount: number, copyRowsLimit: number, copyColsLimit: number) => void; + } + + interface Context { + /** + * Use it if you need to change configuration after initialization. + */ + updateSettings(options: Options): void; + + /** + * Returns an object containing the current grid settings. + */ + getSettings(): Options; + + /** + * Reset all cells in the grid to contain data from the data array. + */ + loadData(data: any[]): void; + + /** + * Listen to keyboard input on document body. + */ + listen(): void; + + /** + * Returns rederer type/ + */ + getCellRenderer(row: number, col: number): string; + + /** + * Stop listening to keyboard input on document body. + */ + unlisten(): void; + + /** + * Returns true if current Handsontable instance is listening to keyboard input on document body. + */ + isListening(): boolean; + + /** + * Rerender the table. + */ + render(): void; + + /** + * Remove grid from DOM. + */ + destroy(): void; + + /** + * Validates all cells using their validator functions and calls callback when finished. Does not render the view. + */ + validateCells(callback: Function): void; + + /** + * Return the current data object (the same that was passed by data configuration option or loadData method). Optionally you can provide cell range row, col, row2, col2 to get only a fragment of grid data + */ + getData(): any; + + /** + * Return the current data object (the same that was passed by data configuration option or loadData method). Optionally you can provide cell range row, col, row2, col2 to get only a fragment of grid data + */ + getData(row: number, col: number, row2: number, col2: number): any; + + /** + * Return cell value at row, col. row and col are the visible indexes (note that if columns were reordered or sorted, the current order will be used). + */ + getDataAtCell(row: number, col: number): any; + + /** + * Same as getDataAtCell, except instead of col, you provide name of the object property (e.g. 'first.name'). + */ + getDataAtRowProp(row: number, prop: string): any; + + /** + * Returns a single row of the data (array or object, depending on what you have). row is the visible index of the row + */ + getDataAtRow(row: number): any; + + /** + * Returns a single row of the data (array or object, depending on what you have). row is the index of the row in the data source. + */ + getSourceDataAtRow(row: number): any; + + /** + * Returns array of column values from the data source. col is the visible index of the column. + */ + getDataAtCol(col: number): any[]; + + /** + * Returns array of column values from the data source. col is the index of the row in the data source. + */ + getSourceDataAtCol(col: number): any[]; + + /** + * Given the object property name (e.g. 'first.name'), returns array of column values from the data source. + */ + getDataAtProp(prop: string): any[]; + + /** + * Get value of selected range. Each column is separated by tab, each row is separated by new line character. + */ + getCopyableData(startRow: number, startCol: number, endRow: number, endCol: number): any; + + /** + * Returns value of selected cell. + */ + getValue(): any; + + /** + * Set new value to a cell. To change many cells at once, pass an array of changes in format [ [row, col, value], ... ] as the only parameter. col is the index of visible column (note that if columns were reordered, the current order will be used). source is a flag for before/afterChange events. If you pass only array of changes then source could be set as second parameter. + */ + setDataAtCell(row: number, col: number, value: any, source?: string): void; + + /** + * Set new value to a cell. To change many cells at once, pass an array of changes in format [ [row, col, value], ... ] as the only parameter. col is the index of visible column (note that if columns were reordered, the current order will be used). source is a flag for before/afterChange events. If you pass only array of changes then source could be set as second parameter. + */ + setDataAtCell(changes: any[], source?: string): void; + + /** + * Same as above, except instead of col, you provide name of the object property (e.g. [0, 'first.name', 'Jennifer']). + */ + setDataAtRowProp(row: number, prop: string, value: any, source?: string); + + /** + * Same as above, except instead of col, you provide name of the object property (e.g. [0, 'first.name', 'Jennifer']). + */ + setDataAtRowProp(changes: any[], source?: string): void; + + /** + * Populate cells at position with 2D input array (e.g. [ [1, 2], [3, 4] ]). + * Use endRow, endCol when you want to cut input when certain row is reached. + * @param source (default value "populateFromArray") is used to identify this call in the resulting events (beforeChange, afterChange). + * @param populateMethod (default value "overwrite", possible values "shift_down" and "shift_right") has the same effect as pasteMethod option (see Options page). + */ + populateFromArray(row: number, col: number, input: any[], endRow: number, endCol: number, source?: string, populateMethod?: string): void; + + /** + * Adds/removes data from the column. This function works is modelled after Array.splice. Parameter col is the index of column in which do you want to do splice. Parameter index is the row index at which to start changing the array. If negative, will begin that many elements from the end. Parameter amount, is the number of old array elements to remove. If the amount is 0, no elements are removed. Fourth and further parameters are the elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array. + */ + spliceCol(col: number, index: number, amount: number, ...elements: any[]): void; + + /** + * Adds/removes data from the row. This function works is modelled after Array.splice. Parameter row is the index of row in which do you want to do splice. Parameter index is the column index at which to start changing the array. If negative, will begin that many elements from the end. Parameter amount, is the number of old array elements to remove. If the amount is 0, no elements are removed. Fourth and further parameters are the elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array. + */ + spliceRow(row: number, index: number, amount: number, ...elements: any[]): void; + + /** + * Insert new row(s) above the row at given index. If index is null or undefined, the new row will be added after the current last row. Default amount equals 1. + */ + alter(type: 'insert_row', index: number, amount?: number, source?: string): void; + + /** + * Insert new column(s) before the column at given index. If index is null or undefined, the new column will be added after the current last column. Default amount equals 1. + */ + alter(type: 'insert_col', index: number, amount?: number, source?: string): void; + + /** + * Remove the row(s) at given index. Default amount equals 1. + */ + alter(type: 'remove_row', index: number, amount?: number, source?: string): void; + + /** + * Remove the column(s) at given index. Default amount equals 1. + */ + alter(type: 'remove_col', index: number, amount?: number, source?: string): void; + + alter(type: string, index: number, amount?: number, source?: string): void; + + /** + * Returns TD element for given row, col if it is rendered on screen. + * Returns null if the TD is not rendered on screen (probably because that part of table is not visible). + */ + getCell(row: number, col: number): any; + + /** + * Return cell properties for given row, col coordinates. + */ + getCellMeta(row: number, col: number): any; + + /** + * Sets cell meta data object key corresponding to params row, col. + */ + setCellMeta(row: number, col: number, key: string, val: string): void; + + /** + * Destroys current editor, renders and selects current cell. If revertOriginal == false, edited data is saved. Otherwise previous value is restored. + */ + destroyEditor(revertOriginal?: boolean): void; + + /** + * Select cell row, col or range finishing at row2, col2. By default, viewport will be scrolled to selection. + */ + selectCell(row: number, col: number, row2: number, col2: number, scrollToSelection?: boolean): void; + + /** + * Deselect current selection. + */ + deselectCell(): void; + + /** + * Return index of the currently selected cells as an array [startRow, startCol, endRow, endCol]. Start row and start col are the coordinates of the active cell (where the selection was started). + */ + getSelected(): void; + + /** + * Returns current selection as a WalkontableCellRange object. Returns undefined if there is no selection. + */ + getSelectedRange(): void; + + /** + * Clears grid. + */ + clear(): void; + + /** + * Returns total number of rows in the grid. + */ + countRows(): number; + + /** + * Returns total number of columns in the grid. + */ + countCols(): number; + + /** + * Returns property name that corresponds with the given column index. + */ + colToProp(column: number): string; + + /** + * Returns index of first visible row. + */ + rowOffset(): number; + + /** + * Returns index of first visible column. + */ + colOffset(): number; + + /** + * Returns number of visible rows. + */ + countVisibleRows(): number; + + /** + * Returns number of visible columns. + */ + countVisibleCols(): number; + + /** + * Returns number of empty rows. If the optional ending parameter is true, returns number of empty rows at the bottom of the table. + */ + countEmptyRows(ending?: boolean): number; + + /** + * Returns number of empty columns.If the optional ending parameter is true, returns number of empty columns at right hand edge of the table. + */ + countEmptyCols(ending?: boolean): number; + + /** + * Returns true if the row at the given index is empty, false otherwise. + */ + isEmptyRow(row: number): boolean; + + /** + * Returns true if the column at the given index is empty, false otherwise. + */ + isEmptyCol(col: number): boolean; + + /** + * Returns array of row headers (if they are enabled). If param row given, return header at given row as string. + */ + getRowHeader(row: number): any; + + /** + * Returns array of col headers (if they are enabled). If param col given, return header at given col as string. + */ + getColHeader(col: number): any; + + /** + * Returns information of this table is configured to display row headers. + */ + hasRowHeaders(): boolean; + + /** + * Returns information of this table is configured to display column headers. + */ + hasColHeaders(): boolean; + + /** + * Return column width. + */ + getColWidth(col: number): number; + + /** + * Return row height. + */ + getRowHeight(row: number): number; + + /** + * Returns column index that corresponds with the given property. + */ + propToCol(property: string): number; + + /** + * Clear undo history. + */ + clearUndo(): void; + + /** + * Return true if undo can be performed, false otherwise. + */ + isUndoAvailable(): boolean; + + /** + * Return true if redo can be performed, false otherwise. + */ + isRedoAvailable(): boolean; + + /** + * Undo last edit. + */ + undo(): void; + + /** + * Redo edit (used to reverse an undo). + */ + redo(): void; + + /** + * Sorts table content by cell values in given column, using order. column is a zero-based column index. Order of sorting can be either ascending (order = true) or descending (order = false). + * Note I: This method is only available when coulmnSorting plugin is enabled. See column sorting demo for details. + * Note II: Running this method will not alter the table data. Sorting takes place only in view layer. + */ + sort(column: number, order: boolean): void; + } +} + +interface JQuery { + handsontable(): JQuery; + handsontable(methodName: string, ...arguments?: any[]): any; + handsontable(options: Handsontable.Options): JQuery; +} \ No newline at end of file From f3db344825d769791657f19925333ca965286e46 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sat, 30 Aug 2014 16:10:05 +0100 Subject: [PATCH 33/40] fix errors in jquery-handsontable --- jquery-handsontable/jquery-handsontable.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery-handsontable/jquery-handsontable.d.ts b/jquery-handsontable/jquery-handsontable.d.ts index dbb0d23d6..7e9b02806 100644 --- a/jquery-handsontable/jquery-handsontable.d.ts +++ b/jquery-handsontable/jquery-handsontable.d.ts @@ -367,7 +367,7 @@ declare module Handsontable { /** * A plugin hook executed before validator function, only if validator function is defined. This can be used to manipulate value of changed cell before it is applied to the validator function. NOTICE: this will not affect values of changes. This will change value ONLY for validation! */ - beforeValidate?: (value: any, row; number, prop: string, source: string) => void; + beforeValidate?: (value: any, row: number, prop: string, source: string) => void; /** * Callback fired after Handsontable instance is initiated. @@ -945,6 +945,6 @@ declare module Handsontable { interface JQuery { handsontable(): JQuery; - handsontable(methodName: string, ...arguments?: any[]): any; + handsontable(methodName: string, ...arguments: any[]): any; handsontable(options: Handsontable.Options): JQuery; -} \ No newline at end of file +} \ No newline at end of file From c3f5cd7864fa0aa032517ddda8d900bf9d1b3633 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sat, 30 Aug 2014 16:15:42 +0100 Subject: [PATCH 34/40] fix implicitly typed parameters in jquery-handsontable --- jquery-handsontable/jquery-handsontable.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jquery-handsontable/jquery-handsontable.d.ts b/jquery-handsontable/jquery-handsontable.d.ts index 7e9b02806..ea6e3e70b 100644 --- a/jquery-handsontable/jquery-handsontable.d.ts +++ b/jquery-handsontable/jquery-handsontable.d.ts @@ -185,12 +185,12 @@ declare module Handsontable { /** * Lets you overwrite the default isEmptyRow method. */ - isEmptyRow? (row): boolean; + isEmptyRow?: (row: number) => boolean; /** * Lets you overwrite the default isEmptyCol method. */ - isEmptyCol? (col): boolean; + isEmptyCol?: (col: number) => boolean; /** * Turn on Manual column resize, if set to a boolean or define initial column resized widths, if set to an array of numbers. @@ -726,7 +726,7 @@ declare module Handsontable { /** * Same as above, except instead of col, you provide name of the object property (e.g. [0, 'first.name', 'Jennifer']). */ - setDataAtRowProp(row: number, prop: string, value: any, source?: string); + setDataAtRowProp(row: number, prop: string, value: any, source?: string): void; /** * Same as above, except instead of col, you provide name of the object property (e.g. [0, 'first.name', 'Jennifer']). @@ -947,4 +947,4 @@ interface JQuery { handsontable(): JQuery; handsontable(methodName: string, ...arguments: any[]): any; handsontable(options: Handsontable.Options): JQuery; -} \ No newline at end of file +} \ No newline at end of file From 06c9171176cbefcf0ad53b6d567a7bfa16fa7183 Mon Sep 17 00:00:00 2001 From: MIZUNE Pine Date: Sun, 31 Aug 2014 06:33:09 +0900 Subject: [PATCH 35/40] Add name into CONTRIBUTORS.md --- CONTRIBUTORS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index bb0933af5..bcf912187 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -240,7 +240,8 @@ All definitions files include a header with the author and editors, so at some p * [Marked](https://github.com/chjj/marked) (by [William Orr](https://github.com/worr)) * [MathJax](https://github.com/mathjax/MathJax) (by [Roland Zwaga](https://github.com/rolandzwaga)) * [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) (by [Sarah Williams](https://github.com/flurg)) -* [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave)) +* [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave)) +* [md5.js](http://labs.cybozu.co.jp/blog/mitsunari/2007/07/md5js_1.html) (by [MIZUNE Pine](https://github.com/pine613)) * [Microsoft Ajax](http://msdn.microsoft.com/en-us/library/ee341002(v=vs.100).aspx) (by [Patrick Magee](https://github.com/pjmagee)) * [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) (by [John Vilk](https://github.com/jvilk)) * [Minimatch](https://github.com/isaacs/minimatch) (by [vvakame](https://github.com/vvakame)) From 60715c8fb783c24cf2093854c5d8ee43530b5ba5 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Sat, 30 Aug 2014 15:11:32 -0400 Subject: [PATCH 36/40] Add definition and tests for "xpath" npm module. --- xpath/xpath-tests.ts | 77 +++++++++++++++++ xpath/xpath.d.ts | 197 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 274 insertions(+) create mode 100644 xpath/xpath-tests.ts create mode 100644 xpath/xpath.d.ts diff --git a/xpath/xpath-tests.ts b/xpath/xpath-tests.ts new file mode 100644 index 000000000..26418d9d7 --- /dev/null +++ b/xpath/xpath-tests.ts @@ -0,0 +1,77 @@ +/// + +import xpath = require('xpath'); + +// A string of xml +var xml: string; +// an xpath query +var xpathText: string; +// a DOM +var doc: Document; +// xpath returns lists of Nodes that do not implement the NodeList interface; +// they are merely arrays. +var nodes: Array; +var node: Node; +var stringResult: string; +var booleanResult: boolean; +var numberResult: number; +var selectFn; +var expression: xpath.XPathExpression; +var namespaceResolver; +var xpathResult: xpath.XPathResult; +var length: number; + +xml = 'xml'; +xpathText = '//this/is/an/xpath/query'; +doc = new DOMParser().parseFromString(xml, 'text/xml'); +nodes = xpath.select(xpathText, doc); +node = xpath.select(xpathText, doc, true); +nodes = xpath.select(xpathText, doc, false); + +node = xpath.select1(xpathText, doc); + +stringResult = xpath.select(xpathText, doc).toString(); + +node = xpath.select(xpathText, doc)[0]; + +selectFn = xpath.useNamespaces({ + 'prefix': 'http://namespaceuri.com/nsfile' +}); +nodes = selectFn(xpathText, doc); +node = selectFn(xpathText, doc, true); +nodes = selectFn(xpathText, doc, false); + +namespaceResolver = { + lookupNamespaceURI: function(prefix) { + return 'http://namespace.domain' + } +}; +expression = xpath.createExpression(xpathText, namespaceResolver); +xpathResult = expression.evaluate(doc, xpath.XPathResult.ANY_TYPE, null); +xpathResult = expression.evaluate(doc, xpath.XPathResult.ANY_TYPE, xpathResult); +xpathResult = expression.evaluate(doc, xpath.XPathResult.ANY_TYPE); +booleanResult = xpathResult.booleanValue; +numberResult = xpathResult.numberValue; +stringResult = xpathResult.stringValue; +node = xpathResult.singleNodeValue; +node = xpathResult.iterateNext(); +node = xpathResult.snapshotItem(10); +length = xpathResult.snapshotLength; + +var arrayOfNumbers: Array = [ + xpath.XPathResult.ANY_TYPE, + xpath.XPathResult.NUMBER_TYPE, + xpath.XPathResult.STRING_TYPE, + xpath.XPathResult.BOOLEAN_TYPE, + xpath.XPathResult.UNORDERED_NODE_ITERATOR_TYPE, + xpath.XPathResult.ORDERED_NODE_ITERATOR_TYPE, + xpath.XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, + xpath.XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, + xpath.XPathResult.ANY_UNORDERED_NODE_TYPE, + xpath.XPathResult.FIRST_ORDERED_NODE_TYPE +]; + +namespaceResolver = xpath.createNSResolver(node); +namespaceResolver = xpath.createNSResolver(doc); + + diff --git a/xpath/xpath.d.ts b/xpath/xpath.d.ts new file mode 100644 index 000000000..c9a11f188 --- /dev/null +++ b/xpath/xpath.d.ts @@ -0,0 +1,197 @@ +// Type definitions for xpath v0.0.7 +// Project: https://github.com/goto100/xpath +// Definitions by: Andrew Bradley +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +// Some documentation prose is copied from the XPath documentation at https://developer.mozilla.org. + +declare module 'xpath' { + + // select1 can return any of: `Node`, `boolean`, `string`, `number`. + // select and selectWithResolver can return any of the above return types or `Array`. + // For this reason, their return types are `any`. + + interface SelectFn { + /** + * Evaluate an XPath expression against a DOM node. Returns the result as one of the following: + * * Array + * * Node + * * boolean + * * number + * * string + * @param xpathText + * @param contextNode + * @param single If true and the evaluation result is one or more Nodes, will return only the first Node instead of an Array + */ + (xpathText: string, contextNode: Node, single?: boolean): any; + } + + var select: SelectFn; + + /** + * Evaluate an xpath expression against a DOM node, returning the first result only. + * Equivalent to `select(xpathText, contextNode, true)` + * @param xpathText + * @param contextNode + */ + function select1(xpathText: string, contextNode: Node): any; + + /** + * Evaluate an XPath expression against a DOM node using a given namespace resolver. Returns the result as one of the following: + * * Array + * * Node + * * boolean + * * number + * * string + * @param xpathText + * @param contextNode + * @param resolver + * @param single If true and the evaluation result is one or more Nodes, will return only the first Node instead of an Array + */ + function selectWithResolver(xpathText: string, contextNode: Node, resolver: XPathNSResolver, single?: boolean): any; + + /** + * Evaluate an xpath expression against a DOM. + * @param xpathText xpath expression as a string. + * @param contextNode xpath expression is evaluated relative to this DOM node. + * @param resolver XML namespace resolver + * @param resultType + * @param result If non-null, xpath *may* reuse this XPathResult object instead of creating a new one. However, it is not required to do so. + * @return XPathResult object containing the result of the expression. + */ + function evaluate(xpathText: string, contextNode: Node, resolver: XPathNSResolver, resultType: number, result?: XPathResult): XPathResult; + + /** + * Creates a `select` function that uses the given namespace prefix to URI mappings when evaluating queries. + * @param namespaceMappings an object mapping namespace prefixes to namespace URIs. Each key is a prefix; each value is a URI. + * @return a function with the same signature as `xpath.select` + */ + function useNamespaces(namespaceMappings: NamespaceMap): typeof select; + interface NamespaceMap { + [namespacePrefix: string]: string; + } + + /** + * Compile an XPath expression into an XPathExpression which can be (repeatedly) evaluated against a DOM. + * @param xpathText XPath expression as a string + * @param namespaceURLMapper Namespace resolver + * @return compiled expression + */ + function createExpression(xpathText: string, namespaceURLMapper: XPathNSResolver): XPathExpression; + + /** + * Create an XPathNSResolver that resolves based on the information available in the context of a DOM node. + * @param node + */ + function createNSResolver(node: Node): XPathNSResolver; + + /** + * Result of evaluating an XPathExpression. + */ + class XPathResult { + /** + * A result set containing whatever type naturally results from evaluation of the expression. Note that if the result is a node-set then UNORDERED_NODE_ITERATOR_TYPE is always the resulting type. + */ + static ANY_TYPE: number; + /** + * A result containing a single number. This is useful for example, in an XPath expression using the count() function. + */ + static NUMBER_TYPE: number; + /** + * A result containing a single string. + */ + static STRING_TYPE: number; + /** + * A result containing a single boolean value. This is useful for example, in an XPath expression using the not() function. + */ + static BOOLEAN_TYPE: number; + /** + * A result node-set containing all the nodes matching the expression. The nodes may not necessarily be in the same order that they appear in the document. + */ + static UNORDERED_NODE_ITERATOR_TYPE: number; + /** + * A result node-set containing all the nodes matching the expression. The nodes in the result set are in the same order that they appear in the document. + */ + static ORDERED_NODE_ITERATOR_TYPE: number; + /** + * A result node-set containing snapshots of all the nodes matching the expression. The nodes may not necessarily be in the same order that they appear in the document. + */ + static UNORDERED_NODE_SNAPSHOT_TYPE: number; + /** + * A result node-set containing snapshots of all the nodes matching the expression. The nodes in the result set are in the same order that they appear in the document. + */ + static ORDERED_NODE_SNAPSHOT_TYPE: number; + /** + * A result node-set containing any single node that matches the expression. The node is not necessarily the first node in the document that matches the expression. + */ + static ANY_UNORDERED_NODE_TYPE: number; + /** + * A result node-set containing the first node in the document that matches the expression. + */ + static FIRST_ORDERED_NODE_TYPE: number; + + /** + * Type of this result. It is one of the enumerated result types. + */ + resultType: number; + + /** + * Returns the next node in this result, if this result is one of the _ITERATOR_ result types. + */ + iterateNext(): Node; + + /** + * returns the result node for a given index, if this result is one of the _SNAPSHOT_ result types. + * @param index + */ + snapshotItem(index: number): Node; + + /** + * Number of nodes in this result, if this result is one of the _SNAPSHOT_ result types. + */ + snapshotLength: number; + + /** + * Value of this result, if it is a BOOLEAN_TYPE result. + */ + booleanValue: boolean; + /** + * Value of this result, if it is a NUMBER_TYPE result. + */ + numberValue: number; + /** + * Value of this result, if it is a STRING_TYPE result. + */ + stringValue: string; + + /** + * Value of this result, if it is a FIRST_ORDERED_NODE_TYPE result. + */ + singleNodeValue: Node; + } + + /** + * A compiled XPath expression, ready to be (repeatedly) evaluated against a DOM node. + */ + interface XPathExpression { + /** + * evaluate this expression against a DOM node. + * @param contextNode + * @param resultType + * @param result + */ + evaluate(contextNode: Node, resultType: number, result?: XPathResult): XPathResult; + } + + /** + * Object that can resolve XML namespace prefixes to namespace URIs. + */ + interface XPathNSResolver { + /** + * Given an XML namespace prefix, returns the corresponding XML namespace URI. + * @param prefix XML namespace prefix + * @return XML namespace URI + */ + lookupNamespaceURI(prefix: string): string; + } +} From 495675e550d65619b479eced3ced3764eb6aeac0 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Sun, 31 Aug 2014 00:51:45 -0400 Subject: [PATCH 37/40] Add "xpath" definition to CONTRIBUTORS list --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index bb0933af5..07795cb9d 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -374,6 +374,7 @@ All definitions files include a header with the author and editors, so at some p * [ws](http://einaros.github.io/ws/) (by [Paul Loyd](https://github.com/loyd)) * [x2js](https://code.google.com/p/x2js/) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) * [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) (by [Michel Salib](https://github.com/michelsalib)) +* [xpath](https://github.com/goto100/xpath) (by [Andrew Bradley](https://github.com/cspotcode)) * [XRegExp](http://xregexp.com/) (by [Bart van der Schoor](https://github.com/Bartvds)) * [YouTube](https://developers.google.com/youtube/) (by [Daz Wilkin](https://github.com/DazWilkin/)) * [YouTube Analytics API](https://developers.google.com/youtube/analytics/) (by [Frank M](https://github.com/sgtfrankieboy)) From 80dea1ec4122a31b09e862ad06b010873ee79a22 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Sun, 31 Aug 2014 01:03:59 -0400 Subject: [PATCH 38/40] Eliminate implicit `any` in "xpath" tests. --- xpath/xpath-tests.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xpath/xpath-tests.ts b/xpath/xpath-tests.ts index 26418d9d7..c20088b9e 100644 --- a/xpath/xpath-tests.ts +++ b/xpath/xpath-tests.ts @@ -15,9 +15,8 @@ var node: Node; var stringResult: string; var booleanResult: boolean; var numberResult: number; -var selectFn; var expression: xpath.XPathExpression; -var namespaceResolver; +var namespaceResolver: xpath.XPathNSResolver; var xpathResult: xpath.XPathResult; var length: number; @@ -34,7 +33,7 @@ stringResult = xpath.select(xpathText, doc).toString(); node = xpath.select(xpathText, doc)[0]; -selectFn = xpath.useNamespaces({ +var selectFn = xpath.useNamespaces({ 'prefix': 'http://namespaceuri.com/nsfile' }); nodes = selectFn(xpathText, doc); From 37d59baa6ff494e8ea14f9f1863ae3deec5f8ac4 Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Sun, 31 Aug 2014 11:11:19 +0100 Subject: [PATCH 39/40] add tests for jquery-handsontable --- .../jquery-handsontable-tests.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 jquery-handsontable/jquery-handsontable-tests.ts diff --git a/jquery-handsontable/jquery-handsontable-tests.ts b/jquery-handsontable/jquery-handsontable-tests.ts new file mode 100644 index 000000000..b17e6fffa --- /dev/null +++ b/jquery-handsontable/jquery-handsontable-tests.ts @@ -0,0 +1,28 @@ +/// +/// + +var data = [ + ["", "Maserati", "Mazda", "Mercedes", "Mini", "Mitsubishi"], + ["2009", 0, 2941, 4303, 354, 5814], + ["2010", 5, 2905, 2867, 412, 5284], + ["2011", 4, 2517, 4822, 552, 6127], + ["2012", 2, 2422, 5399, 776, 4151] +]; + +var div = $('div'); +$('body').append(div); + +div.handsontable({ + data: data, + minSpareRows: 1, + colHeaders: true, + contextMenu: true +}); + +var instance: Handsontable.Context = div.handsontable('getInstance'); +for (var i = 1; i < instance.countCols(); i++) { + for (var j = 1; j < instance.countRows(); j++) { + var value = parseInt(instance.getDataAtCell(j, i)) * 2; + instance.setDataAtCell(j, i, value); + } +} \ No newline at end of file From 1339939e44d82e732c0987fd518035ff0872c260 Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 3 Sep 2014 00:55:30 +0900 Subject: [PATCH 40/40] updat IEditor and add IDecorator. see http://blog.atom.io/2014/07/24/decorations.html --- atom/atom.d.ts | 116 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 108 insertions(+), 8 deletions(-) diff --git a/atom/atom.d.ts b/atom/atom.d.ts index 00f55ef02..96b7c849d 100644 --- a/atom/atom.d.ts +++ b/atom/atom.d.ts @@ -497,6 +497,35 @@ declare module AtomCore { screenRangeChanged():any; } + interface IDecorationParams { + id?: number; + class: string; + type: any /* string or string[] */; + } + + interface IDecorationStatic { + isType(decorationParams:IDecorationParams, type:any /* string or string[] */):boolean; + new (marker:IDisplayBufferMarker, displayBuffer:IDisplayBuffer, params: IDecorationParams): IDecoration; + } + + interface IDecoration extends Emissary.IEmitter { + marker: IDisplayBufferMarker; + displayBuffer: IDisplayBuffer; + params: IDecorationParams + id: number; + flashQueue: any[]; + isDestroyed: boolean; + + destroy():void; + update(newParams:IDecorationParams):void; + getMarker():IDisplayBufferMarker; + getParams():IDecorationParams; + isType(type:string):boolean; + matchesPattern(decorationPattern:{[key:string]:IDecorationParams;}):boolean; + flash(klass:string, duration?:number):void; + consumeNextFlash():any; + } + interface IEditor { // Serializable.includeInto(Editor); // Delegator.includeInto(Editor); @@ -509,6 +538,8 @@ declare module AtomCore { cursors:ICursor[]; selections: ISelection[]; suppressSelectionMerging:boolean; + updateBatchDepth: number; + selectionFlashDuration: number; softTabs: boolean; displayBuffer: IDisplayBuffer; @@ -522,6 +553,8 @@ declare module AtomCore { subscriptionsByObject: any; /* WeakMap */ subscriptions: Emissary.ISubscription[]; + mini: any; + serializeParams():{id:number; softTabs:boolean; scrollTop:number; scrollLeft:number; displayBuffer:any;}; deserializeParams(params:any):any; subscribeToBuffer():void; @@ -532,10 +565,7 @@ declare module AtomCore { getTitle():string; getLongTitle():string; setVisible(visible:boolean):void; - setScrollTop(scrollTop:any):void; - getScrollTop():number; - setScrollLeft(scrollLeft:any):void; - getScrollLeft():number; + setMini(mini:any):void; setEditorWidthInChars(editorWidthInChars:any):void; getSoftWrapColumn():number; getSoftTabs():boolean; @@ -545,6 +575,7 @@ declare module AtomCore { getTabText():string; getTabLength():number; setTabLength(tabLength:any):void; + usesSoftTabs():boolean; clipBufferPosition(bufferPosition:any):void; clipBufferRange(range:any):void; indentationForBufferRow(bufferRow:any):void; @@ -553,6 +584,7 @@ declare module AtomCore { buildIndentString(number:any):string; save():void; saveAs(filePath:any):void; + copyPathToClipboard():void; getPath():string; getText():string; setText(text:any):void; @@ -572,6 +604,7 @@ declare module AtomCore { scanInBufferRange():any; backwardsScanInBufferRange():any; isModified():boolean; + isEmpty():boolean; shouldPromptToSave():boolean; screenPositionForBufferPosition(bufferPosition:any, options?:any):TextBuffer.IPoint; bufferPositionForScreenPosition(screenPosition:any, options?:any):TextBuffer.IPoint; @@ -589,15 +622,19 @@ declare module AtomCore { bufferRangeForScopeAtCursor(selector:string):any; tokenForBufferPosition(bufferPosition:any):IToken; getCursorScopes():string[]; + logCursorScope():void; insertText(text:string, options?:any):TextBuffer.IRange[]; insertNewline():TextBuffer.IRange[]; insertNewlineBelow():TextBuffer.IRange[]; insertNewlineAbove():any; indent(options?:any):any; backspace():any[]; - backspaceToBeginningOfWord():any[]; - backspaceToBeginningOfLine():any[]; + // deprecated backspaceToBeginningOfWord():any[]; + // deprecated backspaceToBeginningOfLine():any[]; + deleteToBeginningOfWord():any[]; + deleteToBeginningOfLine():any[]; delete():any[]; + deleteToEndOfLine():any[]; deleteToEndOfWord():any[]; deleteLine():TextBuffer.IRange[]; indentSelectedRows():TextBuffer.IRange[][]; @@ -620,6 +657,7 @@ declare module AtomCore { foldBufferRow(bufferRow:any):any; unfoldBufferRow(bufferRow:any):any; isFoldableAtBufferRow(bufferRow:any):boolean; + isFoldableAtScreenRow(screenRow:any):boolean; createFold(startRow:any, endRow:any):IFold; destroyFoldWithId(id:any):any; destroyFoldsIntersectingBufferRange(bufferRange:any):any; @@ -633,9 +671,12 @@ declare module AtomCore { moveLineUp():ISelection[]; moveLineDown():ISelection[]; duplicateLines():any[][]; - duplicateLine():any[][]; + // duprecated duplicateLine():any[][]; mutateSelectedText(fn:(selection:ISelection)=>any):any; replaceSelectedText(options:any, fn:(selection:string)=>any):any; + decorationsForScreenRowRange(startScreenRow:any, endScreenRow:any):{[id:number]: IDecoration[]}; + decorateMarker(marker:IDisplayBufferMarker, decorationParams: {type:string; class: string;}):IDecoration; + decorationForId(id:number):IDecoration; getMarker(id:number):IDisplayBufferMarker; getMarkers():IDisplayBufferMarker[]; findMarkers(...args:any[]):IDisplayBufferMarker[]; @@ -659,6 +700,7 @@ declare module AtomCore { removeSelection(selection:ISelection):any; clearSelections():boolean; consolidateSelections():boolean; + selectionScreenRangeChanged(selection:any):void; getSelections():ISelection[]; getSelection(index?:number):ISelection; getLastSelection():ISelection; @@ -694,7 +736,16 @@ declare module AtomCore { moveCursorToBeginningOfNextWord():void; moveCursorToPreviousWordBoundary():void; moveCursorToNextWordBoundary():void; + moveCursorToBeginningOfNextParagraph():void; + moveCursorToBeginningOfPreviousParagraph():void; + scrollToCursorPosition(options:any):any; + pageUp():void; + pageDown():void; + selectPageUp():void; + selectPageDown():void; + getRowsPerPage():number; moveCursors(fn:(cursor:ICursor)=>any):any; + cursorMoved(event:any):void; selectToScreenPosition(position:TextBuffer.IPoint):any; selectRight():ISelection[]; selectLeft():ISelection[]; @@ -720,6 +771,8 @@ declare module AtomCore { selectToEndOfWord():ISelection[]; selectToBeginningOfNextWord():ISelection[]; selectWord():ISelection[]; + selectToBeginningOfNextParagraph():ISelection[]; + selectToBeginningOfPreviousParagraph():ISelection[]; selectMarker(marker:any):any; mergeCursors():number[]; expandSelectionsForward():any; @@ -731,16 +784,63 @@ declare module AtomCore { setGrammar(grammer:IGrammar):void; reloadGrammar():any; shouldAutoIndent():boolean; + shouldShowInvisibles():boolean; + updateInvisibles():void; transact(fn:Function):any; beginTransaction():ITransaction; commitTransaction():any; abortTransaction():any[]; inspect():string; logScreenLines(start:number, end:number):any[]; + handleTokenization():void; handleGrammarChange():void; handleMarkerCreated(marker:any):any; getSelectionMarkerAttributes():{type: string; editorId: number; invalidate: string; }; - // joinLine():any; // deprecated + getVerticalScrollMargin():number; + setVerticalScrollMargin(verticalScrollMargin:number):void; + getHorizontalScrollMargin():number; + setHorizontalScrollMargin(horizontalScrollMargin:number):void; + getLineHeightInPixels():number; + setLineHeightInPixels(lineHeightInPixels:number):void; + batchCharacterMeasurement(fn:Function):void; + getScopedCharWidth(scopeNames:any, char:any):any; + setScopedCharWidth(scopeNames:any, char:any, width:any):any; + getScopedCharWidths(scopeNames:any):any; + clearScopedCharWidths():any; + getDefaultCharWidth():number; + setDefaultCharWidth(defaultCharWidth:number):void; + setHeight(height:number):void; + getHeight():number; + getClientHeight():number; + setWidth(width:number):void; + getWidth():number; + getScrollTop():number; + setScrollTop(scrollTop:number):void; + getScrollBottom():number; + setScrollBottom(scrollBottom:number):void; + getScrollLeft():number; + setScrollLeft(scrollLeft:number):void; + getScrollRight():number; + setScrollRight(scrollRight:number):void; + getScrollHeight():number; + getScrollWidth():number; + getVisibleRowRange():number; + intersectsVisibleRowRange(startRow:any, endRow:any):any; + selectionIntersectsVisibleRowRange(selection:any):any; + pixelPositionForScreenPosition(screenPosition:any):any; + pixelPositionForBufferPosition(bufferPosition:any):any; + screenPositionForPixelPosition(pixelPosition:any):any; + pixelRectForScreenRange(screenRange:any):any; + scrollToScreenRange(screenRange:any, options:any):any; + scrollToScreenPosition(screenPosition:any, options:any):any; + scrollToBufferPosition(bufferPosition:any, options:any):any; + horizontallyScrollable():any; + verticallyScrollable():any; + getHorizontalScrollbarHeight():any; + setHorizontalScrollbarHeight(height:any):any; + getVerticalScrollbarWidth():any; + setVerticalScrollbarWidth(width:any):any; + // deprecated joinLine():any; } interface IGrammar {